Python API: reference¶
Every public call of Structure2D, with its complete signature: every parameter, its type and its default. The guide pages
(building a model, loads and analysis,
results and design) explain how to use them; this page is the list. Under each signature is the
first sentence of its docstring; help(Structure2D.name) in Python shows the rest.
create_*: shortcuts¶
create_analysis_case(
id: str | None = None, analysis_type: str = 'Linear', coefficients: dict | None = None,
**kwargs) -> AnalysisCase
# Like add_analysis_case; id optional (auto AC1, AC2, ...); an existing name (any case) is returned unchanged, not duplicated.
create_area_element(
section: str | TriSection | QuadSection, node_i: str | Node, node_j: str | Node,
node_k: str | Node, node_l: str | Node | None = None, id: str | None = None,
**kw) -> TriElement | QuadElement
# Like add_area_element: id optional; nodes/section take id or object.
create_area_section(
name: str, material_name: str | Material, thickness: float = 0.2, **kw) -> TriSection
# Domain-aware area section pair: plane -> CST/QM6 defaults, plate -> MITC3/MITC4 defaults (add_area_section — a TriSection AND a QuadSection under this name, so create_area_element resolves the section whichever shape it ends up building).
create_bar_distributed_load(
elements, load_case=None, q_i: float = None, q_j: float = None, direction: str = 'down')
# Trapezoidal bar load — ``q_i``/``q_j`` at each end [kN/m].
create_bar_element(
section: str | Section, node_i: str | Node, node_j: str | Node, id: str | None = None,
**kw) -> BarElement
# Like add_bar_element: id optional; nodes/section take id or object, section first.
create_bar_point_load(
elements, load_case=None, p: float = None, at: float = 0.5, direction: str = 'down')
# Concentrated load on a bar at a fraction of its span, bars only.
create_bar_section(name: str, material_name: str | Material, b: float, h: float, **kw) -> Section
# Like add_section, but material_name may be an unresolved Eurocode class (e.g.
create_edge_load(object_id: str, edge, load_case=None, p: float = None, direction: str = 'perp')
# Distributed load along one edge — ``p`` [kN/m].
create_from_template(kind: str, **params) -> Structure2D
# A standard structure in one call, on an EMPTY model.
create_load_case(
id: str | None = None, self_weight_factor: float = 0.0, action_type=None,
create_analysis_case: bool = True) -> LoadCase
# Like add_load_case: id optional, auto ("LC1", "LC2", ...).
create_load_combination(
id: str, coefficients: dict[str, float], combo_type='LinearSum') -> LoadCombination
# Like add_load_combination, but a name matching an existing combination (any capitalisation) is returned unchanged instead of raising.
create_material(
name: str, elastic_modulus: float, unit_weight: float, alpha: float = 1e-05, unit_mass=None,
material_type=None, design=None, poisson: float = 0.2) -> Material
create_node(x: float, y: float, id: str | None = None) -> Node
# Like add_node: id optional, auto ("N1", "N2", ...).
create_node_list(outline, id_prefix: str | None = None) -> list[Node]
# One node per point in outline (flexible point-list forms — see ``_compat.as_points``: pairs, flat list, dicts, or two columns).
create_node_load(nodes, load_case=None, p: float = None, direction: str = 'down')
# Concentrated load at a node, magnitude ``p`` [kN].
create_panel(
outline, thickness: float, material: str = 'C30/37', target_size: float = 0.5,
id: str | None = None)
# RC polygon (region + section) in one call — keep the return: ``.node_ids`` are real corner nodes (rectangle CCW: bottom-left, bottom-right, top-right, top-left), for e.g.
create_polygon(
outline, thickness: float, material: str = 'C30/37', target_size: float = 0.5,
id: str | None = None)
# RC polygon (region + section) in one call — keep the return: ``.node_ids`` are real corner nodes (rectangle CCW: bottom-left, bottom-right, top-right, top-left), for e.g.
create_rc_material(
concrete: str = 'C30/37', steel: str = 'B500B', name: str | None = None) -> Material
# Get-or-create a Concrete Material carrying fck/fyk from the Eurocode tables.
create_rc_section(
name: str, b: float, h: float, concrete: str = 'C30/37', steel: str = 'B500B',
cover: float = 0.045) -> Section
# RC rect.
create_self_weight(factor: float = 1.0, load_case=None) -> LoadCase
# Set/create self-weight factor.
create_steel_material(steel: str = 'S275', name: str | None = None) -> Material
# Get-or-create a Steel Material carrying fy/fu from the Eurocode tables (same naming scheme create_steel_section uses: "S_<grade>").
create_steel_section(name: str, profile: str, grade: str = 'S275') -> Section
# Steel section from a catalogue profile + material.
create_support(
nodes: str | Node | list, ux=False, uy=False, tz=False, w=None, tx=None, ty=None,
name: str | None = None)
# Create+assign a support.
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)
# Like add_support_settlement: load_case optional, nodes single ref or list.
create_temperature(target, uniform: float = 0.0, gradient: float = 0.0, load_case=None)
# Temperature action, any target — dispatches by type.
create_timber_bar_section(
name: str, b: float, h: float, timber: str = 'C24', service_class: str = 'SC1') -> Section
# Create a timber rectangular section (and its material) in one call.
create_timber_material(timber: str = 'C24', name: str | None = None) -> Material
# Get-or-create a Timber Material carrying fmk/fvk/fc0k/ft0k from the Eurocode (EN 338) tables.
create_uniform_load(targets, load_case, value, direction: str = 'down', coord_sys: str = 'global')
# Uniform load of ``value``, on bar-like targets [kN/m] or area-like targets [kN/m²] (pressure — dispatched per target's actual kind, may mix both in one call).
add_*: fundamental calls¶
add_analysis_case(
id: str, analysis_type: str = 'Linear', coefficients: dict | None = None,
**kwargs) -> AnalysisCase
# Add an analysis case.
add_area_element(
id: str, node_i: str, node_j: str, node_k: str, node_l: str | None = None, *,
section_name: str) -> TriElement | QuadElement
# 3 nodes -> add_tri_element, 4 (node_l given) -> add_quad_element.
add_area_load(target_id: str, load_case_id: str, pz: float = 0.0)
# Uniform transverse pressure pz [kN/m²] on a slab — plate domain.
add_area_section(
name: str, material_name: str, thickness: float = 0.1, plane_strain: bool = False,
formulation: str = 'CST', quad_formulation: str = 'QM6', rc_cover: float = 0.045,
rc_alpha_s: float = 90.0, rc_bar_phi: float = 16.0, rc_shear_min: bool = True,
rc_cover_top_x: float = None, rc_cover_top_y: float = None, rc_cover_bot_x: float = None,
rc_cover_bot_y: float = None) -> TriSection
# Creates a same-named TriSection + QuadSection pair.
add_area_spring(target_id: str, kz: float = 0.0)
# Attach a Winkler (elastic-foundation) area spring — plate domain.
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 a temperature to an area object (rectangle / surface), applied to the triangles it meshes into.
add_bar_element(
id: str, node_i: str, node_j: str, section_name: str, hinge_i=False, hinge_j=False,
rc_design=False, rc_cover=0.025, rc_cotg_theta=1.0, rc_alpha_s=90.0, sd_ky=None, sd_kz=None,
sd_klt=None, sd_ltb=True, stage: int = 1, is_column: Optional[bool] = None,
beam: Optional[str] = None) -> BarElement
add_concrete_material(
material_name: str, concrete_class: str, steel_class: str, gamma_c=1.5, gamma_s=1.15,
alpha_cc=1.0) -> ConcreteMaterial
# Link EC2 concrete/steel properties to an existing material for RC design.
add_constraint_equation(terms, value: float = 0.0, id: str = '') -> Constraint
# Add a raw linear constraint ``sum(coef * dof) = value``.
add_construction_sequence(sequence) -> object
add_cut(id: str, x1: float, y1: float, x2: float, y2: float, name: str = '') -> Cut
# Create a user-defined section cut, a segment ``(x1,y1)->(x2,y2)`` used to report resultants of internal forces crossing it (see dev/CUT_PLAN.md).
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
# Trapezoidal distributed load, given at BOTH ends.
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 a concentrated load on an element at distance ``a`` from node i.
add_element_spring(
element_id: str, kx=0.0, ky=0.0, coord_sys='global', mode_x='both',
mode_y='both') -> ElementSpring
# Attach a foundation spring directly to an element (replaces any existing one).
add_equal_dof(nodes, components, id: str = '') -> Constraint
# Constrain every node in *nodes* to share the same value of each component in *components* (e.g.
add_field(name: str, expression: str = '0.0')
add_geo_arc(
id: str, cx: float, cy: float, radius: float, start_angle: float, end_angle: float,
section_name: str = '', divisions: int = 16, max_chord: float = 0.0) -> GeoArc
# Add an arc given centre/radius/angles (converted to 3 points).
add_geo_arc_3pts(
id: str, p1, pm, p2, section_name: str = '', divisions: int = 16,
max_chord: float = 0.0) -> GeoArc
# Add an arc through three points (start, mid, end).
add_geo_line(
id: str, x1: float, y1: float, x2: float, y2: float, section_name: str = '',
divisions: int = 1, max_chord: float = 0.0) -> GeoSegment
add_geo_multisegment(
id: str, vertices, closed: bool = False, section_name: str = '', divisions: int = 1,
max_chord: float = 0.0, span_divisions: list | None = None) -> GeoMultisegment
# ``span_divisions`` (optional): one division count per span instead of sharing ``divisions`` across the whole curve — see :class:`~xdfem2d.models.GeoMultisegment`'s docstring.
add_geo_polygon(
id: str, vertices, section_name: str = '', target_size: float = 0.5, prefer_quad: bool = True,
*, tri_section_name: str | None = None) -> GeoPolygon
# Closed-polygon region through *vertices* (meshed into DKT/CST triangles, or quads — see GeoRectangle.prefer_quad's docstring, dev/IMPLEMENT_QUAD.md Phase 8).
add_geo_polyline(
id: str, vertices, closed: bool = False, section_name: str = '', divisions: int = 1,
max_chord: float = 0.0, span_divisions: list | None = None) -> GeoMultisegment
# ``span_divisions`` (optional): one division count per span instead of sharing ``divisions`` across the whole curve — see :class:`~xdfem2d.models.GeoMultisegment`'s docstring.
add_geo_rectangle(
id: str, corner_a, corner_c, section_name: str = '', target_size: float = 0.5,
prefer_quad: bool = True, *, tri_section_name: str | None = None) -> GeoRectangle
# Axis-aligned rectangle from two opposite corner points (meshed into CST triangles at solve time, or quads — see GeoRectangle.prefer_quad's docstring, dev/IMPLEMENT_QUAD.md Phase 8).
add_geo_segment(
id: str, x1: float, y1: float, x2: float, y2: float, section_name: str = '',
divisions: int = 1, max_chord: float = 0.0) -> GeoSegment
add_geo_surface(
id: str, vertices, section_name: str = '', target_size: float = 0.5, prefer_quad: bool = True,
*, tri_section_name: str | None = None) -> GeoPolygon
# Closed-polygon region through *vertices* (meshed into DKT/CST triangles, or quads — see GeoRectangle.prefer_quad's docstring, dev/IMPLEMENT_QUAD.md Phase 8).
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
# Add a distributed load to a line object (line / arc / polyline).
add_line_element_spring(
object_id: str, kx=0.0, ky=0.0, kx_field='', ky_field='', coord_sys='global', mode_x='both',
mode_y='both') -> LineElementSpring
# Attach a foundation spring to a line object (line / arc / polyline).
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 a temperature to a line object (line / arc / polyline).
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
add_load_combination(
id: str, coefficients: dict[str, float], combo_type='LinearSum') -> LoadCombination
# Create a load combination.
add_material(
name: str, elastic_modulus: float, unit_weight: float, alpha: float = 1e-05, unit_mass=None,
material_type=None, design=None, poisson: float = 0.2) -> Material
add_nodal_mass(
node_id: str, mass_case_id: str, mx: float = 0.0, my: float = 0.0,
mtz: float = 0.0) -> NodalMass
# Add (or replace) a concentrated nodal mass for a specific Mass analysis case.
add_node(id: str, x: float, y: float) -> Node
add_node_spring(
node_id: str, kx=0.0, ky=0.0, kt=0.0, mode_x='both', mode_y='both', kz=None, ktx=None,
kty=None) -> NodeSpring
# Attach a spring directly to a node (replaces any existing spring on that node).
add_panel(
outline, thickness: float, material: str = 'C30/37', target_size: float = 0.5,
id: str | None = None)
# RC polygon (region + section) in one call — keep the return: ``.node_ids`` are real corner nodes (rectangle CCW: bottom-left, bottom-right, top-right, top-left), for e.g.
add_plate_section(
name: str, material_name: str, thickness: float = 0.2, formulation: str = 'MITC3',
**kw) -> TriSection
# Sugar for a plate-bending triangle section — plate domain.
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
# Nodal concentrated load.
add_punch_column(
id: str, node_id: str, shape: str = 'rectangular', bx: float = 0.3, by: float = 0.3,
position: str = 'center', force: float = None, dx: float = 0.0, dy: float = 0.0,
beta_min: float = 1.0)
# Define a column / concentrated support for the EC2 §6.4 punching check (plate domain).
add_quad_edge_load(
id: str, quad_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) -> QuadEdgeLoad
# Uniform load on one edge of a quad element — the 4-node analogue of :meth:`add_tri_edge_load`.
add_quad_element(
id: str, node_i: str, node_j: str, node_k: str, node_l: str, section_name: str) -> QuadElement
# Define a 4-node quadrilateral element, the analogue of :meth:`add_tri_element` (dev/IMPLEMENT_QUAD.md Phase 3).
add_quad_section(
name: str, material_name: str, thickness: float = 0.1, plane_strain: bool = False,
formulation: str = 'MITC4', rc_cover: float = 0.045, rc_alpha_s: float = 90.0,
rc_bar_phi: float = 16.0, rc_shear_min: bool = True, rc_cover_top_x: float = None,
rc_cover_top_y: float = None, rc_cover_bot_x: float = None,
rc_cover_bot_y: float = None) -> QuadSection
# Define a quadrilateral section (dev/IMPLEMENT_QUAD.md Phase 3) — the 4-node analogue of :meth:`add_tri_section`.
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
# Add a thermal load to a quad: an in-plane ΔT per node (plane domain) or a through-thickness ``dt_gradient`` T_top − T_bottom [°C] that bends DKT4/MITC4 (plate domain).
add_rc_section(
name: str, b: float, h: float, concrete: str = 'C30/37', steel: str = 'B500B',
cover: float = 0.045) -> Section
# RC rect.
add_rigid_link(master: str, slaves, id: str = '') -> Constraint
# Tie *slaves* to *master* as a single rigid body (in-plane): each slave follows the master's two translations and rotation through the rigid-body kinematics evaluated from the nodal coordinates.
add_section(
name: str, material_name: str, b: float, h: float, area_override=None, inertia_override=None,
profile_name=None, section_type=None, rc_cover=0.045, rc_alpha_s=90.0, rc_bar_phi=16.0,
shape=None, tw=0.0, tf=0.0, rc_shear_min=True, torsion_override=None, angle=0.0,
inertia_minor_override=None, wel_y_override=None, wpl_y_override=None, wel_z_override=None,
wpl_z_override=None, av_y_override=None, av_z_override=None, warping_override=None,
wt_override=None, curve_y_override=None, curve_z_override=None, timber_service_class='SC1',
is_column: bool = False, rc_phi_ef: float = 2.0, rc_n_bars: int = 4, rc_n_bars_y: int = 2,
rc_n_bars_z: int = 2, rc_second_order_method: str = 'nominal_curvature',
rc_torsion_distribution: str = 'top_bottom', beam_overrides: Optional[dict] = None) -> Section
add_spectral_function(
id: str, description: str = '', damping: float = 0.05,
points: list | None = None) -> SpectralFunction
add_steel_section(name: str, profile: str, grade: str = 'S275') -> Section
# Steel section from a catalogue profile + material.
add_support(name: str, ux=False, uy=False, tz=False, w=None, tx=None, ty=None) -> Support
# Define a named set of restraints.
add_support_set(support_set) -> object
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
# Prescribe a non-zero displacement at a supported node.
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)
# Edge load on a boundary side (node_a→node_b) of a surface object.
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
# Add a thermal load to a bar.
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_tri_element(id: str, node_i: str, node_j: str, node_k: str, section_name: str) -> TriElement
add_tri_section(
name: str, material_name: str, thickness: float = 0.1, plane_strain: bool = False,
formulation: str = 'CST', rc_cover: float = 0.045, rc_alpha_s: float = 90.0,
rc_bar_phi: float = 16.0, rc_shear_min: bool = True, rc_cover_top_x: float = None,
rc_cover_top_y: float = None, rc_cover_bot_x: float = None,
rc_cover_bot_y: float = None) -> TriSection
# Define a triangle section.
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
# Add a thermal load to a triangle: an in-plane ΔT per node (plane domain) or a through-thickness ``dt_gradient`` T_top − T_bottom [°C] that bends the DKT (plate domain).
add_variant(variant) -> object
remove_*¶
remove_analysis_case(case_id: str)
remove_area_element(eid: str) -> bool
# Remove the area element *eid* whatever its kind.
remove_area_load(target_id: str, load_case_id: str = '')
# Remove area loads on *target_id* (all cases, or one case).
remove_area_section(name: str)
# Removes both halves of a paired area section.
remove_area_spring(target_id: str)
# Remove any Winkler area spring on *target_id* (surface, triangle, or quad).
remove_area_temperature_load(object_id: str, load_case_id: str = '')
# Remove area temperature loads on *object_id* (all cases, or one).
remove_constraint(id: str) -> None
remove_construction_sequence(seq_id: str)
remove_cut(cut_id: str)
remove_distributed_loads(element_id: str, load_case_id: str = '')
# Remove distributed loads on *element_id* (all cases, or one).
remove_element(element_id: str)
remove_element_spring(element_id: str)
# Remove the foundation spring on *element_id* (the inverse of :meth:`add_element_spring`).
remove_field(name: str)
remove_geo_object(id: str)
remove_line_element_spring(object_id: str)
# Remove the line spring on *object_id* (the inverse of :meth:`add_line_element_spring`).
remove_line_temperature_load(object_id: str, load_case_id: str = '')
# Remove line temperature loads on *object_id* (all cases, or one).
remove_load_case(case_id: str)
remove_load_combination(combo_id: str)
remove_material(name: str)
# Remove a material.
remove_nodal_mass(node_id: str, mass_case_id: str)
remove_node(node_id: str)
# Remove a node with everything that hangs on it: its supports, springs, loads, settlements, masses, constraints and the elements that use it (see references.SITES).
remove_node_spring(node_id: str)
remove_point_loads(node_id: str, load_case_id: str = '')
# Remove point loads on *node_id* (all cases, or one).
remove_punch_column(id: str)
# Remove the punching column with the given id.
remove_quad_edge_load(id: str)
remove_quad_element(id: str)
remove_quad_section(name: str)
remove_quad_temperature_load(quad_id: str, load_case_id: str = '')
# Remove quad temperature loads on *quad_id* (all cases, or one).
remove_section(name: str)
# Remove a bar section.
remove_spectral_function(id: str)
remove_support(name: str)
remove_support_assignment(node_id: str, support_name: str = '')
# Remove the support on a node — the by-node inverse of :meth:`assign_support`.
remove_support_set(set_id: str)
remove_surface_edge_load(id: str)
remove_temperature_load(element_id: str, load_case_id: str = '')
# Remove bar temperature loads on *element_id* (all cases, or one).
remove_tri_edge_load(id: str)
remove_tri_element(id: str)
remove_tri_section(name: str)
remove_tri_temperature_load(tri_id: str, load_case_id: str = '')
# Remove triangle temperature loads on *tri_id* (all cases, or one).
remove_variant(variant_id: str)
rename_*¶
rename_analysis_case(old_id: str, new_id: str)
rename_area_section(old: str, new: str)
# Renames both halves of a paired area section together.
rename_bar_element(old_id: str, new_id: str)
rename_cut(old_id: str, new_id: str)
rename_load_case(old_id: str, new_id: str)
rename_load_combination(old_id: str, new_id: str)
rename_material(old: str, new: str)
# Rename a material, and every section / concrete link that names it.
rename_node(old_id: str, new_id: str)
rename_quad_element(old_id: str, new_id: str)
# Rename a quad, carrying its temperature loads along — the quad counterpart of :meth:`rename_tri_element`.
rename_quad_section(old: str, new: str)
# The quad counterpart of :meth:`rename_tri_section` (added dev/IMPLEMENT_QUAD.md Phase 8, GUI item 2 — the QuadSection manager panel mirrors TriSectionPanel's rename-on-name-change edit flow, and that flow needs this to exist).
rename_section(old: str, new: str)
# Rename a bar section, and every bar / line object that uses it.
rename_support_set(old: str, new: str)
# Give a support set another id; the phases and operations that use it follow.
rename_tri_element(old_id: str, new_id: str)
# Rename a CST triangle, carrying its temperature/edge loads along — the triangle counterpart of :meth:`rename_bar_element`.
rename_tri_section(old: str, new: str)
delete_*: forgiving removal¶
delete_area(object_id: str)
# Delete a region/line object and the nodes it owns that nothing else uses — the inverse of :meth:`create_polygon`/``add_geo_*``.
delete_load(target: str, load_case_id: str = '')
# Remove loads on *target* — the inverse of the ``create_*_load`` family.
delete_spring(target: str)
# Remove the spring on *target* — the inverse of the ``add_*_spring`` family.
delete_support(nodes)
# Remove the support from a node or nodes — the inverse of :meth:`pin`/:meth:`fix`/:meth:`roller`/:meth:`symm`/ :meth:`create_support`.
delete_temperature(target: str, load_case_id: str = '')
# Remove temperature loads on *target* — the inverse of :meth:`create_temperature` (and the ``add_*_temperature_load`` family).
Everything else¶
apply_support_set(support_set) -> None
# Change the supports and springs by *support_set*, on top of the ones there are: a node the set lists takes its restraint (none ticked: no support), the others keep theirs.
area_element_by_id(eid: str)
# The tri or quad element with id *eid*, or ``None``.
area_element_ids() -> list[str]
# Ids of every area element (triangles then quads).
area_elements()
# Every area element (triangles then quads), in a single iterable.
area_kind_of(eid: str)
# ``'tri'``, ``'quad'`` or ``None`` for element id *eid*.
assign_beam(bar_ids=(), tag: Optional[str] = None, name: Optional[str] = None, object_ids=()) -> str
# Tag *bar_ids* (and line objects *object_ids*) as one beam (a new free ``V<n>`` when *tag* is None) and register it.
assign_support(node_id: str, support_name: str) -> SupportAssignment
# Put a support defined by :meth:`add_support` on a node.
calculate() -> dict
# Run the full analysis and return a results dictionary.
check_references()
# Raise ``ValueError`` if the model carries any dangling reference.
clear_beam(bar_ids=(), object_ids=())
# Remove the beam tag from *bar_ids* / line objects *object_ids* (they become auto-detected).
derive_variant(variant, support_set=None, filter_tri: bool = False) -> Structure2D
# Return a NEW Structure2D representing *variant* — a pure transform.
domain_problems() -> list[str]
# Features the model uses that its analysis domain ('plane' or 'plate') does not support.
element_count() -> int
# Total finite elements: bars + triangles + quads.
expand_combination_coefficients(combo) -> dict[str, float]
# Resolve *combo* to a flat ``{analysis_case_id: factor}`` map, expanding any referenced sub-combinations recursively.
field_node_values(name: str) -> dict
# {node_id: f(x, y)} for the named field, evaluated at each node.
fix(nodes: str | Node | list)
# Fixed (encastré): restrains everything.
fix_edge(object_id: str, edge)
# Fully restrain an edge — encastré (the edge counterpart of :meth:`fix`).
free_edge(object_id: str, edge)
# Free an edge of an area object — the inverse of :meth:`support_edge`/ :meth:`pin_edge`/:meth:`fix_edge`.
has_elements() -> bool
# True when the model has at least one bar, triangle or quad.
iter_area_edge_loads()
# Yield (kind, load) for every edge load — per-triangle, per-quad and per-surface-object — with *kind* in {'tri', 'quad', 'surface'}.
iter_area_elements()
# Yield (id, kind, element) for every area element — triangles then quads — with *kind* in {'tri', 'quad'}.
iter_area_loads()
# Yield (kind, load) for every transverse area pressure — per-triangle, per-quad and per-surface-object — with *kind* in {'tri', 'quad', 'area'}.
iter_area_temperature_loads()
# Yield (kind, load) for every area temperature load — per-triangle, per-quad and per-object — with *kind* in {'tri', 'quad', 'area'}.
load(path: str) -> Structure2D
# Load structure from JSON (.json).
materialize_object_nodes(obj, pts, tol: float = 1e-06)
# Create/reposition the real nodes at the target defining points *pts*, storing their ids on ``obj.node_ids``.
next_beam_tag() -> str
# A free ``V<n>`` tag.
normalize_combinations_to_analysis_cases()
# Ensure every combination references analysis cases only.
object_defining_points(obj) -> list
# Current (x, y) of the object's defining nodes (read from the nodes, since objects are node-driven).
pin(nodes: str | Node | list)
# Pinned support (create+assign in one call): translation fixed, rotation free.
pin_edge(object_id: str, edge)
# Simply support an edge of a surface object (the edge counterpart of :meth:`pin`).
prune_beams()
# Drop registry entries with no bar left, unless they carry a name or overrides / timber parameters the user set (those survive an empty beam).
prune_unused_supports(only: set | None = None) -> list
# Drop support definitions no node uses.
purge_dangling_references() -> list[str]
# Remove the loads, springs and other entries that refer to something that no longer exists (see :func:`xdfem2d.references.purge`).
quad_section_of(quad: QuadElement) -> QuadSection | None
# The QuadSection referenced by *quad* (or None if missing).
reference_problems() -> list[str]
# Return a list of dangling cross-references (case, load, material, section, support, spring), each as a readable ``'A → B'`` line.
roller(nodes: str | Node | list, free: str = 'x')
# Roller (plane only).
roller_edge(object_id: str, edge, free: str = 'x')
# Roller along an edge (plane only; the edge counterpart of :meth:`roller`).
save(path: str)
# Save the model as JSON.
set_domain(domain: str) -> dict
# Change the domain of a model with no geometry yet.
solve() -> dict
# Run the full analysis and return a results dictionary.
stiffness_hash() -> str
# Deterministic hash of the *effective stiffness* of this structure.
support_edge(object_id: str, edge, kind: str = 'pin')
# Support an edge of an area object — the general edge-support call.
support_for(ux=False, uy=False, tz=False) -> str | None
# The name of a support with these restraints, reusing or creating one.
support_object_edge(object_id: str, edge, support_name: str)
# Restrain one edge (or ``'all'``) of a surface object with a named support, written onto the object's per-edge ``edge_supports`` list.
symm(nodes: str | Node | list, axis: str = 'x')
# Symmetry (plate only): ``w`` free, rotation restrained (``axis="x"``→θx, ``"y"``→θy).
symm_edge(object_id: str, edge, axis: str = 'x')
# Symmetry line along an edge (plate only; the edge counterpart of :meth:`symm`): w free, a rotation restrained (``axis='x'``->θx, ``'y'``->θy).
tri_section_of(tri: TriElement) -> TriSection | None
# The TriSection referenced by *tri* (or None if missing).
twin_analysis_case_id(load_case_id: str) -> str
# Return the id of the Linear analysis case that applies *load_case_id* with a unit factor, creating the twin (same id as the load case) if needed.
used_field_names() -> set
# Names of fields referenced by object loads and springs.
used_spectral_function_names() -> set
# Names of spectral functions referenced by a Spectrum analysis case.
validate_combination_coefficients(coefficients: dict[str, float], combo=None)
# Validate a combination's coefficients.
variant_nesting_problems() -> list[str]
# Variants whose own model carries sequences or variants.
with_active(active_elements) -> Structure2D
# Sugar: derive a variant that only restricts the active geometry.
with_supports(support_set) -> Structure2D
# Sugar: derive a structure that only swaps the supports.
Functions of the other modules¶
These are plain functions, not methods of Structure2D; struc is the model.
xdfem2d.workflows¶
apply_variant_config(
base, model, active_elements=None, restore_loads=True, prune=True, old_state=None,
actions=True)
# Reconcile an existing variant *model* with the base and a config, **preserving the variant's own loads/cases/combinations and supports**.
area_selection(base, active_elements)
# Which areas a variant's ``active_elements`` keep, as ``(tris, quads, objects)`` sets of ids, or ``None`` for all of them (no set: the variant follows the whole base).
assign_stage(struc, element_ids, stage: int) -> int
# Set the construction stage of the given elements (bars, triangles or quads).
available_combinations(struc, results) -> list
# The combination ids a design can use: the model's load combinations, then any that only the results carry (envelopes), in that order.
base_state(struc) -> dict
# What a variant has to compare against the base: the supports and springs of *struc*, and its nodes, bars, sections and materials, as plain comparable data::
combination_validity(struc, variant_ids, op) -> dict
# Report whether *op* is valid for the given variants (for UI warnings).
copy_variant_supports(variant, source) -> None
# Give the variant the supports and springs of *source* (a Structure2D: the base, or another variant's model).
current_restraints(struc) -> dict
# Return the structure's current supports as ``{node_id: (ux, uy, tz)}``.
extend_base_with_file(base, other, **kw)
# Extend *base* with a model from *other* (path or Structure2D).
import_file_as_variant(struc, other, overlay_id: str, **kw)
# Import *other* (path or Structure2D) into a COPY of struc, registering the resulting variant (its supports are the imported model's).
list_overlays(struc) -> dict
# Summarise the registered overlays for a UI list.
make_variant_model(base, inherit: bool = True, active_elements=None, support_set=None)
# Build a variant's authoritative model — a Structure2D that already reflects the variant's **geometry** (only ``active_elements``) and its supports, plus its loads/cases/combinations.
merge_supports(base, model, old_state, actions: bool = True)
# Bring what the base changed since *old_state* to the variant *model*, wherever the variant has not changed the same thing: its supports and springs, its nodes, bars, sections and materials (field by field) and, with *actions*, its load case
new_variant(
base, id: str, description: str = '', active_elements=None, inherit: bool = True,
support_set=None) -> Variant
# A ready variant: its model, and the record of the base's supports it was made from (so a later sync can tell what the user changed).
phases_from_scenes(scenes, valid_elem_ids, cumulative: bool = True) -> list
# Generate ConstructionPhases from an ordered list of scenes.
phases_from_stages(struc, cases_by_stage: dict = None) -> list
# Generate ConstructionPhases from the elements' ``stage`` attribute (bars and area elements — triangles and quads — alike).
reset_variant_supports(base, variant) -> None
# Discard the variant's own supports and springs: they become the base's, and follow it again.
run_analysis(struc, scope: str = 'active', results: dict = None) -> AnalysisOutcome
# Run *struc* to completion, with no dialogs: the headless counterpart of the GUI's Run.
run_design(
struc, results: dict, kind: str, prefs: dict = None, combinations=None,
sls_combinations=None) -> dict
# Design the members of *kind* from the analysis *results* and store the outcome in them, where ``get design`` reads it: the headless counterpart of the GUI's Design menu.
run_sequence(struc, seq_id: str) -> dict
# Run a registered construction sequence by id.
run_sequences(struc, results, cache: dict = None, on_start=None) -> dict
# Run every construction sequence and inject the phase results into *results*, under ``results['analysis_cases']['seq__<seq>__<phase>']``.
run_variant_combination(
struc, terms, op, missing: str = 'zero', allow_geometry_mismatch: bool = False,
precomputed: dict = None) -> dict
# Solve the structure's registered variants involved in *terms* and combine.
solve_all_variants(base) -> VariantRun
# Solve the base, every variant and every cross-variant combination.
stage_numbers(struc) -> list
# The sorted list of stage numbers present in the model (bars + area elements: triangles and quads).
sync_all_variants(base) -> dict
# Sync every registered variant.
sync_variant_with_base(base, variant, force: bool = False, destructive: bool = False) -> bool
# Reconcile *variant.model* with the current base (see :func:`apply_variant_config`).
validate_for_analysis(struc) -> list
# What stops *struc* from being analysed, as ``[{'code', 'msg'}, ...]`` (empty when it can run), in the order the GUI reports them.
variant_base_diff(base, variant) -> dict
# What a sync would change on *variant.model* — pure, no mutation.
variant_id_collisions(base, variant) -> list
# Ids the variant's own model gave to a node, bar, triangle, quad or geometry object of its own that the base has since used for another one (``[(kind, id), ...]``).
vertical_support_nodes(struc) -> list
# Node ids whose transverse deflection is restrained: the nodes a punching column can sit on.
xdfem2d.combinations¶
auto_combinations(struc, types=('ULS',), replace: bool = True) -> dict
# Add the EN 1990 combinations of the cases of *struc* to it.
default_factors(action_type, category='', locale=None)
# (gamma_fav, gamma_unf, psi0, psi1, psi2) of an action, from eurocodepy.
load_case_factors(lc, locale=None)
# Factors a load case combines with: its category's defaults, each ψ replaced by the case's own value where it has set one.
pure_cases(struc) -> list
# ``[(PureCase, (gamma_fav, gamma_unf, psi0, psi1, psi2)), ...]`` for the analysis cases of *struc* that are unambiguously one action type: a Spectrum case (always seismic) or a Linear case whose load cases all share one type.
xdfem2d.cuts¶
clip_segment_to_triangle(
p1: Point, p2: Point, tri: list[Point], tol: float = 1e-09) -> Optional[tuple[float, float]]
# Clip segment ``p1->p2`` to the (convex) triangle ``tri``.
cut_area_resultant(
struc, results, cut, case, ref_point: Optional[Point] = None, tol: float = 1e-09) -> dict
# Resultant of the area (triangle AND quad — dev/IMPLEMENT_QUAD.md Phase 7) internal forces crossing ``cut`` for ``case`` (a load case, analysis case, or ``LinearSum`` combination id).
cut_bar_resultant(
struc, results, cut, case, ref_point: Optional[Point] = None, tol: float = 1e-09) -> dict
# Resultant of the bar internal forces crossing ``cut`` for ``case`` (a load case, analysis case, or ``LinearSum`` combination id).
cut_distribution(cutres: dict, n: int = 101) -> dict
# Sample ``cutres`` (a :func:`cut_result` return value) into arrays fit for plotting the per-length distribution along ``s in [0, 1]`` (Phase 7): the area fields, piecewise-constant per triangle (zero where the cut isn't inside any triangle),
cut_result(struc, results, cut, case, ref_point: Optional[Point] = None, tol: float = 1e-09) -> dict
# The full result of a cut for one case: bars, areas and their total, ready for the GUI table (Phase 7) — Bars / Areas / Total rows.
cuts_report(struc, results, cases, ref_point: Optional[Point] = None, tol: float = 1e-09) -> list
# One row per ``(cut, case)`` — every cut of ``struc`` against every case id in ``cases`` — with the total resultant, flattened for CSV/report export (Phase 7/8).
find_bar_crossings(struc, cut, tol: float = 1e-09) -> list[dict]
# Bar elements of ``struc`` (a compiled model, see ``geo_expand``) whose segment crosses ``cut``.
find_quad_crossings(struc, cut, tol: float = 1e-09) -> list[dict]
# Quad elements of ``struc`` whose interior the cut passes through — the quad analogue of :func:`find_triangle_crossings` (dev/IMPLEMENT_QUAD.md Phase 7).
find_triangle_crossings(struc, cut, tol: float = 1e-09) -> list[dict]
# Triangles of ``struc`` (a compiled model) whose interior the cut passes through.
segment_intersection(
a1: Point, a2: Point, b1: Point, b2: Point, tol: float = 1e-09) -> Optional[SegmentHit]
# Single-point intersection of segment ``a1->a2`` with ``b1->b2``.
xdfem2d.member_utils¶
cantilever_k_for(struc, member, prefs, incident=None, constrained=None)
# The auto buckling-length factor K for a free-end (cantilever) member, or ``None`` when the feature is off or the member has no free end.
identify_members(struc) -> tuple
# Group the bar elements of *struc* into physical members.
member_free_ends(struc, member, incident=None, constrained=None) -> tuple
# (free_i, free_j): whether each extreme node of *member* is truly free.
member_has_free_end(struc, member, incident=None, constrained=None) -> bool
xdfem2d.design_report¶
build_reports(
struc, results, material: str, *, prefs: dict | None = None, combinations=None) -> dict
# Run the design for *material* with reports on and return ``{id: report}``.
export_docx(
reports: dict, path: str, title: str = 'Design report', font_size: int = 10,
font_family: str = 'sans', summary: dict | None = None, diagrams: dict | None = None) -> None
# Write a Word file at *path*: via **pandoc** (native OMML equations, text matching the ``.md`` byte for byte) when a ``pandoc`` binary is on PATH, else the built-in :func:`render_docx` (no external tool, LaTeX typeset as images + Word-native
export_html(
reports: dict, path: str, title: str = 'Design report', font_size: int = 10,
font_family: str = 'sans', summary: dict | None = None, diagrams: dict | None = None) -> None
# Write an HTML file at *path*: via **pandoc** when available (same ``.md`` text, same MathJax CDN), else the built-in :func:`render_html`.
filter_reports(
reports: dict, material: str, struc, selected_bars=None, selected_nodes=None,
selected_tris=None) -> dict
# Keep only the reports touching the current selection.
latex_png(latex: str, fontsize: int = 15) -> bytes | None
# Typeset a LaTeX math string to a transparent PNG (matplotlib mathtext).
merge_per_combination(per_combo_reports: dict) -> dict
# Flatten ``{combination: {id: report}}`` into ``{"<id> · <combo>": report}``.
pandoc_available() -> bool
# True when a ``pandoc`` binary is on PATH.
per_combination_key(base_id, combination) -> str
# The dict key for a single-combination report of *base_id*.
render_docx(
reports: dict, path: str, title: str = 'Design report', font_size: int = 10,
font_family: str = 'sans', summary: dict | None = None, diagrams: dict | None = None) -> None
# Write ``{id: report_dict}`` to a Word document at *path*.
render_docx_via_pandoc(
reports: dict, path: str, title: str = 'Design report', font_size: int = 10,
font_family: str = 'sans', summary: dict | None = None, diagrams: dict | None = None) -> None
# Write Word by piping the LaTeX Markdown through **pandoc**, which turns the ``$$…$$`` equations into **native, editable OMML** — no MML2OMML.XSL / lxml needed.
render_html(
reports: dict, title: str = 'Design report', font_size: int = 10, font_family: str = 'sans',
summary: dict | None = None, diagrams: dict | None = None) -> str
# Render ``{id: report_dict}`` as a self-contained HTML page (MathJax).
render_html_via_pandoc(
reports: dict, path: str, title: str = 'Design report', font_size: int = 10,
font_family: str = 'sans', summary: dict | None = None, diagrams: dict | None = None) -> None
# Write HTML by piping the LaTeX Markdown through **pandoc** (``--mathjax``, same CDN as :func:`render_html`'s own template) so the exported page comes straight from the same ``.md`` text instead of a second, hand-written HTML renderer that c
render_markdown(
reports: dict, title: str = 'Design report', section_images: dict | None = None,
summary: dict | None = None, diagrams: dict | None = None) -> str
# Render ``{id: report_dict}`` as Markdown.
render_pdf(
reports: dict, path: str, title: str = 'Design report', progress_cb=None, font_size: int = 10,
font_family: str = 'sans', summary: dict | None = None, diagrams: dict | None = None) -> None
# Compose an A4 PDF with matplotlib: text + **native, vector-typeset equations** (:func:`_mathtext_extent_in` for sizing + a direct ``Figure.text`` for the actual draw — no rasterisation) + the **section figure** (:func:`section_figure_png`,
report_base_id(report: dict) -> str
# The base member / element / column id a report is for.
reports_from(design_output) -> dict
# Extract ``{id: report_dict}`` from a design routine's output.
schema_mismatches(reports: dict) -> list
# Ids whose report was produced under a different schema version.
section_figure_png(geom: dict) -> bytes | None
# Draw a cross-section sketch from a ``geom`` dict and return PNG bytes.
summary_rows(reports: dict, material: str | None = None) -> list
# One row per report, read straight from each report's ``meta``.
write_markdown_bundle(
reports: dict, md_path, title: str = 'Design report', summary: dict | None = None,
diagrams: dict | None = None)
# Write a Markdown report *and* an assets folder next to it.
xdfem2d.phasing¶
add_imposed_strain(struc, element_ids, eps, load_case_id)
# Apply an imposed axial strain *eps* to elements (shrinkage / creep proxy).
initial_state_from_results(results: dict, case_id: str, element_ids=None) -> dict
# Build ``{elem_id: ElementInitialState}`` from a solved result's ``element_forces`` for a given load case / analysis case / combination.
resolve_phase_state(prev_active, prev_support_set_ids, operations, all_ids, struc=None)
# Replay one phase's ``operations`` on top of the previous phase's *resolved* state and return the phase's own resolved ``(active_elements, support_set_ids, applied_cases, case_factors)``.
solve_phase(
base, phase, support_sets=None, _sub=None, tri_initial_state: dict | None = None) -> dict
# Solve one construction phase and return a result dict.
solve_sequence(base, sequence, support_sets=None) -> dict
# Solve an ordered :class:`ConstructionSequence` phase by phase.
xdfem2d.template_api¶
build_template(kind: str, **params)
# A new :class:`Structure2D` for *kind* with *params* (see TEMPLATE_KINDS).
check_params(kind: str, params: dict) -> dict
# *params* completed with the defaults, or ValueError saying what is wrong.
domain_mismatch(kind: str, struc) -> str
# '' unless *struc* is an empty plate-domain model (a grillage or slab started from New Model) and *kind* is a bar kind, else what is wrong.
fill_in_place(target, built) -> None
# Make *target* (an empty model) the model *built*, keeping its object.
has_geometry(struc) -> bool
# True when *struc* already has nodes, bars, area elements or objects.
kind_signature(kind: str) -> str
# ``kind(name=default, ...)`` as text, for a message or a reference.
normalize_kind(kind) -> str
# The kind *kind* names, or ValueError listing the valid ones.
template_kinds() -> list[str]