Python API: loads and analysis¶
How to apply loads and set up the analysis in code: load cases, the loads themselves, analysis cases, combinations,
masses and spectra. Building the model is on Python API: building a model. The conventions that apply to
every call (signs, domains, create_* and add_*) are on Scripting with the engine.
The signatures on this page are written from the engine, so they are complete: every parameter, with its type and default. Python API: reference lists every call.
Every load belongs to a load case, so that comes first. A load case is only a definition of loads; an analysis case is what gets solved (see Analysis).
| To apply… | Shortcut | Fundamental |
|---|---|---|
| A load case | create_load_case |
add_load_case |
| A uniform load on a bar or a slab | create_uniform_load |
add_distributed_load, add_area_load, add_line_distributed_load |
| A trapezoidal or point load on a bar | create_bar_distributed_load, create_bar_point_load |
add_distributed_load, add_element_point_load |
| A load on a node or an edge | create_node_load, create_edge_load |
add_point_load, add_tri_edge_load, add_surface_edge_load |
| Self-weight, temperature, settlement | create_self_weight, create_temperature, create_support_settlement |
add_temperature_load and its relatives, add_support_settlement |
| An analysis case | create_analysis_case |
add_analysis_case |
| A combination, a nodal mass, a spectrum | add_load_combination, add_nodal_mass, add_spectral_function |
Load cases¶
Convenience call (create_*)¶
create_load_case(
id: str | None = None, self_weight_factor: float = 0.0, action_type=None,
create_analysis_case: bool = True) -> LoadCase
id optional — auto-assigned ("LC1", "LC2", …) when omitted.
action_type accepts the Eurocode letter ("G"/"Q"/"W"/"E"/"T"),
the word ("permanent"/"live"/"wind"/"seismic"/"temperature",
case-insensitive), or the old dashed label — whichever is written, the
stored value is always the letter. create_analysis_case=True also creates
a matching AnalysisCase with the same id (see Analysis cases below) so a new load case is solvable right away, without a
separate call.
Fundamental call¶
add_load_case(
id: str, self_weight_factor=0.0, action_type=None, create_analysis_case: bool = True,
load_duration=None, category: str = '', psi0=None, psi1=None, psi2=None) -> LoadCase
id required — what create_load_case above forwards to.
Bar and area loads¶
Convenience calls (create_*)¶
create_uniform_load(targets, load_case, value, direction: str = 'down', coord_sys: str = 'global')
create_bar_distributed_load(
elements, load_case=None, q_i: float = None, q_j: float = None, direction: str = 'down')
# trapezoidal; bars only
create_bar_point_load(
elements, load_case=None, p: float = None, at: float = 0.5, direction: str = 'down')
# bars only; at = fraction of the span
create_uniform_load is the one to use for a constant load. value is a force per length [kN/m] on a bar-like target (a bar, or a
geometry line, segment, multisegment or arc) and a pressure [kN/m²] on an area-like target (a slab region, a triangle or a quad), and
the call routes each target by its own kind, so one call may mix both. It checks every target before applying anything, so it either
applies everything or raises. It returns a dictionary from each target id to 'bar' or 'area'.
direction is "down" or "up" (the gravity axis: −Y in a plane model, −Z in a plate model) for both kinds, or "perp" and "axial"
(local axes, bars only, plane domain). coord_sys ("global" or "local") only matters for bars.
targets and elements take a single id or object, or a list of either (a list in gives a list out). load_case is the load case, as an
id or a LoadCase; where it is optional, leaving it out uses a default case that is created on first use. create_bar_distributed_load only
takes "down" and "up".
Fundamental calls¶
add_distributed_load(
element_id: str, load_case_id: str, fxe=0.0, fxd=0.0, fye=0.0, fyd=0.0, coord_sys='global',
fze=None, fzd=None) -> DistributedLoad
add_element_point_load(
element_id: str, load_case_id: str, a: float, fx=0.0, fy=0.0, mz=0.0, coord_sys='global',
fz=None) -> ElementPointLoad
add_area_load(target_id: str, load_case_id: str, pz: float = 0.0)
# slab pressure (plate); a surface object, a triangle id or a quad id
add_line_distributed_load(
object_id: str, load_case_id: str, fx=0.0, fy=0.0, fx_field='', fy_field='',
coord_sys='global') -> LineDistributedLoad
Signed components (fx, fy, …) in a chosen frame (coord_sys), not a named direction: what the shortcuts above forward to. Reach for
these directly for a load the shortcuts cannot express, such as a trapezoidal axial load or a point load in a local frame with both fx and fy.
Negative pz is downward; a new area load replaces an existing one on the same target and case.
Node and edge loads¶
Convenience calls (create_*)¶
create_node_load(nodes, load_case=None, p: float = None, direction: str = 'down')
create_edge_load(object_id: str, edge, load_case=None, p: float = None, direction: str = 'perp')
create_node_load direction: "down"/"up" (both domains — plane: global
∓Y; plate: transverse, ∓Z). "left"/"right" (global ∓X) are plane
domain only. create_edge_load's edge: 'all' | 'bottom'/'right'/
'top'/'left' | an integer index — same vocabulary as support_edge.
direction: "perp" (outward normal) or "tang" (along the edge, sign
follows the edge's own winding, not a global direction — for a rectangle,
'top' is −X, not +X; use create_node_load on the corner node for an
unambiguous global push instead of guessing "tang"'s sign).
Fundamental calls¶
add_point_load(
node_id: str, load_case_id: str, fx=0.0, fy=0.0, mz=0.0, fz=None, mx=None,
my=None) -> PointLoad
add_tri_edge_load(
id: str, tri_id: str, node_a: str, node_b: str, load_case_id: str, fx: float = 0.0,
fy: float = 0.0, coord_sys: str = 'global', pn: float = 0.0, pt: float = 0.0) -> TriEdgeLoad
add_surface_edge_load(
id: str, object_id: str, node_a: str, node_b: str, load_case_id: str, fx: float = 0.0,
fy: float = 0.0, coord_sys: str = 'global', pn: float = 0.0, pt: float = 0.0)
add_point_load is the only way to put a moment (mz/mx/my) or an
in-plane force on a plate node — what neither create_node_load nor
create_uniform_load can express. add_tri_edge_load addresses an
already-meshed triangle's edge (post-solve ids); create_edge_load above
works pre-mesh, on the geometry object itself.
Self-weight, temperature and settlement¶
Convenience calls (create_*)¶
create_self_weight(factor: float = 1.0, load_case=None) -> LoadCase
# sets/creates self_weight_factor
create_temperature(target, uniform: float = 0.0, gradient: float = 0.0, load_case=None)
create_support_settlement(
nodes: str | Node | list, load_case=None, ux=0.0, uy=0.0, tz=0.0, w=None, tx=None, ty=None)
create_temperature dispatches by target type: bar → add_temperature_load,
triangle → add_tri_temperature_load, quad → add_quad_temperature_load,
geo line object → add_line_temperature_load, geo area object →
add_area_temperature_load. It only takes a single uniform/gradient
value, never a field: add_area_temperature_load/add_line_temperature_load
below are the ones that accept field_name/grad_field_name for a ΔT that
varies spatially (sampled per generated mesh node/bar); use them directly
for that case, the same way create_bar_distributed_load above is the one
to reach for when create_uniform_load's "down"/"up"-only
direction is not enough. create_support_settlement's nodes: a single
id/Node, or a list of either; w/tx/ty are the plate-domain aliases of
ux/uy/tz.
Fundamental calls¶
add_temperature_load(
bar_id: str | None = None, load_case_id: str | None = None, dt_uniform=0.0, dt_gradient=0.0,
alpha=None, *, element_id: str | None = None, delta_t_uniform: float | None = None,
delta_t_gradient: float | None = None) -> TemperatureLoad
# bars — alpha: accepted, no effect (see below)
add_tri_temperature_load(
tri_id: str, load_case_id: str, dt_i=0.0, dt_j=0.0, dt_k=0.0,
dt_gradient=0.0) -> TriTemperatureLoad
# triangles
add_quad_temperature_load(
quad_id: str, load_case_id: str, dt_i=0.0, dt_j=0.0, dt_k=0.0, dt_l=0.0,
dt_gradient=0.0) -> QuadTemperatureLoad
# quads
add_area_temperature_load(
object_id: str, load_case_id: str, dt_uniform=0.0, dt_gradient=0.0, field_name='',
grad_field_name='') -> AreaTemperatureLoad
add_line_temperature_load(
object_id: str, load_case_id: str, dt_uniform=0.0, dt_gradient=0.0, field_name='',
grad_field_name='') -> LineTemperatureLoad
add_support_settlement(
node_id: str, load_case_id: str, ux=0.0, uy=0.0, tz=0.0, w=None, tx=None,
ty=None) -> SupportSettlement
bar_id/dt_uniform/dt_gradient are the canonical names for
add_temperature_load now — matching tri_id/quad_id and
dt_uniform/dt_gradient elsewhere in the temperature-load family, instead
of the bar's old generic element_id and delta_t_uniform/
delta_t_gradient. The old element_id=/delta_t_uniform=/
delta_t_gradient= keywords still work (same pattern as tri_section_name=
above); the stored TemperatureLoad attributes and the .x2d field keep
the names element_id/delta_t_uniform/delta_t_gradient.
alpha is a different thing from a deprecated alias — it is accepted but
has no effect at all. Unlike the keywords above (each still sets the value
it names, just under an old spelling), passing alpha to
add_temperature_load changes nothing: the thermal expansion coefficient
always comes from the element's material (Material.alpha) at analysis
time. The parameter exists only so old call sites that already pass alpha
keep working: TemperatureLoad has nowhere to store it.
Analysis cases, combinations and dynamics¶
AnalysisCase controls how a model is solved (linear, modal, spectrum, …). It is a different concept from a LoadCase, which only says what loads exist; the two only share the word "case".
Analysis case: convenience call¶
create_analysis_case(
id: str | None = None, analysis_type: str = 'Linear', coefficients: dict | None = None,
**kwargs) -> AnalysisCase
id optional — auto-assigned ("AC1", "AC2", …) when omitted.
create_load_case's create_analysis_case=True (see Load cases above)
already creates one of these with a matching id for the common case; call
this directly only for a case that needs a different id or a non-default
analysis_type.
Analysis case, fundamental¶
add_analysis_case(
id: str, analysis_type: str = 'Linear', coefficients: dict | None = None,
**kwargs) -> AnalysisCase
# analysis_type: Linear | NonLinear | Mass | Modal | Spectrum | GeometricNonlinear
id required — what create_analysis_case above forwards to.
Combinations, masses and spectra¶
add_load_combination(
id: str, coefficients: dict[str, float], combo_type='LinearSum') -> LoadCombination
add_nodal_mass(
node_id: str, mass_case_id: str, mx: float = 0.0, my: float = 0.0,
mtz: float = 0.0) -> NodalMass
add_spectral_function(
id: str, description: str = '', damping: float = 0.05,
points: list | None = None) -> SpectralFunction
No create_* layer for these three — no auto-id convenience has been
needed for them yet.