MeshBuilderPython Python API
AirFrame 0.0.20261017 ·
import MeshBuilderPythonMeshBuilder Python bindings (C++ API + pybind11)
class MeshBuilder
Parametric mesh builder for aerospace structures.
Supports context manager protocol for automatic cleanup:
with MeshBuilder() as mesh:
mesh.AddVertexElement(0, 0, 0)
MeshBuilder() -> None
Create a new MeshBuilder instance.
ReserveVertexElements(count: int) -> None
Reserve memory for a number of vertex elements to optimize performance.
Args:
count (int): Number of vertex elements to reserve
Raises:
RuntimeError: If the operation fails
AddVertexElement(x: float, y: float, z: float) -> int
Add a vertex and return its index.
Args:
x, y, z (double): Coordinates of the vertex
Returns:
int: Index of the newly created vertex
Raises:
RuntimeError: If the operation fails
ModifyVertexElement(index: int, x: float, y: float, z: float) -> None
Modify an existing vertex element.
Args:
index (int): Vertex index
x, y, z (double): New coordinates
Raises:
RuntimeError: If the operation fails
ScaleVertexElements(*args, **kwargs)
Overloaded function.
1. ScaleVertexElements(scaleX: float, scaleY: float, scaleZ: float, originX: float = 0.0, originY: float = 0.0, originZ: float = 0.0, vertexElementSet: int = -1) -> None
Scale vertex elements in a set.
Args:
scaleX, scaleY, scaleZ (double): Scaling factors
originX, originY, originZ (double, optional): Origin point for scaling (default: 0.0)
vertexElementSet (int, optional): Vertex element set to scale (-1 for all, default: -1)
Returns:
int: 0 on success, negative value on error
Raises:
RuntimeError: If the operation fails
2. ScaleVertexElements(scaleX: float, scaleY: float, scaleZ: float, originX: float, originY: float, originZ: float, vertexIndices: Annotated[numpy.ArrayLike, numpy.int32]) -> None
Scale the given vertex elements about an origin, in place (elements referencing them follow).
Args:
scaleX, scaleY, scaleZ (double): Scaling factors
originX, originY, originZ (double): Origin point for scaling
vertexIndices (array of int): Vertex element indices (duplicates scaled once)
Raises:
RuntimeError: If the operation fails
TranslateVertexElements(translateX: float, translateY: float, translateZ: float, vertexIndices: Annotated[numpy.ArrayLike, numpy.int32]) -> None
Translate the given vertex elements, in place (elements referencing them follow).
Args:
translateX, translateY, translateZ (double): Translation offsets
vertexIndices (array of int): Vertex element indices (duplicates translated once)
Raises:
RuntimeError: If the operation fails
RotateVertexElements(axisPointX: float, axisPointY: float, axisPointZ: float, axisDirX: float, axisDirY: float, axisDirZ: float, angle: float, vertexIndices: Annotated[numpy.ArrayLike, numpy.int32]) -> None
Rotate the given vertex elements about an axis, in place (right-hand rule).
Args:
axisPointX, axisPointY, axisPointZ (double): Point on the rotation axis
axisDirX, axisDirY, axisDirZ (double): Rotation axis direction
angle (double): Rotation angle in degrees
vertexIndices (array of int): Vertex element indices (duplicates rotated once)
Raises:
RuntimeError: If the operation fails
MirrorVertexElements(planeOriginX: float, planeOriginY: float, planeOriginZ: float, planeNormalX: float, planeNormalY: float, planeNormalZ: float, vertexIndices: Annotated[numpy.ArrayLike, numpy.int32]) -> None
Mirror the given vertex elements across a plane, in place. Only positions change;
use MirrorSurfaceElementSet / MirrorVolumeElementSet to keep element orientation.
Args:
planeOriginX, planeOriginY, planeOriginZ (double): Point on the mirror plane
planeNormalX, planeNormalY, planeNormalZ (double): Plane normal vector
vertexIndices (array of int): Vertex element indices (duplicates mirrored once)
Raises:
RuntimeError: If the operation fails
CopyVertexElementSet(setIndex: int) -> int
Copy a vertex element set (vertices duplicated) into a new vertex element set.
Args:
setIndex (int): Index of the vertex element set to copy
Returns:
int: Index of the new vertex element set
Raises:
RuntimeError: If the operation fails
MergeCoincidentVertexElements(mergeDistance: float, vertexElementSetIndex: int = -1) -> int
Merge vertices that are closer than mergeDistance into a single vertex.
Args:
mergeDistance (double): Maximum distance to consider vertices coincident
vertexElementSetIndex (int, optional): Vertex set to restrict merging (-1 for all)
Returns:
int: 0 on success, negative on error
Raises:
RuntimeError: If the operation fails
GetNumberOfVertexElements() -> int
Get the number of vertex elements.
Returns:
int: Number of vertex elements
GetVertexElementsDefinition() -> numpy.NDArray[numpy.float64]
Get all vertices as a NumPy array.
Returns:
ndarray: Shape (N, 3) array of vertex coordinates
GetNumberOfVertexElementSets() -> int
Get the number of vertex element sets.
Returns:
int: Number of vertex element sets
GetNumberOfVertexElementsInSet(setIndex: int) -> int
Get the number of vertex elements in a set.
Args:
setIndex (int): Index of the set
Returns:
int: Number of vertex elements in the set
Raises:
RuntimeError: If the operation fails
GetVertexElementSetElements(setIndex: int) -> numpy.NDArray[numpy.int32]
Returns vertex element set indexes as a NumPy array.
Args:
setIndex (int): Index of the set
Returns:
ndarray: Array of vertex indices
Raises:
RuntimeError: If the operation fails
GetNumberOfVertexElementsFromLineElementSet(setIndex: int) -> int
Get the number of unique vertex elements from a line element set.
Args:
setIndex (int): Line element set index
Returns:
int: Number of unique vertex elements used by the line element set
Raises:
RuntimeError: If the operation fails
GetVertexElementsFromLineElementSet(setIndex: int) -> numpy.NDArray[numpy.int32]
Get unique vertex indices from a line element set.
Args:
setIndex (int): Line element set index
Returns:
ndarray: Array of unique vertex indices used by the line element set
Raises:
RuntimeError: If the operation fails
DeleteVertexElements(setIndex: int = -1) -> None
Deletes all vertex elements (or of given set) that are not used by upper level elements.
Args:
setIndex (int, optional): Index of the vertex element set (-1 for all vertices).
Raises:
RuntimeError: If the operation fails
CreateVertexElementSet(vertexIndices: object = None) -> int
Create a new vertex element set, optionally populated with initial data.
Args:
vertexIndices (array-like, optional): Array of vertex element indices (None for empty set)
Returns:
int: Index of the newly created vertex element set
SetVertexElementSetElements(setIndex: int, vertexIndices: object = None) -> None
Replace the contents of an existing vertex element set.
Args:
setIndex (int): Index of the vertex element set to modify
vertexIndices (array-like, optional): Array of vertex element indices (None to clear)
Raises:
RuntimeError: If the operation fails
CreateLineElementSetFromVertexExtrusion(vertexIndex: int, dir: Annotated[numpy.ArrayLike, numpy.float64], length: float, divisions: int, distribution: int = 0, ratio: float = 1.0) -> int
Create a line element set by extruding a vertex along a direction.
Args:
vertexIndex (int): Index of vertex to extrude
dir (array-like): Direction vector [x, y, z]
length (double): Extrusion length
divisions (int): Number of segments
distribution (Distribution): Point distribution law (default: Uniform)
ratio (double): Distribution ratio parameter (default: 1.0)
Returns:
int: ID of the created line element set
Raises:
RuntimeError: If the operation fails
CreateLineElementSetFromVertexSweep(vertexIndex: int, controlPoints: Annotated[numpy.ArrayLike, numpy.float64], numLines: int, distribution: int = 0, ratio: float = 1.0, startAxis: int = -1, startValue: float = 0.0, endAxis: int = -1, endValue: float = 0.0, segmentIndex: int = 0) -> int
Create a line element set by sweeping a vertex along control points.
Args:
vertexIndex (int): Starting vertex
controlPoints (ndarray): Control points (N, 3)
numLines (int): Number of line segments
distribution (Distribution): Distribution type
ratio (double): Distribution ratio
startAxis (int): Start clipping axis (-1 = none)
startValue (double): Start clip value
endAxis (int): End clipping axis (-1 = none)
endValue (double): End clip value
segmentIndex (int): Segment index (default 0)
Returns:
int: ID of the created line set
Raises:
RuntimeError: If the operation fails
CreateLineElementSetBetweenVertices(v0: int, v1: int, divisions: int, distribution: int = 0, ratio: float = 1.0) -> int
Create a line element set between two vertices.
Args:
v0, v1 (int): Vertex indices
divisions (int): Number of divisions
distribution (Distribution): Point distribution law (default: Uniform)
ratio (double): Distribution ratio parameter (default: 1.0)
Returns:
int: ID of the created line set
Raises:
RuntimeError: If the operation fails
CreateLineElementSetFromCircle(centerPoint: Annotated[numpy.ArrayLike, numpy.float64], radius: float, segments: int, normal: Annotated[numpy.ArrayLike, numpy.float64], startDirection: Annotated[numpy.ArrayLike, numpy.float64], startAngle: float = 0.0, endAngle: float = 0.0, distribution: int = 0, ratio: float = 1.0) -> int
Create a line element set forming a 3D circle or arc.
Args:
centerPoint (array-like): Center coordinates (3,)
radius (double): Circle radius
segments (int): Number of segments (>=3 for full circle; the chain is always open, a full circle ends on a vertex coincident with its first one)
normal (array-like): Plane normal (3,)
startDirection (array-like): Reference direction (3,)
startAngle (double): Start angle (radians, default 0.0)
endAngle (double): End angle (radians, default 2PI)
distribution (Distribution): Spacing distribution (default Uniform)
ratio (double): Distribution ratio (default 1.0)
Returns:
int: ID of the created line set
Raises:
RuntimeError: If the operation fails
ReserveLineElements(count: int) -> None
Reserve memory for a number of line elements to optimize performance.
Args:
count (int): Number of line elements to reserve
Raises:
RuntimeError: If the operation fails
AddLineElement(v0: int, v1: int) -> int
Add a line between two vertices and return its index.
Args:
v0, v1 (int): Vertex indices
Returns:
int: Index of the newly created line element
CreateSurfaceElementSetFromLineExtrusion(lineSetId: int, dir: Annotated[numpy.ArrayLike, numpy.float64], length: float, divisions: int, distribution: int = 0, ratio: float = 1.0) -> int
Extrudes a line element set along a direction, thus creating a surface elements.
Created surface elements are stored in a new surface element set which
in turn is last set in the surface element set array. Process will also create
additional line element sets, in this order: the edge opposite to the starting
line set, then one side edge per free end of the starting line set (a vertex used
by one of its line elements only): none for a closed loop, two for an open chain.
Args:
lineSetId (int): Line set to extrude
dir (array): Extrusion direction [x, y, z]
length (double): Extrusion length
divisions (int): Number of divisions
distribution (Distribution): Distribution type
ratio (double): Distribution ratio
Raises:
RuntimeError: If the operation fails
Returns:
int: Index of the newly created surface element set
CopyLineElementSet(setIndex: int) -> int
Copy a line element set (vertices and lines duplicated) into a new line element set.
Args:
setIndex (int): Index of the line element set to copy
Returns:
int: Index of the new line element set
Raises:
RuntimeError: If the operation fails
MergeLineElementSets(setIndices: list) -> int
Merge multiple line element sets into a single set, removing duplicates.
Args:
setIndices (Iterable[int]): Sequence of line element set indices to merge
Returns:
int: Index of the newly created merged line element set
Raises:
RuntimeError: If the operation fails
GetNumberOfLineElements() -> int
Get the number of line elements.
Returns:
int: Number of line elements
GetLineElementsDefinition() -> numpy.NDArray[numpy.int32]
Get all line elements as a NumPy array.
Returns:
ndarray: Shape (N, 2) array of line vertex indices
GetNumberOfLineElementSets() -> int
Get the number of line element sets.
Returns:
int: Number of line element sets
GetNumberOfLineElementsInSet(setIndex: int) -> int
Get the number of line elements in a line element set.
Args:
setIndex (int): Index of the line element set
Returns:
int: Number of line elements in the set
Raises:
RuntimeError: If the operation fails
GetLineElementSetElements(setIndex: int) -> numpy.NDArray[numpy.int32]
Get a line element set by index.
Args:
setIndex (int): Index of the line element set
Returns:
ndarray: Array of line element indices in the set
Raises:
RuntimeError: If the operation fails
CreateLineElementSet(lineIndices: object = None) -> int
Create a new line element set, optionally populated with initial data.
Args:
lineIndices (array-like, optional): Array of line element indices (None for empty set)
Returns:
int: Index of the newly created line element set
SetLineElementSetElements(setIndex: int, lineIndices: object = None) -> None
Replace the contents of an existing line element set.
Args:
setIndex (int): Index of the line element set to modify
lineIndices (array-like, optional): Array of line element indices (None to clear)
Raises:
RuntimeError: If the operation fails
DeleteLineElements(setIndex: int = -1) -> None
Deletes all line elements (or of given set) that are not used by upper level elements.
Args:
setIndex (int, optional): Index of the line element set (-1 for all lines).
Raises:
RuntimeError: If the operation fails
ReserveSurfaceElements(count: int) -> None
Reserve memory for a number of surface elements to optimize performance.
Args:
count (int): Number of surface elements to reserve
Raises:
RuntimeError: If the operation fails
AddTriaSurfaceElement(v0: int, v1: int, v2: int) -> int
Add a triangular surface.
Args:
v0, v1, v2 (int): Vertex indices in CCW order
Returns:
int: Surface index
AddQuadSurfaceElement(v0: int, v1: int, v2: int, v3: int) -> int
Add a quadrilateral surface.
Args:
v0, v1, v2, v3 (int): Vertex indices in CCW order
Returns:
int: Surface index
CreateSurfaceElementSetFromLoft(lineSetA: int, lineSetB: int, rows: int, flipB: bool = False, distribution: int = 0, ratio: float = 1.0) -> int
Create a quad surface mesh between two line element sets.
Lofts between two line element sets with optional intermediate rows.
The two line sets must have the same number of vertices.
Args:
lineSetA (int): Index of first line element set
lineSetB (int): Index of second line element set
rows (int): Number of quad layers between polylines (>=1)
flipB (bool, optional): Reverse vertex order of lineSetB (default: False)
distribution (Distribution, optional): Interpolation spacing law (default: Uniform)
ratio (double, optional): Distribution ratio parameter (default: 1.0)
flipWinding (bool, optional): Reverse element orientation (default: False)
Returns:
int: Index of created surface element set
Raises:
RuntimeError: In case of failure
CreateSurfaceElementSetFromFan(sideSetA: int, sideSetB: int, outerSet: int) -> int
Fill a fan-shaped surface from three line element sets using bilinear interpolation.
Creates a structured fan-shaped surface mesh from an apex vertex radiating
outward to an arc. The three input line sets define the radial boundaries
and outer arc.
Args:
sideSetA (int): Index of first radial side line set
sideSetB (int): Index of second radial side line set
outerSet (int): Index of outer boundary arc line set
Returns:
int: Index of created surface element set
Raises:
RuntimeError: If polylines don't share common apex, have mismatched vertex counts,
or other validation fails
CopySurfaceElementSet(setIndex: int) -> int
Copy a surface element set (vertices and elements duplicated) into a new surface element set.
Args:
setIndex (int): Index of the surface element set to copy
Returns:
int: Index of the new surface element set
Raises:
RuntimeError: If the operation fails
MirrorSurfaceElementSet(setIndex: int, planeOriginX: float, planeOriginY: float, planeOriginZ: float, planeNormalX: float, planeNormalY: float, planeNormalZ: float) -> None
Mirror a surface element set across a plane, in place (element node order reversed
so normals stay consistent).
Args:
setIndex (int): Index of the surface element set to mirror
planeOriginX, planeOriginY, planeOriginZ (double): Point on the mirror plane
planeNormalX, planeNormalY, planeNormalZ (double): Plane normal vector
Raises:
RuntimeError: If the operation fails
CopyVolumeElementSet(setIndex: int) -> int
Copy a volume element set (vertices and elements duplicated) into a new volume element set.
Args:
setIndex (int): Index of the volume element set to copy
Returns:
int: Index of the new volume element set
Raises:
RuntimeError: If the operation fails
MirrorVolumeElementSet(setIndex: int, planeOriginX: float, planeOriginY: float, planeOriginZ: float, planeNormalX: float, planeNormalY: float, planeNormalZ: float) -> None
Mirror a volume element set across a plane, in place (element node order changed
so volumes stay positive).
Args:
setIndex (int): Index of the volume element set to mirror
planeOriginX, planeOriginY, planeOriginZ (double): Point on the mirror plane
planeNormalX, planeNormalY, planeNormalZ (double): Plane normal vector
Raises:
RuntimeError: If the operation fails
MergeSurfaceElementSets(setIndices: list) -> int
Merge multiple surface element sets into a single set, removing duplicates.
Args:
setIndices (Iterable[int]): Sequence of surface element set indices to merge
Returns:
int: Index of the newly created merged surface element set
Raises:
RuntimeError: If the operation fails
MergeVertexElementSets(setIndices: list) -> int
Merge multiple vertex element sets into a single set, removing duplicates.
Args:
setIndices (Iterable[int]): Sequence of vertex element set indices to merge
Returns:
int: Index of the newly created merged vertex element set
Raises:
RuntimeError: If the operation fails
MergeVolumeElementSets(setIndices: list) -> int
Merge multiple volume element sets into a single set, removing duplicates.
Args:
setIndices (Iterable[int]): Sequence of volume element set indices to merge
Returns:
int: Index of the newly created merged volume element set
Raises:
RuntimeError: If the operation fails
GetNumberOfSurfaceElements() -> int
Get number of surface elements.
Returns:
int: Number of surface elements
GetSurfaceElementType(elemIndex: int) -> int
Get the type of a surface element (Triangle or Quad).
Args:
elemIndex (int): Index of the surface element
Returns:
SurfaceElementType: Element type (Tria=0, Quad=1)
Raises:
RuntimeError: If element index is out of range
GetSurfaceElementDefinition(elemIndex: int) -> numpy.NDArray[numpy.int32]
Get the vertex indices for a specific surface element.
Args:
elemIndex (int): Index of the surface element
Returns:
ndarray: 1D array of vertex indices (length 3 for triangles, 4 for quads)
Raises:
RuntimeError: If element index is out of range
GetNumberOfSurfaceElementSets() -> int
Get the number of surface element sets.
Returns:
int: Number of surface element sets
GetNumberOfSurfaceElementsInSet(setIndex: int) -> int
Get the number of surface elements in a surface element set.
Args:
setIndex (int): Index of the surface element set
Returns:
int: Number of surface elements in the set
Raises:
RuntimeError: If the operation fails
GetSurfaceElementSetElements(setIndex: int) -> numpy.NDArray[numpy.int32]
Get a surface element set by index.
Args:
setIndex (int): Index of the surface element set
Returns:
ndarray: Array of surface element indices in the set
Raises:
RuntimeError: If the operation fails
GetNumberOfVertexElementsInSurfaceElementSet(setIndex: int) -> int
Get the number of unique vertex elements from a surface element set.
Args:
setIndex (int): Surface element set index
Returns:
int: Number of unique vertex elements used by the surface element set
Raises:
RuntimeError: If the operation fails
GetVertexElementsFromSurfaceElementSet(setIndex: int) -> numpy.NDArray[numpy.int32]
Get unique vertex indices from a surface element set.
Args:
setIndex (int): Surface element set index
Returns:
ndarray: Array of unique vertex indices used by the surface element set
Raises:
RuntimeError: If the operation fails
DeleteSurfaceElements(setIndex: int = -1) -> None
Deletes all surface elements (or of given set) that are not used by upper level elements.
Args:
setIndex (int, optional): Index of the surface element set (-1 for all surfaces).
Raises:
RuntimeError: If the operation fails
CreateSurfaceElementSet(surfaceIndices: object = None) -> int
Create a new surface element set, optionally populated with initial data.
Args:
surfaceIndices (array-like, optional): Array of surface element indices (None for empty set)
Returns:
int: Index of the newly created surface element set
SetSurfaceElementSetElements(setIndex: int, surfaceIndices: object = None) -> None
Replace the contents of an existing surface element set.
Args:
setIndex (int): Index of the surface element set to modify
surfaceIndices (array-like, optional): Array of surface element indices (None to clear)
Raises:
RuntimeError: If the operation fails
ReserveVolumeElements(count: int) -> None
Reserve memory for a number of volume elements to optimize performance.
Args:
count (int): Number of volume elements to reserve
Raises:
RuntimeError: If the operation fails
AddBrickVolumeElement(n0: int, n1: int, n2: int, n3: int, n4: int, n5: int, n6: int, n7: int) -> int
Add a brick (hexahedral) volume element.
Args:
n0-n7 (int): Node (vertex) indices defining the brick element
Brick node ordering (standard hexahedron):
Bottom face (z-): n0, n1, n2, n3 (counter-clockwise)
Top face (z+): n4, n5, n6, n7 (counter-clockwise)
Returns:
int: Index of the newly created brick volume element
Raises:
RuntimeError: If node indices are invalid or duplicate
AddWedgeVolumeElement(n0: int, n1: int, n2: int, n3: int, n4: int, n5: int) -> int
Add a wedge (triangular prism) volume element.
Args:
n0-n5 (int): Node (vertex) indices defining the wedge element
Wedge node ordering (triangular prism):
Bottom face (triangle): n0, n1, n2 (counter-clockwise)
Top face (triangle): n3, n4, n5 (counter-clockwise)
Returns:
int: Index of the newly created wedge volume element
Raises:
RuntimeError: If node indices are invalid or duplicate
AddTetraVolumeElement(n0: int, n1: int, n2: int, n3: int) -> int
Add a tetrahedral volume element.
Args:
n0-n3 (int): Node (vertex) indices defining the tetra element
Tetra node ordering (standard tetrahedron):
Base face (triangle): n0, n1, n2 (counter-clockwise)
Apex: n3
Returns:
int: Index of the newly created tetra volume element
Raises:
RuntimeError: If node indices are invalid or duplicate
CreateVolumeElementSetFromSurfaceExtrusion(surfaceSetId: int, dir: Annotated[numpy.ArrayLike, numpy.float64], length: float, divisions: int, distribution: int = 0, ratio: float = 1.0) -> int
Extrude a surface set to create volumes.
Args:
surfaceSetId (int): Surface set to extrude
dir (array): Extrusion direction [x, y, z]
length (float): Extrusion length
divisions (int): Number of divisions
distribution (Distribution): Distribution type
ratio (float): Distribution ratio
Returns:
int: Volume set ID
GetNumberOfVolumeElements() -> int
Get the number of volume elements.
Returns:
int: Number of volume elements
GetVolumeElementType(elemIndex: int) -> int
Get the type of a volume element (Brick, Wedge, or Tetra).
Args:
elemIndex (int): Index of the volume element
Returns:
VolumeElementType: Element type (Brick=0, Wedge=1, Tetra=2)
Raises:
RuntimeError: If element index is out of range
GetVolumeElementDefinition(elemIndex: int) -> numpy.NDArray[numpy.int32]
Get the vertex indices for a specific volume element.
Args:
elemIndex (int): Index of the volume element
Returns:
ndarray: 1D array of vertex indices (length 8 for brick, 6 for wedge)
Raises:
RuntimeError: If element index is out of range
GetNumberOfVolumeElementSets() -> int
Get the number of volume element sets.
Returns:
int: Number of volume element sets
GetNumberOfVolumeElementsInSet(setIndex: int) -> int
Get the number of volume elements in a volume element set.
Args:
setIndex (int): Index of the volume element set
Returns:
int: Number of volume elements in the set
Raises:
RuntimeError: If the operation fails
GetVolumeElementSetElements(setIndex: int) -> numpy.NDArray[numpy.int32]
Get a volume element set by index.
Args:
setIndex (int): Index of the volume element set
Returns:
ndarray: Array of volume element indices in the set
Raises:
RuntimeError: If the operation fails
GetNumberOfVertexElementsInVolumeElementSet(setIndex: int) -> int
Get the number of unique vertex elements from a volume element set.
Args:
setIndex (int): Volume element set index
Returns:
int: Number of unique vertex elements used by the volume element set
Raises:
RuntimeError: If the operation fails
GetVertexElementsFromVolumeElementSet(setIndex: int) -> numpy.NDArray[numpy.int32]
Get unique vertex indices from a volume element set.
Args:
setIndex (int): Volume element set index
Returns:
ndarray: Array of unique vertex indices used by the volume element set
Raises:
RuntimeError: If the operation fails
DeleteVolumeElements(setIndex: int = -1) -> None
Deletes all volume elements (or of given set) that are not used by upper level elements.
Args:
setIndex (int, optional): Index of the volume element set (-1 for all volumes).
Raises:
RuntimeError: If the operation fails
CreateVolumeElementSet(volumeIndices: object = None) -> int
Create a new volume element set, optionally populated with initial data.
Args:
volumeIndices (array-like, optional): Array of volume element indices (None for empty set)
Returns:
int: Index of the newly created volume element set
SetVolumeElementSetElements(setIndex: int, volumeIndices: object = None) -> None
Replace the contents of an existing volume element set.
Args:
setIndex (int): Index of the volume element set to modify
volumeIndices (array-like, optional): Array of volume element indices (None to clear)
Raises:
RuntimeError: If the operation fails
DeleteVertexElementsByIndex(indices: Annotated[numpy.ArrayLike, numpy.int32]) -> None
Delete the vertex elements of an index list (those still used by upper level elements are kept).
Unlike DeleteVertexElements, no set is needed and none is left behind.
Args:
indices (array-like): Vertex element indices
DeleteLineElementsByIndex(indices: Annotated[numpy.ArrayLike, numpy.int32]) -> None
Delete the line elements of an index list.
Args:
indices (array-like): Line element indices
DeleteSurfaceElementsByIndex(indices: Annotated[numpy.ArrayLike, numpy.int32]) -> None
Delete the surface elements of an index list.
Args:
indices (array-like): Surface element indices
DeleteVolumeElementsByIndex(indices: Annotated[numpy.ArrayLike, numpy.int32]) -> None
Delete the volume elements of an index list.
Args:
indices (array-like): Volume element indices
GetLineElementDefinition(elemIndex: int) -> numpy.NDArray[numpy.int32]
Get the two vertex indices of a line element.
Args:
elemIndex (int): Line element index
Returns:
ndarray: Vertex indices [v0, v1]
GetVertexElementSetsForVertex(vertexIndex: int) -> numpy.NDArray[numpy.int32]
Get the indices of the vertex element sets holding a vertex element.
GetLineElementSetsForLine(lineIndex: int) -> numpy.NDArray[numpy.int32]
Get the indices of the line element sets holding a line element.
GetVertexToSetsMap() -> tuple
Get the sets of every vertex element at once, as CSR arrays.
Returns:
tuple: (offsets, setIndices): the sets of vertex i are setIndices[offsets[i]:offsets[i+1]]
GetLineToSetsMap() -> tuple
Get the sets of every line element at once, as CSR arrays.
Returns:
tuple: (offsets, setIndices): the sets of line i are setIndices[offsets[i]:offsets[i+1]]
RebuildElementSetMaps() -> None
Rebuild the element-to-sets maps (done on demand anyway; this does it now).
CreateFaceSet() -> int
Create a new empty face set.
Returns:
int: Index of the new face set
GetNumberOfFaceSets() -> int
Get number of face sets.
GetNumberOfFacesInSet(setIndex: int) -> int
Get number of faces in a face set.
GetFaceSetFace(setIndex: int, faceIndex: int) -> tuple
Get one face of a face set.
Returns:
tuple: (FaceItemSource, element index, local face number (1-based))
GetFaceSetFaces(setIndex: int) -> list
Get all faces of a face set as a list of (FaceItemSource, element index, local face number).
AddFaceToSet(setIndex: int, elementSource: MeshBuilder::FACE_ITEM_SOURCE, elementIndex: int, faceIndex: int) -> None
Add a face to a face set (kept sorted, no duplicates).
Args:
setIndex (int): Face set index
elementSource (FaceItemSource): SURFACE (faces 1 and 2: the two sides) or VOLUME
elementIndex (int): Surface or volume element index
faceIndex (int): Local face number (1-based)
RemoveFaceFromSet(setIndex: int, elementSource: MeshBuilder::FACE_ITEM_SOURCE, elementIndex: int, faceIndex: int) -> None
Remove a face from a face set.
ClearFaceSet(setIndex: int) -> None
Remove all faces from a face set.
Clone() -> MeshBuilder
Get an independent copy of the mesh with all its sets.
ExportToOBJ(filename: str) -> int
Export mesh to OBJ file.
Args:
filename (str): Path to output OBJ file
Returns:
int: 0 on success, negative on error
GetErrorMessage() -> str
Get the last error message from the MeshBuilder instance.
Returns:
str: Error message string
clear() -> None
Clear all mesh data (vertices, lines, surfaces, volumes).
Enumerations
enum Distribution
Point distribution types for meshing operations.
| Uniform | 0 | Equal spacing |
| Linear | 1 | Linear gradation |
| Bilinear | 2 | Bilinear gradation |
| Cosine | 3 | Cosine spacing (clustering at ends) |
| InverseCosine | 4 | Inverse cosine spacing |
| BellShaped | 5 | Bell-shaped clustering at center |
enum SurfaceElementType
Surface element types.
| Tria | 0 | Triangular element |
| Quad | 1 | Quadrilateral element |
| None | 2 | Invalid/None |
enum VolumeElementType
Volume element types.
| Brick | 0 | Brick/Hexahedral element (8 nodes) |
| Wedge | 1 | Wedge/Triangular prism element (6 nodes) |
| Tetra | 2 | Tetrahedral element (4 nodes) |
| None | 3 | Invalid/None |
enum FaceItemSource
Kind of element a face of a face set belongs to.
| SURFACE | 0 | Surface element (face 1: front side, 2: back side) |
| VOLUME | 1 | Volume element face |
| UNKNOWN | 2 | Unknown/invalid |