SingleLineMesh
SingleLineMesh
SingleLineMesh(user_name: str, element: Element, region: Optional[RegionBase] = None, *, x0: float = 0.0, y0: float = 0.0, z0: float = 0.0, x1: float = 1.0, y1: float = 0.0, z1: float = 0.0, number_of_lines: int = 1, merge_points: bool = True, density: Optional[float] = None, mass_per_length: Optional[float] = None)
Bases: LineMeshPart
Parametric 1D line mesh part defined between two points in 3D space.
This mesh part discretizes a straight line between a start point (x0, y0, z0)
and an end point (x1, y1, z1) into a specified number of segments, automatically
assigning physical beam element templates and computing consistent lumped point Mass data.
Note
- Requires a compatible beam element that has a valid cross-section and coordinate transformation.
- Total element mass and rotational inertia are lumped and assigned to generated point arrays.
Example
from femora.core.model import Model
model = Model()
sec = model.section.beam.elastic(
user_name="column_sec", E=29000.0, A=10.0, Iz=100.0, Iy=100.0
)
transf = model.transformation.transformation3d("Linear", 0.0, 1.0, 0.0)
beam_ele = model.element.beam.disp(ndof=6, section=sec, transformation=transf)
# Discretize a single vertical column
column = model.meshpart.line.single_line(
user_name="pier_column",
element=beam_ele,
x0=0.0, y0=0.0, z0=0.0,
x1=0.0, y1=0.0, z1=15.0,
number_of_lines=5,
)
print(column.tag)
Create a parametric single line mesh part.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_name
|
str
|
Unique user-defined name for this mesh part. |
required |
element
|
Element
|
Associated Element template used for discretization. |
required |
region
|
Optional[RegionBase]
|
Physical Region where this mesh part is added. |
None
|
x0
|
float
|
Start point X-coordinate. |
0.0
|
y0
|
float
|
Start point Y-coordinate. |
0.0
|
z0
|
float
|
Start point Z-coordinate. |
0.0
|
x1
|
float
|
End point X-coordinate. |
1.0
|
y1
|
float
|
End point Y-coordinate. |
0.0
|
z1
|
float
|
End point Z-coordinate. |
0.0
|
number_of_lines
|
int
|
Number of element segments along the line. |
1
|
merge_points
|
bool
|
If True, duplicate nodes at segment boundaries are merged. |
True
|
density
|
Optional[float]
|
Material density used by this meshpart to create nodal translational and rotational Mass arrays from the element section properties. |
None
|
mass_per_length
|
Optional[float]
|
Compatibility alias for older line-mass workflows. Femora converts it to density using section area; prefer density for new code. |
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If element is not compatible, start and end points are identical, or number_of_lines is less than 1. |
TypeError
|
If merge_points is not a boolean. |
Methods:
is_element_compatible
Verify that the element belongs to compatible type families and has cross-section and transformation metadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
element
|
Element
|
Element template to verify. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if compatible, False otherwise. |