Part of the Structure tab redesign. It builds on:
EditCtx::finish.This sub-project redesigns trusses on that same mechanism, so that a truss stays parametric and fits both steel and timber.
The user asked for this (“redesenhar treliças para atender melhor aço e madeira”, redesign the trusses to serve steel and timber better) and told me to make the design decisions alone.
MemberHost abstraction in
cc_core::member_host.Element::member_host() and member_host_mut() return
Option<&dyn MemberHost> (and &mut dyn), plus a dispatch by
ElementKind.SteelBuilding is ported to it with no change in behavior, and the
2b tests still pass.Truss host element, category Truss with TypeData::Truss {}.
Its parameters:
start, end: the plan span line, between the truss’s support points;base_offset: the bottom chord axis above the level at the supports;shape: Flat, Mono or Gable;height: chord to chord for Flat, or the rise at the apex or high
end for Mono and Gable; for those two the bottom chord is level;pattern: Pratt, Howe, Warren, KingPost, QueenPost or
Fink. King post, queen post and Fink apply only to Gable. A
pattern that does not apply falls back to Pratt, a decision made
in check.panels: the number of bottom-chord panels. The default comes from
the span (about 1.5 m each). The minimum is 2, the maximum 64. A
Gable needs an even count.top_chord_type, bottom_chord_type and web_type: beam types;post_type: a column type, for the vertical web members;copies: how many trusses (1 to 200);spacing: distance between copies, to the left of start→end,
0.3 to 20 m;members and detached: as in 2b.end_offset.post_type, from the bottom chord axis to
the top chord axis. A vertical shorter than 0.05 m is skipped.k * spacing.MAX_MEMBERS = 4000; a truss over it is refused (see the amendment below).Material defaults (the material comes from the Structure tab’s
selector, or the command’s material):
| material | chords | web | posts |
|---|---|---|---|
| steel | Ue 150x60x20x2,00 |
Ue 100x50x17x2,00 |
column type of Ue 100x50x17x2,00 |
| timber | Peça 6x16 |
Peça 6x12 |
column type of Peça 6x12 |
| concrete | not offered; the command refuses it |
The catalog series are NBR6355-Ue and Timber-Sawn. Types are made
through catalog_type, which 2b added.
L = |end − start|. Panel
points on the bottom chord are at x_i = i·L/panels.Flat: h;Mono: h·x/L;Gable: h·(1 − |2x/L − 1|).The top-chord panel points are at the same x values. For Mono and
Gable the top chord meets the bottom chord at the supports where its
height is 0. The vertical there is skipped, being under 0.05 m.
i between x_i and x_{i+1}:
panels = 4 these are the canonical members; other counts use the
panel points nearest the quarters.{ kind: TopChord | BottomChord | Diagonal | Vertical,
copy: u16, index: u16 }.truss_create keeps its name and parameters for compatibility, and
also accepts:
shape;kingpost, queenpost and fink;top_chord_type, bottom_chord_type and post_type
(chord_type sets both chords);copies, spacing and material.It now creates a Truss host instead of a group and returns
{ id, members }.
Breaking change: the old group of loose members is gone. A test that read the group is updated.
element_get and element_set show and patch the truss parameters
like the building’s. members cannot be changed.Plans draw the truss host as its span line (start to end), dashed, for each copy. That is enough to pick and select it.
truss_create with the material of the tab.truss_create defaults for steel and timber, and concrete refused;element_set of panels regenerates in one undo step.MemberHost trait as packed RoleKey(u64)
values that sort like the typed roles. Each host keeps its own typed
role and its file format.Truss::check refuses a truss whose full layout (all copies) would
exceed MAX_MEMBERS, so a layout is never cut short, and bounds
base_offset to ±10 km.BeamVertical::Center.truss_create arguments.
height is still required.bottom_offset sets base_offset.material defaults to steel; concrete is refused.chord_type sets both chords. The top and bottom chord types
override it.members and makes its own. Task 1’s port
must keep this behavior, which commit 20839ef added after the plan was
written.