Part of the architecture notes indexed in AGENTS.md. Keep each topic in its bullet here; AGENTS.md only lists the topics.
cc_core::bar_marks: Project::bar_marking (BarMarking: prefix, start, length_tolerance, stock_length, the frozen marks table frozen: Vec<FrozenMark> of mark, diameter, grade and a compact canonical MarkShape; tracked as settings, EditCtx::bar_marking_mut, serde default, repair bounds it, MAX_FROZEN, MAX_MARK_LEGS). Sets and shaped bars have a partition and a bar_mark (Element::rebar_partition/rebar_bar_mark), bar types a grade and an optional mass_per_meter (TypeData::rebar, RebarGeom::grade/mass_per_meter(), which weights use). cc_geom::bar_shape::summary reads a bar’s ShapeSummary from its center line (points in a line one leg, equal chords turning evenly one arc leg with its radius, a ring one leg of a whole turn; a true_length longer than the line, as a tie’s hooks, spread over the legs), and cc_geom::bar_marks::resolve (pure, over ModelGeometry::rebar) gives every bar a Mark: a set’s bar_mark first, then the first frozen entry its shape matches (diameter, grade, ShapeSummary::matches within the tolerance and ANGLE_TOLERANCE_DEG), then shapes numbered after the highest frozen number in the stable order partition, diameter descending, length descending, canonical shape; BarMarks sorts marks naturally, with exact counts, lengths and weights per mark (of_bar, of_set). cc_views::bending: ScheduleDef::bending (BendingOptions: partitions, group_by_partition, waste_percent; serde default, repaired) turns a reinforcement schedule into a row per mark (bending gives the exact rows and DiameterTotals, the totals adding the rows, which add their bars; table formats them), with Table::summary under it (caption), group Row::headings and a BarSketch per row (sketch_of: the shape’s legs laid flat in order, short legs drawn longer; draw_sketch fits it in the cell, schedule::drawing makes those rows SKETCH_ROW tall) whose CSV and table text is shape_code (straight 500, L 30-470, stirrup 14x44, stirrup 14x44 hook 135° 5 hook 135° 5, arc R=220 L=345; format::bar_length writes centimeters). Bar tags: ElementKind::BarTag (cc_core::bar_tag, category BarTag, TypeData::BarTag { text_size } made with the first tag) is view-owned (plans, elevations, sections) and references a set (set, removed with it by remove_element and repair), with position, leader, rotation_deg, multiplier and parts; cc_views::bar_tags derives the text (2x 25 N1 Ø12.5 c/12 C=500) and draws the tagged set’s bars as thin lines in that view (no other view draws bars in 2D). cc_engine::commands::bar_marks: bar_marks_list, bar_marks_update (freeze, drop_unused), bar_marks_renumber (prefix, start, keep_overrides), bar_marking_set, bar_length_check, bending_schedule_create, bar_tag_create; the reinforcement commands take partition, element_get gives a set’s marks and a tag’s text, schedule_table the summary. IFC export writes Partition, BarMark, Mark and Grade in REBAR_PSET (ConstructCAD_Rebar), and import reads the first two and the grade back; a set laid out in a host also writes Host and Layout, and comes back as a set of the imported host (#368, see the cc_ifc notes in interop.md). The app shows headings and the summary in the schedule view; tags are placed by their command.RebarLayout::Stirrups { spacing, hooks: Option<StirrupHooks> } (cc_core::StirrupHooks { angle, tail }: degrees in StirrupHooks::ANGLES, 90 to 180, and the straight end in bar diameters up to MAX_TAIL, at least MIN_TAIL_LENGTH 5 cm; Default 135° and 10 diameters; serde default None, not written when None, so older files keep their stirrups without hooks and their lengths; invalid hooks make the set invalid like a wall tie’s angles). cc_geom::rebar::LoopHooks (of, the bend’s center-line radius PIN_RADIUS 2 diameters as a tie’s hook) is set on every stirrup Bar (Bar::hooks: beams, strip beams, columns along the outline, round, sectors, polygons and overlapping rectangles); the loop is not drawn with them, Bar::length adds 2 × (angle × radius + tail) to the loop (sides to the sharp corners, or true_length), and a column’s outline starts at its sharpest convex corner (from_convex_corner), where the hooks are. bar_shape::summary reads a hooked loop from that corner as an open shape [hook, loop legs…, hook] (hook legs hook: true, their length the straight end, bent by the hook’s angle the way the loop turns; the bends’ arcs are in the bar’s length, not in the legs), and ShapeSummary::hooked_loop gives back the closed loop (its closing turn what the others leave of a whole turn) and the two hooks; bending::shape_code writes stirrup 14x44 hook 135° 5 hook 135° 5 and sketch_of draws the hooks at the closing corner without labels. rebar_create, rebar_typical and strip_rebar_create beam take hook (0 for none) and tail (commands::rebar::stirrup_hooks), new sets getting 135° and 10 diameters; element_set edits layout.Stirrups.hooks (null for none). IFC export writes the loop as the bar’s directrix and the hooked length in BarLength, as for ties. The app: Stirrup Hooks (none, 90°, 135°) and Hook Tail (diameters) rows in a stirrup set’s Reinforcement section (properties::stirrup_hook_rows).Rebar::anchorage: Option<cc_core::Anchorage { length, hook: AnchorHook }>: the length in bar diameters (DEFAULT_LENGTH 40, MIN_LENGTH 10 to MAX_LENGTH 100), AnchorHook none, down, up or auto (direction by BarFace: auto bends top bars down and bottom bars up; side bars never bend), MIN_HOOK 8 diameters; serde default none, not written when none (no format change); Anchorage::fits the Longitudinal and Sides layouts; repair resets one out of range, or on a set that is not a beam’s longitudinal or side bars, to none and keeps the set, so element_set refuses it. cc_geom::rebar: Supports::of (built only when a set is anchored) keeps each support’s ColumnInput (build::support_input, shared with build_beams: a structural column’s convex hull, a pile cap that is not a ring) and the beam ends framed into it; Supports::anchors gives a set an EndAnchor at each BeamEnd::Column end of its beam, in_line when another beam framed into that support leaves it the opposite way (within IN_LINE) at a common depth. anchor_end finds where the bar’s line (polygon::clip_line) or circle (support_span: the crossings of the circle with the outline’s sides, placed along the axis from the end face, half a turn either way) runs through the support behind the end face (within SUPPORT_GAP), so a turned or round support is met where the bar meets it: the bar runs on past the near face up to the far face less the cover, at most the anchorage length; where that is short a top or bottom bar ends in a vertical 90° leg making up the rest (at least MIN_HOOK, at most the support’s height less the cover, else none); in line it runs half the support and half a lap (lap_of: the splice’s, else 40 diameters) past the near face, still at most to the far face less the cover, without a hook, so two beams’ bars lap inside the support; None (the bar stops the cover short of the end as before) where the line misses the support, the bar lies above or below it, or the cover leaves no room. BeamRun is the developed bar (legs and run; corners sharp, the legs measured to the run’s line as a wall bar’s BarEnd legs are, no bend deduction), cut by Splice::pieces after the anchorage is added (piece: legs, and the run in chords along an arc with the developed true_length). An end framed into a support takes the anchorage and an end joined to another beam lap_at_joins, never both; stirrups are unchanged. bar_shape reads a hooked bar as an L or U (bent along an arc). cc_engine::commands::rebar: rebar_create and rebar_typical (the beams’ top and bottom sets) take anchor (AnchorArg: true or diameters) and anchor_hook, refused on stirrups and columns; element_set edits anchorage (null for none). The app: Anchor into Supports and Anchorage Hook rows of a beam’s longitudinal and side sets (properties::anchorage_rows; no hook row for side bars; the length is set by commands). Tests: cc_engine/tests/beam_anchorage.rs.cc_engine::commands::wall_rebar: wall_rebar_create (walls, or the structural walls of a level or the project; faces both/exterior/interior, cover/cover_exterior/cover_interior, horizontal { type, spacing | zones }, vertical { type, spacing, offset, from, to, bottom, top }, ties { type, every_horizontal, every_vertical, hooks } (the two hook angles, kept in RebarLayout::WallTies::hooks), outer horizontal/vertical, max_length, lap, lap_at_joins; with no family given, horizontal and vertical bars every 15 cm; curtain walls refused; one Rebar set per family and face, one undo step, {created, walls, skipped, not_structural}, with a warning when walls chosen by level or project are all left out for not being structural; a wall is structural by default when its type is, as the templates’ concrete wall types are); rebar_create stays for beams and columns. rebar_copy (commands::rebar: from, to, sets, replace) copies a host’s sets to hosts of the same kind and section (host_kind: column, beam, wall, strip; same_section: the same type, or column and beam types whose placed outlines match), refusing floors and slab foundations, one undo step, {created, replaced}. Rebar::lap_at_joins (also strip_rebar_create and rebar_create for beams) runs the bars along a host half a lap past each end where another host carries on in the same line (cc_geom::rebar::carries_on over the ends of the hosts’ axes, run_past), so the rings of a cylinder, a ring footing or a ring beam lap at the joints; Rebar::overlapping makes a column’s stirrups one closed rectangle around each of the rectangles of a section of square corners (cc_geom::faces::rectangles), and Rebar::lifts cuts a column’s vertical bars at given heights (Rebar::lift_pieces); all with serde defaults, checked by Rebar::is_valid. The sets are ordinary Rebar elements hosted by the wall (removed with it, in rebar schedules, 3D rebar views and IFC as IfcReinforcingBar). The app: a structural wall’s Reinforcement section in the properties palette (properties::reinforcement, shared with beams and columns), whose typical button runs the command. Session::geom is the cached geometry: after a command that does not return an element, tests read Session::geometry.Rebar sets with the layouts SlabStraight { top, angle_deg, spacing, inner, hook }, SlabRing { top, spacing, center, inner }, SlabRadial { top, count, center, start, intermediate, inner } and SlabTrim { top, count, spacing, anchorage, diagonals } (RebarLayout::in_slab, slab_top; limits in cc_core::slab_bars; repair keeps them in floors and foundation slabs). cc_geom::slab_rebar lays them out: Slab::of reads the outline, openings (a floor’s own and its shafts’ cuts), the circles of its sketch and the bottom and top of its structure (core_range); Region is the slab less the cover (the boundary moved in, openings grown, with polygon::offset; empty when a side flips), whose stretches of a line are found by even-odd crossings and, on a side that is a chord of a sketched circle, moved onto the circle itself, so bars end on true arcs; arcs clips a circle. Mesh lines run either side of the one through the middle of the slab’s box, each stretch a bar cut by Rebar::splice, with a vertical leg (hook) only at ends on the slab’s own edge; rings are closed, or with a splice pieces lapping around; trimming bars run along the sides of each opening’s box and across its corners, in a region a hair wider so the line the cover draws is inside. An inner set lies a bar of the layer’s other sets further in. cc_engine::commands::slab_rebar: slab_rebar_create (slabs, or the structural floors, Floor::structural, and the foundation slabs of a level or the project; layout mesh/radial, layers, type/cross_type, spacing/cross_spacing, angle, hook, center, radial_count, start, intermediate, cover, trim (values or false; made only for slabs with openings), max_length, lap; one undo step, {created, slabs}); element_get of any rebar set lists derived.bars ({length, count} to the millimeter, longest first). The app: a floor’s Structural checkbox, and the Reinforcement section of a structural floor’s or a foundation slab’s properties.TypeData::Foundation::haunch (cc_core::StripHaunch { edge_thickness, beam_width, beam_height }: the footing slab is the type’s thickness deep at the faces of the beam and edge_thickness at its edges, the beam rises beam_height above it; fits, outline, area; TypeData::strip_haunch and foundation_depth, the top of the foundation being the top of the beam; repair drops a haunch that makes no section). Every strip’s FoundationGeom::strip keeps its BeamGeom (frame, section, ends after joins), and FoundationGeom::body() is that of a haunched one, swept with BeamGeom::add_to (straight or arc) with its exact volume; plans add the beam’s two faces (BeamGeom::line), legends draw the T, IFC export writes a faceted body. A strip hosts Rebar sets (RebarLayout::fits_strip): its own StripTransverse { top, spacing } and StripLongitudinal { top, spacing } (cc_geom::strip_rebar: StripSection::top(v) is the height of the footing’s top across it; a top bar across goes down to the bottom layer at each edge, up the slopes and flat between the beam’s faces; bars along follow the slopes at their own radius on an arc, top ones leaving the beam’s width, and lie inside the bars across), and a beam’s Stirrups, Sides and top/bottom Longitudinal, laid out by beam_bars in a beam as wide as the beam part (StripSection::beam_half) and as deep as the whole section. cc_engine::commands::strip_rebar: strip_rebar_create (strips or those of a level, layers, type/longitudinal_type, transverse_spacing, longitudinal_spacing (0 for none), beam { type, top, bottom, sides, stirrup_type, stirrups } or false: a haunched strip gets stirrups and two top bars by default, a plain one only when asked; cover, max_length, lap; {created, strips}). A foundation slab keeps the curves it was drawn with (Foundation::sketch, Foundation::new, slab_area; foundation_slab_create curves, sketch_get/sketch_set), so FoundationGeom::drawn_area and its volume are exact and slab_rebar clips bars to its circles. The app: the Beam on the footing section of a strip type’s Type Properties (type_dialog::strip_haunch_rows) and the Reinforcement section of a strip’s properties.Project::pile_cap) host RebarLayout::CapBottom { count, spacing, diagonals, bend }, CapTop { spacing, bend }, CapSides { spacing, hooks } and Stirrups; piles host PileLongitudinal { count, spacing, length, projection }, PileSpiral { pitch, length } and PileTies { spacing, length, hooks } (RebarLayout::in_cap, fits_cap, in_pile; limits in cc_core::pile_bars: MAX_BAND, MAX_AROUND, MAX_BEND, MAX_LENGTH the longest pile, MAX_PITCH; serde defaults on the optional fields, no format change, as for the strip and slab variants). Project::rebar_host_fits (repair and IFC import) keeps cap layouts in pads that are pile caps, pile layouts in piles, and neither in beams or columns; an edit that would leave one elsewhere (a cap’s type turned into a plain pad’s while it has sets) is refused by the edit check. Every family is laid out by its role from the cap’s geometry when the model is built (cc_geom::cap_rebar, CapInput from FoundationGeom::cap, the type’s PileLayout, embedment and pile size), so a type’s layout change re-lays the sets: bottom bars are a band of count bars between each two piles of a triangle (its three sides) or a square (its four sides, and with diagonals its two diagonals), each as wide as a pile (spread over ±(size − d)/2) on the line through the two piles’ axes; count bars along the line of a pair or a Line (is_beam_like) spread across the cap’s width less the inset; a mesh spacing apart both ways (stations, first direction along u) in a single-pile, round or ring cap (Region: the outline moved in, exact chords of a disk, two pieces either side of a ring’s hole; offsets on an edge are moved a hair inside). Bands that cross lie in layers a bar apart; the lowest bar lies on the piles’ heads, max(cover, embedment) above the cap’s bottom; ends turn up (bottom) or down (top) the side faces by bend, at most to the other face less the cover; bottom and top bars are spliced (cut along the developed bar). Side loops (CapSides, closed by LoopHooks at a convex corner like stirrups; circles exact through true_length; both faces of a ring) sit at most spacing apart between the bottom and top layers (side_heights); Stirrups are laid out only across a beam-like cap, as a beam’s, and nothing elsewhere. Nesting: stirrups at the cover, side loops inside them, bottom and top bars inside both. Piles (cc_geom::pile_rebar, PileInput): bars around the section (round: count or ceil(2πr / spacing) evenly on the circle; square: faces::outline_faces and face_bars, corners first) inside the spiral or ties, from length below the head (0: the toe plus the cover) to projection above it, under a cap at most to the cap’s top less the cover; cut in lifts by Rebar::column_pieces. A spiral is one bar with Bar::helix (Helix { radius, pitch, turns }, turns = height / pitch, not necessarily whole, no closing turns), drawn in chords (at most ShapedRebar::MAX_POINTS) with true_length = turns × √((2πr)² + pitch²); a square pile’s spiral winds on its inscribed circle. bar_shape::summary reads a helix as one coiled leg (LegSummary::pitch, sweep = turns × 2π), kept in frozen marks (MarkLeg::pitch, serde default, MAX_MARK_TURNS), bending::shape_code writes spiral R=15 p=10 L=5546 and sketch_of draws a short zigzag. A pile kept by a layout change keeps its sets (piles keep their ids); a pile removed takes its sets along (remove_element); a pile the change adds takes copies of the sets of the cap’s first reinforced pile (EditCtx::sync_piles), in the same undo step. Copies of a cap or pile do not take its sets, as no host’s copy does (rebar_copy copies them, now also between caps and between piles of one type); a mirror moves them with the host. cc_engine::commands::pile_rebar: pile_cap_rebar_create (caps, or the caps of a level or the project without reinforcement; type, bottom, top, sides, stirrups each values or false; bottom count 4, bend 20 diameters, top 8 mm straight, sides 8 mm, stirrups 5 mm only in beam-like caps; cover, max_length, lap, partition; one undo step; {created, caps, skipped: [{cap, reason}]}, a cap too small for the cover skipped through cc_geom::pile::cap_room_problem) and pile_rebar_create (piles, caps, or the piles of a level or the project without reinforcement; count (6 round, 4 square) or spacing, length, projection (40 diameters), transverse spiral (round) / ties (square) / none, transverse_type, pitch, hook, tail; {created, piles, skipped}). IFC export writes the sets with Host and Layout (bottom, top and pile bars MAIN, side loops EDGE, stirrups, ties and spirals LIGATURE), and import lays them out again in the imported cap or pile. Bar tags write the spacing of top meshes, ties and spirals. The app: the Reinforcement section of a pile cap’s and a pile’s properties (Typical Reinforcement runs the commands; properties::pile_rebar_rows: Mesh Spacing, Diagonal Bands, Bent Ends, Reinforced Length, Projection into Cap; hooks of side loops and ties), and Pile Cap Reinforcement and Pile Reinforcement in the Structure tab’s Reinforcement group (UiCommand::PileCapRebar, PileRebar: the selection, else the active level). Tests: cc_engine/tests/pile_rebar.rs.