Model¶
Accessed via app.model.
ModelFacade¶
- class pyrobotstructural.model.facade.ModelFacade(raw_app)[source]¶
Bases:
objectFacade for building and editing the structural model.
Accessed via
app.model. Aggregates the geometry, section, support, and management sub-editors.- Parameters:
raw_app (Any)
- begin_edit()[source]¶
Context manager that batches all structure modifications into a single multi-operation flush. Delegates to
app.model.geometry.begin_edit().Usage¶
- with app.model.begin_edit():
app.model.geometry.add_node(nodes_array) app.model.geometry.add_member(members_array, section_name=”IPE 100”) app.model.supports.apply_node_support([1, 2], “Pinned”)
GeometryEditor¶
- class pyrobotstructural.model.geometry.GeometryEditor(raw_app)[source]¶
Bases:
_BaseEditorEditor for structural geometry: nodes, bars, shells, and cladding.
Accessed via
app.model.geometry. Provides methods to add nodes, bar members, shell panels, and cladding surfaces to the Robot model. Usebegin_edit()to batch bulk operations into a single COM multi-operation flush for large performance gains.- Parameters:
raw_app (Any)
- begin_edit()[source]¶
Context manager that batches all structure modifications into a single multi-operation flush, dramatically reducing COM overhead for large bulk operations.
- Return type:
Generator[None,Any,None]
Usage¶
- with app.model.geometry.begin_edit():
app.model.geometry.add_node([[1, 0, 0, 0], [2, 1, 0, 0]]) app.model.geometry.add_member([[1, 1, 2]], section_name=”IPE 100”)
- add_node(number_or_data, x=None, y=None, z=None)[source]¶
Add one or more nodes to the model.
- Parameters:
number_or_data (
Union[int,list,ndarray]) –Single node: pass number (int) alongside x, y, z.
Multiple nodes: pass a 2D list or numpy array of shape (N, 4) where each row is [number, x, y, z].
x (
float|None) – Coordinates in meters. Only used when adding a single node.y (
float|None) – Coordinates in meters. Only used when adding a single node.z (
float|None) – Coordinates in meters. Only used when adding a single node.
- Return type:
None
Examples
Single node:
>>> model.add_node(1, 0.0, 1.0, 2.0)
Multiple nodes as a 2-D list:
>>> model.add_node([[1, 0.0, 1.0, 2.0], [2, 3.0, 4.0, 5.0]])
NumPy array:
>>> import numpy as np >>> nodes = np.array([[1, 0.0, 1.0, 2.0], [2, 3.0, 4.0, 5.0]]) >>> model.add_node(nodes)
- add_member(number_or_data, start_node=None, end_node=None, section_name=None, material_name=None, release_name=None, tension_comp=None, truss=False)[source]¶
Add one or more bars to the model.
- Parameters:
number_or_data (
Union[int,list,ndarray]) –Single bar: pass bar number (int) alongside start_node and end_node.
Multiple bars: pass a 2-D list or numpy array of shape (N, 3) where each row is [member_number, start_node, end_node].
start_node (
int|None) – Start node number. Only used when adding a single bar.end_node (
int|None) – End node number. Only used when adding a single bar.section_name (
Any|str) – Section name — must already exist in the model.material_name (
Any|str) – Material name — must already exist in the model.release_name (
Any|str) – Release name — must already exist in the model.tension_comp (
Any|str) – ‘tension’ for tension-only, ‘compression’ for compression-only.truss (
bool) – If True, sets the bar as a truss element (axial forces only).
- Return type:
None
Examples
Single member:
>>> model.add_member(1, 1, 2, section_name="HEA200")
Multiple members as a list:
>>> model.add_member([[1, 1, 2], [2, 2, 3], [3, 3, 4]], section_name="HEA200")
Multiple truss members as a NumPy array:
>>> import numpy as np >>> model.add_member(np.array([[1, 1, 2], [2, 2, 3]]), truss=True)
- add_contour(points, number=None)[source]¶
Adds a contour object to the model.
- Parameters:
points (
list[list[float,float,float]]) – List of points, each point to be list of coordinates x, y, znumber (
Any|int) – Number of the contour object, optional, if you specify number make sure it is free.
- Returns:
Number of the created contour.
- Return type:
int
- add_cladding(points, number=None, load_distribution='Two-way', dir_x=None, flip_z=False)[source]¶
Add a cladding object to the model.
- Parameters:
points (
list[list[float,float,float]]) – Contour vertices as a list of[index, x, y, z]rows.number (
Any|int) – Object number to assign. If omitted, the next free number is used. The caller is responsible for ensuring the number is not already taken.load_distribution (
str) –Load distribution mode. One of:
"Two-way"— isotropic distribution (default)"One-way X"— load carried in local X direction only"One-way Y"— load carried in local Y direction only
dir_x (
Union[tuple,list,ndarray,None]) –Cartesian direction vector
(x, y, z)for the cladding’s local X axis, expressed in global coordinates. The vector is normalised internally, so its magnitude does not matter.When omitted, Robot auto-computes the local X axis from the panel geometry (usually along the first edge of the contour).
This setting is relevant for one-way cladding (
"One-way X"/"One-way Y"), where the local X axis determines the span direction.flip_z (
bool) – IfTrue, reverses the panel’s local Z axis (i.e. flips the outward normal to the opposite face). Defaults toFalse.
- Raises:
ValueError – If
load_distributionis not one of the accepted strings.ValueError – If
dir_xis provided but is not a 3-element array or is a zero vector.
- Return type:
None
Examples
- Return type:
None- Parameters:
points (list[list[float, float, float]])
number (Any | int)
load_distribution (str)
dir_x (tuple | list | ndarray | None)
flip_z (bool)
Isotropic cladding with Robot’s default local axes:
>>> app.model.geometry.add_cladding(points, load_distribution="Two-way")
One-way cladding spanning in the global Y direction:
>>> app.model.geometry.add_cladding( ... points, ... load_distribution="One-way X", ... dir_x=(0.0, 1.0, 0.0), ... )
Cladding with flipped normal (load applied from below):
>>> app.model.geometry.add_cladding(points, flip_z=True)
- add_shell_by_contour(points, number=None, material_name=None, thickness=None, thickness_name=None)[source]¶
Adds a shell panel object to the model.
- Parameters:
points (
list[list[float,float,float]]) – List of points, each point to be list of coordinates x, y, znumber (
Any|int) – Number of the contour object, optional, if you specify number make sure it is free.matarial_name (str) – Material name
thickness (
Any|float) – Thickness, curently only constant thickness is supported. Currently only homogeneous thickness supported.TODO (support variable thickness eg. thicknessData.Type = I_THT_VARIABLE_ALONG_LINE, thicknessData.Thick1,)
thicknessData.Thick2
material_name (Any | str)
thickness_name (Any | str)
- Return type:
None
SupportEditor¶
- class pyrobotstructural.model.supports.SupportEditor(raw_app)[source]¶
Bases:
_BaseEditor- Parameters:
raw_app (Any)
- define_nodal_support(name, *, ux=0, uy=0, uz=0, rx=0, ry=0, rz=0, kx=0.0, ky=0.0, kz=0.0, hx=0.0, hy=0.0, hz=0.0, one_dir=None, alpha=0.0, beta=0.0, gamma=0.0)[source]¶
Create a nodal support label and store it in the model.
Supports three independent restraint mechanisms per DOF — rigid fixity, elastic spring, and one-directional (unilateral) blocking. They can be combined freely: e.g. a direction can be both elastically restrained and one-directional (tension-only spring).
- Parameters:
name (
str) – Label name for this support. Must be unique within the model.ux (
int) – Rigid restraint in X translation.0= free,1= fully fixed.uy (
int) – Rigid restraint in Y translation.uz (
int) – Rigid restraint in Z translation.rx (
int) – Rigid restraint about X axis.ry (
int) – Rigid restraint about Y axis.rz (
int) – Rigid restraint about Z axis.kx (
float) – Translational elastic spring stiffness in X [kN/m].0.0= not used.ky (
float) – Translational elastic spring stiffness in Y [kN/m].kz (
float) – Translational elastic spring stiffness in Z [kN/m].hx (
float) – Rotational elastic spring stiffness about X [kNm/rad].0.0= not used.hy (
float) – Rotational elastic spring stiffness about Y [kNm/rad].hz (
float) – Rotational elastic spring stiffness about Z [kNm/rad].one_dir (
Optional[dict[str,str]]) –One-directional (unilateral) blocking. Keys are DOF names (
"ux","uy","uz","rx","ry","rz"). Values are"+"/"plus"(resists positive displacement only) or"-"/"minus"(resists negative displacement only).Example:
one_dir={"uz": "-"} # compression-only foundation (resists downward)
alpha (
float) – Rotation of support local axes about global Z [rad].0.0= aligned with global axes.beta (
float) – Rotation of support local axes about global Y [rad].gamma (
float) – Rotation of support local axes about global X [rad].
- Raises:
ValueError – If
one_dircontains an unknown DOF key or direction string.- Return type:
None
Examples
Pinned support (UX, UY, UZ fixed, rotations free):
>>> app.model.supports.define_nodal_support("Pinned", ux=1, uy=1, uz=1)
Roller in Z with elastic spring in X (1000 kN/m):
>>> app.model.supports.define_nodal_support("SpringX", uz=1, kx=1000.0)
Compression-only (one-directional) support in Z:
>>> app.model.supports.define_nodal_support("CompOnly", one_dir={"uz": "-"})
Combined elastic + one-directional (tension-only spring in Z):
>>> app.model.supports.define_nodal_support( ... "TensionSpringZ", kz=5000.0, one_dir={"uz": "+"} ... )
- apply_support_to_edge(edge_name, support_name, edge_object=None)[source]¶
Apply a support label to an edge.
- Parameters:
edge_name (
str) – Edge string name, it must be whole name for example… TODO: finish this textsupport_name (
str) – Support name, assumes support existsedge_object (
Any) – Edge object can be optionally provided, make sure you provide IRobotObjEdge, edge_name will be ignored.
- Return type:
None
- apply_node_support(node_number, support_name)[source]¶
Apply a support condition to one or more nodes.
- Parameters:
node_number (
Union[int,list,ndarray]) – A single node number, or a 1-D list/array of node numbers.support_name (
str) – Support name — assumed to already exist in the model.
- Return type:
None
Examples
Single node:
>>> app.model.supports.apply_node_support(1, "Pinned")
Multiple nodes — list or numpy array:
>>> app.model.supports.apply_node_support([1, 2, 3], "Pinned") >>> app.model.supports.apply_node_support(np.array([1, 2, 3]), "Pinned")
SectionEditor¶
- class pyrobotstructural.model.sections.SectionEditor(raw_app)[source]¶
Bases:
_BaseEditor- Parameters:
raw_app (Any)
- create_tube_section(name, diameter, thickness, material)[source]¶
Creates custom tubular section.
- Parameters:
name (
str) – Name of the section.diameter (
float) – Diameter in metersthickness (
float) – Thickness in metersmaterial (
str) – Material name
- Return type:
None
- create_rect_section(name, height, width, material, thickness=None)[source]¶
Creates custom rectangle section, either solid or hollow (RHS).
- Parameters:
name (
str) – Name of the section.height (
float) – Height in millimeterswidth (
float) – Width in millimetersmaterial (
str) – Material namethickness (
float|None) – Wall thickness in millimeters. If None, a solid (filled) section is created. If provided, a hollow rectangular hollow section (RHS) is created with uniform wall thickness.
- Return type:
None
- apply_section_to_bar(bar_number, section_name)[source]¶
Applies section to a existing bar.
- Parameters:
bar_number (
int) – Bar numbersection_name (
str) – Section name, assume it exists
- Return type:
None
- load_from_database(database_name, section_name)[source]¶
Loads a section from database. Database must be added into Robot manually first, depending on regional settings Robot contains some default bases, eg. EURO, EC5, RUSER
- Parameters:
database_name (
str) – Database name it must exist in Robot filesection_name (
str) – Section name, assume it exists in given database
- Return type:
None
- add_database(database_name)[source]¶
Adds database of given name to the Robot project. It must be one of the databases which exist in Robot files. Go to: Job Preferences -> Databases -> Steel and Timber Sections -> Add new
- Parameters:
database_name (
str) – Database name it must exist in Robot databases.- Return type:
None
ReleaseEditor¶
- class pyrobotstructural.model.releases.ReleaseEditor(raw_app)[source]¶
Bases:
_BaseEditor- Parameters:
raw_app (Any)
- define_member_release(name, start_ux=0, start_uy=0, start_uz=0, start_rx=0, start_ry=0, start_rz=0, end_ux=0, end_uy=0, end_uz=0, end_rx=0, end_ry=0, end_rz=0)[source]¶
Creates a member stndard linear release of given properties. TODO: Add more options, there can be damping, nonlinearity, elastic spring
- Parameters:
name (
str) – Name of the release.start_ux (
int) – Start node release x axis, 0 - free, 1 - fixed.start_uy (
int) – Start node release y axis, 0 - free, 1 - fixed.start_uz (
int) – Start node release z axis, 0 - free, 1 - fixed.start_rx (
int) – Start node release around x axis, 0 - free, 1 - fixed.start_ry (
int) – Start node release around x axis, 0 - free, 1 - fixed.start_rz (
int) – Start node release around x axis, 0 - free, 1 - fixed.end_ux (
int) – End node release x axis, 0 - free, 1 - fixed.end_uy (
int) – End node release y axis, 0 - free, 1 - fixed.end_uz (
int) – End node release z axis, 0 - free, 1 - fixed.end_rx (
int) – End node release around x axis, 0 - free, 1 - fixed.end_ry (
int) – End node release around x axis, 0 - free, 1 - fixed.end_rz (
int) – End node release around x axis, 0 - free, 1 - fixed.
- Return type:
None
- add_release_to_member(bar_number, release_name)[source]¶
Adds relase to existing member.
- Parameters:
bar_number (
int) – Bar number.release_name (
str) – Release name
- Return type:
None
- define_linear_realease(name, ux=0, uy=0, uz=0, rx=0, kx=None, ky=None, kz=None, hx=None)[source]¶
Create a new linear release.
- Parameters:
name (
str) – Name of the releaseux (
int) – Release for x direction, if 1 then full release, if 2 then release in direction opposite to the local system on the panel edge. 3 then release in direction with local system on the panel edge.uy (
int) – Release for y direction, if 1 then full release, if 2 then release in direction opposite to the local system on the panel edge.uz (
int) – Release for y direction, if 1 then full release, if 2 then release in direction opposite to the local system on the panel edge. 3 then release in direction with local system on the panel edge.rx (
int) – Release for rotation around x axis, if 1 then full release, if 2 then release in direction opposite to the local system on the panel edge. 3 then release in direction with local system on the panel edge.kx (float, optional) – Elastic release value in direction x, if applied, then ux value is ignored.
kx – Elastic release value in direction y, if applied, then ux value is ignored.
kx – Elastic release value in direction z, if applied, then ux value is ignored.
hx (
float) – Elastic release for rotation around x axis, if applied, then ux value is ignored.ky (float)
kz (float)
- Return type:
None