Sections — g.sections¶
Parametric structural cross-section builders. Each method creates
3D geometry directly in the active session and returns an Instance
with named sub-regions (flanges, web, end faces) ready for constraints
and loads.
g.sections¶
apeGmsh.sections._builder.SectionsBuilder ¶
Bases: _HasLogging
Direct in-session section builder (g.sections).
Source code in src/apeGmsh/sections/_builder.py
W_solid ¶
W_solid(bf: float, tf: float, h: float, tw: float, length: float, *, anchor='start', align='z', label: str = 'W_solid', lc: float = 1e+22, translate: tuple[float, float, float] = (0.0, 0.0, 0.0), rotate: tuple[float, ...] | None = None) -> 'Instance'
Build a W-shape solid directly in the current session.
Same geometry as :func:apeGmsh.sections.W_solid but
without a Part intermediary. Returns an Instance with
.labels accessor.
Parameters¶
anchor : str or (x, y, z), default "start"
Re-origin the section in its local frame before optional
align and before the user's translate/rotate.
See :func:apeGmsh.core._section_placement.compute_anchor_offset.
align : str or (ax, ay, az), default "z"
Reorient the local +Z axis to a world direction.
See :func:apeGmsh.core._section_placement.compute_alignment_rotation.
lc : float
Target element size for this section's BRep points.
Default 1e22 imposes no constraint — element size
is governed by :meth:set_global_size alone.
Example¶
::
with apeGmsh("frame") as g:
col = g.sections.W_solid(
bf=150, tf=20, h=300, tw=10, length=2000,
label="col", lc=50,
)
g.mesh.sizing.set_global_size(100)
g.mesh.generation.generate(3)
Source code in src/apeGmsh/sections/_builder.py
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 | |
rect_solid ¶
rect_solid(b: float, h: float, length: float, *, anchor='start', align='z', label: str = 'rect', lc: float = 1e+22, translate: tuple[float, float, float] = (0.0, 0.0, 0.0), rotate: tuple[float, ...] | None = None) -> 'Instance'
Build a solid rectangular bar directly in the session.
Parameters¶
lc : float
Target element size for this section's BRep points.
Default 1e22 imposes no constraint.
Source code in src/apeGmsh/sections/_builder.py
rect_hollow ¶
rect_hollow(b: float, h: float, t: float, length: float, *, anchor='start', align='z', label: str = 'rect_hollow', lc: float = 1e+22, translate: tuple[float, float, float] = (0.0, 0.0, 0.0), rotate: tuple[float, ...] | None = None) -> 'Instance'
Build a hollow rectangular tube (HSS) directly in the session.
Parameters¶
b : float
Outer width (X-direction).
h : float
Outer height (Y-direction).
t : float
Wall thickness.
length : float
Extrusion length (Z-direction).
lc : float
Target element size. Default 1e22 imposes no constraint.
Source code in src/apeGmsh/sections/_builder.py
pipe_solid ¶
pipe_solid(r: float, length: float, *, anchor='start', align='z', label: str = 'pipe_solid', lc: float = 1e+22, translate: tuple[float, float, float] = (0.0, 0.0, 0.0), rotate: tuple[float, ...] | None = None) -> 'Instance'
Build a solid circular bar directly in the session.
Parameters¶
r : float
Radius.
length : float
Extrusion length (Z-direction).
lc : float
Target element size. Default 1e22 imposes no constraint.
Source code in src/apeGmsh/sections/_builder.py
pipe_hollow ¶
pipe_hollow(r_outer: float, t: float, length: float, *, anchor='start', align='z', label: str = 'pipe_hollow', lc: float = 1e+22, translate: tuple[float, float, float] = (0.0, 0.0, 0.0), rotate: tuple[float, ...] | None = None) -> 'Instance'
Build a hollow circular pipe directly in the session.
Parameters¶
r_outer : float
Outer radius.
t : float
Wall thickness.
length : float
Extrusion length (Z-direction).
lc : float
Target element size. Default 1e22 imposes no constraint.
Source code in src/apeGmsh/sections/_builder.py
angle_solid ¶
angle_solid(b: float, h: float, t: float, length: float, *, anchor='start', align='z', label: str = 'angle_solid', lc: float = 1e+22, translate: tuple[float, float, float] = (0.0, 0.0, 0.0), rotate: tuple[float, ...] | None = None) -> 'Instance'
Build an L-shape (angle) directly in the session.
Parameters¶
b : float
Horizontal leg width (X-direction).
h : float
Vertical leg height (Y-direction).
t : float
Thickness of both legs.
length : float
Extrusion length (Z-direction).
lc : float
Target element size. Default 1e22 imposes no constraint.
Source code in src/apeGmsh/sections/_builder.py
channel_solid ¶
channel_solid(bf: float, tf: float, h: float, tw: float, length: float, *, anchor='start', align='z', label: str = 'channel_solid', lc: float = 1e+22, translate: tuple[float, float, float] = (0.0, 0.0, 0.0), rotate: tuple[float, ...] | None = None) -> 'Instance'
Build a C-shape (channel) directly in the session.
Parameters¶
bf : float
Flange width.
tf : float
Flange thickness.
h : float
Clear web height (between flanges).
tw : float
Web thickness.
length : float
Extrusion length (Z-direction).
lc : float
Target element size. Default 1e22 imposes no constraint.
Source code in src/apeGmsh/sections/_builder.py
tee_solid ¶
tee_solid(bf: float, tf: float, h: float, tw: float, length: float, *, anchor='start', align='z', label: str = 'tee_solid', lc: float = 1e+22, translate: tuple[float, float, float] = (0.0, 0.0, 0.0), rotate: tuple[float, ...] | None = None) -> 'Instance'
Build a T-shape (tee) directly in the session.
Parameters¶
bf : float
Flange width.
tf : float
Flange thickness.
h : float
Stem height.
tw : float
Stem thickness.
length : float
Extrusion length (Z-direction).
lc : float
Target element size. Default 1e22 imposes no constraint.
Source code in src/apeGmsh/sections/_builder.py
W_face ¶
W_face(bf: float, tf: float, h: float, tw: float, *, label: str = 'W_face', lc: float = 1e+22, translate: tuple[float, float] = (0.0, 0.0), rotate: float | None = None) -> 'Instance'
W-shape cross-section face (centred on the origin).
Same profile as :meth:W_solid (bf flange width, tf
flange thickness, h clear web height, tw web
thickness) without the extrusion. rotate is an in-plane
angle in degrees about the world origin, applied before
translate.
Source code in src/apeGmsh/sections/_builder.py
rect_face ¶
rect_face(b: float, h: float, *, label: str = 'rect_face', lc: float = 1e+22, translate: tuple[float, float] = (0.0, 0.0), rotate: float | None = None) -> 'Instance'
Solid rectangular cross-section face (centred on the origin).
Source code in src/apeGmsh/sections/_builder.py
rect_hollow_face ¶
rect_hollow_face(b: float, h: float, t: float, *, label: str = 'rect_hollow_face', lc: float = 1e+22, translate: tuple[float, float] = (0.0, 0.0), rotate: float | None = None) -> 'Instance'
Hollow rectangular (HSS) cross-section face: outer b × h,
wall thickness t, centred on the origin.
Source code in src/apeGmsh/sections/_builder.py
pipe_face ¶
pipe_face(r: float, *, label: str = 'pipe_face', lc: float = 1e+22, translate: tuple[float, float] = (0.0, 0.0), rotate: float | None = None) -> 'Instance'
Solid circular cross-section face of radius r at the
origin.
Source code in src/apeGmsh/sections/_builder.py
pipe_hollow_face ¶
pipe_hollow_face(r: float, t: float, *, label: str = 'pipe_hollow_face', lc: float = 1e+22, translate: tuple[float, float] = (0.0, 0.0), rotate: float | None = None) -> 'Instance'
Hollow circular (pipe) cross-section face: outer radius
r, wall thickness t, centred on the origin.
Source code in src/apeGmsh/sections/_builder.py
angle_face ¶
angle_face(b: float, h: float, t: float, *, label: str = 'angle_face', lc: float = 1e+22, translate: tuple[float, float] = (0.0, 0.0), rotate: float | None = None) -> 'Instance'
L-shape (angle) cross-section face — heel at the origin,
horizontal leg b and vertical leg h of thickness t
(same profile as :meth:angle_solid).
Source code in src/apeGmsh/sections/_builder.py
channel_face ¶
channel_face(bf: float, tf: float, h: float, tw: float, *, label: str = 'channel_face', lc: float = 1e+22, translate: tuple[float, float] = (0.0, 0.0), rotate: float | None = None) -> 'Instance'
C-shape (channel) cross-section face — web on the y-axis,
opening toward +x (same profile as :meth:channel_solid).
Source code in src/apeGmsh/sections/_builder.py
tee_face ¶
tee_face(bf: float, tf: float, h: float, tw: float, *, label: str = 'tee_face', lc: float = 1e+22, translate: tuple[float, float] = (0.0, 0.0), rotate: float | None = None) -> 'Instance'
T-shape (tee) cross-section face — flange on top (y in
[0, tf]), stem hanging below (same profile as
:meth:tee_solid).
Source code in src/apeGmsh/sections/_builder.py
plot_faces ¶
Preview the session's flat-face geometry before meshing.
Draws the boundary polylines of every dim-2 entity in the
current (synchronized) model and, when annotate=True, marks
each face's centroid with the plain physical-group name
covering it (the *_face builders' auto-PG) — falling back
to the entity tag. Matplotlib only; returns the Axes.
Source code in src/apeGmsh/sections/_builder.py
W_shell ¶
W_shell(bf: float, tf: float, h: float, tw: float, length: float, *, anchor='start', align='z', label: str = 'W_shell', lc: float = 1e+22, translate: tuple[float, float, float] = (0.0, 0.0, 0.0), rotate: tuple[float, ...] | None = None) -> 'Instance'
Build a W-shape as 3 mid-surface shell rectangles.
Parameters¶
lc : float
Target element size for this section's BRep points.
Default 1e22 imposes no constraint.
Source code in src/apeGmsh/sections/_builder.py
Solid sections¶
3D volumes suitable for solid elements (dim=3).
apeGmsh.sections.solid.W_solid ¶
W_solid(bf: float, tf: float, h: float, tw: float, length: float, *, anchor='start', align='z', name: str = 'W_solid') -> Part
Create a W-shape (wide flange) as a 3D solid Part.
The section is built as an extruded I-profile, then sliced into 7 hex-compatible volumes by 4 axis-aligned cuts.
Parameters¶
bf : float
Flange width.
tf : float
Flange thickness.
h : float
Clear web height (between flanges, not including flanges).
tw : float
Web thickness.
length : float
Extrusion length along Z.
anchor : str or (x, y, z), default "start"
Re-origin the section in its local frame before optional align.
See :func:apeGmsh.core._section_placement.compute_anchor_offset.
align : str or (ax, ay, az), default "z"
Reorient the local +Z axis to a world direction.
See :func:apeGmsh.core._section_placement.compute_alignment_rotation.
name : str, default "W_solid"
Part name.
Labels created¶
top_flange
3 volumes forming the top flange (y > h/2).
bottom_flange
3 volumes forming the bottom flange (y < −h/2).
web
1 volume for the web (|y| ≤ h/2).
top_flange_face
Outer +y skin surfaces of the top flange (face-to-face
stacking target for align_to).
bottom_flange_face
Outer −y skin surfaces of the bottom flange.
web_left_face, web_right_face
Exposed −x / +x outer faces of the web (within |y| ≤ h/2).
start_face, end_face
Cross-section profile faces at z=0 and z=length.
Returns¶
Part
Example¶
::
col = W_solid(bf=150, tf=20, h=300, tw=10, length=3000)
with apeGmsh("frame") as g:
g.parts.add(col, label="col_A")
g.mesh.structured.set_transfinite_automatic()
g.mesh.sizing.set_global_size(50)
g.mesh.generation.generate(3)
Source code in src/apeGmsh/sections/solid.py
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | |
apeGmsh.sections.solid.rect_solid ¶
rect_solid(b: float, h: float, length: float, *, anchor='start', align='z', name: str = 'rect_solid') -> Part
Create a solid rectangular bar as a 3D Part.
Parameters¶
b : float Width (X-direction). h : float Height (Y-direction). length : float Length (Z-direction). name : str Part name.
Labels created¶
body — the single volume.
Returns¶
Part
Source code in src/apeGmsh/sections/solid.py
apeGmsh.sections.solid.rect_hollow ¶
rect_hollow(b: float, h: float, t: float, length: float, *, anchor='start', align='z', name: str = 'rect_hollow') -> Part
Create a hollow rectangular tube (HSS) as a 3D solid Part.
Parameters¶
b : float Outer width (X-direction). h : float Outer height (Y-direction). t : float Wall thickness. length : float Length (Z-direction). name : str Part name.
Labels created¶
body — the hollow tube volume.
Returns¶
Part
Source code in src/apeGmsh/sections/solid.py
apeGmsh.sections.solid.pipe_solid ¶
Create a solid circular bar as a 3D Part.
Parameters¶
r : float Radius. length : float Length (Z-direction). name : str Part name.
Labels created¶
body — the single cylinder volume.
Returns¶
Part
Source code in src/apeGmsh/sections/solid.py
apeGmsh.sections.solid.pipe_hollow ¶
pipe_hollow(r_outer: float, t: float, length: float, *, anchor='start', align='z', name: str = 'pipe_hollow') -> Part
Create a hollow circular pipe as a 3D solid Part.
Parameters¶
r_outer : float Outer radius. t : float Wall thickness. length : float Length (Z-direction). name : str Part name.
Labels created¶
body — the hollow pipe volume.
Returns¶
Part
Source code in src/apeGmsh/sections/solid.py
apeGmsh.sections.solid.angle_solid ¶
angle_solid(b: float, h: float, t: float, length: float, *, anchor='start', align='z', name: str = 'angle_solid') -> Part
Create an L-shape (angle) as a 3D solid Part.
The angle is placed with its corner at the origin, legs extending in +X and +Y. Sliced at the corner junction for hex-compatible meshing.
Parameters¶
b : float Horizontal leg width (X-direction). h : float Vertical leg height (Y-direction). t : float Thickness of both legs. length : float Extrusion length (Z-direction). name : str Part name.
Labels created¶
horizontal_leg — volumes in the horizontal leg (y < t).
vertical_leg — volumes in the vertical leg (x < t).
horizontal_leg_face — underside of h-leg at y=0.
vertical_leg_face — back of v-leg at x=0.
start_face, end_face — profile faces at z=0 and z=length.
Returns¶
Part
Source code in src/apeGmsh/sections/solid.py
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 | |
apeGmsh.sections.solid.channel_solid ¶
channel_solid(bf: float, tf: float, h: float, tw: float, length: float, *, anchor='start', align='z', name: str = 'channel_solid') -> Part
Create a C-shape (channel) as a 3D solid Part.
The channel opens in the +X direction. The web is at x=0, flanges extend in the +X direction from the web.
Parameters¶
bf : float Flange width (depth of flanges in X). tf : float Flange thickness. h : float Clear web height (between flanges). tw : float Web thickness. length : float Extrusion length (Z-direction). name : str Part name.
Labels created¶
top_flange — volumes in the top flange (y > h/2).
bottom_flange — volumes in the bottom flange (y < −h/2).
web — volumes in the web.
top_flange_face — outer +y skin of top flange.
bottom_flange_face — outer −y skin of bottom flange.
start_face, end_face — profile faces at z=0 and z=length.
Returns¶
Part
Source code in src/apeGmsh/sections/solid.py
422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 | |
apeGmsh.sections.solid.tee_solid ¶
tee_solid(bf: float, tf: float, h: float, tw: float, length: float, *, anchor='start', align='z', name: str = 'tee_solid') -> Part
Create a T-shape (tee / WT) as a 3D solid Part.
The flange is at the top (+Y), the stem hangs down. Centered on the web at x=0.
Parameters¶
bf : float Flange width. tf : float Flange thickness. h : float Stem height (from bottom of flange to bottom of stem). tw : float Stem (web) thickness. length : float Extrusion length (Z-direction). name : str Part name.
Labels created¶
flange — volumes in the flange.
stem — volumes in the stem.
flange_face — outer +y skin of the flange (top).
stem_face — outer −y skin of the stem (bottom).
start_face, end_face — profile faces at z=0 and z=length.
Returns¶
Part
Source code in src/apeGmsh/sections/solid.py
504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 | |
Shell sections¶
Mid-surface geometry for shell elements (dim=2).
apeGmsh.sections.shell.W_shell ¶
W_shell(bf: float, tf: float, h: float, tw: float, length: float, *, anchor='start', align='z', name: str = 'W_shell') -> Part
Create a W-shape as 3 mid-surface shell rectangles.
The I-section is represented by:
- top flange — horizontal rectangle at
y = h/2 + tf/2(flange mid-plane), widthbf, lengthlength. - bottom flange — horizontal rectangle at
y = -(h/2 + tf/2). - web — vertical rectangle at
x = 0, heighth, lengthlength.
Parameters¶
bf : float Flange width. tf : float Flange thickness (positions the mid-surface; the shell element's section definition carries the actual thickness). h : float Clear web height (between flange mid-surfaces). tw : float Web thickness (informational — the mid-surface is at x=0). length : float Extrusion length along Z. name : str Part name.
Labels created¶
top_flange
The top flange mid-surface.
bottom_flange
The bottom flange mid-surface.
web
The web mid-surface.
Returns¶
Part
Source code in src/apeGmsh/sections/shell.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | |
Profile sections¶
2D cross-sections for fiber analysis or sweep operations.
apeGmsh.sections.profile.W_profile ¶
W_profile(bf: float, tf: float, h: float, tw: float, *, anchor='start', align='z', name: str = 'W_profile') -> Part
Create a W-shape 2D cross-section (no extrusion).
The I-shaped surface sits in the XY plane at z=0, centered on the origin.
Parameters¶
bf : float Flange width. tf : float Flange thickness. h : float Clear web height. tw : float Web thickness. name : str Part name.
Labels created¶
profile — the I-shaped surface.
Returns¶
Part
Example¶
::
section = W_profile(bf=150, tf=20, h=300, tw=10)
# section.has_file -> True (auto-persisted)
# Use for fiber analysis or sweep along a path
Source code in src/apeGmsh/sections/profile.py
Section documents¶
Declarative, versioned JSON descriptions of a cross-section — the source of truth the Qt builder edits. See Author a section document.
apeGmsh.sections._document.SectionDocument ¶
Declarative section description (continuum lane, ADR 0080 B1).
Construct blank via :meth:new, load via :meth:open, mutate via
the add_* / set_* methods (the same surface the builder
GUI drives), persist via :meth:save, and realize via
:meth:build — which runs a private apeGmsh session (builders →
booleans → mesh) and returns a
:class:~apeGmsh.sections.SectionProperties.
Source code in src/apeGmsh/sections/_document.py
new
classmethod
¶
new(*, name: str | None = None, kind: Literal['continuum', 'fiber'] = 'continuum', units: str = '') -> 'SectionDocument'
A blank document. units is a display label only —
apeGmsh stays unit-agnostic.
Source code in src/apeGmsh/sections/_document.py
open
classmethod
¶
Load a .section.json document (version-window checked).
Source code in src/apeGmsh/sections/_document.py
export_script ¶
Render the document as a readable, runnable apeGmsh script
(ADR 0080 B4) and return the text; write it to path when
given. One-way export — round-trip editing is the JSON
document's job. Continuum scripts bind the analyzer to
sec; fiber scripts define build_section(ops).
Source code in src/apeGmsh/sections/_document.py
save ¶
Write the document as deterministic, diff-friendly JSON
(strict spec - non-finite floats refuse rather than emitting
non-portable NaN/Infinity tokens).
Source code in src/apeGmsh/sections/_document.py
to_dict ¶
set_material ¶
set_material(name: str, *, E: float | None = None, nu: float | None = None, G: float | None = None, fy: float | None = None, density: float | None = None, uniaxial: 'tuple[str, dict[str, Any]] | None' = None) -> None
Define (or redefine) a named material. Dual-role: the
continuum build needs E+nu on used materials; the
fiber handoff needs uniaxial=("<Type>", {kwargs}) —
resolved as ops.uniaxialMaterial.<Type>(**kwargs). Give
either role or both; continuum-parameter validation defers to
:class:SectionMaterial at build so the rules stay single.
Source code in src/apeGmsh/sections/_document.py
add_shape ¶
add_shape(shape: str, *, id: str, material: str | None = None, translate: tuple[float, float] = (0.0, 0.0), rotate: float | None = None, **params: float) -> None
Add a parametric shape. id becomes the physical-group
label; material defaults to id when materials are
used.
Source code in src/apeGmsh/sections/_document.py
add_polygon ¶
add_polygon(points: 'list[tuple[float, float]]', *, id: str, material: str | None = None, translate: tuple[float, float] = (0.0, 0.0), rotate: float | None = None) -> None
Add a freehand straight-segment polygon (the canvas tool's output). Points are authoring-plane vertices in order; the loop closes automatically.
Source code in src/apeGmsh/sections/_document.py
add_embed ¶
The composite-partition primitive: carve inner out of
outer (cut, tool kept) then fragment the pair conformally.
The double-cover trap is unrepresentable through this op.
Source code in src/apeGmsh/sections/_document.py
add_cut ¶
Raw boolean cut (e.g. punching holes with a sacrificial
tool shape). For overlapping material regions use
:meth:add_embed instead.
Source code in src/apeGmsh/sections/_document.py
add_fragment_pair ¶
Raw conformal fragment of two touching (non-overlapping) shapes.
Source code in src/apeGmsh/sections/_document.py
add_bar ¶
One discrete rebar on a continuum section, in authoring
(x, y) coordinates. Rides the kind="fiber" lowering at
:meth:to_section; concrete area is not deducted.
Source code in src/apeGmsh/sections/_document.py
add_bar_line ¶
add_bar_line(*, material: str, n: int, area: float, start: tuple[float, float], end: tuple[float, float]) -> None
n equally spaced bars from start to end
(endpoints included, n >= 2), authoring coordinates.
Stored parametric and expanded at handoff.
Source code in src/apeGmsh/sections/_document.py
add_template ¶
Add a parametric RC template (stored as parameters,
re-expanded on every build). materials maps the template's
roles to material-table names — exact cover required.
Source code in src/apeGmsh/sections/_document.py
build ¶
Realize the document.
Continuum lane: private apeGmsh session → builders → booleans
→ mesh → :class:SectionProperties (which snapshots the fem,
so the session is closed before returning). Documents with an
empty materials table build in the analyzer's
geometric-only mode; otherwise every shape's material
(explicit or defaulted to its id) must exist in the table —
fail-loud here, before any session is opened.
Fiber lane: templates expand deterministically and merge with
the literal patches/layers/points into a :class:FiberRecipe
(no session, no bridge objects) — hand it to
:meth:to_section for the OpenSees handoff.
Source code in src/apeGmsh/sections/_document.py
to_section ¶
Resolve the document on an apeSees bridge.
Fiber lane: construct each used material's uniaxial spec
via ops.uniaxialMaterial.<Type>(**params) (one bridge
material per document material name) and register the section
as ops.section.Fiber(...).
Continuum lane (ADR 0080 B3): build the analyzer, resolve the
region materials' uniaxial specs, expand the bars
overlay, and register
ops.section.ComputedSection(kind="fiber", fibers=...,
bars=...) — the Gauss-fiber lowering plus discrete rebar.
(For the elastic lowering, call
ops.section.ComputedSection(analysis=doc.build())
directly.) Fail-loud on any used material with no uniaxial
role.
Source code in src/apeGmsh/sections/_document.py
analysis_from_fem ¶
Wrap a :class:FEMData that :meth:build_fem produced for
this document into its analyzer.
Split out so the meshing can happen somewhere else — the ADR
0080 B6 properties worker meshes in a subprocess and calls this
with the FEMData that came back (see
:mod:apeGmsh.sections._mesh_proc).
Source code in src/apeGmsh/sections/_document.py
build_fem ¶
The gmsh half of a continuum build: run the private
session (builders → booleans → mesh) and return the FEMData
snapshot. No materials, no analyzer, no solve.
This is the only part of a section build that touches Gmsh, and Gmsh is one process-global, non-reentrant C++ runtime — so this is also the only part that has to be serialized against other threads, or moved out of the process entirely.
Source code in src/apeGmsh/sections/_document.py
apeGmsh.sections._document.FiberRecipe
dataclass
¶
FiberRecipe(patches: tuple[dict[str, Any], ...], layers: tuple[dict[str, Any], ...], points: tuple[dict[str, Any], ...], GJ: float | None)
A fiber-lane document, fully expanded (ADR 0080 B2).
Plain data — patch / layer / point dicts carrying material
names from the document's table, templates already expanded.
:meth:SectionDocument.to_section turns it into a registered
bridge Fiber; tests and the GUI read it directly.
areas_by_material ¶
Total fiber area per material name (patches by geometry,
layers/points by n·A) — the exact-sum test surface.
Source code in src/apeGmsh/sections/_document.py
apeGmsh.sections._builder_gui.launch_builder ¶
launch_builder(path_or_doc: 'str | Path | SectionDocument | None' = None, *, blocking: bool = True) -> 'SectionBuilderWindow'
Open the section builder.
path_or_doc is a .section.json path, an existing
:class:SectionDocument, or None for a blank continuum
document. blocking=True enters the Qt event loop;
blocking=False returns immediately with the window alive
(notebooks: %gui qt).
Source code in src/apeGmsh/sections/_builder_gui.py
apeGmsh.sections._handoff.handoff_snippet ¶
Render the paste-ready bridge handoff for doc.
Parameters¶
doc The section document, either lane. path Where the document lives on disk. Continuum lane only — the snippet re-opens the document, so it needs the path; a placeholder derived from the document name is emitted when this is omitted (the GUI passes the file it has open). Ignored by the fiber lane, which inlines everything.
Returns¶
str
Python source assuming an apeSees bridge bound to ops.
Always compile()-able.
Source code in src/apeGmsh/sections/_handoff.py
Moment–curvature¶
apeGmsh.sections._mc.moment_curvature ¶
moment_curvature(doc: 'SectionDocument', *, axis: "Literal['z', 'y']" = 'z', kappa_max: float, n_steps: int = 40, axial: float = 0.0, tol: float = 1e-08, max_iter: int = 25) -> MomentCurvature
Push a fiber-lane document's section to kappa_max and record
its moment–curvature response.
Parameters¶
doc
A fiber-lane :class:~apeGmsh.sections.SectionDocument.
Every material it uses needs a uniaxial spec. (Continuum
documents lower to fibers only through a bridge — hand
doc.to_section(ops) to a frame model for those.)
axis
"z" (default) bends about the section's z-axis — DOF 6,
whose elastic slope is the analyzer's EIxx_c. "y" is
DOF 5 / EIyy_c.
kappa_max
Target curvature. Signed: a negative value walks the curve
into the other quadrant, which is how an asymmetric section's
two directions get compared.
n_steps
Displacement-control steps from 0 to kappa_max.
axial
Constant axial force held during the push, applied first and
frozen (loadConst). OpenSees convention — compression is
negative.
tol, max_iter
Newton convergence test (NormDispIncr) parameters.
Returns¶
MomentCurvature
Raises¶
MomentCurvatureError The document is not fiber-lane, an argument is out of range, a material has no usable uniaxial spec, or the axial pre-load did not converge. ImportError No OpenSees backend is installed. Raised after the document is resolved, so a malformed document reports its own problem whether or not a solver is present.
Notes¶
Wipes the process-global OpenSees domain — see the module docstring.
Source code in src/apeGmsh/sections/_mc.py
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 | |
apeGmsh.sections._mc.MomentCurvature
dataclass
¶
MomentCurvature(axis: str, curvature: tuple[float, ...], moment: tuple[float, ...], axial: float, complete: bool)
One moment–curvature curve (ADR 0080 B7).
curvature and moment are parallel, start at (0, 0), and
carry the sign of kappa_max. complete is False when a
step failed to converge before n_steps — the curve up to that
point is still valid, which is the normal end of an RC section that
crushes.