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
224 225 226 227 228 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 | |
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_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
28 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 | |
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
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 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 | |
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
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
500 501 502 503 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 | |
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