Part of the Structure tab redesign. 2a (the Structure tab by material and the grid frame) comes before it. 2b adds a parametric steel shed: portal frames, purlins and girts, generated as real columns and beams that a host element keeps in step with its parameters.
The user approved approach A (a host element owning real members) and asked me to make the remaining design decisions alone. Those decisions are recorded here.
SteelBuilding element that holds the parameters:
Column and Beam elements. They show up in
schedules, IFC, the analytical model and tags with no special case.Out of scope:
braces_between_columns already do.cc_core::steel_building)ElementKind::SteelBuilding(SteelBuilding):
SteelBuilding.TypeData::SteelBuilding {}: the type is created with the first
building, the same way Shaft does it.The struct’s fields:
| field | meaning | default | bounds |
|---|---|---|---|
origin: DVec2 |
plan point of the first frame’s left column | finite | |
rotation_deg: f64 |
turn of the local x axis (across the span) | 0 | finite |
span: f64 |
column axis to column axis, m | 20 | 2..=100 |
eave_height: f64 |
column top above the level, m | 6 | 1..=50 |
slope_percent: f64 |
roof slope | 10 | 0..=100 |
roof: RoofShape |
Gable (ridge at mid-span) or Mono (rising toward x = span) |
Gable | |
bays: u32 |
frames = bays + 1 | 5 | 1..=100 |
bay_spacing: f64 |
frame to frame, m | 6 | 1..=30 |
column_type, rafter_type: ElementTypeId |
must be column and beam types | ||
purlins: Option<Secondary> |
Secondary { type_id, spacing }, spacing along the rafter’s plan run |
Some, 1.5 | spacing 0.3..=10 |
girts: Option<Secondary> |
on both long sides, spacing up the wall | Some, 1.5 | same |
members: Vec<FrameMember> |
FrameMember { role: MemberRole, id: ElementId } |
empty | |
detached: Vec<MemberRole> |
roles the user took over | empty |
MemberRole is a small Copy + Ord serde struct:
{ kind: RoleKind, frame: u16, index: u16 }, where RoleKind is
Column, Rafter, Purlin or Girt.
SteelBuilding::layout(&self, project) -> Vec<(MemberRole, ElementTypeId, ElementKind)>
is deterministic. Positions are in local coordinates, x across the span
and y along the building, then mapped to plan through origin and rotation.
Frame k is at y = k * bay_spacing.
(0, y_k) (index 0) and (span, y_k) (index 1).
Base at the level, unconnected height = eave_height, structural.(0, y_k) to
(span / 2, y_k); index 1 from (span, y_k) to (span / 2, y_k).(0, y_k) to (span, y_k).top_offset = eave_height + rafter depth, where the depth is the
height of the rafter type’s section box. It rises at
slope_percent / 100 over the plan run (end_offset).k to frame k + 1.
x = column half depth, then every spacing, with one at the
ridge (span / 2 - purlin half width, mirrored for the other half).frame is the bay and index is the purlin line.x = -(column half depth + girt half width)
(side 0) and x = span + (column half depth + girt half width)
(side 1).spacing above the level to below the eave, every
spacing.index holds side * 1000 + row.MAX_MEMBERS = 4000 members. layout stops adding beyond that.Section depths and widths come from Project::type_section boxes. A
missing section reads as 0.2 m.
EditCtx::finish, first step)sync_steel_buildings runs first, before the other syncs. It sees which
elements the edit itself changed:
detached list, and the
members entry is dropped. The element stays as the user left it.detached:
members ids already belong to
another host (a copy) has its members cleared before step 2, so it
gets its own.Other rules:
EditCtx::remove_element).members entries whose element is missing or is not a column
or beam, and repeated ids or roles;detached repeats;(0, 0) to
(span, bays * bay_spacing) turned into plan, as a thin dashed
rectangle owned by the host. This lets the host be picked and selected
in plans. The name tag SteelBuilding + mark is not drawn.steel_building_create:
level;origin, default [0, 0];rotation;span, eave_height, slope_percent;roof (gable / mono);bays, bay_spacing;column_type, rafter_type;purlins and girts: { type, spacing } or null for none,
default on.W row W310x38,7.NBR6355-Ue row
Ue 150x60x20x2,00.structural_type_for
does, through a shared helper catalog_type(s, category, series,
designation) in structure_material.rs.{ id, members }.element_get shows the building’s parameters in params. element_set
merges a patch over them. The repair check refuses out-of-range values,
and the sync regenerates the members in the same step. element_get’s
derived lists the member ids by role kind.
UiCommand::SteelBuilding,
icon steel-building) opens a dialog (steel_building_ui.rs,
dialog::Dialog) with:
OK runs steel_building_create on the active level.
engine_edit::element, plus a Reset
members button that clears detached and regenerates.2(b + 1);2(b + 1) for gable, b + 1 for mono;Rafter slope and ends, and the bounds (MAX_MEMBERS), are also checked.
steel_building_create with defaults makes the catalog types once.element_set regenerates in one undo step.FrameRoof { Gable, Mono }, because cc_core::RoofShape
already exists.eave_height + rafter depth). They are turned so their depth runs
across the span, so the existing beam joins stop the rafters at the
column faces. The eave height stays the rafters’ underside.sync_steel_buildings runs right after sync_profiles, before every
sync that touches elements.spacing, 2·spacing and
so on, strictly below the eave.element_set refuses to change members. detached stays editable,
and Reset Members clears it.ElementKind::SteelBuilding holds a Box. There is no format bump,
thanks to serde defaults.