Part of the architecture notes indexed in AGENTS.md. Keep each topic in its bullet here; AGENTS.md only lists the topics.
cc_engine::dimensions: associate ties the ends of a new dimension to the elements or level lines whose linework in the view passes through them; set_value drives the model from a new value (commands dimension_create, dimension_set_value). A dimension type (TypeData::Dimension { text_size, style }) holds a cc_core::dim_style::DimensionStyle (serde defaults, repair): the end mark (a LeaderSymbol, a tick by default) and its size and pen, the line pen and color, witness gap and extension, dimension line extension, text offset, prefix/suffix and an opaque text box; cc_views::dimension_layout lays a dimension out with it and draw_dimension/draw_marks draw it (marks through notes::symbol_at, shared with leaders); radial, diameter and ordinate dimensions keep their own arrows. The app edits it in Type Properties (dim_type_ui.rs).cc_core::tag: plans tag doors, windows, rooms, columns, beams and pad footings or pile caps (TagTarget::of) by themselves; a tag type (TypeData::Tag { target, style: TagStyle }, category Tag, in Category::NAMED but not ALL; the template carries one per target, made by Project::ensure_tag_types at the end of from_template_system with the default style, and tag_type_create makes more; older files may have none) holds lines (TagLine { text, size }: {Field} templates read by title_block::field_parts: a ScheduleField by serde name, ScheduleField::from_name, written as a schedule cell, cc_views::schedule::cell_text, plus Mark, TypeName, Section and a room’s Area), a TagSymbol (shapes or Component(id) of a detail component drawn at paper size), sizes, pens, LeaderMode, TagOrientation, crossed_when_unplaced; TagStyle::repair bounds it. A target with no tag type draws TagTarget::default_style(), what plans always drew. View::tags (TagPlacement: offset, rotation_deg, tag_type, hidden, leader; all-default ones removed) and View::tag_types (per target) are the view’s; the older View::tag_offsets is read only and moved into tags by repair_view_tags (also run by sync_views, which drops placements of deleted elements and tag types), and sync_tag_types clears component symbols whose type is gone (format 29). cc_views::tag draws them: each target computes a TagSpot (point, leader anchor, host direction, Align) in annotate.rs (opening_tags, rooms in plan_annotations, structure_tags_in), prepare expands the lines (empty lines keep their place; a tag writing nothing is not drawn), draw lays it out and records its TagHandle (center, half along and across the tag, rotation radians; contains, corners_at, rotate_grip; rooms too: a click on a room’s tag still picks the room through its pick fill). Texts carry an optional color (Prim::Text::color, Drawing2D::colored_text; None keeps every drawing as it was): a tag style’s text_color, a grid style’s and a mark style’s color give theirs, painted by the app and written by the SVG (and so PNG), PDF and DXF (nearest ACI) exports. Commands in cc_engine::commands::tags: tag_type_create, tag_set (one undo step over ids), tag_get, and view_set/view_get tag_types; tag_move still moves the offset. Grids and view marks (phase 2): TypeData::Grid { bubble, style: GridStyle } (cc_core::grid: ends: BubbleEnds End/Start/Both/None, a TagSymbol (a component’s texts write {Name}), text_size (default TEXT_SHARE of the bubble), pen, color, line_pattern; serde default, the template’s grid type is the default style), Grid::ends overrides the type’s, and TagPlacement::start_offset (grids only; repair resets it on others) with offset moves a grid’s start and end bubble per view (elbow leader; hidden hides the bubbles, not the line), in plans and in projected_grids (the line’s bottom is its start; the view’s tags); annotate::grid_line draws both and records Drawing2D::bubbles (BubbleHandle, bubble_at). cc_core::view_mark: TypeData::ViewMark { kind: MarkKind (Section, Elevation), style: MarkStyle } (category ViewMark, in NAMED not ALL; the template carries one per kind, made by Project::ensure_mark_types with the default style, and view_mark_type_create makes more: head paper mm, 0 = 0.5 m in the model as elevation markers always were; symbol, split, top/bottom/label MarkText templates of {Number}, {Sheet}, {Name}, {Letter}, MarkArrow, heads: BubbleEnds, line_weight, color, arrow_color; MarkKind::default_style() is what plans always drew); View::mark_type (sections and elevations; Project::mark_type_for/mark_style: own, else first of the kind, else the default) and View::mark_offsets (floor plans, by elevation view) are repaired by repair_view_marks (also in sync_views). plan::section_marks/elevation_mark draw through draw_head (MarkFields), plan_drawing takes the plan’s offsets (plan_of none) and records Drawing2D::marks (MarkHandle, mark_at); tag::draw_symbol_component and fill_fields are shared; tag::stale_symbols/reset_symbol reset component symbols of tag, grid and mark types. Commands: view_mark_type_create, mark_move (cc_engine::commands::view_marks), view_set/view_get mark_type, tag_set start_offset and grids (plans, elevations, sections), tag_get of a grid (ends, bubbles). The app (tag_type_ui.rs): the Type Properties sections of tag, grid and view mark types (type_sections: lines with a Field menu of tag_fields, symbol picker of shapes and detail components; one type_set per change through engine_edit::element_type), the Tag Types dialog (UiCommand::TagTypes, Annotate → Tags: per target and mark kind, New, Duplicate, Edit, a default row’s Edit making the type first; graphics_dialog::Edits), the palette’s Tag section (element_section: type, rotation, leader, hidden, reset, a grid’s ends, all tag_set) and the view rows (view_rows: tag_types, mark_type through engine_edit::view); tools::annotation_handles (before the Select tool’s grips) drags tags (Drag::Tag), the rotate grip of the element selected alone (Drag::TagRotate), grid bubbles in plans, elevations and sections (Drag::Bubble) and elevation markers in floor plans (Drag::Mark, mark_move), and opens Hide Tag/Reset Tag on a right click (Interaction::tag_menu).cc_core::level_mark: ElementKind::LevelMark(LevelMark) (category LevelMark, a TypeData::LevelMark { text_size, datum, finished_suffix, raw_suffix } type created with the first mark, or by level_mark_type_create) lives in one view like a text note (view, position in the view’s drawing coordinates, flip, optional finished/raw overrides, show_raw); repair resets bad values and drops marks of deleted views. cc_geom::level_mark::levels measures them: in plans the top of the highest floor of the plan’s level under the point (else the level) and, as the raw level, that floor’s top less the layers above its core (core_range); in elevations and sections the point’s height, with the raw level of a floor whose top it lies on at the section line. cc_views::level_marks draws the plan symbol (circle with two filled quarters) or the section symbol (triangle down to the point) with the values (texts: sign, datum added, suffix). Commands level_mark_create and level_mark_type_create; element_get gives derived.finished, raw and texts. In the app: Annotate → Levels (UiCommand::LevelMarkPlan/LevelMarkSection, which create the type when there is none, Tool::LevelMark, level_mark_ui.rs: the tool snaps in sections to the view’s lines, the palette rows and the type’s rows).cc_core::detail: ElementKind::DetailLine(DetailLine) (category DetailLine, a TypeData::DetailLine {} type created with the first line) is one SketchCurve in its owner view’s drawing coordinates (Element::owner_view, like text notes; removed with the view) with a style: LineStyleRef. That is LineStyleRef::BuiltIn(DetailStyle) (thin, medium, wide, hidden, dashed, center, dotted: weight, black, LinePattern) or LineStyleRef::Project(LineStyleId), one of the project’s line styles (see Line styles and regions). Repair drops invalid or out-of-bounds curves; no phase, no 3D, no IFC. A polyline is one element per segment, so each is a plain curve for cc_core::sketch_edit: wall_ops (trim_corner between detail lines, trim_detail/trim_to, split, offset_copy, curve_of) handles them, and Element::translate/transform move the curve. cc_views::detail draws them over the model in plans, ceiling plans, elevations, sections, legends and drafting views (hosts_cad) as segments in the style’s own Pen; DXF export names their layer after the style code. cc_engine::commands::detail: detail_line_create (curves as CurveArg, style code); element_set takes "style": "<code>" and refuses another view. The app (detail_ui.rs): Annotate → Detail Line (Tool::DetailLine; AppState::detail holds mode and style, detail_draw the curve in progress, drawn with sketch_mode::draw through a Target::Detail session and created as soon as it is drawn), grips (Drag::DetailGrip, sketch_mode::curve_grips/moved), properties, Split/Offset previews; tools::cad_snap snaps to them; outside plans the Modify tools take only view-owned elements (detail_ui::view_owned, modify::linear_at).cc_core::detail::LineStyleDef (id, unique name that is no built-in code, weight_mm in MIN_WEIGHT_MM..=MAX_WEIGHT_MM, color, LinePattern) lives in Project::line_styles (tracked as settings, EditCtx::line_styles_mut; serde default, no format bump); LineStyleRef::pen/code take the styles and read a missing one as thin, and repair (repair_line_styles) fixes ids, weights and the count and resets dangling references; Project::line_style_users lists the detail lines and regions using a style. cc_core::region::Region (owner view, outline, openings, optional sketch, boundary: Option<LineStyleRef>, none drawing no boundary) is the data of ElementKind::FilledRegion (category FilledRegion, TypeData::FilledRegion { fill: PatternFill }) and ElementKind::MaskingRegion (category MaskingRegion, TypeData::MaskingRegion {}), both view-owned like detail lines (removed with the view, no phase, no 3D, no IFC) and sketched (drawn_sketch, sketched_profile, so sync_sketches, sketch_get/sketch_set and Edit Boundary work). cc_views::region::regions draws a view’s regions in id order over the model and under its annotations (in plans before section marks, tags and grids; elsewhere before detail lines, dimensions and texts): the fill as one Prim::Fill (a region with openings as a cc_geom::polygon::keyhole ring, else triangles), opaque white for masks, a solid pattern’s color, or a nearly clear alpha (still picked) under the pattern lines (hatch::hatch_with_holes, LineStyle::Hatch with the pattern’s color), then the boundary in the style’s pen. DXF puts regions with a boundary on the style’s layer (white is ACI 255). cc_engine::commands::line_style (line_styles_list, line_style_create, line_style_set, line_style_delete with replace_with, default thin, in the same step) and cc_engine::commands::region (filled_region_create, masking_region_create, filled_region_type_create; style codes resolve through detail::style_arg: built-in code, then project style name; element_set takes "boundary": "<code>"/"none"). The app: line_styles_dialog.rs (Annotate → Line Styles, OK/Cancel through graphics_dialog::Edits), region_ui.rs (Annotate → Filled Region/Masking Region start Tool::Sketch with the region category, sketched by sketch_mode::canvas in any view hosts_cad accepts, with no level; finish runs the create command for the active view; properties and the type’s Fill section), and detail_ui::style_picker lists built-in and project styles (DetailOptions::style is a LineStyleRef).cc_core::fill_pattern: Project::fill_patterns (FillPatternId → FillPattern: unique name that is no built-in code, description, FillPatternKind::Drafting (paper mm) or Model (real mm), scale, PatternLine families of angle, origin, offset [along, across] and dashes; bounded by MAX_*, MIN_OFFSET, MIN_PERIOD) is tracked as settings (EditCtx::fill_patterns_mut; format 25). Pattern::Custom(id) (Pattern::ALL stays the 13 built-ins; the shader and the 3D view read a custom pattern as none, the material’s plain color) is used by material fills, TypeData::FilledRegion, component sheet hatches and view/phase overrides; PatternSlot visitors (visit_material, visit_type, visit_view_graphics, visit_phase_graphics, Project::visit_patterns) find them for pattern_usage, deletion with a replacement and repair (repair_fill_patterns drops invalid families and clears references to missing patterns). cc_core::pat reads and writes .pat text (bounded, per-pattern errors with line numbers, ;%UNITS=/;%TYPE= markers). cc_views::hatch::hatch_in/hatch_with_holes_in take the project’s patterns (callers: cut::cut_fill, projected::render’s surface lines, graphics::apply overrides, region::draw_filled, detail_component::draw_pieces); hatch_custom lays dashed families anchored at the origin, drafting patterns at paper_unit(spacing) per mm and model ones at 0.001 m per mm, skipping families closer than MIN_PAPER_SPACING on paper, capped by MAX_CUSTOM_SEGMENTS. cc_engine::commands::fill_patterns: fill_patterns_list, fill_pattern_get, _create, _set, _duplicate, _delete (replace_with), _import (path or text, names, on_clash, kind, units, scale, preview), _export; pattern_arg resolves a built-in code or a project pattern’s name (filled region types); model values write {"Custom": id}. The app: fill_patterns_dialog.rs (Manage → Fill Patterns, the import dialog, and picker/paint/choices shared by the material browser, region types and graphics_dialog::override_cells).cc_core::detail_component: a ComponentKind::Detail component (category DetailComponent, TypeData::Component) is made only of 2D pieces, the title blocks’ SheetItems in ComponentDef::sheet (chosen over plan_only ComponentItems, which are prisms with no open lines, pens or texts), in meters in its own frame (text heights too; pen weights paper millimeters): SheetShape::Stroke gained pattern and a closed stroke’s hatch (PatternFill, drawn as a filled region’s; title blocks ignore both) and SheetShape::Nested places another detail component by name (its first type’s values; Project::detail_def, detail_nests), refused in title blocks by repair_def. ComponentDef::resolve_2d resolves the pieces of either kind (resolve_sheet adds the paper and drops nested pieces) and walk visits an element’s pieces and its nested ones through a Place (similarity: scale, then PlanTransform), with a cycle guard (the stack of names), MAX_DEPTH, MAX_VISITS and MAX_POINTS. ElementKind::DetailComponent(DetailComponent) (view, position, rotation_deg, scale in MIN_SCALE..=MAX_SCALE, mirrored across its X axis before turning, overrides) is view-owned like detail lines (removed with the view, no phase, no 3D, no IFC); Element::transform composes its placement. cc_views::detail_component draws a view’s components after its regions (draw_pieces: pictures, strokes with fills, texts) and dxf_blocks turns them into cc_views::dxf::DxfBlocks for to_dxf_with (a block per component, or per element with overrides; nested pieces as inserts unless they would close a cycle; the elements’ own primitives skipped). .ccomp files carry what a detail component nests (ComponentFile::nested; types_for adds those the project lacks by name). cc_cad::Limits::keep_blocks keeps inserts that place a block by a similarity as CadInserts (CadRead::inserts) and reads each block used on its own (CadRead::kept, base at the origin, nested references kept, cycles dropped by drop_cycles, MAX_INSERTS); other inserts, anonymous blocks and dimensions stay flattened. cc_engine::commands::detail_component: detail_component_create (from pieces, or from a view’s detail lines, regions, text notes and detail components with origin, replace default true), detail_component_place, element_set checks (check), cad_blocks/insert_place for cad_import blocks: true (one undo step: the drawing if anything is left, a type per block, an element per insert); component_sheet_piece_* edit detail components’ pieces too (check_nested refuses cycles). The app (detail_component_ui.rs): Annotate → Detail Component (Tool::DetailComponent, options in AppState::detail_component, preview of the lines), Create Detail Component (UiCommand::CreateDetailComponent, names Detail N), the properties rows, the Blocks as components preference (Preferences::cad_blocks, Preferences → General → Import); the component environment refuses detail components (pieces are edited with commands).cc_core::title_block: a title block is a ComponentKind::TitleBlock component (category TitleBlock, TypeData::Component, created with title_block_create and a copy of the standard block in every project) whose ComponentDef::sheet holds 2D SheetItems (Stroke, Text, Image pieces; fields are cc_core::expr expressions in paper millimeters from the bottom-left corner, reading the parameters and SheetWidth/SheetHeight); ComponentDef::resolve_sheet(paper) returns the drawable pieces plus per-piece errors (bounded; repair drops pieces past the limits and wrong kinds), and cc_views::sheet::compose_sheet draws them for the sheet’s paper in place of the old fixed border and block. A sheet’s ViewKind::Sheet keeps title_block (a type, or none for blank paper), fields (values of the block’s text parameters marked instance, its per-sheet fields) and issue_date; texts hold {fields} that cc_views::sheet_fields expands (sheet, project, project:<Name> from ProjectInfo::fields, param:<Name>, today’s and the issue date formatted by cc_engine::i18n::format_date). Format 22 (main took 21) gives older files the standard block, translated through the template keys (tpl-tb-*), and points every sheet at it (persist::from_ron_with_repairs_localized). Pictures are RasterImages kept in the piece (size-bounded, base64 in files and .ccomp); commands and queries show only a summary of them. Engine commands in cc_engine::commands::sheets (sheet_set, sheet_fields, title_block_create, component_sheet_piece_add/set/delete, project_info_set fields). The app: sheet properties and the project fields table in Project Information, and title_block_env.rs, the title block editor, which reuses the component environment with one Sheet view (preview paper, edge reference planes, SheetEditor), the Lines (sketch mode Target, points on edges or planes written as expressions), Text and Image tools, selection and grips, and writes everything through component_* commands.