pre.OpenSeesMatlabPre ¤
Bases: handle
OpenSeesMatlabPre Pre-processing utilities for OpenSeesMatlab.
OpenSeesMatlabPre groups helper tools used before and during model construction. It is created automatically by OpenSeesMatlab and is accessed through the pre property:
1 2 3 | |
The interface includes:
- unitSystem for unit metadata and conversion helpers.
- Gmsh2OPS for converting Gmsh meshes to OpenSees definitions.
- section geometry recording for plotting fiber sections.
- model-data utilities such as nodal mass and M/C/K matrix extraction.
- load transformation helpers for gravity, beam, and surface loads.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | |
Methods:
-
setSectionGeometryRecorder–Enable or disable section geometry recording.
-
plotSection–Plot recorded fiber-section geometry.
-
getNodeMass–Get assembled nodal mass data from the current OpenSees model.
-
getMCK–Assemble and return a global model matrix.
-
createGravityLoad–Create and apply gravity loads from assembled nodal masses.
-
beamGlobalUniformLoad–Apply global uniform loads to beam elements.
-
beamGlobalPointLoad–Apply global point loads to beam elements.
-
surfaceGlobalPressureLoad–Apply uniform pressure loads to surface elements.
Properties:
-
unitSystem(None) –Unit system information for the model, including length, force, time, etc. This can be used for unit conversions and ensuring consistency in model definitions and results interpretation. See pre.UnitSystem for details.
-
fiberSectionMesh(pre.FiberSectionMesh) –Stub instance of pre.FiberSectionMesh, pre-wired to this
unitSystem ¤
unitSystem
Unit system information for the model, including length, force, time, etc. This can be used for unit conversions and ensuring consistency in model definitions and results interpretation. See pre.UnitSystem for details.
fiberSectionMesh ¤
fiberSectionMesh: pre.FiberSectionMesh
Stub instance of pre.FiberSectionMesh, pre-wired to this model's OpenSees interface.
See pre.FiberSectionMesh for full documentation.
setSectionGeometryRecorder ¤
Enable or disable section geometry recording.
When enabled, fiber-section-related OpenSees commands issued through opsmat.opensees are recorded by a SectionGeometryRecorder. The recorded geometry can then be plotted with plotSection. This is useful because OpenSees itself does not retain enough section construction history for visualization in all workflows.
Syntax
1 2 3 | |
Input arguments:
-
sw(logical) –If true, enable section geometry recording. If false, disable it and clear the current recorder. Default is true.
Example
1 2 3 4 5 6 7 | |
plotSection ¤
(secTag: double, ax=[])
Plot recorded fiber-section geometry.
plotSection visualizes a section previously recorded by setSectionGeometryRecorder(true). The recorder must be enabled before the corresponding OpenSees section, fiber, patch, and layer commands are issued.
Syntax
1 2 | |
Input arguments:
-
secTag(double) –Section tag to plot. It should match a section tag previously defined through ops.section while recording was enabled.
-
ax(axes handle) –Target axes for plotting. If empty or omitted, the recorder will create a suitable figure/axes.
Example
1 2 3 4 | |
getNodeMass ¤
()
Get assembled nodal mass data from the current OpenSees model.
The returned map contains nodal mass contributions assembled from model definitions, element mass contributions, and mass matrix information supported by the underlying utility implementation.
Syntax
1 | |
Output arguments:
-
nodeMass(containers.Map) –Map of nodal masses.
- Key : node tag
- Value : row vector of nodal masses for each degree of freedom
Example
1 2 | |
getMCK ¤
(matrixType, constraintsArgs={"Penalty", 1e12, 1e12}, systemArgs={"FullGeneral"}, numbererArgs={"Plain"})
Assemble and return a global model matrix.
Syntax
1 2 3 | |
Input arguments:
-
matrixType(char or string) –Matrix type: 'm', 'c', 'k', or 'ki'.
-
constraintsArgs(char, string, or cell array) –Arguments passed to the OpenSees constraints command. Default: {'Penalty', 1e12, 1e12}.
-
systemArgs(char, string, or cell array) –Arguments passed to the OpenSees system command. Default: {'FullGeneral'}.
-
numbererArgs(char, string, or cell array) –Arguments passed to the OpenSees numberer command. Default: {'Plain'}.
createGravityLoad ¤
Create and apply gravity loads from assembled nodal masses.
This method obtains nodal mass information and converts it to equivalent nodal gravity loads. The generated loads are applied to the active OpenSees load pattern by calling the OpenSees load command through the parent command interface.
Syntax
1 2 3 | |
Input arguments:
-
excludeNodes(double array) –Node tags to exclude from gravity load application. Default is empty, meaning all nodes with assembled mass are included.
-
direction(string) –Gravity direction. Must be "X", "Y", "Z", "x", "y", or "z". Default is "Z".
-
factor(double) –Gravity/load scale factor. Default is -9.81.
Output arguments:
-
nodeLoads(containers.Map) –Applied nodal loads.
- Key : node tag
- Value : row vector nodal load
Example
1 2 3 | |
beamGlobalUniformLoad ¤
Apply global uniform loads to beam elements.
The input load components are defined in the global coordinate system. They are transformed to each beam element's local coordinate system and then applied through ops.eleLoad(...).
Syntax
1 2 | |
Input arguments:
-
eleTags(double array) –Element tags to which the uniform load will be applied.
-
wx(double) –Uniform load intensity in the global x direction. Default is 0.0.
-
wy(double) –Uniform load intensity in the global y direction. Default is 0.0.
-
wz(double) –Uniform load intensity in the global z direction. Default is 0.0.
Example
1 2 3 | |
beamGlobalPointLoad ¤
Apply global point loads to beam elements.
The input load components are defined in the global coordinate system. They are transformed to each beam element's local coordinate system and then applied through ops.eleLoad(...).
Syntax
1 2 | |
Input arguments:
-
eleTags(double array) –Element tags to which the point load will be applied.
-
px(double) –Point load magnitude in the global x direction. Default is 0.0.
-
py(double) –Point load magnitude in the global y direction. Default is 0.0.
-
pz(double) –Point load magnitude in the global z direction. Default is 0.0.
-
xl(double) –Location along each beam element as a fraction of the element length. Use 0.0 at the I end, 1.0 at the J end, and 0.5 for midspan. Default is 0.5.
Example
1 2 3 | |
surfaceGlobalPressureLoad ¤
Apply uniform pressure loads to surface elements.
This method converts uniform pressure on surface elements to equivalent nodal loads in global coordinates. The positive surface normal follows the cross product of the I-J and J-K element edges.
Syntax
1 | |
Input arguments:
-
eleTags(double array) –Surface element tags to which the pressure load will be applied.
-
p(double) –Uniform pressure magnitude per unit area. p can be scalar or a vector with one value per element tag.
Example
1 2 3 | |
pre.UnitSystem ¤
Bases: handle
Fast unit conversion system for OpenSeesMatlab.
The unit system allows users to set their preferred basic units for length, force, and time. It then provides conversion factors for a wide range of units based on these basic units. Users can access unit conversion factors through properties (e.g., unit.mm, unit.kN, unit.MPa) or by using the unit system as a function with an expression (e.g., unit("N/mm^2")). unit.mm2 would return the conversion factor for mm^2 based on the current length unit, unit.mm3 would return the conversion factor for mm^3 based on the current length unit, and so on.
Supported units include:
- lengthUnit, options: inch, ft, mm, cm, m, km
- forceUnit, options: lb, lbf, kip, n, kn, mn, kgf, tonf
- timeUnit, options: msec, sec, min, hour, day, year
- massUnit, options: mg, g, kg, ton, t, slug, slinch
- stressUnit, options: pa, kpa, mpa, gpa, bar, psi, ksi, psf, ksf
Example
1 2 3 4 5 6 7 | |
setBasicUnits ¤
(lengthUnit, forceUnit, timeUnit)
Set the basic units for length, force, and time. This will reset the unit system and update all conversion factors accordingly.
Input arguments:
-
lengthUnit–
pre.Gmsh2OPS ¤
Bases: handle
GMSH2OPS Generate OpenSees-MATLAB commands from Gmsh .msh files.
This class reads ASCII Gmsh .msh files and converts mesh entities,
nodes, elements, and physical groups into OpenSees-MATLAB commands.
The class supports:
- parsing
$PhysicalNames,$Entities,$Nodes, and$Elements - querying nodes/elements by dimension-entity tags or physical groups
- creating OpenSees commands directly at runtime
- writing MATLAB or Tcl command scripts
Input arguments:
-
ops(object) –OpenSees-MATLAB command object used by runtime command creation methods.
Notes
- This implementation is intended for ASCII Gmsh MSH 4.x files.
- Runtime Gmsh API access is intentionally not included here.
-
The generated MATLAB commands assume an OpenSees-MATLAB interface such as:
ops.node(...) ops.element(...) ops.fix(...)
Examples:
Create the converter and read a mesh file:
1 2 | |
Write node and element commands to a MATLAB script:
1 2 3 | |
Create commands directly at runtime:
1 2 3 4 | |
readGmshFile ¤
READGMSHFILE Read an ASCII Gmsh .msh file.
Input arguments:
-
filePath(char) –Path to the
.mshfile. -
PrintInfo(logical) –If true, print geometry, physical group, and mesh summary information. Default is true.
Notes
This method parses the following sections when present:
$PhysicalNames$Entities$Nodes$Elements
The parsed data are stored in:
gmshEntitiesgmshNodesgmshElesgmshPhysicalGroups
Examples:
1 2 | |
printInfo ¤
()
PRINTINFO Print geometry, physical group, and mesh summary information.
Notes
This method prints:
- entity counts by dimension
- physical group names
- total node and element counts
- minimum and maximum node/element tags
getDimEntityTags ¤
(Dim=[])
GETDIMENTITYTAGS Return dimension-entity tag pairs.
Input arguments:
-
Dim(double) –Dimension to filter. If empty, all dimension-entity tags are returned.
Output arguments:
-
dimEntityTags(double array) –N-by-2 array of
[dim, entityTag].
getBoundaryDimTags ¤
GETBOUNDARYDIMTAGS Return all boundary dim-entity tags recursively.
Input arguments:
-
DimEntityTags(double array) –N-by-2 array of
[dim, entityTag]. -
PhysicalGroupNames((char, string, cellstr)) –Physical group name or names.
-
IncludeSelf(logical) –If true, the queried entities themselves are also included. Default is false.
Output arguments:
-
boundaryDimTags(double array) –Unique sorted boundary dim-entity tags.
Notes
The boundaries are collected recursively, so surfaces return their boundary curves and corner points, and volumes return their boundary surfaces, curves, and points.
getNodeTags ¤
(DimEntityTags=[], PhysicalGroupNames=[])
GETNODETAGS Return node tags from selected entities or groups.
Input arguments:
-
DimEntityTags(double array) –N-by-2 array of
[dim, entityTag]. If provided, it takes priority overPhysicalGroupNames. -
PhysicalGroupNames((char, string, cellstr)) –Physical group name or list of names.
Output arguments:
-
nodeTags(double column vector) –Unique node tags in stable order.
Notes
If both DimEntityTags and PhysicalGroupNames are empty,
all available mesh entities with nodes are used.
Examples:
1 2 3 | |
getElementTags ¤
(DimEntityTags=[], PhysicalGroupNames=[])
GETELEMENTTAGS Return element tags from selected entities or groups.
Input arguments:
-
DimEntityTags(double array) –N-by-2 array of
[dim, entityTag]. -
PhysicalGroupNames((char, string, cellstr)) –Physical group name or list of names.
Output arguments:
-
eleTags(double column vector) –Unique element tags in stable order.
createNodeCmds ¤
(DimEntityTags=[], PhysicalGroupNames=[], StartNodeTag=[])
CREATENODECMDS Create OpenSees node commands at runtime.
Input arguments:
-
DimEntityTags(double array) –N-by-2 array of
[dim, entityTag]. -
PhysicalGroupNames((char, string, cellstr)) –Physical group name or list of names.
-
StartNodeTag(double) –Starting node tag. If empty, original Gmsh node tags are used.
Output arguments:
-
nodeTags(double column vector) –Generated OpenSees node tags.
Notes
If StartNodeTag is provided, node tags are reassigned in
ascending order from that value.
createElementCmds ¤
(opsEleType, OpsEleArgs={}, DimEntityTags=[], PhysicalGroupNames=[], StartEleTag=[])
CREATEELEMENTCMDS Create OpenSees element commands at runtime.
Input arguments:
-
opsEleType(char or string) –OpenSees element type, such as
"truss"or"quad". -
OpsEleArgs(cell) –Additional arguments appended after tag and node tags.
-
DimEntityTags(double array) –N-by-2 array of
[dim, entityTag]. -
PhysicalGroupNames((char, string, cellstr)) –Physical group name or names.
-
StartEleTag(double) –Starting element tag. If empty, original Gmsh element tags are used.
Output arguments:
-
eleTags(double column vector) –Generated OpenSees element tags.
Notes
If StartEleTag is provided, element tags are reassigned in
ascending order from that value.
Examples:
1 2 | |
createFixCmds ¤
(dofs, DimEntityTags=[], PhysicalGroupNames=[])
CREATEFIXCMDS Create OpenSees fix commands at runtime.
Input arguments:
-
dofs(cell or numeric array) –Constrained degrees of freedom flags, such as
{1,1,1}or[1 1 1]. -
DimEntityTags(double array) –N-by-2 array of
[dim, entityTag]. -
PhysicalGroupNames((char, string, cellstr)) –Physical group name or names.
Output arguments:
-
fixedTags(double column vector) –Fixed node tags.
Notes
Duplicate node tags are removed automatically.
setOutputFile ¤
(FileName: char = 'src.m')
SETOUTPUTFILE Set the output script file.
Input arguments:
-
FileName(char) –Output file name. Must end with
.mor.tcl. Default is'src.m'.
Notes
If the file ends with .m, MATLAB/OpenSees commands are written.
If the file ends with .tcl, Tcl/OpenSees commands are written.
A model header is automatically written to the file.
Examples:
1 2 | |
writeNodeFile ¤
(DimEntityTags=[], PhysicalGroupNames=[], StartNodeTag=[])
WRITENODEFILE Write node commands to the output script.
Input arguments:
-
DimEntityTags(double array) –N-by-2 array of
[dim, entityTag]. -
PhysicalGroupNames((char, string, cellstr)) –Physical group name or list of names.
-
StartNodeTag(double) –Starting node tag. If empty, original Gmsh node tags are used.
Output arguments:
-
nodeTags(double column vector) –Written node tags.
Notes
setOutputFile must be called before using this method.
writeElementFile ¤
(opsEleType, OpsEleArgs={}, DimEntityTags=[], PhysicalGroupNames=[], StartEleTag=[])
WRITEELEMENTFILE Write element commands to the output script.
Input arguments:
-
opsEleType(char or string) –OpenSees element type.
-
OpsEleArgs(cell) –Additional arguments appended after tag and node tags.
-
DimEntityTags(double array) –N-by-2 array of
[dim, entityTag]. -
PhysicalGroupNames((char, string, cellstr)) –Physical group name or names.
-
StartEleTag(double) –Starting element tag. If empty, original Gmsh element tags are used.
Output arguments:
-
eleTags(double column vector) –Written element tags.
Notes
setOutputFile must be called before using this method.
writeFixFile ¤
(dofs, DimEntityTags=[], PhysicalGroupNames=[])
WRITEFIXFILE Write fix commands to the output script.
Input arguments:
-
dofs(cell or numeric array) –Constrained degrees of freedom flags.
-
DimEntityTags(double array) –N-by-2 array of
[dim, entityTag]. -
PhysicalGroupNames((char, string, cellstr)) –Physical group name or names.
Output arguments:
-
fixedTags(double column vector) –Written fixed node tags.
Notes
setOutputFile must be called before using this method.
pre.FiberSectionMesh ¤
Bases: handle
Cross-section meshing, geometric property computation, and OpenSees fiber section definition via the OpenSees MATLAB interface.
This class accepts an assembly of user-defined section parts, each
described by a polyshape geometry object and an OpenSees material
tag. Parts are independent and can represent distinct materials (e.g.
confined core, unconfined cover, steel plate). The class meshes each
part with a raster (rectangular grid) strategy, computes section
properties from the resulting fiber discretisation, and writes the
section definition directly into an OpenSees model through a shared
OpenSees MATLAB interface object (ops).
1 2 3 4 5 | |
Rebar groups may also be registered. They contribute fiber calls
to the build output but are excluded from all geometric
property calculations; the caller is responsible for rebar geometry.
This class belongs to the pre package. Static utility methods
must therefore be called as pre.FiberSectionMesh.<method>.
Input arguments:
-
parts(struct array) –Array of solid-region descriptors. Each element must contain the following fields:
- name (char) – Human-readable label for the part.
- matTag (int) – OpenSees uniaxial material tag.
- geometry (polyshape) – Closed polygon defining the region
boundary. Holes and multi-region shapes (created with
subtract,intersect, etc.) are fully supported. - meshSize (double, optional) – Target raster cell size.
Defaults to
20when the field is absent or empty. - secTag (double, optional) – Per-part OpenSees section
tag. Defaults to
NaN; the class-levelsecTagproperty takes precedence when set.
-
rebars(struct array) –Array of rebar-group descriptors. Each element must contain:
- name (char) – Human-readable label.
- matTag (int) – OpenSees uniaxial material tag.
- coords (N-by-2 double) – Bar centre coordinates; each row
is
[y, z]. - area (double) – Cross-sectional area of one bar (scalar) or individual areas for each bar (N-by-1 vector).
-
secTag(double) –Global OpenSees section tag applied to the entire assembly. Overrides any
secTagvalues stored in individual parts. Defaults toNaN(must be set before callingbuild).
Properties:
-
parts(struct array) –Solid-region descriptors as provided by the caller.
-
rebars(struct array) –Rebar-group descriptors as provided by the caller.
-
secTag(_Hx9U5) –Global OpenSees section tag.
-
meshFibers(struct array) –Fiber cells produced by the last call to
mesh. Each element has fieldsy,z,area,hw,hh,matTag, andpartName. Empty untilmeshhas been called. -
sectionProps(_dXrgj) –Geometric properties produced by the last call to
computeProps. Fields:A,Cy,Cz,Iy,Iz,Iyz,ry,rz,I1,I2,theta. Empty untilcomputePropshas been called.
Examples:
Recommended workflow via the opsmat.pre.fiberSection stub::
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | |
Notes
- The coordinate system follows the OpenSees convention:
yis the horizontal axis andzis the vertical axis in the section plane. - Always create sections via
opsmat.pre.fiberSection.new(...)rather than directly withpre.FiberSectionMesh(...); the former injectsopsautomatically sobuildworks without extra steps. - The
opsmat.pre.fiberSectionMeshstub is a shell instance with no parts or rebars. It is safe to call static helpers on it at any time; onlynewproduces a real, usable section. - Rebar fibers are written last inside the
section Fiberblock but contribute nothing tosectionProps. - Calling
meshagain after changingpartsinvalidates the previously computedsectionProps;computePropsmust be re-called.
See Also
Methods:
-
new–Create a fully configured FiberSectionMesh with ops injected.
-
mesh–Discretise all section parts into triangular fiber cells.
-
computeProps–Compute cross-section geometric properties.
-
printProps–Print a formatted summary of section properties.
-
build–Write the fiber section definition into the OpenSees model.
-
plot–Visualize the triangular section mesh, rebars, and centroid.
-
polygonShape–polygonShape Create an arbitrary closed polygon polyshape.
-
rectShape–rectShape Create a solid rectangular polyshape.
-
hollowRectShape–Create a hollow rectangular (box) polyshape.
-
circleShape–circleShape Create a solid circular polyshape.
-
annulusShape–annulusShape Create an annular (hollow circular) polyshape.
-
IShape–IShape Create a doubly-symmetric I- or H-section polyshape.
-
TShape–TShape Create a T-section (flange + web) polyshape.
-
LShape–LShape Create an L-section (equal- or unequal-leg angle) polyshape.
-
lineRebars–Generate rebar coordinates along a polyline or closed polygonal path.
-
rectRebars–Bar centres around the perimeter of a rectangle.
-
circRebars–circRebars Bar centres arranged on a full circle.
-
arcRebars–arcRebars Bar centres along a circular arc.
-
polygonRebars–polygonRebars Bar centres along an arbitrary polygon path.
new ¤
Create a fully configured FiberSectionMesh with ops injected.
Call this on the opsmat.pre.fiberSection stub rather than
using the constructor directly. The ops object stored in
the stub is automatically transferred to the new section so
that build works without any extra setup.
Input arguments:
-
parts(struct array) –Solid-region descriptors. See class documentation for required fields (
name,matTag,geometry). -
rebars(struct array, optional keyword) –Rebar-group descriptors. Omit entirely when the section has no reinforcement. Default
[]. -
secTag(double, optional keyword) –OpenSees section tag (positive integer). Can also be assigned later via
sec.secTag = valuebefore callingbuild. DefaultNaN.
Output arguments:
-
sec(FiberSectionMesh) –New section object with
opsalready injected. Ready formesh,computeProps, andbuild.
mesh ¤
()
Discretise all section parts into triangular fiber cells.
This method must be called before computeProps or
build. Calling mesh again discards
the previous fiber set and resets isComputed.
Input arguments:
-
None–
Output arguments:
-
None–meshFibersis updated in place (handle semantics).
Notes
The Partial Differential Equation Toolbox - MATLAB is required.
computeProps ¤
()
Compute cross-section geometric properties.
Evaluates the following properties from the current fiber mesh using the standard fiber-integration formulas. Rebar fibers are not included.
mesh is called automatically if it has not yet been
invoked.
Notes
Computed quantities stored in obj.sectionProps:
| Field | Description |
|---|---|
| A | Total cross-sectional area. |
| Cy | y-coordinate of the centroid. |
| Cz | z-coordinate of the centroid. |
| Iy | Second moment of area about the horizontal centroidal axis (integral of z^2 dA). |
| Iz | Second moment of area about the vertical centroidal axis (integral of y^2 dA). |
| Iyz | Product of inertia (integral of y*z dA). |
| ry | Radius of gyration about the horizontal centroidal axis. |
| rz | Radius of gyration about the vertical centroidal axis. |
| I1 | Larger principal second moment of area. |
| I2 | Smaller principal second moment of area. |
| theta | Angle (degrees) from the z-axis to the principal axis corresponding to I1. |
build ¤
(secType='Fiber', GJ: double = 1.0e12)
Write the fiber section definition into the OpenSees model.
Input arguments:
-
secType(char or string) –OpenSees section type. Default is
'Fiber'. You can specify any valid OpenSees fiber section type, e.g, "FiberThermal". -
GJ(double) –Torsional stiffness passed through the
'-GJ'option. Default is1.0e12. Only used for 3D case.
Examples:
1 2 3 4 5 6 | |
plot ¤
(color: double = [], partColors: cell = {}, alpha: double = 0.92, fill: logical = false, showEdges: logical = true, showRebars: logical = true, showCentroid: logical = false, ax=[])
Visualize the triangular section mesh, rebars, and centroid.
Input arguments:
-
color(double array, shape (1, 3)) –Single RGB color applied to all parts. If empty, colors are assigned automatically from a colormap.
-
partColors(cell array) –One RGB or hex color per part. This overrides
colorand the colormap. -
alpha(double) –Face transparency for filled mesh patches. Default is 0.92.
-
fill(logical) –If false, only colored mesh lines are shown. If true, filled triangular mesh patches are shown. Default is false.
-
showEdges(logical) –Show mesh edges when
fillis true. Default is true. -
showRebars(logical) –Show rebar groups. Default is true.
-
showCentroid(logical) –Show centroid marker if section properties have been computed. Default is false.
-
ax(axes) –Target axes. If empty, a new figure is created.
polygonShape
Static
¤
(yVerts, zVerts)
polygonShape Create an arbitrary closed polygon polyshape.
Convenience wrapper around the polyshape constructor for
user-supplied vertex lists. The polygon is automatically
closed; do not repeat the first vertex at the end. Holes can
be created afterwards with subtract.
Input arguments:
-
yVerts((N,) double) –y-coordinates of the polygon vertices in order (CW or CCW).
-
zVerts((N,) double) –z-coordinates of the polygon vertices in the same order. Must have the same length as
yVerts.
Output arguments:
-
ps(polyshape) –Closed polygon built from the supplied vertices.
Examples:
1 2 3 4 5 6 7 8 9 | |
rectShape
Static
¤
(b, h, cy, cz)
rectShape Create a solid rectangular polyshape.
Input arguments:
-
b(double) –Width in the y-direction.
-
h(double) –Height in the z-direction.
-
cy(double) –y-coordinate of the centroid. Default
0. -
cz(double) –z-coordinate of the centroid. Default
0.
Output arguments:
-
ps(polyshape) –Axis-aligned solid rectangle.
Examples:
1 2 3 4 5 | |
hollowRectShape
Static
¤
(bo, ho, bi, hi, cy, cz)
Create a hollow rectangular (box) polyshape.
The inner rectangle is concentrically subtracted from the
outer rectangle. Both rectangles share the same centroid.
To model eccentric voids use subtract directly on two
rectShape results.
Input arguments:
-
bo(double) –Outer width (y-direction).
-
ho(double) –Outer height (z-direction).
-
bi(double) –Inner (void) width (y-direction). Must be
< bo. -
hi(double) –Inner (void) height (z-direction). Must be
< ho. -
cy(double) –y-coordinate of the shared centroid. Default
0. -
cz(double) –z-coordinate of the shared centroid. Default
0.
Output arguments:
-
ps(polyshape) –Hollow rectangular polygon (outer minus inner).
Examples:
1 2 3 4 5 | |
circleShape
Static
¤
(r, cy, cz, n)
circleShape Create a solid circular polyshape.
The circle is approximated by a regular n-gon. The default of 64 vertices is sufficient for typical section meshes; use 128 or higher for very fine meshes or large radii.
Input arguments:
-
r(double) –Radius of the circle.
-
cy(double) –y-coordinate of the centre. Default
0. -
cz(double) –z-coordinate of the centre. Default
0. -
n(int) –Number of polygon vertices. Default
64.
Output arguments:
-
ps(polyshape) –Regular n-gon approximating the circle.
Examples:
1 2 | |
annulusShape
Static
¤
(Ro, Ri, cy, cz, n)
annulusShape Create an annular (hollow circular) polyshape.
Useful for circular steel tubes, pipe piles, or circular concrete sections with a central void.
Input arguments:
-
Ro(double) –Outer radius.
-
Ri(double) –Inner radius. Must satisfy
0 < Ri < Ro. -
cy(double) –y-coordinate of the centre. Default
0. -
cz(double) –z-coordinate of the centre. Default
0. -
n(int) –Number of polygon vertices on each boundary circle. Default
64.
Output arguments:
-
ps(polyshape) –Annular polygon (outer circle minus inner circle).
Examples:
1 2 3 4 5 | |
IShape
Static
¤
(bf, tf, hw, tw, cy, cz)
IShape Create a doubly-symmetric I- or H-section polyshape.
The section is assembled from three rectangles (top flange,
web, bottom flange) combined with union. The centroid is
placed at the intersection of the two axes of symmetry.
┌──────────────┐ ─ z = +H/2 (top of top flange)
│ top flange │
└───┬──────┬───┘ ─ z = +hw/2
1 | |
┌───┴──────┴───┐ ─ z = -hw/2
│ bottom flange│
└──────────────┘ ─ z = -H/2
Input arguments:
-
bf(double) –Flange width (y-direction).
-
tf(double) –Flange thickness (z-direction, both flanges identical).
-
hw(double) –Clear web height (z-direction, between flanges).
-
tw(double) –Web thickness (y-direction).
-
cy(double) –y-coordinate of the section centroid. Default
0. -
cz(double) –z-coordinate of the section centroid. Default
0.
Output arguments:
-
ps(polyshape) –I-section polygon. Total height =
hw + 2*tf.
Examples:
1 2 3 4 5 | |
TShape
Static
¤
(bf, tf, hw, tw, cy, cz)
TShape Create a T-section (flange + web) polyshape.
The web hangs below the flange. The reference centroid
(cy, cz) is placed at the centre of the flange's top face
(i.e. z = 0 is the top of the section). The overall depth is
tf + hw.
┌──────────────┐ z = 0 (top of flange / reference)
│ flange │
└───┬──────┬───┘ z = -tf
1 2 3 4 5 | |
Input arguments:
-
bf(double) –Flange width (y-direction).
-
tf(double) –Flange thickness (z-direction).
-
hw(double) –Web height below the flange (z-direction).
-
tw(double) –Web thickness (y-direction).
-
cy(double) –y-coordinate of the section centreline. Default
0. -
cz(double) –z-coordinate of the top of the flange. Default
0.
Output arguments:
-
ps(polyshape) –T-section polygon. Total depth =
tf + hw.
Examples:
T-beam 600 wide flange, 120 thick, 600 web height, 100 thick::
1 | |
LShape
Static
¤
(b, h, t, cy, cz)
LShape Create an L-section (equal- or unequal-leg angle) polyshape.
The horizontal leg extends in the +y direction and the
vertical leg extends in the +z direction from the heel at
(cy, cz).
┌──┐ z = cz + h (top of vertical leg)
│ │
│ ├────────┐ z = cz + t
└──┴────────┘ z = cz (bottom / heel)
cy cy + b
Input arguments:
-
b(double) –Total width of the horizontal leg (y-direction).
-
h(double) –Total height of the vertical leg (z-direction).
-
t(double) –Leg thickness (applied to both legs; for unequal thickness use
polygonShapedirectly). -
cy(double) –y-coordinate of the heel corner. Default
0. -
cz(double) –z-coordinate of the heel corner. Default
0.
Output arguments:
-
ps(polyshape) –L-section polygon.
Examples:
1 2 3 4 5 | |
lineRebars
Static
¤
(yPath: double, zPath: double, n: double = [], gap: double = [], closed: logical = false, removeDuplicateEnd: logical = true, tol: double = 1.0e-10)
Generate rebar coordinates along a polyline or closed polygonal path.
Path vertices are always occupied by rebars. Each path segment is
then independently interpolated using either a target spacing gap
or an approximate total bar count n.
Input arguments:
-
yPath(double array, shape (n, 1)) –y-coordinates of the path vertices.
-
zPath(double array, shape (n, 1)) –z-coordinates of the path vertices.
-
n(double) –Approximate total number of bars along the whole path.
-
gap(double) –Target spacing along each segment.
-
closed(logical) –If true, connect the last point back to the first point.
-
removeDuplicateEnd(logical) –Remove repeated final point if identical to the first point.
-
tol(double) –Tolerance for duplicate and zero-length points.
Output arguments:
-
coords(double array, shape (m, 2)) –Rebar coordinates. Each row is [y, z].
rectRebars
Static
¤
(b, h, cover, varargin)
Bar centres around the perimeter of a rectangle.
Distributes bars around all four faces of a rectangle. The
spacing is controlled by nY + nZ (bars per face) or
by a uniform centre-to-centre gap. Corner bars are always
present and are counted only once.
Input arguments:
-
b(double) –Section width (y-direction).
-
h(double) –Section height (z-direction).
-
cover(double) –Distance from the face to the bar centre.
-
nY((int, keyword)) –Number of bars along the top / bottom faces (corners included). Must be supplied together with
nZ. -
nZ((int, keyword)) –Number of bars along the left / right faces (corners included). Must be supplied together with
nY. -
gap((double, keyword)) –Uniform target spacing; the same gap is applied to all four faces independently. Cannot be combined with
nY/nZ. -
cy(double, optional keyword) –y-coordinate of the section centroid. Default
0. -
cz(double, optional keyword) –z-coordinate of the section centroid. Default
0.
Output arguments:
-
coords((N, 2) double) –Unique bar centre coordinates sorted by angle; each row is
[y, z].
Examples:
1 2 3 4 5 6 7 8 | |
circRebars
Static
¤
(R, varargin)
circRebars Bar centres arranged on a full circle.
Distributes bars uniformly on a circle of radius R.
The spacing is controlled by n (number of bars) or by the
target arc gap. The closed option selects whether the
layout is treated as a closed loop (default) — spacing is
2*pi*R / n — or open, which has no practical difference
for a full circle but is provided for API consistency.
Input arguments:
-
R(double) –Radius of the bar circle (to bar centres).
-
n((int, keyword)) –Number of bars equally spaced around the full circle. Must be
>= 2. -
gap((double, keyword)) –Target arc-length spacing between adjacent bar centres.
n = round(2*pi*R / gap). -
cy(double, optional keyword) –y-coordinate of the circle centre. Default
0. -
cz(double, optional keyword) –z-coordinate of the circle centre. Default
0. -
startAngle(double, optional keyword) –Angle (degrees) of the first bar, measured CCW from the +y axis. Default
90(bar at the top).
Output arguments:
-
coords((N, 2) double) –Bar centre coordinates; each row is
[y, z].
Examples:
1 2 3 4 5 6 7 8 | |
arcRebars
Static
¤
(R, angStart, angEnd, varargin)
arcRebars Bar centres along a circular arc.
Distributes bars from angle angStart to angEnd along
an arc of radius R. By default the two end angles are
included (closed = true). Set closed = false to
place bars strictly between the end angles.
Input arguments:
-
R(double) –Arc radius (to bar centres).
-
angStart(double) –Start angle in degrees, measured CCW from the +y axis.
-
angEnd(double) –End angle in degrees, measured CCW from the +y axis. May be less than
angStartto sweep CW. -
n((int, keyword)) –Number of bars including end bars (when
closed = true) or excluding them (whenclosed = false). Must be>= 2whenclosed = true,>= 1otherwise. -
gap((double, keyword)) –Target arc-length spacing. The actual bar count is determined from the arc length and the gap.
-
closed(logical, optional keyword) –true(default) – bars placed atangStartandangEndas well as in between.false– bars placed strictly between the two angles, evenly spaced. -
cy(double, optional keyword) –y-coordinate of the arc centre. Default
0. -
cz(double, optional keyword) –z-coordinate of the arc centre. Default
0.
Output arguments:
-
coords((N, 2) double) –Bar centre coordinates; each row is
[y, z].
Examples:
1 2 3 4 5 | |
polygonRebars
Static
¤
(yPath, zPath, varargin)
polygonRebars Bar centres along an arbitrary polygon path.
Traverses the edges of a polygon (given as an ordered vertex list) and places bars at uniform arc-length spacing along the path. The polygon can be treated as open (a poly-line) or closed (the last vertex connects back to the first).
This is useful for non-rectangular or non-circular cages, such as hexagonal columns, wall boundary elements, or custom shapes.
Input arguments:
-
yPath((M,) double) –y-coordinates of the polygon vertices in traversal order.
-
zPath((M,) double) –z-coordinates of the polygon vertices in traversal order.
-
n((int, keyword)) –Total number of bars distributed along the full path (including the start point; end point included only if
closed = true). -
gap((double, keyword)) –Target arc-length spacing between adjacent bars.
-
closed(logical, optional keyword) –true(default) – the last vertex connects back to the first vertex, forming a closed loop.false– the path is open; bars run from the first to the last vertex only.
Output arguments:
-
coords((N, 2) double) –Bar centre coordinates; each row is
[y, z].
Notes
Bar positions are determined by uniform arc-length parameterisation of the polyline. Vertices of the path are not necessarily bar positions.
Examples:
Hexagonal cage, 18 bars, closed::
1 2 3 4 | |
Open poly-line, bars at 80 mm::
1 2 | |