cc_core API← API reference · Generated from the source by cargo run -p api_doc; edit the doc comments, not this page.
Core BIM data model for ConstructCraft.
The Project is the single source of truth. Every view, schedule and
sheet is a query over it; all geometry is derived. Edits go through
Document::edit, which records a Transaction for undo/redo.
| Module | Items | Summary |
|---|---|---|
cc_core |
0 | Core BIM data model for ConstructCraft. |
cc_core::arc |
4 | Circular arcs in plan, described like polyline arcs by their two ends and a bulge: tan(sweep / 4), positive when the arc turns counter-clockwise from the start to the end, 0 for a straight line, ±1 for a half circle. |
cc_core::bar_marks |
20 | Bar marks: the names (N1, N2…) bending schedules and bar tags give the bars of reinforcement, one per bar shape: the same diameter, steel grade and shape (legs, radii, bends and hooks, within a length tolerance and ANGLE_TOLERANCE_DEG, read from either end or mirrored). |
cc_core::bar_tag |
5 | Bar tags: annotations that write a reinforcement set’s bars in a plan, an elevation or a section — 25 N1 Ø12.5 c/12 C=500: the count, the mark, the diameter in millimeters, the spacing in centimeters (sets without one leave it out) and the length of one bar in centimeters (C=var when the set’s bars differ). |
cc_core::bracing |
11 | Parametric bracing: a host element that holds the parameters of the braces of one bay of a frame (the bay line between two column axes, the storey height, the number of storeys, the pattern and the brace type) and owns the ordinary beams made from them, kept in step like a truss’s (see crate::member_host). |
cc_core::browser |
13 | Project browser organization: named schemes that group the views of the project browser by view type, level, discipline or phase, in that order of nesting. |
cc_core::cad |
20 | Imported CAD drawings (DWG and DXF underlays). |
cc_core::callout |
5 | Crop regions and callouts. |
cc_core::component |
25 | Parametric components: user-defined objects (furniture, fixtures, casework…) whose solids are sized by named parameters. |
cc_core::component_file |
14 | .ccomp component files: a component definition with all its types and the materials it uses, to share components between projects. |
cc_core::component_ref |
13 | Reference planes, reference lines and labeled dimensions of a component: the skeleton that parameters drive and pieces follow. |
cc_core::component_script |
15 | Scripted component pieces: the model side. |
cc_core::connection |
7 | Steel and timber connections: an element at one end of a column or beam (member, end) of a standard kind, whose plates and bolts cc_geom::connection derives from the member’s geometry on every build. |
cc_core::curtain |
20 | Curtain walls: walls made of a grid of panels and mullions. |
cc_core::design_option |
4 | Design options: alternative sets of elements within one project. |
cc_core::detail |
9 | Detail lines: view-specific 2D curves (lines, arcs, circles and whole or partial ellipses, the SketchCurve geometry) drawn in one view with a line style. |
cc_core::detail_component |
14 | Detail components: reusable 2D components for construction details. |
cc_core::dim_line |
7 | The dimension line of linear and aligned dimensions: lining it up with the lines of other dimensions, and chains of dimensions that share one line (continuous dimensioning). |
cc_core::dim_refs |
5 | Associative dimensions: each end of a dimension may reference a point of an element (stored in that element’s own frame, plus a height in elevations and sections) or a level. |
cc_core::dim_style |
4 | How a dimension type draws its dimensions: the marks at the ends of the dimension line, the witness lines, the pens and the text around the value. |
cc_core::document |
3 | |
cc_core::element |
36 | |
cc_core::element::slab_bars |
3 | Limits of slab reinforcement. |
cc_core::element::wall_bars |
5 | Limits of wall reinforcement. |
cc_core::expr |
6 | Arithmetic expressions over named parameters, used by component geometry: numbers, parameter names, + - * / ^, parentheses, unary minus and the functions min, max, abs, sqrt, round, floor, ceil, sin, cos, tan (degrees). |
cc_core::fill_pattern |
22 | The project’s own fill patterns (hatches): families of parallel, possibly dashed lines, as in the plain-text .pat format CAD programs share (see crate::pat). |
cc_core::graph_binding |
2 | Elements made by visual programming graphs. |
cc_core::graphics |
14 | View graphics: what a view shows and how it draws it. |
cc_core::grid |
8 | Grid naming and alignment. |
cc_core::ids |
1 | |
cc_core::level_mark |
5 | Level marks: annotations that write the elevation of a point in a plan, an elevation or a section — the finished level above a shelf line and the raw (structural) level under it. |
cc_core::lightning |
8 | Lightning protection: the conductors of a lightning protection system (on the roof, down the walls and in the ground) and the protection classes the coverage check uses. |
cc_core::mass |
7 | Conceptual masses: volumes for massing studies. |
cc_core::material |
16 | Materials: identity data, graphics in views (shading, transparency, surface and cut patterns), render appearance and physical properties. |
cc_core::member_host |
5 | Member hosts: elements with no geometry of their own (steel buildings, trusses, bracings, wall framings) that own ordinary columns and beams laid out from their parameters. |
cc_core::mep |
16 | Building services (MEP): plumbing, electrical, structured cabling and lightning protection systems, the pipe, conduit and cable tray segments that run them, the valves on pipes, and the data that makes a component a plumbing fixture or an electrical, communications or lightning protection device. |
cc_core::openings |
11 | Doors and windows as components: the built-in definitions that the template’s door and window types use and that older files’ door and window types become. |
cc_core::pad |
8 | Building pads: a flat area at an elevation, graded into the terrain that hosts it, with cut and fill slopes running out from its edges to the existing ground. |
cc_core::paint |
4 | Painted faces: a material laid on one surface of an element, over the material its type gives it (a painted wall face, a tiled floor top). |
cc_core::pat |
10 | The plain-text .pat hatch pattern format many CAD programs read and write, as publicly described: text ;%UNITS=MM *NAME, optional description ;%TYPE=MODEL angle, x-origin, y-origin, delta-x, delta-y [, dash1, dash2, ...]rust A header line starting with * opens a pattern; each following line is a family of parallel lines through the origin at the angle (degrees), the next line shifted by delta-x along it and delta-y across it, with optional dashes (positive drawn, negative gaps, zero dots). |
cc_core::persist |
12 | .ccad project files: a versioned RON document. |
cc_core::phase |
10 | Construction phases (renovation work). |
cc_core::pile |
29 | Piles and pile caps. |
cc_core::profile |
14 | Profiles of component pieces: closed outlines of straight segments, arcs and parts of ellipses drawn on one of the component’s planes (plan, front or side), with every coordinate an crate::expr expression, and the solids made from them: an extrusion across the plane or a revolution about an axis in it. |
cc_core::profile_catalog |
6 | Built-in profile catalogs: the standard series of rolled, cold-formed, timber and hollow sections, as tables (cells split by ;, since the designations write decimals with a comma) compiled into the binary and parsed once. |
cc_core::profile_sweep |
7 | Swept profiles: a closed profile, held by the element’s type, carried along a path drawn in plan at a height above the element’s level. |
cc_core::profiles_project |
7 | Structural profiles in the project: lookups and repair of loaded files. |
cc_core::project |
9 | |
cc_core::properties |
6 | Property and quantity sets carried over from IFC files: named sets of named values, each value keeping its IFC measure type. |
cc_core::ramp |
7 | Ramps: the plan shapes of a ramp element and the accessibility rules of its type (steepest slope, highest rise of one flight, shortest landing). |
cc_core::raster |
6 | Raster images kept in a project (imported pictures, scanned drawings): the file’s own bytes, unchanged, with the format and pixel size. |
cc_core::recovery |
9 | Crash recovery: while a project has unsaved changes, a copy of it is written now and then to a recovery folder, so a crash (or a power cut) loses at most the last few minutes of work. |
cc_core::region |
3 | Regions: 2D areas drawn in one view, owned by it like detail lines and text notes (Element::owner_view), in the view’s drawing coordinates (meters). |
cc_core::render_settings |
28 | Per-view settings of photorealistic rendering (path tracing). |
cc_core::repair |
0 | Repair of projects read from files, which may be damaged or crafted: invalid numbers and dangling references are removed or reset so the rest of the program can rely on a consistent model. |
cc_core::roofing |
5 | Roof coverings and framing. |
cc_core::scale |
4 | Drawing scales as people read them: 1:50 in metric projects, the customary 1/4" = 1'-0" in imperial ones. |
cc_core::schedule |
15 | Schedule definitions: which fields a schedule shows, how rows are filtered, sorted and grouped, how each column is formatted and how the table looks on paper. |
cc_core::section_props |
1 | Geometric properties of a section outline (area, centroid, second moments, moduli, radii of gyration, torsion constant, mass per length), computed exactly for the polygon with Green’s theorem. |
cc_core::shaft |
3 | Shaft openings: a vertical opening with an outline in plan, from its level (plus base_offset) up to a level or a height, that cuts every floor, ceiling and roof it passes through. |
cc_core::site |
7 | Where the project stands on Earth: the geographic position of the project origin, its height above sea level, the direction of true north and the parts of its postal address, plus the conversion between latitude/longitude and the project’s own coordinates (meters) used to bring map data in. |
cc_core::sketch |
7 | Sketches: the curves an outline is drawn with (lines, arcs, circles and ellipses; rectangles and polygons are drawn as lines). |
cc_core::sketch_edit |
13 | Editing the curves of a sketch: where two curves (or the lines, circles and ellipses they lie on) cross, a curve trimmed or extended to a point, split in two, and offset alone or along the chain of curves joined to it. |
cc_core::spline |
21 | Splines of sketches: a chain of cubic Bézier segments, kept as their control points p0 c1 c2 p1 c1 c2 p2 … (3n + 1 points for n segments). |
cc_core::stair |
19 | Stairs: the plan shapes of a stair element, how its type is built (solid, cast in place, assembled) and the rules that size its steps (riser limits and Blondel’s formula 2 × riser + tread). |
cc_core::steel_building |
22 | Parametric steel buildings: a host element that holds the parameters of a steel shed (span, eave height, roof slope and shape, bays, the types of its members, purlins and girts) and owns ordinary columns and beams made from them. |
cc_core::structural_material |
1 | The structural material of a column or beam type: concrete, steel (rolled or cold-formed) or timber. |
cc_core::structural_profile |
16 | Structural profiles: the cross-sections of columns, beams and framing members as named project objects (Project::profiles). |
cc_core::sun |
32 | The sun of a view: where it stands in the sky for a date, a time and the project’s site, and the settings each view keeps to place it. |
cc_core::sweep |
8 | Sweeps and blends of component pieces. |
cc_core::template_spec |
6 | The sizes and names that differ between the metric and the imperial templates. |
cc_core::title_block |
28 | Title blocks: components of kind ComponentKind::TitleBlock whose 2D pieces (ComponentDef::sheet) draw a whole sheet (border, title block, logo) in paper millimeters, origin at the paper’s bottom-left corner. |
cc_core::topography |
11 | Terrain: a topography surface from measured points (x, y, z) inside a closed boundary drawn in plan. |
cc_core::transform |
1 | Rigid transforms in plan (move, rotate, mirror) applied to elements. |
cc_core::truss |
21 | Parametric trusses: a host element that holds the parameters of a plane truss (its span line, shape, height, web pattern, panels, member types and copies) and owns the ordinary beams (chords, diagonals) and columns (verticals) made from them, kept in step like a steel building’s (see crate::member_host). |
cc_core::types |
16 | |
cc_core::units |
13 | Project units: how lengths, areas, volumes, angles, slopes and money are displayed and typed. |
cc_core::view |
18 | |
cc_core::wall_framing |
12 | Light steel and wood framing of walls: a host element attached to one straight wall that owns ordinary columns (studs, king and jack studs, cripples) and beams (tracks or plates, headers, sills, blocking) laid out from its parameters, its wall and the doors and windows the wall hosts. |
cc_core::wall_ops |
7 | Geometry edits of linear elements (walls, beams, grids): trim or extend to a corner or to a reference line, split, offset and align. |
cc_corecrates/cc_core/src/lib.rs
Re-exports
pub use template_spec::Defaultspub use cad::{CadColorMode, CadDrawing, CadImport, CadLayer, CadPrim, CadUnit}pub use callout::{Callout, CropBox}pub use component::{ ComponentDef, ComponentItem, ComponentKind, ComponentParam, ComponentShape, DoorOperation, ParamKind, ResolveCtx, SymbolLine, WindowOperation, }pub use component_ref::{PlaneAxis, RefDimension, RefEqual, RefLine, RefPlane}pub use component_script::{Hotspot, HotspotShape, ParamChoice, ScriptEval, ScriptInput, ScriptOwner, ScriptResult}pub use connection::{Connection, ConnectionKind, ConnectionParams, MemberEnd}pub use design_option::{DesignOption, OptionSet}pub use detail::{DetailLine, DetailStyle, LineStyleDef, LineStyleRef}pub use detail_component::DetailComponentpub use dim_refs::{DimRef, Projection, RefAnchor, RefHeight, RefTarget}pub use document::{Document, EditCtx, Transaction}pub use element::{ BarEnd, BarFace, Beam, BeamLateral, BeamVertical, Ceiling, Column, Component, Dimension, DimensionKind, Element, ElementKind, FaceBars, Floor, Foundation, FoundationShape, Grid, Hosted, Leader, LeaderSymbol, LocationLine, Railing, Ramp, Rebar, RebarLayout, Roof, RoofShape, Room, ShapedRebar, SpacingZone, Splice, Stair, TextNote, Wall, WallSide, WallTop, slab_bars, wall_bars, }pub use fill_pattern::{FillPattern, FillPatternKind, PatternLine}pub use graphics::{ CategoryGraphics, FillGraphics, FilterOp, FilterParam, FilterRule, FilterUse, GraphicOverride, LineGraphics, LinePattern, TemplateIncludes, TemporaryVisibility, ViewFilter, ViewGraphics, ViewTemplate, }pub use ids::{ BrowserSchemeId, ElementId, ElementTypeId, FillPatternId, FilterId, GroupId, LevelId, LineStyleId, OptionId, OptionSetId, PhaseFilterId, PhaseId, ProfileId, SystemId, TemplateId, Uid, ViewId, }pub use lightning::{ConductorRole, LightningConductor, LpsClass}pub use material::{Material, MaterialClass, Pattern, PatternFill}pub use mep::{DeviceKind, MepData, MepSegment, MepSystem, SystemClass, SystemKind, TrayStyle, Valve, ValveKind}pub use persist::{ FORMAT_VERSION, PersistError, from_ron, from_ron_with_repairs, from_ron_with_repairs_localized, load, load_with_repairs, load_with_repairs_localized, read_to_string_limited, save, to_ron, }pub use phase::{Phase, PhaseDisplay, PhaseFilter, PhaseGraphics, PhaseState, PhaseStatus}pub use profile::{ProfilePoint, SketchPlane}pub use project::{ Group, Level, Project, ProjectField, ProjectInfo, can_join_geometry, join_priority, template_default, }pub use ramp::{RampCheck, RampIssue, RampLayout, RampRules, RampShape, ramp_flights}pub use region::Regionpub use render_settings::{RenderEnvironment, RenderSettings, ToneMap}pub use schedule::{ BendingOptions, ColumnAlign, ColumnFormat, ScheduleAppearance, ScheduleDef, ScheduleField, ScheduleFilter, SortLevel, }pub use section_props::SectionPropertiespub use stair::{ LandingBeams, LandingPosts, PostAt, StairBuild, StairCheck, StairConstruction, StairIssue, StairLayout, StairRailing, StairRules, StairShape, StairSide, Stringers, TreadRule, Turn, stair_steps, }pub use structural_material::StructuralMaterialpub use structural_profile::{ProfileDef, ProfileMaterial, ProfileShape, SectionOutline}pub use sun::{SunDate, SunInterval, SunMode, SunPreset, SunSettings, SunSite, SunState}pub use transform::PlanTransformpub use types::{ Category, ColumnSection, ElementType, FoundationKind, Layer, LayerFunction, SectionShape, StripHaunch, TypeData, TypeInfo, WallFunction, stair_layout, }pub use units::{AreaUnit, LengthUnit, MeasurementSystem, NumberStyle, SlopeUnit, Units, VolumeUnit}pub use view::{ CameraState, DetailLevel, Direction, Looking, MAX_PAPER_MM, MAX_SECTION_SEGMENT, MIN_PAPER_MM, MepDiscipline, ShadingSettings, SheetSize, Underlay, UnderlayLevel, UnderlayPlan, View, ViewCategory, ViewKind, Viewport, VisualStyle, }pub use glam::{DVec2, DVec3}cc_core::arccrates/cc_core/src/arc.rs
Circular arcs in plan, described like polyline arcs by their two ends and
a bulge: tan(sweep / 4), positive when the arc turns counter-clockwise
from the start to the end, 0 for a straight line, ±1 for a half circle.
A bulge is unchanged by moving, rotating or scaling the ends, and by a
mirror that also swaps them.
Items: MAX_BULGE · Arc · segments · ARC_STEP
MAX_BULGEpub const MAX_BULGE: f64
Largest bulge accepted: a sweep of about 337°, short of a full circle.
Arcpub struct Arc
A circular arc from start_angle turning by sweep radians
(counter-clockwise when positive) around center.
Traits: Debug, Clone, Copy, PartialEq
Fields
center: DVec2radius: f64start_angle: f64sweep: f64Methods
pub fn from_bulge(a: DVec2, b: DVec2, bulge: f64) -> Option<Arc>
The arc from a to b with bulge; None when it is a straight
line (no bulge), or the ends coincide or are not finite.
pub fn bulge_through(a: DVec2, m: DVec2, b: DVec2) -> Option<f64>
Bulge of the arc from a through m to b; None when the points
are (nearly) collinear, coincide, or m is not between the ends.
pub fn bulge_tangent(a: DVec2, tangent: DVec2, b: DVec2) -> Option<f64>
The arc tangent to tangent at a ending at b (a tangent arc),
as a bulge; None when b lies on the tangent line.
pub fn bulge_radius(a: DVec2, b: DVec2, radius: f64, ccw: bool, major: bool) -> Option<f64>
The arc of radius from a to b, as a bulge: the shorter arc, or the
longer one when major, turning counter-clockwise when ccw. None when
the radius is less than half the distance between the ends.
pub fn sign(&self) -> f64
Turning direction: 1 counter-clockwise, -1 clockwise.
pub fn length(&self) -> f64pub fn angle_at(&self, u: f64) -> f64
Angle of the point u along the arc from its start.
pub fn point(&self, u: f64) -> DVec2
Point u along the arc from its start (beyond the ends it continues on the circle).
pub fn tangent(&self, u: f64) -> DVec2
Unit direction of travel at u.
pub fn at(&self, u: f64, v: f64) -> DVec2
Point u along the arc and v to the left of it (on a concentric circle).
pub fn radius_at(&self, v: f64) -> f64
Radius of the concentric circle v to the left of the arc.
pub fn locate(&self, p: DVec2) -> (f64, f64)
Position of p in the arc’s frame: distance along the arc from its
start (negative before it, past length after it; measured to the
nearer side of the gap of the circle) and distance to the left.
pub fn points(&self, u0: f64, u1: f64, v: f64, max_step: f64) -> Vec<DVec2>
The arc between u0 and u1 along it (either order), as points at
most max_step radians apart (at least two points).
pub fn bulge_between(&self, u0: f64, u1: f64) -> f64
The bulge of the part of this arc between u0 and u1.
segmentspub fn segments(angle: f64, max_step: f64) -> usize
Number of segments for a span of angle radians, each at most max_step.
ARC_STEPpub const ARC_STEP: f64
Default angular step for drawing and meshing arcs: 3°.
cc_core::bar_markscrates/cc_core/src/bar_marks.rs
Bar marks: the names (N1, N2…) bending schedules and bar tags give the
bars of reinforcement, one per bar shape: the same diameter, steel grade
and shape (legs, radii, bends and hooks, within a length tolerance and
ANGLE_TOLERANCE_DEG, read from either end or mirrored).
Marks are derived (cc_geom::bar_marks resolves them, a pure
function): a set’s bar_mark override names all its bars; otherwise a
bar whose shape matches an entry of the frozen marks table
(BarMarking::frozen, in table order) takes its mark; the shapes left
are numbered on the fly with the prefix, after the highest frozen number
(and from start), in a stable order: partition, then diameter
descending, then length descending, then shape. So every bar has a mark,
and frozen marks never shift when the model changes. Freezing writes the
marks shown into the table; renumbering clears it and freezes a fresh
numbering.
The settings live in crate::Project::bar_marking (tracked as project
settings) with the stock_length bars are bought in (bars longer than it
need splices).
Items: DEFAULT_PREFIX · DEFAULT_START · MAX_START · DEFAULT_LENGTH_TOLERANCE · MIN_LENGTH_TOLERANCE · MAX_LENGTH_TOLERANCE · ANGLE_TOLERANCE_DEG · DEFAULT_STOCK_LENGTH · MAX_FROZEN · MAX_MARK_LEGS · MAX_MARK_LENGTH · MAX_MARK_TEXT · MIN_STOCK_LENGTH · MAX_STOCK_LENGTH · BarMarking · FrozenMark · MarkShape · MarkLeg · tolerance_ok · stock_length_ok
DEFAULT_PREFIXpub const DEFAULT_PREFIX: &str
Prefix of numbered marks when none is set.
DEFAULT_STARTpub const DEFAULT_START: u32
First number when none is set.
MAX_STARTpub const MAX_START: u32
Largest first number.
DEFAULT_LENGTH_TOLERANCEpub const DEFAULT_LENGTH_TOLERANCE: f64
Legs of two bars of one mark differ by at most this when none is set, meters.
MIN_LENGTH_TOLERANCEpub const MIN_LENGTH_TOLERANCE: f64
Smallest and largest length tolerance, meters.
MAX_LENGTH_TOLERANCEpub const MAX_LENGTH_TOLERANCE: f64
ANGLE_TOLERANCE_DEGpub const ANGLE_TOLERANCE_DEG: f64
Turns of two bars of one mark differ by at most this, degrees.
DEFAULT_STOCK_LENGTHpub const DEFAULT_STOCK_LENGTH: f64
Length bars are bought in when none is set, meters.
MAX_FROZENpub const MAX_FROZEN: usize
Most entries of the frozen marks table.
MAX_MARK_LEGSpub const MAX_MARK_LEGS: usize
Most legs of a frozen shape (bars of more legs are numbered, not frozen).
MAX_MARK_LENGTHpub const MAX_MARK_LENGTH: f64
Longest leg or radius a frozen shape keeps, meters.
MAX_MARK_TEXTpub const MAX_MARK_TEXT: usize
Longest prefix or mark, in characters.
MIN_STOCK_LENGTHpub const MIN_STOCK_LENGTH: f64
Shortest and longest stock length, meters.
MAX_STOCK_LENGTHpub const MAX_STOCK_LENGTH: f64
BarMarkingpub struct BarMarking
How bars are marked: the numbering and the frozen marks table.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize, Default
Fields
prefix: String
Text before the number of numbered marks (e.g. “N” for N1, N2…).
start: u32
The first number given.
length_tolerance: f64
Legs (and radii) of bars of one mark differ by at most this, meters.
stock_length: f64
Length bars are bought in, meters: longer bars need splices.
frozen: Vec<FrozenMark>
Marks kept for their shapes, in order: a bar takes the first that matches it.
Methods
pub fn is_default(&self) -> bool
Whether nothing differs from the defaults (files leave it out).
pub fn number_of(&self, mark: &str) -> Option<u32>
The number of a mark written with the prefix (N12 → 12), if it is one.
pub fn mark_of(&self, n: u32) -> String
The mark of number n.
pub fn check(&self) -> Option<String>
Why the values cannot be kept (None: they can): the checks
Self::repair applies, as a message.
pub fn repair(&mut self) -> usize
Bring the values into range (a long prefix cut, bad numbers reset to their defaults, unusable or extra frozen entries dropped); returns how many changed.
FrozenMarkpub struct FrozenMark
A mark kept for one bar shape.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
mark: Stringdiameter: f64
Bar diameter, meters.
grade: String
Steel grade (empty: none).
shape: MarkShapeMethods
pub fn is_valid(&self) -> bool
Whether the entry is usable: a mark of 1 to MAX_MARK_TEXT
characters, a finite diameter above 0, a usable shape.
MarkShapepub struct MarkShape
A bar shape in a compact canonical form: open or closed, its legs in
order (the orientation cc_geom::bar_marks picks among the readings
from either end, mirrored and, for closed bars, from any corner).
Traits: Debug, Clone, PartialEq, Default, Serialize, Deserialize
Fields
closed: boollegs: Vec<MarkLeg>Methods
pub fn is_valid(&self) -> bool
Whether the shape is usable: one to MAX_MARK_LEGS legs of finite
lengths above 0 and at most MAX_MARK_LENGTH, radii likewise,
turns within a whole turn either way.
pub fn length(&self) -> f64
Length of the bar, meters.
MarkLegpub struct MarkLeg
One leg of a MarkShape: its length (meters), the radius of an arc
leg, the turn along an arc and the bend after the leg (degrees, signed
the way the bar first turns), and whether it is part of a hook.
Traits: Debug, Clone, Copy, PartialEq, Default, Serialize, Deserialize
Fields
length: f64radius: Option<f64>sweep: f64bend: f64hook: booltolerance_okpub fn tolerance_ok(v: f64) -> bool
Whether v is a usable length tolerance.
stock_length_okpub fn stock_length_ok(v: f64) -> bool
Whether v is a usable stock length.
cc_core::bar_tagcrates/cc_core/src/bar_tag.rs
Bar tags: annotations that write a reinforcement set’s bars in a plan,
an elevation or a section — 25 N1 Ø12.5 c/12 C=500: the count, the
mark, the diameter in millimeters, the spacing in centimeters (sets
without one leave it out) and the length of one bar in centimeters
(C=var when the set’s bars differ). A multiplier writes 2x first,
for sets repeated on both faces. The text is derived each time
(cc_views::bar_tags), from the set’s bars and marks.
Like text notes, a tag lives in one view (view); it goes with that view
and with its set.
Items: MAX_MULTIPLIER · DEFAULT_TEXT_SIZE · BarTagParts · BarTag · repair_type
MAX_MULTIPLIERpub const MAX_MULTIPLIER: u32
Largest multiplier.
DEFAULT_TEXT_SIZEpub const DEFAULT_TEXT_SIZE: f64
Text size of the default type, paper millimeters.
BarTagPartspub struct BarTagParts
The parts of a tag’s text that are written.
Traits: Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default
Fields
count: boolmark: booldiameter: boolspacing: boollength: boolBarTagpub struct BarTag
A bar tag in a view.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
view: ViewIdset: ElementId
The reinforcement set (or shaped bars) tagged.
position: DVec2
Where the text starts (its left end, on the baseline), in the view’s drawing coordinates.
leader: Option<DVec2>
Where a leader from the text points (none: no leader).
rotation_deg: f64
The text’s angle, degrees counter-clockwise.
multiplier: u32
How many times the set is repeated (2 writes 2x first; 1: nothing).
parts: BarTagPartsMethods
pub fn new(view: ViewId, set: ElementId, position: DVec2) -> Selfpub fn is_valid(&self) -> bool
Whether its points are finite (a tag without one is dropped).
pub fn repair(&mut self) -> usize
Bring the values into range (points far away reset, a bad angle or multiplier reset); returns how many changed.
pub fn check(&self) -> Option<String>
Why the values cannot be kept (None: they can), as a message.
repair_typepub fn repair_type(text_size: &mut f64) -> usize
Replace an invalid type text size; returns how many changed.
cc_core::bracingcrates/cc_core/src/bracing.rs
Parametric bracing: a host element that holds the parameters of the
braces of one bay of a frame (the bay line between two column axes, the
storey height, the number of storeys, the pattern and the brace type) and
owns the ordinary beams made from them, kept in step like a truss’s (see
crate::member_host).
Local coordinates: x along start → end (the bay, L wide), heights above
the level from base_offset, storey s between s · height and
(s + 1) · height.
Items: LENGTH · HEIGHT · STORIES · BASE_OFFSET · DEFAULT_LENGTH · DEFAULT_HEIGHT · BracingPattern · BracingRole · BracingMember · Bracing · host_type
LENGTHpub const LENGTH: RangeInclusive<f64>
The bay width, column axis to column axis, meters.
HEIGHTpub const HEIGHT: RangeInclusive<f64>
One storey, meters.
STORIESpub const STORIES: RangeInclusive<u32>
BASE_OFFSETpub const BASE_OFFSET: RangeInclusive<f64>
The foot of the lowest storey above the level, meters.
DEFAULT_LENGTHpub const DEFAULT_LENGTH: f64
DEFAULT_HEIGHTpub const DEFAULT_HEIGHT: f64
BracingPatternpub enum BracingPattern
How the braces cross a storey of the bay.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
V
Two braces from the top corners down to the middle of the bay.
Chevron
Two braces from the bottom corners up to the middle of the bay (an inverted V).
Diagonal
One brace from a bottom corner to the opposite top corner.
X
Both diagonals.
K
Four braces from the mid-height of each column to the middle of the bay at the top and at the bottom of the storey.
Methods
pub const ALL: [BracingPattern; 5]pub fn code(self) -> &'static strpub fn from_code(code: &str) -> Option<Self>pub fn key(self) -> &'static str
The i18n key of its name.
pub fn per_story(self) -> usize
How many braces it puts in a storey.
BracingRolepub struct BracingRole
A brace’s place: its storey (from the bottom) and its index in the pattern there.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize
Fields
story: u16index: u16Methods
pub fn key(self) -> RoleKeypub fn from_key(key: RoleKey) -> Option<Self>BracingMemberpub struct BracingMember
A brace the bracing manages.
Traits: Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize
Fields
role: BracingRoleid: ElementIdBracingpub struct Bracing
Traits: Debug, Clone, PartialEq, Serialize, Deserialize, MemberHost
Fields
start: DVec2
The bay in plan: the axes of its two columns.
end: DVec2base_offset: f64
The foot of the lowest storey above the level, meters.
height: f64
One storey, meters.
stories: u32
Storeys braced, one above the other.
pattern: BracingPatternflip: bool
A diagonal rises toward the start instead of the end.
alternate: bool
Diagonals change direction storey by storey (a zigzag).
brace_type: ElementTypeId
The beam type of the braces.
members: Vec<BracingMember>detached: Vec<BracingRole>Methods
pub fn new(brace_type: ElementTypeId) -> Self
An X bracing of one 3 m storey over a 5 m bay on the x axis, at the level.
pub fn length(&self) -> f64
The bay width.
pub fn total_height(&self) -> f64
Foot to top of all its storeys, meters.
pub fn check(&self) -> Result<(), String>
Whether every number is in its range (the first one that is not, named).
pub fn check_types(&self, project: &Project) -> Result<(), String>
Whether the brace type is a beam type.
pub fn reset_out_of_range(&mut self) -> usize
Put every out-of-range number back to its default; returns how many.
pub fn transform(&mut self, t: &PlanTransform)
Move, turn or mirror it (a mirrored diagonal rises toward the mirrored end).
pub fn layout(&self) -> Vec<(BracingRole, ElementTypeId, ElementKind)>
Its braces: role, type and beam, storey by storey from the bottom.
Empty when a number is out of range (see Bracing::check).
host_typepub fn host_type(id: ElementTypeId, name: String) -> ElementType
The type a project gets with its first bracing.
cc_core::browsercrates/cc_core/src/browser.rs
Project browser organization: named schemes that group the views of the
project browser by view type, level, discipline or phase, in that order
of nesting. The schemes and the one in use are project settings; with no
scheme in use the browser lists the views by type alone.
tree builds what the browser shows: at each depth the views that have
a value for the criterion go into a group per value, and the others (a
section has no level) go on to the next criterion beside those groups.
Items: MAX_SCHEMES · MAX_CRITERIA · MAX_NAME · DEFAULT_GROUPING · GroupBy · Discipline · BrowserScheme · BrowserOrganization · distinct · GroupKey · Node · label · tree
MAX_SCHEMESpub const MAX_SCHEMES: usize
Most schemes a project keeps.
MAX_CRITERIApub const MAX_CRITERIA: usize
Most criteria a scheme nests.
MAX_NAMEpub const MAX_NAME: usize
Longest scheme name, characters.
DEFAULT_GROUPINGpub const DEFAULT_GROUPING: [GroupBy; 1]
The grouping of a project without a scheme in use: by view type.
GroupBypub enum GroupBy
What a level of the browser tree groups the views by.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize
Variants
ViewType
Floor plans, ceiling plans, 3D views, sections, sheets…
Level
The level of a floor or ceiling plan, lowest first.
Discipline
Architecture, structure or a building service (plans only).
Phase
The phase a view shows, earliest first.
Methods
pub const ALL: [GroupBy; 4]pub fn name(self) -> &'static str
Name in commands (view_type, level, discipline, phase).
pub fn from_name(name: &str) -> Option<Self>pub fn key(self) -> &'static str
Translation key of the criterion’s name.
Disciplinepub enum Discipline
The discipline a plan belongs to.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash
Variants
ArchitectureStructureServices(MepDiscipline)Methods
pub fn name(self) -> &'static str
Name in command results (architecture, structure, plumbing…).
pub fn key(self) -> &'static str
Translation key of the discipline’s name.
pub fn of(view: &View) -> Option<Self>
The discipline of a view: plans have one, other views none.
BrowserSchemepub struct BrowserScheme
A named way to group the browser’s views.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
id: crate::BrowserSchemeIdname: Stringgroup_by: Vec<GroupBy>
The criteria, outermost first (no repeats, at most MAX_CRITERIA).
BrowserOrganizationpub struct BrowserOrganization
The project’s browser schemes and the one in use.
Traits: Debug, Clone, PartialEq, Default, Serialize, Deserialize
Fields
schemes: Vec<BrowserScheme>active: Option<crate::BrowserSchemeId>
The scheme the browser follows (None: by view type alone).
Methods
pub fn is_default(&self) -> bool
Nothing to save: no schemes, the default in use.
pub fn scheme(&self, id: crate::BrowserSchemeId) -> Option<&BrowserScheme>pub fn in_use(&self) -> Option<&BrowserScheme>
The scheme in use, if any.
pub fn grouping(&self) -> &[GroupBy]
The criteria the browser groups by now.
pub fn repair(&mut self) -> usize
Fix what a crafted file may hold: too many schemes, repeated or zero ids, empty or overlong names, repeated or too many criteria, a scheme in use that does not exist. Returns how many things changed.
distinctpub fn distinct(criteria: &[GroupBy]) -> Vec<GroupBy>
criteria without repeats, cut at MAX_CRITERIA.
GroupKeypub enum GroupKey
What a group of the browser tree stands for.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash
Variants
ViewType(ViewCategory)Level(LevelId)Discipline(Discipline)Phase(PhaseId)Methods
pub fn criterion(self) -> GroupBy
The criterion the group comes from.
Nodepub enum Node
A row of the browser tree.
Traits: Debug, Clone, PartialEq
Variants
Group { key: GroupKey, children: Vec<Node> }View(ViewId)Methods
pub fn view_count(&self) -> usize
How many views the row holds (a view row holds itself).
labelpub fn label(view: &View) -> String
A view’s name in the browser: sheets go by number and name.
treepub fn tree(project: &Project, criteria: &[GroupBy]) -> Vec<Node>
The browser tree of project grouped by criteria, outermost first.
cc_core::cadcrates/cc_core/src/cad.rs
Imported CAD drawings (DWG and DXF underlays).
A CadDrawing is the neutral form cc_cad reads both formats into:
layers and flat primitives (blocks already inserted) in drawing units.
Arcs stay arcs (centers and ends can be snapped to) and are tessellated
only when drawn. A CadImport element places one drawing in one 2D
view: units to meters, an extra scale, a rotation and an insertion point.
The drawing is shared (Arc), so undo steps that change the placement or
the layers do not copy it.
Items: MAX_PRIMS · MAX_POLY_POINTS · MAX_TEXT_CHARS · MAX_COORD · CadUnit · CadColorMode · CadLayer · CadHAlign · CadVAlign · CadPrim · on_paper · text_width · union · CadImage · MAX_IMAGES · CadDrawing · CadImport · CadSnapIndex · CadSnap · aci_color
MAX_PRIMSpub const MAX_PRIMS: usize
Most primitives one drawing may hold (after blocks are inserted).
MAX_POLY_POINTSpub const MAX_POLY_POINTS: usize
Most points of one polyline or fill.
MAX_TEXT_CHARSpub const MAX_TEXT_CHARS: usize
Longest text kept, in characters.
MAX_COORDpub const MAX_COORD: f64
Largest coordinate magnitude accepted, drawing units.
CadUnitpub enum CadUnit
Units a drawing is drawn in.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
MillimetersCentimetersDecimetersMetersKilometersInchesFeetYardsMilesMethods
pub const ALL: [CadUnit; 9]pub fn meters(self) -> f64
Meters in one unit.
pub fn from_insunits(code: i64) -> Option<CadUnit>
The unit of a DXF $INSUNITS code (DWG INSUNITS uses the same
codes); None for unitless (0) and units not listed here.
pub fn code(self) -> &'static str
Short name used by commands (mm, cm, dm, m, km, in, ft, yd, mi).
pub fn from_code(code: &str) -> Option<CadUnit>pub fn key(self) -> &'static str
Translation key of the unit name.
CadColorModepub enum CadColorMode
How an imported drawing is colored.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
Grey
One grey for everything: a background to trace over.
Layers
The colors of the layers and entities (white and very light colors darkened for white paper).
Black
Black, like the model’s linework.
Methods
pub const ALL: [CadColorMode; 3]pub fn key(self) -> &'static strpub fn code(self) -> &'static strpub fn from_code(code: &str) -> Option<CadColorMode>CadLayerpub struct CadLayer
A layer of the drawing.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
name: Stringcolor: [u8; 3]
The layer color (from its color index or true color).
visible: bool
On and thawed in the file.
CadHAlignpub enum CadHAlign
Horizontal alignment of a text at its position.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
LeftCenterRightCadVAlignpub enum CadVAlign
Vertical alignment of a text at its position.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
BaselineBottomMiddleTopCadPrimpub enum CadPrim
A primitive of a drawing, in drawing units. layer indexes
CadDrawing::layers; color is the entity’s own color (None: the
layer’s).
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Variants
Polyline { layer: u32, #[serde(default, skip_serializing_if = "Option::is_none")] color: Option<[u8; 3]>, #[serde(default, skip_serializing_if = "is_false")] closed: bool, pts: Vec<DVec2>, #[serde(default, skip_serializing_if = "Vec::is_empty")] bulges: Vec<f64>, }
Polyline through pts; bulges[i] bends the segment from point i
(tan(sweep / 4), positive counter-clockwise; empty: all straight).
Arc { layer: u32, #[serde(default, skip_serializing_if = "Option::is_none")] color: Option<[u8; 3]>, center: DVec2, radius: f64, start: f64, sweep: f64, }
Circular arc from start (radians) turning by sweep (positive
counter-clockwise; ±τ for a circle).
Text { layer: u32, #[serde(default, skip_serializing_if = "Option::is_none")] color: Option<[u8; 3]>, pos: DVec2, height: f64, #[serde(default)] rotation: f64, text: String, #[serde(default)] h: CadHAlign, #[serde(default)] v: CadVAlign, }
One line of text height tall, rotated by rotation radians.
Fill { layer: u32, #[serde(default, skip_serializing_if = "Option::is_none")] color: Option<[u8; 3]>, pts: Vec<DVec2>, }
Solid fill of a simple outline.
Methods
pub fn layer(&self) -> u32pub fn color(&self) -> Option<[u8; 3]>pub fn bounds(&self) -> Option<(DVec2, DVec2)>
Bounding box in drawing units (arcs by their full circle when that is simpler).
pub fn is_valid(&self) -> bool
Whether every number is finite and within MAX_COORD, with enough points.
on_paperpub fn on_paper(rgb: [u8; 3]) -> [u8; 3]
A file color as drawn on white paper: colors meant for a dark screen (white, yellow, cyan) darkened.
text_widthpub fn text_width(text: &str, height: f64) -> f64
Approximate width of a text line (the proportion used for notes).
unionpub fn union(a: Option<(DVec2, DVec2)>, b: Option<(DVec2, DVec2)>) -> Option<(DVec2, DVec2)>
Merge two optional boxes.
CadImagepub struct CadImage
A raster image laid on the drawing: pixel (0, 0) is the top-left corner
of the parallelogram origin + s·u + t·v (s, t in 0..1), whose
bottom-left corner is origin, u running along the image’s width and
v up its height (drawing units).
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
layer: u32origin: DVec2u: DVec2v: DVec2image: std::sync::Arc<crate::raster::RasterImage>Methods
pub fn corners(&self) -> [DVec2; 4]
Corners in order: bottom-left, bottom-right, top-right, top-left.
pub fn is_valid(&self) -> bool
Whether the placement is finite, not flat, and the image usable.
pub fn bounds(&self) -> Option<(DVec2, DVec2)>
MAX_IMAGESpub const MAX_IMAGES: usize
Most images one drawing may hold.
CadDrawingpub struct CadDrawing
A drawing read from a DWG, DXF, SVG or PDF file, or an imported picture.
Traits: Debug, Clone, PartialEq, Default, Serialize, Deserialize
Fields
layers: Vec<CadLayer>prims: Vec<CadPrim>images: Vec<CadImage>
Pictures, drawn under the primitives.
extents: Option<(DVec2, DVec2)>
Extents of the primitives (min, max), drawing units.
units: Option<CadUnit>
Units the file declares (None: unitless).
Methods
pub fn compute_extents(&mut self)
Recompute CadDrawing::extents from the primitives.
pub fn layer_of(&self, prim: &CadPrim) -> Option<&CadLayer>
The layer of a primitive.
pub fn needs_repair(&self) -> bool
Whether CadDrawing::repair would change anything.
pub fn repair(&mut self) -> usize
Remove invalid primitives and dangling layer references; returns how many were fixed.
CadImportpub struct CadImport
A DWG or DXF drawing placed in one 2D view, in that view’s drawing
coordinates (like text notes): drawing point p lands at
position + R(rotation)·M·(p · units · scale), M mirroring across
the drawing’s X axis when mirrored.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
view: ViewIdname: String
Name of the file it was read from (for display).
drawing: std::sync::Arc<CadDrawing>units: CadUnit
Units of the drawing.
scale: f64
Extra scale on top of the units.
position: DVec2
Where the drawing’s origin lands, view coordinates (meters).
rotation_deg: f64
Rotation in degrees counter-clockwise.
mirrored: boolhidden_layers: BTreeSet<String>
Layers hidden in this view (by name).
color_mode: CadColorModehalftone: bool
Drawn faded (mixed with white).
Methods
pub fn factor(&self) -> f64
Meters per drawing unit, scale included.
pub fn placement(&self) -> PlanTransform
The rigid part of the placement (rotation, mirror, position).
pub fn to_view(&self, p: DVec2) -> DVec2
A drawing point in view coordinates.
pub fn to_drawing(&self, q: DVec2) -> DVec2
A view point in drawing units (inverse of CadImport::to_view).
pub fn layer_visible(&self, index: u32) -> bool
Whether layer index is shown.
pub fn transform(&mut self, t: &PlanTransform)
Move, rotate or mirror the placement.
pub fn is_valid(&self) -> bool
Whether the placement’s numbers are usable.
pub fn snap_features(&self, q: DVec2, r: f64) -> CadSnap
Snap features of the visible primitives near q (view coordinates)
within r: endpoints and vertices, midpoints, arc centers, and
segments, all in view coordinates.
pub fn snap_features_in(&self, index: &CadSnapIndex, q: DVec2, r: f64) -> CadSnap
CadImport::snap_features with the drawing’s primitives found
through index, built from this element’s drawing (callers keep it
while the drawing is the same, so a pointer move visits only the
primitives near it). Long polylines give only their segments near q.
CadSnapIndexpub struct CadSnapIndex
Where a drawing’s primitives lie, to find those near a point without visiting them all: snapping asks on every pointer move, and imported drawings hold up to a million primitives. A uniform grid over the drawing’s extents; primitives spanning many cells are kept apart and checked on every query.
Traits: Debug, Clone, Default
Some fields are private.
Methods
pub fn new(drawing: &CadDrawing) -> Selfpub fn near(&self, p: DVec2, r: f64) -> Vec<usize>
Indices, in ascending order, of the primitives whose bounds come
within r of p (drawing units).
CadSnappub struct CadSnap
Snap features of an imported drawing near a point, view coordinates.
Traits: Debug, Clone, Default, PartialEq
Fields
ends: Vec<DVec2>mids: Vec<DVec2>centers: Vec<DVec2>lines: Vec<(DVec2, DVec2)>arcs: Vec<crate::arc::Arc>aci_colorpub fn aci_color(index: i64) -> [u8; 3]
RGB of an AutoCAD Color Index (the standard 256-entry palette: 1-9 the named colors, 10-249 hue/saturation steps, 250-255 greys); 0 and 256 (by block / by layer) and 7 come out black for white paper.
cc_core::calloutcrates/cc_core/src/callout.rs
Crop regions and callouts.
A view of the model drawn in 2D (a floor or ceiling plan, a section or
an elevation) may have a crop: a rectangle in its own drawing
coordinates (meters on the view plane) outside which nothing of the
model is drawn. A callout is a mark in a parent view standing for a
detail view of a region of it: the detail view keeps the parent’s kind
(so it stays live with the model) and its crop is the callout’s
rectangle, or the callout points to a drafting view and keeps its own
rectangle. The callout lives on the detail view (crate::View::callout),
so deleting that view removes its mark, and moving the mark is editing
the detail view’s crop.
Items: MIN_CROP · MAX_CROP · MAX_CHAIN · CropBox · Callout
MIN_CROPpub const MIN_CROP: f64
Smallest side of a crop rectangle, meters.
MAX_CROPpub const MAX_CROP: f64
Largest coordinate of a crop rectangle, meters from the view’s origin.
MAX_CHAINpub const MAX_CHAIN: usize
How many parent links Project::sync_callouts follows (details of details).
CropBoxpub struct CropBox
A rectangle in a view’s drawing coordinates, min below and left of max.
Traits: Debug, Clone, Copy, PartialEq, Serialize, Deserialize
Fields
min: DVec2max: DVec2Methods
pub fn new(a: DVec2, b: DVec2) -> Self
The rectangle with corners a and b (any two opposite corners).
pub fn is_valid(&self) -> bool
Finite, ordered, at least MIN_CROP on each side and within MAX_CROP.
pub fn contains(&self, p: DVec2) -> boolpub fn size(&self) -> DVec2pub fn center(&self) -> DVec2pub fn corners(&self) -> [DVec2; 4]
The corners, counter-clockwise from min.
pub fn translated(&self, d: DVec2) -> SelfCalloutpub struct Callout
A callout: the mark in parent standing for the view that holds it.
Traits: Debug, Clone, Copy, PartialEq, Serialize, Deserialize
Fields
parent: ViewId
The view the mark is drawn in.
rect: Option<CropBox>
The mark’s rectangle in the parent, for a callout pointing to a drafting view (which has no crop). A detail view of the model has none: its crop is the rectangle.
cc_core::componentcrates/cc_core/src/component.rs
Parametric components: user-defined objects (furniture, fixtures,
casework…) whose solids are sized by named parameters.
A ComponentDef lists numeric parameters and solid pieces. Each piece
is a box, a cylinder, a plan outline extruded upwards, or a profile of
lines and arcs drawn on the plan, front or side plane and extruded across
it or revolved about an axis (crate::profile); its coordinates and
sizes are crate::expr expressions over the parameters, in the
component’s local frame: origin at the insertion point, X to the right,
Y to the back, Z up, meters. A piece marked void is cut out of the
solid pieces it overlaps. Types of the same component share the definition and
differ in parameter values; parameters marked instance can be
overridden per element.
Pieces brought in from other tools (IFC import) may be fixed polyhedral
meshes instead, and the definition then remembers the IFC class the
object had, so it is written back as the same class.
A script piece (ComponentShape::Script) is Lua source that returns
other pieces; see crate::component_script.
Re-exports
pub use crate::profile::{ProfilePoint, SketchPlane}Items: ComponentKind · ParamKind · ComponentParam · ComponentShape · ComponentItem · DetailLevels · ConnectorDirection · ComponentConnector · ResolvedConnector · WALL_THICKNESS · HostOpening · DoorOperation · WindowOperation · SymbolSegment · SymbolLine · ComponentDef · IfcClass · ComponentPart · PartError · ResolveCtx · replace_name · convex_hull · library · mep_library · device_library
ComponentKindpub enum ComponentKind
What a component represents (used for IFC mapping and grouping).
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
FurnitureCaseworkPlumbingLightingElectrical
Outlets, switches and distribution boards.
GenericDoor
Doors: with a HostOpening, their types are of the door category.
Window
Windows: with a HostOpening, their types are of the window category.
Niche
Niches: with a HostOpening that has a depth, their types are of
the niche category and recess one face of their wall (see crate::openings).
TitleBlock
A sheet layout (border, title block): 2D pieces in paper millimeters, see crate::title_block.
Detail
A detail component: 2D pieces in meters placed in one view, see crate::detail_component.
Methods
pub const ALL: [ComponentKind; 11]pub fn key(self) -> &'static strpub fn is_2d(self) -> bool
Kinds whose definitions hold only 2D pieces (ComponentDef::sheet).
ParamKindpub enum ParamKind
Unit or kind of a parameter value.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
Length
Meters.
Angle
Degrees.
NumberText
Text (in ComponentParam::text).
Boolean
Yes or no: value 1 or 0, so expressions can read it.
Choice
One of ComponentParam::choices, by key (in text).
Material
A project material, by name (in text).
Methods
pub const ALL: [ParamKind; 3]
The numeric kinds, the ones a hand-made parameter can take.
pub const EVERY: [ParamKind; 7]
Every kind.
pub fn key(self) -> &'static strpub fn is_text(self) -> bool
The value is text (ComponentParam::text), not a number.
pub fn name(self) -> &'static str
The name used by commands and scripts.
pub fn from_name(name: &str) -> Option<ParamKind>ComponentParampub struct ComponentParam
Traits: Debug, Clone, PartialEq, Default, Serialize, Deserialize
Fields
name: String
Name used in expressions (see expr::is_valid_name).
value: f64
Value of this type (1 or 0 for booleans; unused by text kinds).
kind: ParamKindinstance: bool
Elements may override the value.
label: String
Shown instead of the name when set.
text: String
Value of this type for text, choice (the key) and material (the name) parameters.
choices: Vec<crate::component_script::ParamChoice>
The options of a choice parameter.
from_script: bool
Declared by a script piece: kept in step with it, not renamed by hand.
Methods
pub fn number(name: impl Into<String>, value: f64, kind: ParamKind) -> ComponentParam
A numeric parameter of this type.
pub fn display(&self) -> &str
The label shown: the label, or the name.
pub fn accepts_text(&self, text: &str) -> bool
Whether text is a value this parameter can take (a choice’s key).
ComponentShapepub enum ComponentShape
Geometry of a piece; every field is an expression.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Variants
Box { x: String, y: String, z: String, width: String, depth: String, height: String }
Box from the corner (x, y, z) with the given sizes.
Cylinder { x: String, y: String, z: String, radius: String, height: String }
Vertical cylinder with its base centered at (x, y, z).
Extrusion { points: Vec<(String, String)>, z: String, height: String }
Closed profile in plan extruded upwards from z.
Profile { plane: SketchPlane, points: Vec<ProfilePoint>, offset: String, depth: String }
Closed profile of lines and arcs on plane, placed at offset on the
axis normal to the plane (Z, Y or X) and extruded depth along it.
Revolution { plane: SketchPlane, points: Vec<ProfilePoint>, offset: String, axis: String, angle: String }
Closed profile on plane (placed at offset on its normal axis) turned
angle degrees about the line u = axis of the plane (vertical in
the front and side planes).
Sweep { plane: SketchPlane, path: Vec<ProfilePoint>, offset: String, profile: Vec<ProfilePoint> }
Closed profile (u to the left of the path, v along the plane’s
normal) carried along the open path drawn on plane, which stands
at offset on its normal axis; mitered at the path’s corners.
Blend { plane: SketchPlane, bottom: Vec<ProfilePoint>, top: Vec<ProfilePoint>, offset: String, depth: String }
The solid joining the closed bottom outline on plane at offset
to the closed top outline depth farther along its normal.
Mesh { vertices: std::sync::Arc<Vec<[f64; 3]>>, faces: std::sync::Arc<Vec<Vec<u32>>> }
Fixed polyhedral surface (not parametric): vertices in the component frame and faces as counter-clockwise (seen from outside) index loops.
Script { source: String }
Lua source whose geometry function returns the pieces (see
crate::component_script); they take this piece’s material and
flags where they set none.
Methods
pub fn expressions(&self) -> Vec<(&'static str, &String)>
Every expression of the shape, with a field label.
pub fn expressions_mut(&mut self) -> Vec<&mut String>pub fn point_count(&self) -> usize
Number of outline points of a profile (0 for boxes, cylinders and meshes).
ComponentItempub struct ComponentItem
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
name: Stringshape: ComponentShapematerial: String
Project material; empty for the default color.
in_plan: bool
The piece’s outline is drawn in plans.
void: bool
The piece is cut out of the solid pieces it overlaps instead of adding to them.
plan_only: bool
A plan symbol only (a door’s swing): drawn in plans, not a solid.
detail: DetailLevels
The detail levels of the views that show the piece (all by default).
DetailLevelspub struct DetailLevels
The detail levels of the views a piece shows in.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default
Fields
coarse: boolmedium: boolfine: boolMethods
pub const ALL: Selfpub fn is_all(&self) -> boolpub fn shows(&self, level: crate::DetailLevel) -> bool
Whether a view at level shows the piece.
pub fn set(&mut self, level: crate::DetailLevel, on: bool)ConnectorDirectionpub enum ConnectorDirection
Which way a run leaves a connector, in the component’s frame.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
DownUpFront
Towards -Y.
Back
Towards +Y (usually the wall).
Left
Towards -X.
Right
Towards +X.
Methods
pub const ALL: [ConnectorDirection; 6]pub fn key(self) -> &'static strpub fn vector(self) -> DVec3
Unit vector in the component’s frame.
pub fn is_vertical(self) -> bool
Whether runs leave it vertically.
ComponentConnectorpub struct ComponentConnector
A point where a pipe or conduit connects to the component: a toilet has a water inlet and a sewer outlet, an outlet its electrical connection.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
name: Stringsystem: crate::SystemKind
The kind of system it connects to.
x: String
Position in the component’s frame (expressions).
y: Stringz: Stringdirection: ConnectorDirectiondiameter: String
Outside diameter of the run it takes, meters (an expression); empty for unset.
Methods
pub fn expressions_mut(&mut self) -> [&mut String; 4]ResolvedConnectorpub struct ResolvedConnector
A connector resolved in the component’s frame.
Traits: Debug, Clone, PartialEq
Fields
index: usizename: Stringsystem: crate::SystemKindpoint: DVec3direction: ConnectorDirectiondiameter: Option<f64>WALL_THICKNESSpub const WALL_THICKNESS: &str
Name of the host wall’s thickness in the expressions of door and window
components (see crate::openings).
HostOpeningpub struct HostOpening
The opening a door or window component cuts in its host wall: width
wide, centered on the component, height tall from the sill.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
width: String
Expression of the parameters.
height: String
Expression of the parameters.
sill: String
Sill height of new elements (windows), an expression; empty for 0.
own_symbol: bool
Plans draw the pieces marked in_plan instead of the category’s
symbol (a door’s swing, a window’s sash lines).
operation: WindowOperation
How a window’s panels open (doors ignore it): the plan symbol and the IFC panel properties.
door_operation: DoorOperation
How a door’s leaves swing (windows ignore it): the plan swings, the elevation symbol and the IFC operation type.
depth: String
Niches: how far the opening goes into the wall from the face it is on, an expression of the parameters; empty for an opening through the wall (doors and windows).
Methods
pub fn expressions_mut(&mut self) -> [&mut String; 3]DoorOperationpub enum DoorOperation
How the leaves of a swing door open, after IFC’s door operation types:
each leaf swings about a vertical hinge towards the side the door opens
to, with the hand of WindowOperation (left is the start of the
opening along the wall, swapped by the element’s hand flip).
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
SingleSwingLeft
One leaf hinged on the left.
SingleSwingRight
One leaf hinged on the right.
DoubleDoor
Two leaves hinged on either jamb, meeting in the middle (a double door).
Methods
pub const ALL: [Self; 3]pub fn is_single_left(&self) -> boolpub fn key(self) -> &'static str
The interface key of its name.
pub fn leaves(self) -> usize
How many leaves the door has.
pub fn mirrored(self) -> Self
The same door with its hand swapped (a flipped element).
pub fn ifc_operation(self) -> &'static str
Its IfcDoorTypeOperationEnum value.
pub fn from_ifc(operation: &str) -> Option<Self>
The operation of an IFC door operation type; None for those it has no value for.
pub fn ifc_panels(self) -> &'static [(&'static str, f64)]
The leaves from the start of the opening: each one’s IFC panel
position (IfcDoorPanelPositionEnum) and share of the width.
pub fn hinges(self) -> &'static [(f64, f64)]
The hinges in plan, as WindowOperation::hinges.
pub fn elevation_lines(self, width: f64, height: f64) -> Vec<SymbolSegment>
The lines of its elevation symbol, as WindowOperation::elevation_lines.
WindowOperationpub enum WindowOperation
How the panels of a window open, after IFC’s window panel operations:
side-hung panels swing about a vertical hinge towards the side the
window opens to (y of its frame). The hand is the hinge’s side seen
looking that way (a door’s convention): left is the start of the
opening along the wall (-x), swapped by the element’s hand flip.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
Fixed
One panel that does not open.
SideHungLeft
One panel hinged on the left.
SideHungRight
One panel hinged on the right.
DoubleSideHung
Two panels hinged on either jamb, meeting in the middle.
TopHung
One panel hinged at its head, projecting out at the bottom.
PivotHorizontal
One panel turning about a horizontal axis at mid height.
PivotVertical
One panel turning about a vertical axis in the middle.
Sliding
Two panels sliding past each other along the wall.
Methods
pub const ALL: [Self; 8]pub fn is_fixed(&self) -> boolpub fn key(self) -> &'static str
The interface key of its name.
pub fn ifc_panels(self) -> &'static [(&'static str, &'static str)]
The panels from the start of the opening: each one’s IFC operation
and position (IfcWindowPanelOperationEnum, IfcWindowPanelPositionEnum).
pub fn ifc_partitioning(self) -> &'static str
The IFC partitioning of a window type with these panels.
pub fn from_ifc_panels(panels: &[&str]) -> Option<Self>
The operation of IFC panels (operations in order along the window);
None for combinations it has no value for.
pub fn hinges(self) -> &'static [(f64, f64)]
The hinges in plan: for each side-hung panel, where its hinge stands as a fraction of the opening’s width from its start, and which way along the wall the panel closes (+1 towards the end). Others: none.
pub fn elevation_lines(self, width: f64, height: f64) -> Vec<SymbolSegment>
The lines of its elevation symbol on an opening width wide and
height tall, as (x, z) from its bottom left (the start of the
opening along the wall): the opening direction as a triangle whose
apex points at the hinge or the axis, pivot axes running past the
frame, and a sliding window’s arrows.
SymbolSegmentpub type SymbolSegment = ((f64, f64), (f64, f64), SymbolLine)
A line of a window’s elevation symbol: its ends (x, z) and how it is drawn.
SymbolLinepub enum SymbolLine
How a line of a window’s elevation symbol is drawn.
Traits: Debug, Clone, Copy, PartialEq, Eq
Variants
Opening
The opening direction (dashed).
Axis
A pivot axis (dash-dot).
Plain
A plain thin line (a sliding panel’s arrow).
ComponentDefpub struct ComponentDef
Traits: Debug, Clone, PartialEq, Default, Serialize, Deserialize
Fields
kind: ComponentKindparams: Vec<ComponentParam>items: Vec<ComponentItem>ifc: Option<IfcClass>
IFC class of objects imported from IFC, written back on export.
mep: Option<crate::MepData>
Plumbing fixture or electrical device data.
opening: Option<Box<HostOpening>>
The opening a door or window cuts in its wall.
connectors: Vec<ComponentConnector>
Where pipes and conduits connect to it.
ref_planes: Vec<crate::component_ref::RefPlane>
Named planes whose positions expressions read (see crate::component_ref).
ref_lines: Vec<crate::component_ref::RefLine>
Named lines on the sketch planes.
dimensions: Vec<crate::component_ref::RefDimension>
Dimensions between reference planes, labeled by the parameters that drive them.
equals: Vec<crate::component_ref::RefEqual>
Planes kept halfway between two others (EQ).
hotspots: Vec<crate::component_script::Hotspot>
Points elements move with grips, declared by script pieces.
sheet: Vec<crate::title_block::SheetItem>
The 2D pieces of a title block (see crate::title_block) or of a
detail component (see crate::detail_component).
Methods
pub fn param(&self, name: &str) -> Option<&ComponentParam>pub fn values(&self, overrides: &BTreeMap<String, f64>) -> BTreeMap<String, f64>
Numeric parameter values (booleans as 1 or 0) with instance
overrides applied (only to instance parameters; non-finite
overrides are ignored). Text parameters are left out.
pub fn texts(&self, overrides: &BTreeMap<String, String>) -> BTreeMap<String, String>
Text, choice and material values with instance overrides applied
(only to instance parameters, and only values the parameter accepts).
pub fn hotspot_positions(&self, moved: &BTreeMap<String, [f64; 3]>) -> BTreeMap<String, DVec3>
Hotspot positions with the element’s moved ones applied (finite only).
pub fn hotspot(&self, name: &str) -> Option<&crate::component_script::Hotspot>pub fn has_script(&self) -> bool
Whether any piece is a script.
pub fn opening_size(&self) -> Option<(f64, f64)>
Width and height of the opening a door or window cuts (None for
other components, or when they do not evaluate to positive sizes).
pub fn opening_depth(&self) -> Option<f64>
The depth of a niche’s recess (see HostOpening::depth): None
for an opening through the wall, or a depth that does not evaluate
to a positive length.
pub fn resolve_connectors(&self, overrides: &BTreeMap<String, f64>) -> Vec<ResolvedConnector>
The connectors whose expressions evaluate, in the component’s frame.
pub fn default_sill(&self) -> f64
Sill height of new doors and windows of this definition (0 when unset or invalid).
pub fn category(&self) -> crate::Category
The category of the types of this definition: doors and windows (with an opening) have their own.
pub fn resolve(&self, overrides: &BTreeMap<String, f64>) -> (Vec<ComponentPart>, Vec<(usize, PartError)>)
Resolve every piece; pieces that fail are reported with their index.
pub fn resolve_in(&self, overrides: &BTreeMap<String, f64>, extra: &[(&str, f64)]) -> (Vec<ComponentPart>, Vec<(usize, PartError)>)
Resolve every piece with extra names defined too (a door’s
WALL_THICKNESS); parameters of the same name win. Pieces also
read the reference planes. Script pieces fail here: they need
ComponentDef::resolve_with.
pub fn resolve_with(&self, ctx: &ResolveCtx) -> (Vec<ComponentPart>, Vec<(usize, PartError)>)
Resolve every piece, script pieces through ctx.scripts.
pub fn main_material(&self) -> &str
Material of the first piece (for coloring and type legends).
pub fn rename_param(&mut self, old: &str, new: &str)
Rename a parameter and every reference to it in the pieces.
pub fn rename(&mut self, old: &str, new: &str)
Rename a parameter, reference plane or line and every expression, dimension and label that reads it.
pub fn scope(&self, overrides: &BTreeMap<String, f64>, extra: &[(&str, f64)]) -> Scope (in cc_core::component_ref)
The values every expression of the component reads (see Scope).
Planes may read parameters and other planes in any order; a plane
left unresolved (a missing name or a cycle) is reported once.
pub fn ref_plane(&self, name: &str) -> Option<RefPlane> (in cc_core::component_ref)
A reference plane by name, origin planes included (as at: "0").
pub fn all_ref_planes(&self) -> Vec<RefPlane> (in cc_core::component_ref)
Every plane, the origin ones first.
pub fn name_taken(&self, name: &str) -> bool (in cc_core::component_ref)
Whether name is already used by a parameter, plane or line (or reserved).
pub fn dimension_value(&self, scope: &Scope, index: usize) -> Result<f64, RefError> (in cc_core::component_ref)
The value a dimension shows: the distance between its planes, or why not.
pub fn equal_holds(&self, index: usize) -> Result<(), RefError> (in cc_core::component_ref)
Whether equality index holds: three parallel planes seen edge-on
in its view, the middle one written halfway between the others.
pub fn ref_problems(&self) -> Vec<String> (in cc_core::component_ref)
The names an expression of the component reads, other than parameters and planes, that do not exist; and repeated or invalid names. Empty when the references are sound.
pub fn resolve_sheet(&self, paper: DVec2) -> SheetPieces (in cc_core::title_block)
The 2D pieces on a paper sheet (millimeters); pieces that fail are
reported with their index and left out.
pub fn resolve_2d(&self, lookup: &dyn Fn(&str) -> Option<f64>) -> SheetPieces (in cc_core::title_block)
The 2D pieces resolved with lookup (title blocks and detail
components); pieces that fail are reported with their index and left out.
IfcClasspub struct IfcClass
An IFC entity class with its predefined and object types.
Traits: Debug, Clone, PartialEq, Default, Serialize, Deserialize
Fields
entity: String
Entity name as written in IFC files, e.g. IFCPIPESEGMENT.
predefined: String
PredefinedType enumeration value (without dots); empty if unset.
object_type: String
ObjectType (the user-defined type when predefined is USERDEFINED).
properties: Vec<crate::properties::PropertySet>
Property and quantity sets of the IFC type object.
ComponentPartpub struct ComponentPart
A resolved piece: a prism of footprint between z0 and z1, in the
component’s local frame. Meshes, profiles on the front and side planes
and revolutions carry their faces, with the convex hull of the vertices
as footprint and their height range.
Traits: Debug, Clone, PartialEq
Fields
item: usizefootprint: Vec<DVec2>z0: f64z1: f64material: Stringin_plan: boolvoid: bool
Cut out of the other pieces (see cc_geom::resolve_component).
plan_only: bool
Drawn in plans only (see ComponentItem::plan_only).
detail: DetailLevels
The detail levels of the views that show it.
faces: Vec<Vec<DVec3>>
Faces of a piece that is not a vertical prism (empty for prisms).
smooth: Vec<bool>
Per face of faces, whether it is a facet of a curved surface (see
cc_geom::Solid::smooth_curved); filled in when a placed piece is
resolved, empty otherwise.
PartErrorpub enum PartError
Why a piece could not be resolved.
Traits: Debug, Clone, PartialEq, std::fmt::Display
Variants
Expr { field: &'static str, error: ExprError, }Degenerate
A size is zero or negative, or a profile has fewer than 3 points.
Script(String)
A script piece failed (its last pieces that worked may still be shown).
ResolveCtxpub struct ResolveCtx<'a>
What resolving reads besides the definition.
Traits: Default
Fields
overrides: &'a BTreeMap<String, f64>
Numeric (and boolean) instance values.
texts: &'a BTreeMap<String, String>
Text, choice and material instance values.
hotspots: &'a BTreeMap<String, [f64; 3]>
Moved hotspots.
extra: &'a [(&'a str, f64)]
Names defined besides the parameters (a door’s wall thickness).
scripts: &'a dyn crate::component_script::ScriptEvalowner: crate::component_script::ScriptOwner
Whose pieces these are (for the last script result that worked).
replace_namepub fn replace_name(text: &str, old: &str, new: &str) -> String
Replace whole-identifier occurrences of old in text (numbers such as
2e3 are left alone).
convex_hullpub fn convex_hull(points: &[DVec2]) -> Vec<DVec2>
Convex hull of plan points (counter-clockwise; fewer than 3 points when degenerate).
librarypub fn library(n: &dyn Fn(&str) -> String) -> Vec<(String, String, ComponentDef)>
The default component library: (component name, type name, definition).
Parameter names come from n (keys tpl-param-*), so expressions use
the translated names; materials are the template’s.
mep_librarypub fn mep_library(n: &dyn Fn(&str) -> String) -> Vec<(String, String, ComponentDef)>
The building-services part of the default library: plumbing fixtures and electrical devices. Wall-mounted devices have their back on the insertion point and stand out towards -Y; their elevation is the instance’s base offset (the mounting height).
device_librarypub fn device_library(device: crate::DeviceKind, n: &dyn Fn(&str) -> String) -> Option<(String, String, ComponentDef)>
The built-in definition of a communications or lightning protection
device, which a project gets with the first one placed: (component,
type name, definition). Data outlets and racks hang on walls like the
electrical devices (their back on the insertion point); an air terminal
is a rod standing Height (an instance parameter) on a base plate; an
earth electrode a rod driven Length down from its top. None for the
other device kinds (see mep_library).
cc_core::component_filecrates/cc_core/src/component_file.rs
.ccomp component files: a component definition with all its types and
the materials it uses, to share components between projects.
Items: COMPONENT_FORMAT_VERSION · ComponentFile · NestedComponent · ComponentFileType · ComponentFileError · extract · to_ron · from_ron · save · MAX_COMPONENT_BYTES · load · MAX_LIBRARY_FILES · scan · types_for
COMPONENT_FORMAT_VERSIONpub const COMPONENT_FORMAT_VERSION: u32
Current .ccomp format version.
ComponentFilepub struct ComponentFile
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
format_version: u32generator: Stringcomponent: Stringdef: ComponentDef
The definition, with the first type’s parameter values.
types: Vec<ComponentFileType>materials: Vec<Material>nested: Vec<NestedComponent>
The detail components a detail component nests (directly or deeper), so the file stands alone; loading adds those the project lacks.
NestedComponentpub struct NestedComponent
A detail component another one in the file nests.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
component: Stringdef: ComponentDef
The definition, with its first type’s parameter values.
ComponentFileTypepub struct ComponentFileType
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
name: Stringvalues: BTreeMap<String, f64>
Parameter values of this type.
info: TypeInfoComponentFileErrorpub enum ComponentFileError
Traits: Debug, Error
Variants
Io(#[from] std::io::Error)Parse(#[from] ron::error::SpannedError)Serialize(#[from] ron::Error)Version(u32)Invalid(String)NotFound(String)extractpub fn extract(project: &Project, component: &str) -> Result<ComponentFile, ComponentFileError>
Collect the component named component from project.
to_ronpub fn to_ron(file: &ComponentFile) -> Result<String, ComponentFileError>
from_ronpub fn from_ron(text: &str) -> Result<ComponentFile, ComponentFileError>
Parse and validate a component file.
savepub fn save(file: &ComponentFile, path: &Path) -> Result<(), ComponentFileError>
MAX_COMPONENT_BYTESpub const MAX_COMPONENT_BYTES: u64
Largest .ccomp file read: imported meshes make the largest ones.
loadpub fn load(path: &Path) -> Result<ComponentFile, ComponentFileError>
MAX_LIBRARY_FILESpub const MAX_LIBRARY_FILES: usize
Most component files a library scan reads.
scanpub fn scan(folders: &[std::path::PathBuf]) -> (Vec<(std::path::PathBuf, ComponentFile)>, Vec<(std::path::PathBuf, String)>)
The component files (.ccomp) in folders and their subfolders, sorted
by path: the ones that load, and the paths of those that do not, with
why. Bounded in depth and number of files; links to folders are not followed.
types_forpub fn types_for(project: &Project, file: &ComponentFile, mut alloc: impl FnMut() -> u64) -> (Vec<ElementType>, Vec<Material>)
Types to add to project for file: the component and type names are
made unique and missing materials are listed. Ids are allocated from
alloc, so callers can add them inside a transaction.
cc_core::component_refcrates/cc_core/src/component_ref.rs
Reference planes, reference lines and labeled dimensions of a
component: the skeleton that parameters drive and pieces follow.
A reference plane is a named plane square to one axis of the component’s
frame, at a position given by an crate::expr expression. Its name can
be used in any expression of the component (a piece’s coordinates, other
planes, connectors), so a piece “locked” to a plane simply reads it:
x = Right. Three origin planes are always there, at zero:
CENTER_X (the plane x = 0, center left/right), CENTER_Y (y = 0,
center front/back) and BASE (z = 0).
A dimension between two parallel planes shows their distance in one of
the component’s views. Labeling it with a parameter writes the second
plane’s position as the first plus (or minus) the parameter, so changing
the parameter moves the plane and whatever reads it. Everything stays an
expression; there is no constraint solver.
Items: CENTER_X · CENTER_Y · BASE · ORIGIN_PLANES · MAX_REFS · PlaneAxis · RefPlane · RefLine · RefDimension · RefEqual · RefError · Scope · is_reserved_for
CENTER_Xpub const CENTER_X: &str
The origin plane x = 0 (center left/right).
CENTER_Ypub const CENTER_Y: &str
The origin plane y = 0 (center front/back).
BASEpub const BASE: &str
The origin plane z = 0 (the base).
ORIGIN_PLANESpub const ORIGIN_PLANES: [(&str, PlaneAxis); 3]
The origin planes: name and axis.
MAX_REFSpub const MAX_REFS: usize
Most reference planes, lines and dimensions of a component.
PlaneAxispub enum PlaneAxis
The axis a reference plane is square to.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
X
A plane x = constant (left/right): seen edge-on in the plan and front views.
Y
A plane y = constant (front/back): seen edge-on in the plan and side views.
Z
A plane z = constant (a height): seen edge-on in the front and side views.
Methods
pub const ALL: [PlaneAxis; 3]pub fn in_view(self, view: SketchPlane) -> Option<bool>
Where a plane square to this axis is seen edge-on in view: Some(true)
as a line of constant u (vertical), Some(false) as a line of constant
v (horizontal), None when the view looks along the plane’s face.
pub fn key(self) -> &'static strRefPlanepub struct RefPlane
A named plane square to axis at the position at (an expression).
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
name: Stringaxis: PlaneAxisat: StringRefLinepub struct RefLine
A named line drawn on one of the sketch planes: the plane stands at
offset along its normal axis, and the ends are (u, v) expressions in
it (see SketchPlane). Revolution axes and angled references use it.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
name: Stringplane: SketchPlaneoffset: Stringstart: (String, String)end: (String, String)RefDimensionpub struct RefDimension
A dimension between the parallel reference planes from and to, shown
in view; label is the parameter that drives it, if any. place is
where its line sits across the planes (meters, in the view’s other
coordinate).
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
view: SketchPlanefrom: Stringto: Stringlabel: Option<String>place: f64RefEqualpub struct RefEqual
An equality (EQ): the plane middle stays halfway between the parallel
planes a and b, shown in view as two equal dimensions at place.
Its position is written (a + b) / 2 when the equality is made.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
view: SketchPlanea: Stringmiddle: Stringb: Stringplace: f64Methods
pub fn expression(&self) -> String
The expression that keeps middle halfway.
RefErrorpub enum RefError
Why a reference plane, line or dimension does not evaluate.
Traits: Debug, Clone, PartialEq, std::fmt::Display
Variants
Expr { name: String, error: ExprError }
Its expression fails (an unknown name also covers planes that depend on each other in a cycle).
Dimension { index: usize }
A dimension names a missing plane, or planes that are not parallel.
Equal { index: usize }
An equality names a missing plane, planes that are not parallel, or its middle plane is no longer halfway.
Scopepub struct Scope
Every name that expressions of the component read, with its value: the
parameters (with overrides), extra names, the origin planes and the
reference planes that evaluate, plus the planes that do not.
Traits: Debug, Clone, Default, PartialEq
Fields
values: BTreeMap<String, f64>errors: Vec<RefError>Methods
pub fn get(&self, name: &str) -> Option<f64>is_reserved_forpub fn is_reserved_for(kind: crate::component::ComponentKind, name: &str) -> bool
Whether name is reserved in a component of kind: the origin planes
and a door’s wall thickness everywhere, the paper size
(SheetWidth, SheetHeight) in title blocks.
cc_core::component_scriptcrates/cc_core/src/component_script.rs
Scripted component pieces: the model side.
A crate::ComponentShape::Script piece holds Lua source that declares
parameters and hotspots and returns ordinary pieces from its geometry
function. Running Lua is not this crate’s business: resolving goes
through a ScriptEval (the cc_script crate implements it), which
gets the parameter values and returns the pieces, or an error and the
last pieces that worked for the same owner.
The parameters a script declares are copied into the definition’s
params (marked from_script) and its hotspots into hotspots, so
schedules, the properties palette, engine commands and files see them
without running Lua.
Items: MAX_SCRIPT_LEN · MAX_CHOICES · MAX_TEXT_LEN · MAX_HOTSPOTS · ParamChoice · HotspotShape · Hotspot · parse_color · color_text · ScriptOwner · ScriptInput · ScriptResult · ScriptEval · NoScripts · truncate
MAX_SCRIPT_LENpub const MAX_SCRIPT_LEN: usize
Longest script source kept (bytes); longer ones are emptied on load.
MAX_CHOICESpub const MAX_CHOICES: usize
Most choices of a choice parameter.
MAX_TEXT_LENpub const MAX_TEXT_LEN: usize
Longest text value, label or choice key kept (bytes).
MAX_HOTSPOTSpub const MAX_HOTSPOTS: usize
Most hotspots of a definition.
ParamChoicepub struct ParamChoice
One option of a choice parameter: a stable key and the label shown.
Traits: Debug, Clone, PartialEq, Eq, Default, Serialize, Deserialize
Fields
key: Stringlabel: StringHotspotShapepub enum HotspotShape
The marker drawn for a hotspot.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
CircleSquareTriangleDiamondTriangleDownMethods
pub const ALL: [HotspotShape; 5]pub fn name(self) -> &'static str
The name scripts use.
pub fn from_name(name: &str) -> Option<HotspotShape>Hotspotpub struct Hotspot
A point of a component that its elements move with a grip; scripts read where it is. Positions are in the component’s frame (meters).
Traits: Debug, Clone, PartialEq, Default, Serialize, Deserialize
Fields
name: Stringlabel: Stringposition: [f64; 3]
Where new elements have it.
shape: HotspotShapecolor: [u8; 4]
RGBA.
parse_colorpub fn parse_color(text: &str) -> Option<[u8; 4]>
Parse #RRGGBB or #RRGGBBAA (alpha last).
color_textpub fn color_text(c: [u8; 4]) -> String
#RRGGBBAA.
ScriptOwnerpub struct ScriptOwner
Whose script result this is, for the last pieces that worked: the element’s type and the element (none for a type’s own preview).
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default
Fields
type_uid: Uidelement: Option<Uid>piece: usize
The piece of the definition.
ScriptInputpub struct ScriptInput
What a script receives.
Traits: Debug, Clone, PartialEq, Default
Fields
numbers: BTreeMap<String, f64>
Numeric parameters (booleans as 0 or 1), reference planes and extra names such as a door’s wall thickness.
texts: BTreeMap<String, String>
Text, choice (the key) and material (the name) parameters.
hotspots: BTreeMap<String, DVec3>
Hotspot positions.
ScriptResultpub struct ScriptResult
A script’s pieces, or why there are none this time.
Traits: Debug, Clone, PartialEq, Default
Fields
items: Option<Arc<Vec<ComponentItem>>>
The pieces, or the last that worked for the same owner when the script failed (none when it never worked).
error: Option<String>
ScriptEvalpub trait ScriptEval
Runs a piece’s script.
Implemented by (2): cc_core::component_script::NoScripts, cc_script::object::ScriptCache
Required and provided items
fn eval(&self, source: &str, input: &ScriptInput, owner: ScriptOwner) -> ScriptResultNoScriptspub struct NoScripts
No runtime: every script fails.
Traits: ScriptEval
truncatepub fn truncate(text: &mut String, max: usize) -> bool
Cut text to at most max bytes on a character boundary; whether it was cut.
cc_core::connectioncrates/cc_core/src/connection.rs
Steel and timber connections: an element at one end of a column or beam
(member, end) of a standard kind, whose plates and bolts
cc_geom::connection derives from the member’s geometry on every build.
It has no placement of its own: it is removed with its member
(crate::EditCtx::remove_element), follows its phases and design option
(crate::phase::phase_host), is never copied (Project::copy_set),
and a member end carries at most one (Project::repair_connections
keeps the lowest id).
Items: LENGTH · COUNT · ConnectionKind · MemberEnd · ConnectionParams · Connection · host_type
LENGTHpub const LENGTH: RangeInclusive<f64>
Every length of a connection, meters. A plate’s width and length
may also be 0: taken from the member’s section plus edge.
COUNTpub const COUNT: RangeInclusive<u32>
Bolt rows and columns.
ConnectionKindpub enum ConnectionKind
The standard joints.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default, Serialize, Deserialize
Variants
BasePlate
A steel plate under a column with anchor bolts.
EndPlate
A steel plate on a beam end that stops at a column face, bolted through.
FinPlate
A steel plate along the web of a beam end at a column or a beam.
TimberBolts
A group of bolts with washers through a timber beam end at a column.
Hanger
A bent steel plate under a timber beam end at a beam.
Methods
pub const ALL: [ConnectionKind; 5]pub fn code(self) -> &'static strpub fn from_code(code: &str) -> Option<Self>pub fn key(self) -> &'static str
The i18n key of its name.
pub fn at_column(self) -> bool
Whether it sits at a column’s base (else at a beam’s start or end).
pub fn material(self) -> StructuralMaterial
The Structure tab material whose Connections group offers it.
pub fn defaults(self) -> ConnectionParams
The parameters a new connection of this kind gets.
MemberEndpub enum MemberEnd
Which end of its member a connection sits at.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize
Variants
Base
A column’s base.
Start
A beam’s start.
End
A beam’s end.
Methods
pub const ALL: [MemberEnd; 3]pub fn code(self) -> &'static strpub fn key(self) -> &'static strConnectionParamspub struct ConnectionParams
The sizes of a connection, meters (see the kind for what each means).
Traits: Debug, Clone, Copy, PartialEq, Serialize, Deserialize, Default
Fields
thickness: f64
Plate thickness (a bolted joint’s washers).
width: f64
Plate width; 0: from the member’s section plus edge.
length: f64
Plate length; 0: from the member’s section (or bolts) plus edge.
bolt_diameter: f64rows: u32columns: u32spacing: f64
Bolt to bolt.
edge: f64
Bolt to the plate’s edge (or to the member’s end).
anchor_length: f64
Anchor bolts below a base plate.
Methods
pub fn check(&self) -> Result<(), String>
Whether every value is in range.
pub fn reset_out_of_range(&mut self, kind: ConnectionKind) -> usize
Values out of range back to kind’s defaults (a bad width or length
to 0); returns how many changed.
Connectionpub struct Connection
A connection at one end of a column or beam.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
member: ElementId
The column or beam.
end: MemberEndkind: ConnectionKindparams: ConnectionParamsMethods
pub fn new(member: ElementId, end: MemberEnd, kind: ConnectionKind) -> Self
A connection with the kind’s default parameters.
pub fn fits(&self, member: &ElementKind) -> bool
Whether it can sit on member at its end: a base plate on a column’s
base, the other kinds on a beam’s start or end.
host_typepub fn host_type(id: ElementTypeId, name: String) -> ElementType
The type a project gets with its first connection.
cc_core::curtaincrates/cc_core/src/curtain.rs
Curtain walls: walls made of a grid of panels and mullions.
A wall type with a CurtainSystem (TypeData::Wall::curtain) is a
curtain wall type: its walls are not layered bodies but a grid laid over
the wall’s face, vertical lines spaced along the wall and horizontal lines
up from its base, with a panel in each cell and mullions on the lines and
around the border. Each wall may adjust its grid (CurtainEdits): its
own lines instead of the type’s, segments of lines removed (the cells on
both sides become one panel) and panels swapped.
layout works out the grid of one wall in wall-local coordinates
(u along the wall’s body centerline from its start, z absolute
elevations); cc_geom::curtain places it in the world.
Items: MAX_LINES · MIN_SPACING · LINE_TOL · GridLayout · GridJustification · CurtainGrid · CurtainPanel · Mullion · CurtainSystem · GridAxis · GridSegment · PanelSwap · CurtainEdits · MAX_TEXT · to_text · from_text · PanelCell · MullionPiece · Layout · layout
MAX_LINESpub const MAX_LINES: usize
Most grid lines on one axis of a wall (files are hostile input).
MIN_SPACINGpub const MIN_SPACING: f64
Smallest spacing a layout uses, in meters.
LINE_TOLpub const LINE_TOL: f64
Positions within this distance are the same grid line.
GridLayoutpub enum GridLayout
How a grid spaces its lines over the length (or height) of a wall.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
None
No lines: one cell across.
FixedDistance
A line every spacing, from where justification says.
FixedNumber
count equal divisions.
MaxSpacing
As few equal divisions as keep them at most spacing wide.
Methods
pub const ALL: [GridLayout; 4]pub fn key(self) -> &'static strGridJustificationpub enum GridJustification
Where a fixed-distance grid starts: the remainder goes to the other end (or half to each end, centered).
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
StartCenterEndMethods
pub const ALL: [GridJustification; 3]pub fn key(self) -> &'static strCurtainGridpub struct CurtainGrid
The lines of one direction of a curtain grid.
Traits: Debug, Clone, Copy, PartialEq, Serialize, Deserialize, Default
Fields
layout: GridLayoutspacing: f64
Distance between lines (fixed distance) or the widest cell (maximum spacing).
count: u32
Number of divisions (fixed number).
justification: GridJustificationMethods
pub fn lines(&self, lo: f64, hi: f64) -> Vec<f64>
The interior lines between lo and hi, ascending (at most MAX_LINES).
pub fn repair(&mut self) -> usize
Fix non-finite or too small values; returns the number of repairs.
CurtainPanelpub enum CurtainPanel
What fills a cell of the grid.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize, Default
Variants
Glass { thickness: f64, material: String }
A glazed panel thickness thick.
Solid { thickness: f64, material: String }
An opaque panel thickness thick (spandrel, infill).
Empty
No panel: the cell is open.
Component { component: ElementTypeId }
A component placed in the cell (a door or window component in its
opening, other components from the cell’s lower left corner), its
Width and Height parameters set to the cell’s size.
Methods
pub fn key(&self) -> &'static strpub fn material(&self) -> Option<&str>pub fn thickness(&self) -> f64pub fn is_glazed(&self) -> boolpub fn repair(&mut self, exists: &dyn Fn(ElementTypeId) -> bool) -> usize
Fix a bad thickness, and a component that is no longer a type
(exists says which are); returns the number of repairs.
Mullionpub struct Mullion
A rectangular mullion section: width seen on the face of the wall,
depth across it.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize, Default
Fields
width: f64depth: f64material: StringCurtainSystempub struct CurtainSystem
The curtain grid of a wall type.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize, Default
Fields
vertical: CurtainGrid
Vertical lines, spaced along the wall.
horizontal: CurtainGrid
Horizontal lines, spaced up from the wall’s base.
panel: CurtainPanel
What fills the cells.
vertical_mullion: Option<Mullion>
Mullions on the interior vertical lines.
horizontal_mullion: Option<Mullion>
Mullions on the interior horizontal lines.
border_mullion: Option<Mullion>
Mullions around the border.
Methods
pub fn with_materials(glass: &str, frame: &str) -> Self
A system whose panels and mullions are of the given materials.
pub fn thickness(&self) -> f64
Thickness of walls of this type: the deepest mullion or the panel (at least 1 cm).
pub fn main_material(&self) -> &str
The material of the frame (the first mullion with one), else the panel’s.
pub fn materials(&self) -> Vec<&str>
Material names referenced.
pub fn rename_material(&mut self, old: &str, new: &str)pub fn components(&self) -> Vec<ElementTypeId>
The component types used as panels.
pub fn repair(&mut self, exists: &dyn Fn(ElementTypeId) -> bool) -> usizeGridAxispub enum GridAxis
A direction of the grid: vertical lines (spaced along the wall) or horizontal ones (spaced up it).
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize
Variants
VerticalHorizontalGridSegmentpub struct GridSegment
A removed piece of an interior grid line: the line at at (u of a
vertical line, height above the base of a horizontal one), between the
two lines across it on both sides of along (a height for a vertical
line, a u for a horizontal one).
Traits: Debug, Clone, Copy, PartialEq, Serialize, Deserialize
Fields
axis: GridAxisat: f64along: f64PanelSwappub struct PanelSwap
A panel other than the type’s, in the cell (or merged cells) holding the
point u along the wall and z above its base.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
u: f64z: f64panel: CurtainPanelCurtainEditspub struct CurtainEdits
One wall’s adjustments to its type’s grid. Positions are wall-local:
u along the body centerline from its start, heights above its base.
Traits: Debug, Clone, PartialEq, Default, Serialize, Deserialize
Fields
vertical: Option<Vec<f64>>
The wall’s own vertical lines instead of the type’s.
horizontal: Option<Vec<f64>>
The wall’s own horizontal lines instead of the type’s.
removed: Vec<GridSegment>panels: Vec<PanelSwap>Methods
pub fn is_empty(&self) -> boolpub fn reverse(&mut self, length: f64)
The same edits for the wall walked the other way (length long).
pub fn materials(&self) -> impl Iterator<Item = &str>pub fn rename_material(&mut self, old: &str, new: &str)pub fn components(&self) -> impl Iterator<Item = ElementTypeId> + '_
The component types used as panels.
pub fn repair(&mut self, exists: &dyn Fn(ElementTypeId) -> bool) -> usize
Drop non-finite values and keep the lists bounded; returns the number of repairs.
MAX_TEXTpub const MAX_TEXT: usize
Longest text from_text reads (files are hostile input).
to_textpub fn to_text<T: Serialize>(value: &T) -> String
A curtain system or a wall’s edits as text (for exchange files, such as an IFC property). Component panels keep their type id, which only means something in the same project.
from_textpub fn from_text<T: serde::de::DeserializeOwned>(text: &str) -> Option<T>
Read what to_text wrote; None when it is too long or not valid.
PanelCellpub struct PanelCell
A cell, or cells merged where segments were removed, and its panel.
Traits: Debug, Clone, PartialEq
Fields
column: usize
Its lowest column and row (cells are numbered from the start and from the base).
row: usizecell_u: (f64, f64)
The span between the grid lines around it (absolute elevations).
cell_z: (f64, f64)u: (f64, f64)
The panel’s own extent: the cell less the mullions around it.
z: (f64, f64)panel: CurtainPanelswapped: bool
Swapped on this wall rather than the type’s.
Methods
pub fn area(&self) -> f64MullionPiecepub struct MullionPiece
A straight piece of mullion: along a vertical line at at from span.0
to span.1 (heights), or along a horizontal line at height at from
span.0 to span.1 (along the wall); offset is where its section’s
center lies from the line, along the wall or up.
Traits: Debug, Clone, PartialEq
Fields
axis: GridAxisborder: boolat: f64offset: f64span: (f64, f64)mullion: MullionMethods
pub fn length(&self) -> f64Layoutpub struct Layout
The grid of one curtain wall.
Traits: Debug, Clone, PartialEq, Default
Fields
u: Vec<f64>
Vertical lines along the wall, both ends included.
z: Vec<f64>
Horizontal lines (absolute elevations), base and top included.
panels: Vec<PanelCell>mullions: Vec<MullionPiece>Methods
pub fn columns(&self) -> usizepub fn rows(&self) -> usizepub fn panel_at(&self, column: usize, row: usize) -> Option<&PanelCell>
The panel covering cell (column, row).
pub fn cell_center(&self, column: usize, row: usize) -> Option<(f64, f64)>
The center (u, z) of cell (column, row).
pub fn interior(&self, axis: GridAxis) -> &[f64]
Interior lines of an axis (without the borders).
pub fn glazed_area(&self) -> f64pub fn mullion_length(&self) -> f64pub fn panel_count(&self) -> usize
Panels that are there (not empty cells).
layoutpub fn layout(system: &CurtainSystem, edits: &CurtainEdits, u: (f64, f64), base: f64, top: f64) -> Layout
The grid of a curtain wall of system, adjusted by edits, over u
(along the body centerline, between the ends after joins) and from
base to top (absolute elevations).
cc_core::design_optioncrates/cc_core/src/design_option.rs
Design options: alternative sets of elements within one project.
The project holds OptionSets (say “Entrance” or “Kitchen layout”),
each with an ordered list of DesignOptions and one primary option.
An element belongs to the main model (Element::design_option is
None), shown with every option, or to exactly one option. A view shows
the main model plus one option of each set: the one it chooses
(View::design_options), else the option being edited when it belongs to
that set (Project::active_option), else the set’s primary option
(“automatic”). Elements of the other options are left out of the view
altogether: drawings, schedules, joins and room boundaries.
Hosted elements follow their hosts (a door is in its wall’s option, see
Project::option_fixes); annotations belong to no option. Deleting an
option deletes its elements; accepting a set’s primary option moves its
elements into the main model and deletes the set with its other options
and their elements. IFC export writes the main model and the primary
options only.
Items: MAX_OPTION_SETS · MAX_OPTIONS · DesignOption · OptionSet
MAX_OPTION_SETSpub const MAX_OPTION_SETS: usize
Most option sets in a project.
MAX_OPTIONSpub const MAX_OPTIONS: usize
Most options in a set.
DesignOptionpub struct DesignOption
One alternative of an option set.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
id: OptionIdname: StringOptionSetpub struct OptionSet
A named group of mutually exclusive design options.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
id: OptionSetIdname: Stringoptions: Vec<DesignOption>
The alternatives, in display order (never empty in a repaired project).
primary: OptionId
The option views show by default and exports write.
Methods
pub fn option(&self, id: OptionId) -> Option<&DesignOption>pub fn contains(&self, id: OptionId) -> boolpub fn primary_option(&self) -> Option<OptionId>
The primary option (the first one when the primary is unknown).
cc_core::detailcrates/cc_core/src/detail.rs
Detail lines: view-specific 2D curves (lines, arcs, circles and whole or
partial ellipses, the SketchCurve geometry) drawn in one view with a
line style. Like text notes they live in their view’s drawing
coordinates (meters), are owned by it (Element::owner_view) and go
with it; they belong to no phase-dependent geometry, take no part in the
model’s 3D or IFC, and are drawn in drafting views and on top of plans,
ceiling plans, elevations, sections and legends.
A polyline is drawn as one element per segment, so each segment is an
ordinary curve that the sketch edits (crate::sketch_edit: trim,
extend, split, offset) and grips change on its own.
The line style is a LineStyleRef: one of the built-in
DetailStyles or one of the project’s own line styles
(LineStyleDef: a name, weight, color and dash pattern, kept in
Project::line_styles and tracked as project settings). Region
boundaries (crate::region) take the same references. A reference to
a project style that no longer exists reads as the thin built-in style,
and repair resets it.
Items: DetailLine · MAX_COORD · LineStyles · LineStyleRef · MAX_LINE_STYLES · MIN_WEIGHT_MM · MAX_WEIGHT_MM · LineStyleDef · DetailStyle
DetailLinepub struct DetailLine
A detail line of one view.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
view: ViewId
The view that owns (and alone shows) the line.
curve: SketchCurve
The curve, in the view’s drawing coordinates (meters).
style: LineStyleRef
How the line is drawn.
Methods
pub fn is_valid(&self) -> bool
Finite numbers and a size (see SketchCurve::is_valid), within bounds.
pub fn snap_features(&self, out: &mut crate::cad::CadSnap)
What drawing tools snap to on the line (in the shape of an imported drawing’s snap features): ends, middles, centers, quadrant and axis points, and the lines and arcs themselves (ellipses by their chords).
MAX_COORDpub const MAX_COORD: f64
Coordinates and sizes past this (meters) are refused (a crafted file).
LineStylespub type LineStyles = BTreeMap<LineStyleId, LineStyleDef>
The project’s line styles, by id.
LineStyleRefpub enum LineStyleRef
The style a detail line or a region’s boundary is drawn with.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, Default
Variants
BuiltIn(DetailStyle)
One of the built-in styles.
Project(LineStyleId)
One of the project’s line styles (Project::line_styles).
Methods
pub fn pen(self, styles: &LineStyles) -> (f64, [u8; 3], LinePattern)
Width on paper (millimeters), color and dash pattern; a project style that is gone reads as the default built-in style.
pub fn code(self, styles: &LineStyles) -> String
The style’s name as a code (DXF layers, commands): a built-in style’s code, a project style’s name.
pub fn exists(self, styles: &LineStyles) -> bool
Whether the reference is to a style that exists.
MAX_LINE_STYLESpub const MAX_LINE_STYLES: usize
Most project line styles (a crafted file).
MIN_WEIGHT_MMpub const MIN_WEIGHT_MM: f64
Range of a line style’s weight, paper millimeters.
MAX_WEIGHT_MMpub const MAX_WEIGHT_MM: f64
LineStyleDefpub struct LineStyleDef
One of the project’s line styles: a name, a weight on paper, a color and a dash pattern. Names are unique and differ from the built-in codes, so commands can name either.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
id: LineStyleIdname: Stringweight_mm: f64
Width on paper, millimeters.
color: [u8; 3]pattern: LinePatternMethods
pub fn repair(&mut self) -> bool
Bring the weight into range (a crafted file); returns whether it changed.
DetailStylepub enum DetailStyle
The built-in line styles of detail lines.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
Thin
Fine continuous line.
MediumWideHidden
Short dashes.
Dashed
Long dashes.
Center
Dash-dot (center lines, axes).
DottedMethods
pub const ALL: [DetailStyle; 7]pub fn weight_mm(self) -> f64
Width on paper, millimeters.
pub fn pattern(self) -> LinePatternpub fn code(self) -> &'static str
The name used by commands and DXF layers.
pub fn from_code(code: &str) -> Option<Self>pub fn key(self) -> &'static str
Translation key of the name.
cc_core::detail_componentcrates/cc_core/src/detail_component.rs
Detail components: reusable 2D components for construction details.
A detail component is a component of kind ComponentKind::Detail
(category DetailComponent, TypeData::Component) made only of 2D
pieces, the same SheetItems title blocks are drawn with
(ComponentDef::sheet): strokes of lines and arcs (open or closed,
with a pen weight in paper millimeters, a color, a dash pattern, and a
solid or pattern fill when closed), texts and pictures, plus
SheetShape::Nested pieces that place another detail component
inside this one. Unlike a title block’s, every length is in meters in
the component’s own frame (text heights too), and expressions read the
component’s parameters.
An element of kind ElementKind::DetailComponent places a type in one
view (view, like detail lines and text notes; removed with it): its
origin at position in the view’s drawing coordinates, turned
rotation_deg, sized by scale and, when mirrored, flipped across
its own X axis before turning. It has no phase, no 3D and no IFC.
Nested components are named by their component name and read the
parameter values of that component’s first type; resolving them
(walk) is bounded in depth, in visits and in drawn points, and a
component met again inside itself is left out (a cycle).
Items: MIN_SCALE · MAX_SCALE · MAX_DEPTH · MAX_VISITS · MAX_POINTS · scale_ok · DetailComponent · Place · nested_names · Visit · walk · stroke_of · ring_stroke · def_of
MIN_SCALEpub const MIN_SCALE: f64
Range of a placement’s scale.
MAX_SCALEpub const MAX_SCALE: f64
MAX_DEPTHpub const MAX_DEPTH: usize
Deepest nesting followed (the element’s own component is depth 0).
MAX_VISITSpub const MAX_VISITS: usize
Most component resolutions one element’s drawing makes.
MAX_POINTSpub const MAX_POINTS: usize
Most points of strokes one element’s drawing draws in all.
scale_okpub fn scale_ok(s: f64) -> bool
Whether s is a usable scale.
DetailComponentpub struct DetailComponent
A detail component placed in one view.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
view: ViewId
The view that owns (and alone shows) it.
position: DVec2
Where the component’s origin lands, view coordinates (meters).
rotation_deg: f64
Degrees counter-clockwise.
scale: f64
Size factor of the whole component.
mirrored: bool
Flipped across its own X axis (before turning).
overrides: BTreeMap<String, f64>
Values of instance parameters that differ from the type.
Methods
pub fn new(view: ViewId, position: DVec2) -> Selfpub fn is_valid(&self) -> bool
Finite numbers within bounds and a usable scale.
pub fn place(&self) -> Place
Where the component’s frame goes in the view.
pub fn transform(&mut self, t: &PlanTransform)
Move, rotate or mirror the placement with the view’s contents.
Placepub struct Place
A similarity of the plane: scale by scale, then the rigid t.
Traits: Debug, Clone, Copy, PartialEq, Default
Fields
t: PlanTransformscale: f64Methods
pub fn apply(&self, p: DVec2) -> DVec2pub fn apply_vector(&self, v: DVec2) -> DVec2pub fn then(&self, next: &Place) -> Place
self followed by next.
pub fn nested(&self, n: &crate::title_block::SheetNested) -> Place
The placement of a nested piece, resolved in the frame self maps.
pub fn apply_angle(&self, angle: f64) -> f64
A direction given in radians, through the placement.
nested_namespub fn nested_names(def: &ComponentDef) -> impl Iterator<Item = &str>
The names of the components def nests directly.
Visitpub struct Visit<'a>
What walk visits: each resolution’s pieces, where they go, and the
nesting depth (0 for the element’s own component).
Fields
pieces: &'a SheetPiecesplace: Placedepth: usizewalkpub fn walk<'d>(lookup: &dyn Fn(&str) -> Option<&'d ComponentDef>, name: &str, def: &ComponentDef, overrides: &BTreeMap<String, f64>, place: Place, visit: &mut dyn FnMut(Visit)) -> bool
Resolve def with overrides and visit its pieces through place,
then each nested component’s (found by lookup), depth first. A
component already being resolved (a cycle), nesting past MAX_DEPTH,
more than MAX_VISITS resolutions or strokes past MAX_POINTS
points are left out; returns whether everything was visited.
stroke_ofpub fn stroke_of(curve: &SketchCurve) -> Option<SheetShape>
A stroke piece that draws curve (in the component’s frame, meters):
lines and arcs as two points (a longer arc three), circles and whole
ellipses as closed strokes.
ring_strokepub fn ring_stroke(ring: &[DVec2]) -> Option<SheetShape>
A closed stroke along ring (straight sides).
def_ofpub fn def_of(pieces: Vec<SheetItem>) -> ComponentDef
A new detail component definition from pieces.
cc_core::dim_linecrates/cc_core/src/dim_line.rs
The dimension line of linear and aligned dimensions: lining it up with
the lines of other dimensions, and chains of dimensions that share one
line (continuous dimensioning).
The line of a dimension with direction d (unit) is the set of points
x with x · n = a · n + offset, where n = d.perp() (the left of d).
Items: PARALLEL_SIN · extent · offset_through · LineAlignment · align · chain · ordinate
PARALLEL_SINpub const PARALLEL_SIN: f64
Largest sine of the angle between two dimension lines that still counts as parallel (about 0.06°).
extentpub fn extent(dim: &Dimension) -> Option<(DVec2, DVec2)>
The drawn extent of a linear or aligned dimension’s line: where the
witness lines of a and b meet it. None for other kinds or a
degenerate direction.
offset_throughpub fn offset_through(dim: &Dimension, p: DVec2) -> Option<f64>
The offset (from dim.a, left of its direction positive) that puts the
line of dim through p.
LineAlignmentpub struct LineAlignment
The line of dim lined up with another dimension’s.
Traits: Debug, Clone, Copy, PartialEq
Fields
offset: f64
The offset of dim that puts its line on the other line.
reference: DVec2
The end of the other dimension’s line nearest to dim (where a guide starts).
point: DVec2
The point of the aligned line of dim nearest to reference (where the guide ends).
alignpub fn align<'a>(dim: &Dimension, others: impl IntoIterator<Item = &'a Dimension>, tol: f64) -> Option<LineAlignment>
Snap the line of dim (a linear or aligned dimension being placed, at
its current offset) onto the line of a parallel dimension of others
when it lies within tol (model units) of it. The nearest line wins;
None when no parallel line is close enough.
chainpub fn chain(view: ViewId, points: &[DVec2], dir: DVec2, offset: f64, aligned: bool) -> Option<Vec<Dimension>>
The dimensions of a chain through points measured along dir, all on
the line at offset from the first point (left of dir positive): one
dimension from each point to the next. With aligned, a segment along
dir (or against it) is an aligned dimension, so it keeps following the
direction of what it measures; any other segment (and every segment
without aligned) is a linear dimension along dir. None when dir
is degenerate, a value is not finite, or a segment measures nothing
along dir (shorter than 1e-6).
ordinatepub fn ordinate(view: ViewId, points: &[DVec2], dir: DVec2, offset: f64) -> Option<Vec<Dimension>>
The running (ordinate) dimensions from the origin points[0] to each
other point, measured along dir, all on the line at offset from the
origin (left of dir positive). None when dir is degenerate, a value
is not finite, or a point measures nothing from the origin along dir
(closer than 1e-6).
cc_core::dim_refscrates/cc_core/src/dim_refs.rs
Associative dimensions: each end of a dimension may reference a point
of an element (stored in that element’s own frame, plus a height in
elevations and sections) or a level. Every edit ends by recomputing
referenced ends (crate::EditCtx), inside the same transaction, so
dimensions follow moved, rotated, stretched or raised elements and
levels, and undo restores both together.
Items: DimRef · RefTarget · RefAnchor · RefHeight · Projection
DimRefpub struct DimRef
What a dimension end follows.
Traits: Debug, Clone, Copy, PartialEq, Serialize, Deserialize
Fields
target: RefTargetanchor: RefAnchorz: Option<RefHeight>
Height in elevations and sections (None in plans).
Methods
pub fn element(&self) -> Option<ElementId>
The referenced element, if the target is one.
pub(crate) fn is_finite(&self) -> boolpub(crate) fn mirrored(self, target: &ElementKind) -> DimRef
The reference to the mirror image of this point once target (the
referenced element, already mirrored) went through a mirror: a wall
is walked the other way, beams, grids, columns and components keep
their direction, and an opening’s frame follows its wall.
pub(crate) fn target_exists(&self, project: &Project) -> bool
Whether the target still exists in project.
RefTargetpub enum RefTarget
Traits: Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize
Variants
Element(ElementId)Level(LevelId)
A level line of an elevation or section (only its height counts).
RefAnchorpub enum RefAnchor
Where the point sits in the element’s frame.
Traits: Debug, Clone, Copy, PartialEq, Serialize, Deserialize
Variants
Line { from_end: bool, along: f64, across: f64 }
On a wall, beam or grid: along meters from its start (or from its
end when from_end, measured back toward the start), across
meters to the left of its line.
Local { x: f64, y: f64 }
In the frame of a column or component (its position and rotation).
Hosted { along: f64, across: f64 }
On a door or window: along its wall from the opening center,
across to the left of the wall’s line.
Level
A level: the end keeps its position along the view.
RefHeightpub struct RefHeight
Height of a referenced point: dz above the element’s base, or above
its top when from_top (walls), so it follows height changes.
Traits: Debug, Clone, Copy, PartialEq, Serialize, Deserialize
Fields
from_top: booldz: f64Projectionpub struct Projection
How elevations and sections map the model: x along right from
origin (plan), y the height.
Traits: Debug, Clone, Copy, PartialEq
Fields
origin: DVec2right: DVec2Methods
pub fn project(&self, p: DVec2, z: f64) -> DVec2cc_core::dim_stylecrates/cc_core/src/dim_style.rs
How a dimension type draws its dimensions: the marks at the ends of the dimension line, the witness lines, the pens and the text around the value. Sizes are paper millimeters, so they read the same at any scale.
Items: MAX_LENGTH_MM · MIN_MARK_MM · MAX_AFFIX · DimensionStyle
MAX_LENGTH_MMpub const MAX_LENGTH_MM: f64
Most paper millimeters any length of the style may take.
MIN_MARK_MMpub const MIN_MARK_MM: f64
Smallest mark.
MAX_AFFIXpub const MAX_AFFIX: usize
Most characters of the prefix or the suffix.
DimensionStylepub struct DimensionStyle
The drawing parameters of a dimension type. Every field has a default, so types saved before them draw as they did.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize, Default
Fields
mark: LeaderSymbol
The mark at each end of the dimension line (linear and angular dimensions; radial ones keep their arrows).
mark_size: f64
Length of the mark: the stroke of a tick, the depth of an arrow.
mark_weight: Option<f64>
Pen width of the mark; None draws ticks heavy and other marks like the lines.
line_weight: Option<f64>
Pen width of the dimension and witness lines; None is the annotation pen.
color: Option<[u8; 3]>
Color of the lines and marks; None is the annotation color.
witness_gap: f64
Gap between the measured point and the start of its witness line.
witness_extension: f64
How far witness lines run past the dimension line.
line_extension: f64
How far the dimension line runs past the witness lines.
text_offset: f64
Distance from the dimension line to the bottom of the text.
prefix: String
Written before the value.
suffix: String
Written after the value.
opaque_text: bool
The text hides what lies under it (a white box behind it).
Methods
pub fn of(system: crate::MeasurementSystem) -> Self
The default style of a project of system: in imperial projects
round inches on paper (1/8” marks and extensions, 1/16” gaps, the
text 1/32” off the line).
pub fn label(&self, value: &str) -> String
value written with the prefix and the suffix.
pub fn repair(&mut self) -> usize
Reset what is out of range; returns the number of repairs.
cc_core::documentcrates/cc_core/src/document.rs
Items: Transaction · EditCtx · Document
Transactionpub struct Transaction
A recorded, reversible set of changes.
Traits: Debug, Clone, Default
Fields
name: StringSome fields are private.
Methods
pub fn is_empty(&self) -> boolpub fn changed_elements(&self) -> impl Iterator<Item = ElementId> + '_
Element ids touched by this transaction.
EditCtxpub struct EditCtx<'a>
Mutable access to a project inside Document::edit; records the
original state of everything it touches.
Some fields are private.
Methods
pub(crate) fn sync_dimensions(&mut self) (in cc_core::dim_refs)
Move the referenced ends of every dimension to their targets’ current points (and an angle’s vertex to the intersection of its lines); references to deleted targets are dropped (the end stays where it was). Only changed dimensions are touched.
pub fn project(&self) -> &Projectpub fn alloc_id(&mut self) -> u64pub(crate) fn element_changes(&self) -> Vec<(ElementId, Option<&Element>)>
The elements this edit has changed so far, each with its state before
the edit (None: it was added). Elements touched but left as they
were are skipped.
pub(crate) fn changed_types(&self) -> std::collections::BTreeSet<ElementTypeId>
The types this edit has added, removed or changed so far.
pub fn add_element(&mut self, mut element: Element) -> ElementId
Insert an element. Its id must come from EditCtx::alloc_id.
pub fn element_mut(&mut self, id: ElementId) -> Option<&mut Element>pub fn remove_element(&mut self, id: ElementId)
Remove an element and everything it hosts. Iterative with a visited set, so cyclic hosting in a crafted file cannot recurse forever.
pub fn add_view(&mut self, view: View) -> ViewIdpub fn view_mut(&mut self, id: ViewId) -> Option<&mut View>pub fn remove_view(&mut self, id: ViewId)
Remove a view, the elements it owns (dimensions, text notes, imported drawings) and any sheet viewports showing it.
pub fn add_type(&mut self, mut element_type: ElementType) -> ElementTypeIdpub fn type_mut(&mut self, id: ElementTypeId) -> Option<&mut ElementType>pub fn remove_type(&mut self, id: ElementTypeId)
Remove a type (callers make sure no element uses it).
pub fn info_mut(&mut self) -> &mut ProjectInfopub fn levels_mut(&mut self) -> &mut Vec<Level>
Levels; callers should keep them sorted by elevation.
pub fn materials_mut(&mut self) -> &mut Vec<Material>pub fn rename_material(&mut self, old: &str, new: &str) -> bool
Rename a material and every type reference to it. Returns false
(and changes nothing) when new is empty or already taken.
pub fn set_pinned(&mut self, ids: &[ElementId], pinned: bool) -> usize
Pin or unpin elements; returns how many changed.
pub fn set_joined(&mut self, cutting: ElementId, cut: ElementId, joined: bool) -> bool
Join the geometry of two elements, cutting keeping their common
volume (an existing join between them is replaced), or unjoin them.
Returns whether anything changed.
pub fn add_group(&mut self, name: String, members: std::collections::BTreeSet<ElementId>) -> crate::GroupId
Group members (taking them out of any group they were in) under
name; returns the new group’s id.
pub fn remove_group(&mut self, id: crate::GroupId) -> bool
Dissolve a group (its elements stay); returns whether it existed.
pub fn systems_mut(&mut self) -> &mut BTreeMap<crate::SystemId, crate::MepSystem>
Plumbing systems and electrical circuits.
pub fn filters_mut(&mut self) -> &mut BTreeMap<crate::FilterId, crate::ViewFilter>
View filters.
pub fn templates_mut(&mut self) -> &mut BTreeMap<crate::TemplateId, crate::ViewTemplate>
View templates (views that follow one are updated when the edit ends).
pub fn browser_mut(&mut self) -> &mut crate::browser::BrowserOrganization
The project browser’s schemes and the one in use.
pub fn bar_marking_mut(&mut self) -> &mut crate::bar_marks::BarMarking
How the project’s reinforcing bars are marked.
pub fn line_styles_mut(&mut self) -> &mut crate::detail::LineStyles
The project’s line styles.
pub fn sun_presets_mut(&mut self) -> &mut Vec<crate::sun::SunPreset>
The project’s sun presets (see crate::sun).
pub fn fill_patterns_mut(&mut self) -> &mut crate::fill_pattern::FillPatterns
The project’s fill patterns.
pub fn profiles_mut(&mut self) -> &mut BTreeMap<crate::ProfileId, crate::structural_profile::ProfileDef>
The project’s structural profiles.
pub fn phases_mut(&mut self) -> &mut Vec<crate::Phase>
Construction phases, in time order.
pub fn phase_filters_mut(&mut self) -> &mut BTreeMap<crate::PhaseFilterId, crate::PhaseFilter>
Phase filters.
pub fn set_graph_binding(&mut self, id: ElementId, binding: Option<crate::graph_binding::GraphBinding>)
Graphics of each phase status.
Bind an element to the graph call that made it, or unbind it with None.
pub fn phase_graphics_mut(&mut self) -> &mut crate::PhaseGraphicspub fn option_sets_mut(&mut self) -> &mut Vec<crate::OptionSet>
Design option sets (see crate::design_option).
pub fn units_mut(&mut self) -> &mut crate::Unitspub(crate) fn sync_member_hosts(&mut self) (in cc_core::member_host)
Keep member hosts and their members in step, from what this edit itself changed (it runs before the syncs that touch elements):
MemberHost::inputs),
gets the members of its layout (except detached roles):
existing ones rewritten in place (same ids), missing ones added,
those whose role is gone deleted. A host the edit added (a copy, a
paste) keeps none of the members it lists and gets its own: the
listed elements may be another host’s or, after a paste, unrelated
elements the user owns;pub(crate) fn sync_member_phases(&mut self) (in cc_core::member_host)
After the phase and design option syncs: the members of a host whose
phases or option this edit changed (a wall framing follows its wall
there, after Self::sync_member_hosts ran), and the members this
edit added (which sync_options may have put in the active option),
take the host’s phases and option.
pub fn transform_elements(&mut self, ids: &[ElementId], t: &PlanTransform) -> Vec<ElementId> (in cc_core::transform)
Transform ids in one step. Doors and windows of transformed walls
go with them (their offset follows a mirrored wall’s new direction);
hosted elements whose wall is not transformed slide along it by the
translation’s component on the wall. Returns the ids changed.
pub fn copy_elements(&mut self, ids: &[ElementId], transforms: &[PlanTransform]) -> Vec<ElementId> (in cc_core::transform)
Copy ids once per transform (arrays pass several). Copied walls take
copies of their doors and windows along; a hosted element copied
without its wall stays on that wall, shifted along it. Returns the
new ids.
pub fn paste_elements(&mut self, set: &[Element], transforms: &[PlanTransform], level: Option<crate::LevelId>) -> Vec<ElementId> (in cc_core::transform)
Add copies of set (from crate::Project::copy_set) once per
transform, on level when given (hosted elements whose wall was not
copied stay on that wall’s level). Elements whose type, level, view
or wall no longer exist are skipped, and walls attached to a missing
level become unconnected. Copies are built in the creation phase
(see crate::phase). A copied dimension measures the copies of
what it measured; pasted in place (no move, no level) it keeps
measuring what was not copied. Returns the new ids.
pub fn trim_detail(&mut self, id: ElementId, pick: DVec2, boundary: &SketchCurve) -> Result<(), EditError> (in cc_core::wall_ops)
Trim or extend detail line id to the curve boundary (where its
line, circle or ellipse runs), keeping the picked part.
pub fn trim_corner(&mut self, a: ElementId, pick_a: DVec2, b: ElementId, pick_b: DVec2) -> Result<(), EditError> (in cc_core::wall_ops)
Trim or extend two elements so they meet at a corner, keeping the picked parts. Lines meet where they cross; an arc wall meets a line or another arc where its circle crosses it (of two crossings, the one on the elements themselves, else the one that changes them least).
pub fn trim_to(&mut self, id: ElementId, pick: DVec2, reference: Path) -> Result<(), EditError> (in cc_core::wall_ops)
Trim or extend id to the reference path (a line, or an arc’s
circle), keeping the picked part.
pub fn split(&mut self, id: ElementId, at: DVec2) -> Result<ElementId, EditError> (in cc_core::wall_ops)
Split a wall, beam or grid at the projection of at; returns the
new element (the part after the split). Openings past the split go
to the new wall.
pub fn move_endpoint(&mut self, id: ElementId, at_start: bool, to: DVec2) -> Result<(), EditError> (in cc_core::wall_ops)
Move one end of a wall, beam or grid to to (lengthening or
shortening it). Walls whose ends met that end move with it, so
corners stay closed; openings keep their place.
pub fn offset_copy(&mut self, id: ElementId, distance: f64) -> Result<ElementId, EditError> (in cc_core::wall_ops)
A copy of id moved distance perpendicular to its line (positive
to the left of start→end). Openings are not copied.
pub fn align_to(&mut self, id: ElementId, reference: Path) -> Result<(), EditError> (in cc_core::wall_ops)
Move id (with its openings) onto the reference path: a line onto
a parallel line, an arc wall onto the circle of a concentric arc (its
radius changes, its sweep stays; openings keep their angles).
Documentpub struct Document
An open project plus its undo history and file state. Cloned to run a long command (an import) on another thread while the app keeps drawing.
Traits: Clone
Fields
project: Projectpath: Option<PathBuf>creation_phase: Option<crate::PhaseId>
The phase new elements are built in (the active view’s; None:
the last phase). Display state: not saved, not undone.
Some fields are private.
Methods
pub fn new(mut project: Project) -> Selfpub fn set_view_state(&mut self, f: impl FnOnce(&mut Project))
Apply a change that is saved but not undoable, and that no derived
geometry depends on (a 3D view’s camera). The revision stays, so caches
keyed on it stay valid: callers drop what does depend on the change
(see Session::set_view_camera).
pub fn set_active_option(&mut self, option: Option<crate::OptionId>)
Set the design option new elements go into, which views without a
choice of their own show for its set (None: the main model). Not
undone nor saved, but views change: the revision moves on (without
marking the document as changed).
pub fn revision(&self) -> u64
Monotonic counter bumped on every model change; use it to invalidate caches.
pub fn is_dirty(&self) -> boolpub fn mark_saved(&mut self)pub fn mark_unsaved(&mut self)
Treat the project as not saved (one restored from a recovery copy, whose changes never reached its file).
pub fn edit<R>(&mut self, name: impl Into<String>, f: impl FnOnce(&mut EditCtx) -> R) -> R
Run f as one undoable transaction named name.
pub fn edit_merged<R>(&mut self, name: impl Into<String>, merge_key: u64, f: impl FnOnce(&mut EditCtx) -> R) -> R
Like Document::edit, but consecutive edits with the same merge_key
become a single undo step (e.g. while dragging a value).
pub fn undo_depth(&self) -> usize
Number of undoable transactions.
pub fn squash_since(&mut self, depth: usize, name: impl Into<String>) -> bool
Fold the undo steps recorded since undo depth depth into one step
named name (a command made of other commands, undone at once).
Changes that cancel out are dropped, and so is the step if nothing is
left; returns whether a step remains.
pub fn break_merge(&mut self)
End coalescing so the next merged edit starts a new undo step.
pub fn try_edit<R, E>(&mut self, name: impl Into<String>, f: impl FnOnce(&mut EditCtx) -> Result<R, E>, check: impl FnOnce(&Project) -> Result<(), E>) -> Result<R, E>
Like Document::edit, but the change is kept only if f succeeds
and check accepts the resulting project; otherwise the project is
restored and nothing is recorded (no undo step, redo kept).
pub fn try_edit_merged<R, E>(&mut self, name: impl Into<String>, merge_key: Option<u64>, f: impl FnOnce(&mut EditCtx) -> Result<R, E>, check: impl FnOnce(&Project) -> Result<(), E>) -> Result<R, E>
Document::try_edit that merges into the previous step when
merge_key matches its key (like Document::edit_merged).
pub fn can_undo(&self) -> boolpub fn can_redo(&self) -> boolpub fn undo_name(&self) -> Option<&str>pub fn redo_name(&self) -> Option<&str>pub fn undo(&mut self) -> boolpub fn redo(&mut self) -> boolcc_core::elementcrates/cc_core/src/element.rs
Items: Element · ElementKind · WallTop · LocationLine · Wall · Hosted · Floor · Ceiling · RoofShape · Roof · Room · Grid · TextNote · Leader · LeaderSymbol · Dimension · DimensionKind · Column · BeamLateral · BeamVertical · Beam · FoundationShape · Foundation · BarFace · WallSide · SpacingZone · BarEnd · RebarLayout · FaceBars · Splice · Rebar · ShapedRebar · Stair · Ramp · Railing · Component
Elementpub struct Element
A model element instance. Coordinates are in meters; X east, Y north, Z up.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
id: ElementIdlevel: LevelIdtype_id: ElementTypeIdmark: String
“Mark” instance parameter, shown in schedules and tags.
comments: Stringkind: ElementKinduid: Uid
Persistent unique id (IFC GlobalId and similar).
phase_created: crate::PhaseId
The phase the element is built in (see crate::phase).
phase_demolished: Option<crate::PhaseId>
The phase the element is demolished in (not before it is built).
design_option: Option<crate::OptionId>
The design option the element belongs to (None: the main model,
shown with every option; see crate::design_option).
paints: Vec<crate::paint::FacePaint>
Faces painted with a material of their own (see crate::paint).
Methods
pub fn category(&self) -> Categorypub fn rebar_partition(&self) -> Option<&str>
The partition of a reinforcement set or of shaped bars.
pub fn rebar_bar_mark(&self) -> Option<&str>
The mark given by hand to a reinforcement set’s or shaped bars’ bars.
pub fn owner_view(&self) -> Option<ViewId>
The view that owns the element (dimensions, text notes, detail lines and imported drawings live in one view and go with it).
pub fn set_owner_view(&mut self, view: ViewId) -> bool
Give a view-owned element (see Self::owner_view) another view.
Returns false, changing nothing, for elements of the model.
pub fn as_segment(&self) -> Option<&crate::MepSegment>
The run of a pipe, conduit, cable tray or lightning conductor.
pub fn as_segment_mut(&mut self) -> Option<&mut crate::MepSegment>pub fn systems(&self) -> Vec<crate::SystemId>
Systems (or circuits) the element belongs to.
pub fn as_wall(&self) -> Option<&Wall>pub fn as_hosted(&self) -> Option<&Hosted>pub fn as_hosted_mut(&mut self) -> Option<&mut Hosted>pub fn drawn_sketch_mut(&mut self) -> Option<&mut Option<crate::sketch::Sketch>>
The sketch an outline was drawn with (floors, ceilings, roofs and masses), to read or set.
pub fn drawn_sketch(&self) -> Option<&crate::sketch::Sketch>
The sketch an outline was drawn with, if it has one.
pub fn sketched_profile(&self) -> Option<(&[DVec2], &[Vec<DVec2>])>
The outline and openings a sketch makes for this element: floors and roofs have openings, ceilings and masses an outline only.
pub fn drop_stale_sketch(&mut self) -> bool
Drop a sketch that no longer makes the outline (edited without it), or is invalid; returns whether it did.
pub fn sketch(&self) -> Option<&[DVec2]>
Sketch boundary for floors, ceilings and roofs.
pub fn translate(&mut self, delta: DVec2)
Translate the element in plan. Hosted elements move with their host.
pub fn member_host(&self) -> Option<&dyn MemberHost> (in cc_core::member_host)pub fn shaft_cuts_mut(&mut self) -> Option<&mut Vec<Vec<DVec2>>> (in cc_core::shaft)
The shaft cuts kept in a floor, ceiling or roof.
pub fn shaft_cuts(&self) -> &[Vec<DVec2>] (in cc_core::shaft)
The shaft cuts of a floor, ceiling or roof.
pub fn transform(&mut self, t: &PlanTransform) (in cc_core::transform)
Move, rotate or mirror the element in plan. Hosted elements are
placed along their wall and are handled with it (see
crate::EditCtx::transform_elements); here only their hand flips
under a mirror.
ElementKindpub enum ElementKind
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Variants
Wall(Wall)Door(Hosted)Window(Hosted)Niche(Hosted)
A recess in one face of its host wall (the left one; the right with
flip_facing), as deep as its type says: see crate::openings.
Floor(Floor)Ceiling(Ceiling)Roof(Roof)Room(Room)Grid(Grid)Dimension(Box<Dimension>)Text(Box<TextNote>)Column(Column)Beam(Beam)Stair(Stair)Ramp(Ramp)Railing(Railing)Component(Component)Foundation(Foundation)Rebar(Rebar)ShapedRebar(ShapedRebar)
Reinforcing bars bent to shapes of their own, placed by their center lines (bars read from IFC files).
Pipe(crate::MepSegment)Conduit(crate::MepSegment)CableTray(crate::MepSegment)
A cable tray run (a rectangular channel carrying circuits).
Valve(crate::Valve)
A valve on a pipe.
LightningConductor(crate::lightning::LightningConductor)
A conductor of a lightning protection system (roof, down or earth conductor).
CadImport(Box<crate::cad::CadImport>)
A DWG or DXF drawing placed in a 2D view (an underlay to trace over).
Mass(crate::mass::Mass)
A conceptual mass (massing studies).
Sweep(crate::profile_sweep::Sweep)
A profile swept along a path (baseboards, moldings, fascias, gutters).
Shaft(crate::shaft::Shaft)
A vertical opening through floors, ceilings and roofs.
SteelBuilding(Box<crate::steel_building::SteelBuilding>)
A parametric steel building: it owns the columns and beams of its frames.
Truss(Box<crate::truss::Truss>)
A parametric truss: it owns the beams and columns of its chords and web.
Bracing(Box<crate::bracing::Bracing>)
A parametric bracing: it owns the braces of one bay of a frame.
WallFraming(Box<crate::wall_framing::WallFraming>)
Light steel or wood framing of a wall: it owns the studs and the beams of its tracks, headers and sills.
Connection(crate::connection::Connection)
A steel or timber joint at one end of a column or beam (placed by its member).
Topography(crate::topography::Topography)
A terrain surface from measured points inside a boundary.
Pad(crate::pad::Pad)
A building pad graded into its terrain.
DetailLine(crate::detail::DetailLine)
A 2D line, arc, circle or ellipse drawn in one view.
FilledRegion(crate::region::Region)
A 2D area of one view filled as its type says.
MaskingRegion(crate::region::Region)
A 2D area of one view that hides the model’s linework under it.
LevelMark(Box<crate::level_mark::LevelMark>)
The elevation of a point, written in one view.
BarTag(Box<crate::bar_tag::BarTag>)
The count, mark, diameter, spacing and length of a reinforcement set’s bars, written in one view.
Pile(crate::pile::Pile)
A pile: free, or one of a pile cap’s (see crate::pile).
DetailComponent(Box<crate::detail_component::DetailComponent>)
A 2D component placed in one view (construction details).
Methods
pub fn member_host(&self) -> Option<&dyn MemberHost> (in cc_core::member_host)
The host behind this element, if it is one.
pub fn member_host_mut(&mut self) -> Option<&mut dyn MemberHost> (in cc_core::member_host)
WallToppub enum WallTop
How the top of a wall is defined.
Traits: Debug, Clone, Copy, PartialEq, Default, Serialize, Deserialize
Variants
Unconnected
height above the base.
Level { level: LevelId, offset: f64 }
At a level’s elevation plus offset; follows the level when it moves.
LocationLinepub enum LocationLine
Which line of the wall the drawn start-end line follows.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
CenterlineCoreCenterFinishExteriorFinishInteriorCoreExteriorCoreInteriorMethods
pub const ALL: [LocationLine; 6]pub fn key(self) -> &'static strWallpub struct Wall
Traits: Debug, Clone, PartialEq, Serialize, Deserialize, Default
Fields
start: DVec2
Location line start point (see location_line).
end: DVec2base_offset: f64
Offset of the wall base from its level elevation.
height: f64
Unconnected height (used when top is WallTop::Unconnected).
top: WallToplocation_line: LocationLineroom_bounding: bool
The wall bounds rooms.
structural: bool
The wall is load-bearing.
join_start: bool
The start (end) may join other walls; when off it stays square.
join_end: boolbulge: f64
An arc wall: tan(sweep / 4) of its location line, positive when it
turns counter-clockwise from start to end (see crate::arc);
0 for a straight wall.
attach_top: Option<ElementId>
The roof, ceiling or floor the top is attached to: under it the wall rises or drops to its underside, following its slope; elsewhere it keeps its own top.
curtain: crate::curtain::CurtainEdits
Adjustments to the grid of a curtain wall type (ignored by other types).
Methods
pub fn arc(&self) -> Option<crate::arc::Arc>
The arc of the location line (None for a straight wall).
pub fn length(&self) -> f64
Length of the location line (along the arc for arc walls).
pub fn direction(&self) -> DVec2
Unit direction from start to end (X axis if degenerate): the chord of an arc wall.
pub fn normal(&self) -> DVec2
Left-hand normal of the chord.
pub fn tangent_at(&self, distance: f64) -> DVec2
Direction of the location line distance along it.
pub fn normal_at(&self, distance: f64) -> DVec2
Left-hand normal of the location line distance along it.
pub fn point_at(&self, distance: f64) -> DVec2pub fn at(&self, along: f64, across: f64) -> DVec2
The point along the location line and across to its left.
pub fn project(&self, p: DVec2) -> (f64, f64)
Distance along the wall of the projection of p, and the signed
perpendicular distance (positive on the left).
pub fn offset_line(&self, distance: f64) -> (DVec2, DVec2)
The location line moved distance to its left (concentric for arc
walls, which keep their bulge).
Hostedpub struct Hosted
A door or window hosted by a wall.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
host: ElementIdoffset: f64
Distance from the host wall start to the opening center, along the wall.
sill_height: f64
Sill height above the wall base (0 for doors).
flip_facing: bool
Swing/facing to the wall’s right side instead of the left.
flip_hand: bool
Hinge at the opposite jamb.
Floorpub struct Floor
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
boundary: Vec<DVec2>
Boundary sketch (closed polygon, either winding).
height_offset: f64
Offset of the top face from the level elevation.
openings: Vec<Vec<DVec2>>
Openings through the slab (shafts, stairwells): closed outlines inside the boundary, apart from each other.
cuts: Vec<Vec<DVec2>>
Openings cut by shafts, kept in step with them by every edit (see
crate::shaft).
sketch: Option<crate::sketch::Sketch>
The curves the outline was drawn with (see crate::sketch); dropped
when the outline is edited without them.
structural: bool
A structural slab: one that takes reinforcement.
Methods
pub fn new(boundary: Vec<DVec2>, height_offset: f64) -> Self
A floor over boundary with no openings.
pub fn all_openings(&self) -> impl Iterator<Item = &Vec<DVec2>>
Its openings and the shafts’ cuts.
pub fn area(&self) -> f64
Plan area: the boundary less its openings, exact along the arcs, circles and ellipses of its sketch (the boundary’s points are chords).
Ceilingpub struct Ceiling
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
boundary: Vec<DVec2>height_offset: f64
Height of the ceiling’s underside above the level.
cuts: Vec<Vec<DVec2>>
Openings cut by shafts, kept in step with them by every edit (see
crate::shaft).
sketch: Option<crate::sketch::Sketch>
The curves the outline was drawn with (see crate::sketch); dropped
when the outline is edited without them.
RoofShapepub enum RoofShape
Traits: Debug, Clone, Copy, PartialEq, Serialize, Deserialize
Variants
FlatShed { slope: f64, direction_deg: f64, }
Single slope rising towards direction_deg (0 = +X), slope as rise/run.
Gable { slope: f64, ridge_deg: f64, }
Two slopes meeting at a ridge along ridge_deg; the eaves parallel to
the ridge rise, the others become gable ends.
Hip { slope: f64, }
Every eave rises with the same slope (hips and, on long plans, a ridge).
Roofpub struct Roof
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
footprint: Vec<DVec2>base_offset: f64
Offset of the roof base above the level.
overhang: f64shape: RoofShapeholes: Vec<Vec<DVec2>>
Openings through the roof (courtyards), closed outlines inside the footprint; pitched roofs slope down to their eaves too.
cuts: Vec<Vec<DVec2>>
Slope of each footprint edge (edge i from point i to i + 1) that
differs from the shape’s, for gable and hip roofs: Some(0.0) makes
the edge a gable end, Some(s) an eave rising at s; missing or
None entries follow the shape.
Openings cut by shafts, kept in step with them by every edit (see
crate::shaft).
edge_slopes: Vec<Option<f64>>sketch: Option<crate::sketch::Sketch>
The curves the outline was drawn with (see crate::sketch); dropped
when the outline is edited without them.
Methods
pub fn new(footprint: Vec<DVec2>, base_offset: f64, overhang: f64, shape: RoofShape) -> Self
A roof over footprint with no openings.
pub fn edge_slope(&self, i: usize) -> Option<f64>
The slope set on footprint edge i, if any.
pub fn area(&self) -> f64
Plan area: the footprint less its openings.
Roompub struct Room
A room: the space enclosed by room-bounding walls around position.
Its boundary is derived from the walls (see cc_geom).
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
position: DVec2
A point inside the room; also where its tag is drawn.
number: Stringname: Stringheight: f64
Height of the room above its level (upper limit).
Gridpub struct Grid
A named grid line (datum), shown in every plan, and in the elevations and sections it runs square to.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
start: DVec2end: DVec2name: StringTextNotepub struct TextNote
A text note in one view, in that view’s drawing coordinates (like dimensions), optionally with leaders pointing at what it describes.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
view: ViewIdposition: DVec2
Insertion point: the top left corner of the text, before rotation.
text: String
The text; line breaks start new lines.
width: Option<f64>
Wrapping width in paper millimeters for multiline text; None for
single-line text (only explicit line breaks break it).
rotation_deg: f64
Rotation in degrees counter-clockwise.
leaders: Vec<Leader>Leaderpub struct Leader
A leader line from a text to what it points at: one segment, or two when it has an elbow (text → elbow → end).
Traits: Debug, Clone, Copy, PartialEq, Serialize, Deserialize
Fields
end: DVec2
The point it points at, where the symbol is drawn.
elbow: Option<DVec2>
Bend point splitting the leader in two segments.
symbol: LeaderSymbol
LeaderSymbolpub enum LeaderSymbol
The mark at the end of a leader.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
Arrow
Filled arrowhead.
OpenArrow
Open arrowhead (two strokes).
Triangle
Outlined arrowhead.
Dot
Small filled circle.
CircleSquareFilledSquareTick
Slanted stroke (architectural tick).
NoneMethods
pub const ALL: [LeaderSymbol; 9]pub fn key(self) -> &'static str
Translation key of the symbol’s name.
Dimensionpub struct Dimension
A dimension in one view, in that view’s drawing coordinates. What a,
b and offset mean depends on the DimensionKind.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
view: ViewIda: DVec2b: DVec2offset: f64
Linear kinds: distance of the dimension line from a, positive on
the left of the measured direction. Angular: radius of the arc.
kind: DimensionKindrefs: [Option<crate::DimRef>; 2]
Elements the ends a and b follow (associative dimension).
Methods
pub fn length(&self) -> f64pub fn direction(&self) -> Option<DVec2>
Direction the dimension measures along (linear kinds), if defined.
pub fn all_refs_mut(&mut self) -> impl Iterator<Item = &mut Option<crate::DimRef>>
Every element reference: the ends and, for angles, the rays.
pub fn is_associated(&self) -> bool
Whether any end or ray follows an element.
pub fn value(&self) -> f64
The measured value: meters for lengths, radians for angles.
DimensionKindpub enum DimensionKind
How a dimension measures.
Traits: Debug, Clone, Copy, PartialEq, Default, Serialize, Deserialize
Variants
Aligned
Distance from a to b, along a-b.
Linear { dir: DVec2 }
Distance from a to b measured along dir (a unit vector,
horizontal or vertical when placed).
Angular { vertex: DVec2, #[serde(default)] rays: [Option<crate::DimRef>; 2], }
Angle at vertex between the rays through a and through b.
rays hold a second point of each measured line (the vertex, in the
frame of that line’s element), so the vertex follows the elements.
Radial
Radius of the arc centered at a through b.
Diameter
Diameter of the circle centered at a through b.
Ordinate { dir: DVec2 }
Distance from the origin a to b measured along dir (a unit
vector), drawn as a running (ordinate) dimension: the dimensions of
a set share the origin and the line, and each shows its running
total from the origin.
Columnpub struct Column
A column placed at a point, from its base to its top constraint.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
position: DVec2rotation_deg: f64
Rotation of the section in plan, degrees counter-clockwise.
base_offset: f64height: f64
Height when top is unconnected.
top: WallTopstructural: bool
A load-bearing column; an architectural one (off) is cut by the walls it is joined with.
BeamLateralpub enum BeamLateral
Which line across a beam’s section its start-end location line follows.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
Center
The middle of the section.
Left
The left face (looking from the start to the end).
Right
The right face.
Methods
pub const ALL: [BeamLateral; 3]pub fn key(self) -> &'static strpub fn mirrored(self) -> Self
The other side, as seen in a mirror.
BeamVerticalpub enum BeamVertical
Which height of a beam’s section sits at its location elevation.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
TopCenterBottomMethods
pub const ALL: [BeamVertical; 3]pub fn key(self) -> &'static strBeampub struct Beam
A horizontal beam between two points. Its location line is at the level
elevation plus top_offset; vertical picks which height of the section
sits there (the top by default) and lateral which line across it.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
start: DVec2end: DVec2top_offset: f64end_offset: Option<f64>
Location elevation of the end above the level when it differs from the start’s (a sloped beam).
lateral: BeamLateralvertical: BeamVerticaljoin_start: bool
The start (end) may join structural columns and other beams; when off it stays square.
join_end: boolbulge: f64
Bulge of an arc beam (tan(sweep / 4), positive when it turns
counter-clockwise from start to end; see crate::arc); 0 for a
straight beam. An arc beam is level: it has no end_offset.
Methods
pub fn rise(&self) -> f64
Rise of the location line from the start to the end.
pub fn true_length(&self) -> f64
Length along the slope, or along the arc of an arc beam.
pub fn arc(&self) -> Option<crate::arc::Arc>
The arc of the location line (None for a straight beam).
pub fn new(start: DVec2, end: DVec2, top_offset: f64) -> Self
A beam whose ends may join.
pub fn length(&self) -> f64
Distance between the ends (the chord of an arc beam).
FoundationShapepub enum FoundationShape
Where a foundation is in plan.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Variants
Pad { position: DVec2, rotation_deg: f64 }
A pad centered at position, its width along the rotated X axis.
Strip { start: DVec2, end: DVec2, #[serde(default)] bulge: f64, }
A strip centered on the line start-end, or on an arc between them
when bulge is not 0 (tan(sweep / 4), positive when it turns
counter-clockwise from start to end; see crate::arc).
Slab { boundary: Vec<DVec2> }
A slab with this boundary.
Methods
pub fn points_mut(&mut self) -> Vec<&mut DVec2>pub fn points(&self) -> Vec<DVec2>pub fn arc(&self) -> Option<crate::arc::Arc>
The centerline arc of an arc strip (None for straight strips and other shapes).
pub fn strip_length(&self) -> f64
Length of a strip’s centerline (along the arc for arc strips); 0 for other shapes.
Foundationpub struct Foundation
A foundation: its top is top_offset above the level; the type gives its
size and depth.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
shape: FoundationShapetop_offset: f64sketch: Option<crate::sketch::Sketch>
The curves a slab’s boundary was drawn with (see crate::sketch);
dropped when the boundary is edited without them.
Methods
pub fn new(shape: FoundationShape, top_offset: f64) -> Self
A foundation of shape, its top top_offset above its level.
pub fn slab_area(&self) -> Option<f64>
Plan area of a slab, exact along the arcs and circles of its sketch
(the boundary’s points are chords); None for pads and strips.
BarFacepub enum BarFace
Where a set of longitudinal bars lies in its host’s section.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
Top
Along the top of a beam.
Bottom
Along the bottom of a beam.
Perimeter
Around a column’s section (corners first).
Methods
pub fn key(self) -> &'static strWallSidepub enum WallSide
The face of a wall a layer of bars lies near: its exterior (left) face or its interior (right) one.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
ExteriorInteriorMethods
pub const ALL: [WallSide; 2]pub fn key(self) -> &'static strpub fn sign(self) -> f64
1 towards the wall’s left (exterior) face, -1 towards its right.
SpacingZonepub struct SpacingZone
The spacing of a wall’s horizontal bars up to a height above its base; the last zone of a set runs to the top of the wall.
Traits: Debug, Clone, Copy, PartialEq, Serialize, Deserialize
Fields
up_to: f64spacing: f64BarEndpub struct BarEnd
How an end of a wall’s vertical bar is bent: across the wall (towards
the outside of its own face when positive, towards the other face when
negative; 0 for a straight end), then along (back beside the bar when
positive, on past its end when negative; 0 for none). An L hook has only
across; a bar turned into the slab and up again has both.
Traits: Debug, Clone, Copy, PartialEq, Default, Serialize, Deserialize
Fields
across: f64along: f64Methods
pub const MAX_LEG: f64
Longest leg of a bent end, meters.
pub fn is_straight(&self) -> boolpub fn is_valid(&self) -> boolpub fn length(&self) -> f64
Length of the legs.
RebarLayoutpub enum RebarLayout
How a set of bars is laid out in its host.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Variants
Longitudinal { face: BarFace, count: u32 }
count bars running along the host, on face.
Stirrups { spacing: f64 }
Closed stirrups (ties) around the section every spacing along the host.
Sides { count: u32, spacing: f64 }
Side (skin) bars running along a beam on both side faces, between its
top and bottom bars: count on each face, or with a count of 0 as
many as keep them at most spacing apart over the height.
Ties { spacing: f64 }
Cross-ties of a column every spacing up it: a straight bar with a
hook at each end from every bar of its longitudinal set that is not
at a corner, across the section to the bar opposite.
WallHorizontal { side: WallSide, zones: Vec<SpacingZone>, #[serde(default)] inner: bool, }
Horizontal bars near one face of a wall (ring bars in an arc wall),
spaced up the wall by zones from its base. inner puts them inside
the vertical bars of that face instead of outside them.
WallVertical { side: WallSide, spacing: f64, #[serde(default)] offset: f64, #[serde(default)] from: f64, #[serde(default)] to: f64, #[serde(default)] bottom: BarEnd, #[serde(default)] top: BarEnd, #[serde(default)] inner: bool, }
Vertical bars near one face of a wall every spacing along it (from
offset after its start: half a spacing interleaves a second set),
from from to to above its base (to 0: the top), their ends bent
as bottom and top say. inner as for horizontal bars.
WallTies { every_horizontal: u32, every_vertical: u32, #[serde(default = "wall_bars::default_hooks")] hooks: [f64; 2], }
Ties between the two faces of a wall: a hooked bar across it at
every every_horizontal-th horizontal bar and every_vertical-th
vertical bar of its exterior face. hooks are the angles its two
ends are bent by, degrees (at the exterior face, then the interior).
SlabStraight { top: bool, angle_deg: f64, spacing: f64, #[serde(default)] inner: bool, #[serde(default)] hook: f64, }
Straight bars of a slab’s top or bottom layer, spacing apart, in
the direction angle_deg from the plan’s X axis, each clipped to the
slab’s boundary and openings. inner puts them inside the bars of
the other direction of that layer. hook bends the ends at the
slab’s edge by that length: towards the middle of the slab when
positive (down for top bars), out of it when negative (into the wall
above a top bar or below a bottom one); 0 for straight ends.
SlabRing { top: bool, spacing: f64, #[serde(default)] center: Option<DVec2>, #[serde(default)] inner: bool, }
Ring bars of a slab’s layer around center (default: the middle of
the slab), spacing apart, clipped to the slab.
SlabRadial { top: bool, count: u32, #[serde(default)] center: Option<DVec2>, #[serde(default)] start: f64, #[serde(default)] intermediate: f64, #[serde(default)] inner: bool, }
count radial bars of a slab’s layer around center, from the
radius start to the slab’s edge; with an intermediate radius, a
shorter bar from there to the edge between each two.
StripTransverse { top: bool, spacing: f64 }
Bars across a strip footing (radial in an arc strip) every spacing
along it. Bottom bars are straight; a top bar follows the top of the
footing (up its slopes and flat between the faces of its beam) and
its ends turn down to the bottom layer, closing the edges.
StripLongitudinal { top: bool, spacing: f64 }
Bars along a strip footing (ring bars in an arc strip) spacing
apart across it, in its bottom layer or under its top, following its
slopes; top bars leave the width of the beam to the beam’s own.
SlabTrim { top: bool, count: u32, spacing: f64, anchorage: f64, #[serde(default)] diagonals: bool, }
Trimming bars around each opening of a slab, in one layer: count
bars spacing apart along each side of the opening, reaching
anchorage past it, and with diagonals one bar across each corner.
Methods
pub fn runs_along(&self) -> bool
Whether the bars run along the host (and so may be spliced).
pub fn in_wall(&self) -> bool
Whether the set reinforces a wall.
pub fn in_slab(&self) -> bool
Whether the set reinforces a slab (a floor or a foundation slab).
pub fn in_strip(&self) -> bool
Whether the set is one of a strip footing’s own (across or along its footing slab).
pub fn fits_strip(&self) -> bool
Whether a strip footing may host the set: its own layouts, and those of a beam (for the beam on top of it, or its whole section).
pub fn slab_top(&self) -> Option<bool>
Whether a slab’s set lies in its top layer.
pub fn wall_side(&self) -> Option<WallSide>
The face of a wall the set lies near.
pub fn is_valid(&self) -> bool
Whether the values are usable (finite and within their limits).
FaceBarspub struct FaceBars
The longitudinal bars on one face of a column’s section: count of them
evenly spread, the two at the face’s ends (the corners, shared with the
faces beside it) included, so at least 2; or with a count of 0 as many
as keep them at most spacing apart.
Traits: Debug, Clone, Copy, PartialEq, Serialize, Deserialize
Fields
count: u32spacing: f64Methods
pub const MAX_COUNT: u32
Most bars on one face.
pub const MAX_FACES: usize
Most faces a set lists.
pub fn is_valid(&self) -> boolpub fn between(&self, length: f64) -> usize
Bars strictly between the corners of a face length long.
Splicepub struct Splice
Lap splices: a bar longer than max_length (the stock length) is made of
pieces overlapping by lap, the splices of neighbouring bars staggered.
Traits: Debug, Clone, Copy, PartialEq, Serialize, Deserialize
Fields
max_length: f64lap: f64Methods
pub const MIN_LENGTH: f64
Shortest stock length and lap accepted, meters.
pub const MIN_LAP: f64pub fn is_valid(&self) -> bool
Usable: finite, a stock of at least Self::MIN_LENGTH and a lap
from Self::MIN_LAP to half the stock.
pub fn pieces(&self, length: f64, index: usize) -> Vec<(f64, f64)>
The pieces of bar number index of a set, length long: (from,
to) along it. A bar within the stock length is one piece; a longer
one is cut in the fewest equal pieces, and odd bars are cut half a
piece off the even ones so that neighbours never splice together.
Rebarpub struct Rebar
A set of reinforcing bars in a beam, column, wall or slab (host), cover
from its faces; the type gives the bar diameter. The bars follow their host.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
host: ElementIdlayout: RebarLayoutcover: f64splice: Option<Splice>
Lap splices of the bars running along a beam, or the lifts of a column’s vertical bars (none: whole bars).
faces: Vec<FaceBars>
A column’s longitudinal bars face by face, in the order of the faces
of its section (empty: count bars spread around it).
lap_at_joins: bool
Bars along the host (a wall’s horizontal bars, those along a strip footing or a beam) run half a lap past each end where another host carries on in the same line, as the walls of a cylinder or the strips of a ring footing do: the bars of the two then lap by a whole one at the joint, instead of meeting end to end.
overlapping: bool
A column’s stirrups as several closed rectangles that overlap, one around each of the rectangles a section with only square corners is made of (two in an L or a T, three in a U), instead of one stirrup following the whole outline.
lifts: Vec<f64>
Heights above a column’s base where its vertical bars are cut, rising:
the bars of each lift start at one and run a lap past the next (empty:
whole bars, or the equal lifts of splice).
partition: String
The part of the structure the set belongs to (e.g. “FOUNDATION”, “WALL”), which schedules filter and group by; empty for none.
bar_mark: Option<String>
A mark given by hand to all the set’s bars, instead of the one the
project’s marking gives their shape (see crate::bar_marks).
Methods
pub const MAX_LIFTS: usize
Most heights a set’s bars are cut at.
pub fn new(host: ElementId, layout: RebarLayout, cover: f64) -> Rebar
A set in host with nothing but its layout and cover.
pub fn lifts_are_valid(lifts: &[f64]) -> bool
Whether the heights of lifts are usable: positive, finite and rising.
pub fn is_valid(&self) -> bool
Whether the values are usable (finite and within their limits).
pub fn lift_pieces(lifts: &[f64], height: f64, lap: f64) -> Vec<(f64, f64)>
The pieces (from, to) of a vertical bar of a column height high
cut at lifts: each runs from a cut (or the base) to lap past the
next one (or to the top). Cuts at or above the top are ignored.
ShapedRebarpub struct ShapedRebar
Reinforcing bars of any shape (bars bent to a schedule’s shape codes,
read from IFC files): each bar is its center line, in plan x/y and z
above the element’s level (meters), closed when its ends meet; the type
gives the diameter. Unlike Rebar they have no host and keep their
place.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
bars: Vec<Vec<DVec3>>properties: Vec<crate::properties::PropertySet>
Property and quantity sets read from an IFC file (shape code, bar marks, grade), written back on export.
partition: String
The part of the structure the bars belong to, as Rebar::partition.
bar_mark: Option<String>
A mark given by hand to all the bars, as Rebar::bar_mark.
Methods
pub const MAX_BARS: usize
At most this many bars in one element (the ties of a tank wall are a set of over a thousand).
pub const MAX_POINTS: usize
At most this many points along one bar.
pub const MAX_TOTAL_POINTS: usize
At most this many points in all the bars of one element.
pub fn points_mut(&mut self) -> impl Iterator<Item = &mut DVec3>
Every point of every bar.
pub fn is_valid(&self) -> bool
Whether the bars are usable: one to Self::MAX_BARS of them, each
with two to Self::MAX_POINTS finite points and some length, and
no more than Self::MAX_TOTAL_POINTS points in all.
Stairpub struct Stair
A stair starting at start (bottom of the first riser, center of the
width) going up along direction_deg; layout gives its plan shape.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
start: DVec2direction_deg: f64base_offset: f64height: f64
Height when top is unconnected.
top: WallToplayout: crate::StairLayoutRamppub struct Ramp
A ramp starting at start (the middle of its foot) going up along
direction_deg; layout gives its plan shape and slope.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
start: DVec2direction_deg: f64base_offset: f64height: f64
Height when top is unconnected.
top: WallToplayout: crate::RampLayoutRailingpub struct Railing
A railing along an open path.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
path: Vec<DVec2>base_offset: f64stair: Option<crate::StairRailing>
The stair side the railing follows: its path and rise come from the
stair (path keeps the last one, for when the stair is gone).
Methods
pub fn length(&self) -> f64Componentpub struct Component
A placed parametric component (see crate::component).
Traits: Debug, Clone, PartialEq, Default, Serialize, Deserialize
Fields
position: DVec2
Insertion point in plan.
rotation_deg: f64
Rotation in plan, degrees counter-clockwise.
base_offset: f64
Elevation of the insertion point above the level.
overrides: std::collections::BTreeMap<String, f64>
Values of instance parameters that differ from the type.
properties: Vec<crate::properties::PropertySet>
Property and quantity sets of the object (from IFC import).
system: Option<crate::SystemId>
The system or circuit it is connected to (an electrical device’s circuit).
text_overrides: std::collections::BTreeMap<String, String>
Values of instance text, choice and material parameters that differ from the type.
hotspots: std::collections::BTreeMap<String, [f64; 3]>
Hotspots moved away from where the type has them (component frame).
cc_core::element::slab_barscrates/cc_core/src/element.rs
Limits of slab reinforcement.
Items: MAX_RADIAL · MAX_TRIM · MAX_LENGTH
MAX_RADIALpub const MAX_RADIAL: u32
Most radial bars of one set.
MAX_TRIMpub const MAX_TRIM: u32
Most trimming bars along one side of an opening.
MAX_LENGTHpub const MAX_LENGTH: f64
Longest anchorage, hook or start radius, meters.
cc_core::element::wall_barscrates/cc_core/src/element.rs
Limits of wall reinforcement.
Items: MIN_SPACING · MAX_ZONES · MAX_EVERY · HOOK_ANGLES · default_hooks
MIN_SPACINGpub const MIN_SPACING: f64
Least spacing of bars, meters.
MAX_ZONESpub const MAX_ZONES: usize
Most spacing zones of one set of horizontal bars.
MAX_EVERYpub const MAX_EVERY: u32
Ties are placed at most every this many bars.
HOOK_ANGLESpub const HOOK_ANGLES: std::ops::RangeInclusive<f64>
The angles a tie’s hooks may be bent by, degrees.
default_hookspub fn default_hooks() -> [f64; 2]
The hooks of a tie when none are given: 135 degrees at both ends.
cc_core::exprcrates/cc_core/src/expr.rs
Arithmetic expressions over named parameters, used by component
geometry: numbers, parameter names, + - * / ^, parentheses, unary
minus and the functions min, max, abs, sqrt, round, floor,
ceil, sin, cos, tan (degrees). Errors are values, never panics;
nesting depth and input length are bounded.
Items: MAX_LEN · ExprError · eval · names · is_ident_char · is_valid_name
MAX_LENpub const MAX_LEN: usize
Longest expression text accepted, in bytes.
ExprErrorpub enum ExprError
Traits: Debug, Clone, PartialEq, Eq, std::fmt::Display, std::error::Error
Variants
EmptyTooLongTooDeepSyntax(usize)
Unexpected character or token at the byte offset.
UnknownName(String)Arity(String)
Wrong number of arguments for a function.
NotFinite
Division by zero, square root of a negative number, overflow…
evalpub fn eval(text: &str, lookup: &dyn Fn(&str) -> Option<f64>) -> Result<f64, ExprError>
Evaluate text, resolving names with lookup.
namespub fn names(text: &str) -> Vec<String>
Names referenced by text (for dependency checks and renames).
is_ident_charpub fn is_ident_char(c: char) -> bool
Characters allowed in parameter names (letters of any script, digits, _).
is_valid_namepub fn is_valid_name(name: &str) -> bool
Whether name can be used as a parameter name.
cc_core::fill_patterncrates/cc_core/src/fill_pattern.rs
The project’s own fill patterns (hatches): families of parallel, possibly
dashed lines, as in the plain-text .pat format CAD programs share (see
crate::pat). Materials, filled region types and view overrides refer
to one with Pattern::Custom.
Lengths are millimeters: on paper for drafting patterns, which keep their
printed size at any view scale, and in the real world for model patterns
(tiles, brick courses), which scale with the view. A pattern’s scale
multiplies every length.
Items: MAX_FILL_PATTERNS · MAX_FAMILIES · MAX_DASHES · MAX_NAME · MAX_DESCRIPTION · MIN_OFFSET · MIN_PERIOD · MAX_LENGTH · MIN_SCALE · MAX_SCALE · FillPatternKind · PatternLine · FillPattern · FillPatterns · PatternSlot · visit_fill · visit_material · visit_type · visit_override · visit_view_graphics · visit_phase_graphics · PatternUsage
MAX_FILL_PATTERNSpub const MAX_FILL_PATTERNS: usize
Most custom patterns in a project (a crafted file).
MAX_FAMILIESpub const MAX_FAMILIES: usize
Most line families in one pattern.
MAX_DASHESpub const MAX_DASHES: usize
Most dash values in one family.
MAX_NAMEpub const MAX_NAME: usize
Longest pattern name, characters.
MAX_DESCRIPTIONpub const MAX_DESCRIPTION: usize
Longest description, characters.
MIN_OFFSETpub const MIN_OFFSET: f64
Smallest distance between the lines of a family, millimeters (before the scale).
MIN_PERIODpub const MIN_PERIOD: f64
Shortest repeat of a dash list, millimeters (before the scale).
MAX_LENGTHpub const MAX_LENGTH: f64
Largest length or coordinate, millimeters.
MIN_SCALEpub const MIN_SCALE: f64
Range of a pattern’s scale.
MAX_SCALEpub const MAX_SCALE: f64
FillPatternKindpub enum FillPatternKind
How a pattern’s lengths are read.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
Drafting
Millimeters on paper: the same printed size at any view scale.
Model
Millimeters in the real world: scales with the view.
Methods
pub fn key(self) -> &'static strpub fn code(self) -> &'static strpub fn from_code(code: &str) -> Option<Self>PatternLinepub struct PatternLine
One family of parallel lines.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
angle: f64
Direction of the lines, degrees counterclockwise from +x.
origin: [f64; 2]
A point the first line passes through (where its dashes start), mm.
offset: [f64; 2]
From one line to the next, in the line’s own axes: along it (which staggers the dashes) and across it (the spacing), mm.
dashes: Vec<f64>
Dash lengths in turn, mm: positive drawn, negative a gap, zero a dot. Empty: continuous lines.
Methods
pub fn solid(angle: f64, spacing: f64) -> Self
Continuous lines at angle, spacing apart.
pub fn period(&self) -> f64
The length of one repeat of the dashes (0 for continuous lines).
pub fn problem(&self) -> Option<String>
Why the family cannot be drawn, if it cannot.
FillPatternpub struct FillPattern
A custom fill pattern.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
id: FillPatternIdname: Stringdescription: Stringkind: FillPatternKindscale: f64
Multiplies every length of the families.
lines: Vec<PatternLine>Methods
pub fn problem(&self) -> Option<String>
Why the pattern cannot be kept as it is, if it cannot.
pub fn repair(&mut self) -> usize
Fix what a crafted file may hold: names and descriptions within their limits, a valid scale, families that can be drawn and not too many. Returns how many things it changed.
pub fn to_pat(&self) -> String
The pattern as a .pat file entry (see crate::pat::write).
FillPatternspub type FillPatterns = BTreeMap<FillPatternId, FillPattern>
The project’s fill patterns, by id.
PatternSlotpub enum PatternSlot<'a>
A place that holds a pattern: a fill’s own (where Pattern::None means
nothing is drawn) or a view override’s (where None keeps what the view
draws).
Variants
Fill(&'a mut Pattern)Override(&'a mut Option<Pattern>)Methods
pub fn get(&self) -> Option<Pattern>pub fn set(&mut self, with: Pattern)
Put with in place of the pattern.
pub fn clear(&mut self)
Forget the pattern: no lines in a fill, no override in a view.
visit_fillpub fn visit_fill(f: &mut PatternFill, v: &mut dyn FnMut(PatternSlot))
Visits every pattern of a fill.
visit_materialpub fn visit_material(m: &mut Material, v: &mut dyn FnMut(PatternSlot))
Visits the patterns of a material (surface and cut).
visit_typepub fn visit_type(t: &mut TypeData, v: &mut dyn FnMut(PatternSlot))
Visits the patterns of a type: a filled region’s fill, the hatches of a component’s 2D pieces.
visit_overridepub fn visit_override(o: &mut GraphicOverride, v: &mut dyn FnMut(PatternSlot))
Visits the fill patterns of an override.
visit_view_graphicspub fn visit_view_graphics(g: &mut ViewGraphics, v: &mut dyn FnMut(PatternSlot))
Visits the patterns of a view’s (or template’s) graphics.
visit_phase_graphicspub fn visit_phase_graphics(g: &mut PhaseGraphics, v: &mut dyn FnMut(PatternSlot))
Visits the patterns of the phase graphics.
PatternUsagepub struct PatternUsage
What uses a custom pattern.
Traits: Debug, Clone, Default, PartialEq
Fields
materials: Vec<String>types: Vec<ElementTypeId>views: Vec<ViewId>templates: Vec<TemplateId>phase_graphics: boolMethods
pub fn count(&self) -> usizepub fn is_empty(&self) -> boolcc_core::graph_bindingcrates/cc_core/src/graph_binding.rs
Elements made by visual programming graphs.
A graph (cc_engine::graph) run creates elements through engine
commands; each one is bound to the call that made it, so the next run
changes it in place instead of adding another. Bindings live in
crate::Project::graph_bindings, keyed by element, and are tracked by
undo like the other project settings; removing an element drops its
binding, and copies of an element are never bound.
Items: MAX_PATH · GraphBinding
MAX_PATHpub const MAX_PATH: usize
Deepest lacing path kept (list nesting of a graph value).
GraphBindingpub struct GraphBinding
The call of a graph node that made an element.
Traits: Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Deserialize
Fields
graph: Uid
The graph (its file’s uid).
node: u64
The node’s id inside the graph.
path: Vec<u32>
The indices of the call through the lists its inputs were mapped over (empty for a single call).
index: u32
Which of the elements that call made (most calls make one).
Methods
pub fn is_valid(&self) -> bool
Whether it can be kept (a file is hostile input).
pub fn of_node(&self, graph: Uid, node: u64) -> bool
Whether it was made by node of graph.
cc_core::graphicscrates/cc_core/src/graphics.rs
View graphics: what a view shows and how it draws it.
Each view holds a ViewGraphics: per-category visibility and graphic
overrides, the view filters applied to it (in order) and per-element
overrides and hidden elements. The project holds the named
ViewFilters (categories plus rules on parameters) and the
ViewTemplates (sets of view properties a view can follow).
Overrides combine attribute by attribute: an element’s own override
beats the filters, the first matching filter beats later ones, and the
filters beat the element’s phase status overrides (see crate::phase),
which beat the category. An element is hidden when it is hidden in the
view, its category is hidden, or any matching filter hides it.
Items: LinePattern · LineGraphics · FillGraphics · GraphicOverride · CategoryGraphics · FilterUse · ViewGraphics · FilterOp · FilterParam · FilterRule · ViewFilter · TemplateIncludes · ViewTemplate · TemporaryVisibility
LinePatternpub enum LinePattern
Dash pattern of a line.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default, Serialize, Deserialize
Variants
SolidDashShortDash
Short dashes (hidden lines).
DotDashDotMethods
pub const ALL: [LinePattern; 5]pub fn key(self) -> &'static strpub fn dashes_mm(self) -> &'static [f64]
Dash and gap lengths in paper millimeters (empty: continuous).
LineGraphicspub struct LineGraphics
Overrides of a kind of line; None keeps what the view draws.
Traits: Debug, Clone, Copy, PartialEq, Default, Serialize, Deserialize
Fields
color: Option<[u8; 3]>
RGB color.
weight: Option<f64>
Pen width on paper, millimeters.
pattern: Option<LinePattern>
Methods
pub fn is_empty(&self) -> boolpub fn or(&self, lower: &Self) -> Self
Attribute by attribute, these values or else lower’s.
FillGraphicspub struct FillGraphics
Overrides of a kind of fill; None keeps what the view draws.
Traits: Debug, Clone, Copy, PartialEq, Default, Serialize, Deserialize
Fields
color: Option<[u8; 3]>
RGB color (of the pattern lines, or of a solid fill).
pattern: Option<Pattern>
None hides the fill, Solid fills it with the color.
Methods
pub fn is_empty(&self) -> boolpub fn or(&self, lower: &Self) -> SelfGraphicOverridepub struct GraphicOverride
Graphic overrides of a category, filter or element in a view. Cut graphics apply where the view plane cuts the element (plans, sections), projection and surface graphics to what is seen beyond it.
Traits: Debug, Clone, Copy, PartialEq, Default, Serialize, Deserialize
Fields
projection_lines: LineGraphicscut_lines: LineGraphicssurface_fill: FillGraphicscut_fill: FillGraphicshalftone: Option<bool>
Draw faint (lines and fills mixed with white).
transparency: Option<f64>
Surface transparency, 0 (opaque) to 1.
Methods
pub fn is_empty(&self) -> boolpub fn or(&self, lower: &Self) -> Self
Attribute by attribute, these values or else lower’s.
pub fn repair(&mut self) -> usize
Reset values that are not valid numbers or out of range; returns how many.
CategoryGraphicspub struct CategoryGraphics
Visibility and overrides of a category in a view.
Traits: Debug, Clone, Copy, PartialEq, Serialize, Deserialize, Default
Fields
visible: booloverrides: GraphicOverrideMethods
pub fn is_default(&self) -> boolFilterUsepub struct FilterUse
A filter applied to a view: elements it matches are hidden or drawn with its overrides.
Traits: Debug, Clone, Copy, PartialEq, Serialize, Deserialize
Fields
filter: FilterIdvisible: bool
Matching elements are shown (false hides them).
enabled: bool
The filter is applied (false keeps it listed without effect).
overrides: GraphicOverrideMethods
pub fn new(filter: FilterId) -> SelfViewGraphicspub struct ViewGraphics
What a view shows and how: category visibility and overrides, applied filters, and element overrides and hidden elements.
Traits: Debug, Clone, PartialEq, Default, Serialize, Deserialize
Fields
categories: BTreeMap<Category, CategoryGraphics>
Categories with a non-default visibility or overrides.
filters: Vec<FilterUse>
Filters in priority order (the first matching filter wins per attribute).
elements: BTreeMap<ElementId, GraphicOverride>
Overrides of single elements in this view.
hidden: BTreeSet<ElementId>
Elements hidden in this view.
Methods
pub fn is_empty(&self) -> boolpub fn category(&self, c: Category) -> CategoryGraphicspub fn set_category(&mut self, c: Category, g: CategoryGraphics)
Set a category’s graphics (dropping the entry when it is the default).
pub fn resolve(&self, id: ElementId, category: Category, matches: &mut dyn FnMut(FilterId) -> bool) -> Option<GraphicOverride>
The graphics of an element of category, or None when it is
hidden; matches says whether a filter matches the element.
pub fn resolve_phased(&self, id: ElementId, category: Category, matches: &mut dyn FnMut(FilterId) -> bool, phase: &GraphicOverride) -> Option<GraphicOverride>
Self::resolve with the overrides of the element’s phase status,
which rank below the filters and above the category.
pub fn repair(&mut self, filters: &BTreeMap<FilterId, ViewFilter>, elements: Option<&dyn Fn(ElementId) -> bool>) -> usize
Drop references to missing filters and elements and invalid values; returns how many.
FilterOppub enum FilterOp
How a rule compares an element’s parameter with its value.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize
Variants
EqualsNotEqualsContainsNotContainsBeginsWithNotBeginsWithGreaterGreaterOrEqualLessLessOrEqualHasValueHasNoValueMethods
pub const ALL: [FilterOp; 12]pub fn key(self) -> &'static strpub fn needs_value(self) -> bool
Whether the operator takes a value.
pub fn test(self, actual: Option<(&str, Option<f64>)>, value: &str) -> bool
Whether actual (the element’s value as text and, for quantities,
as a number in SI units; None when it has none) satisfies the
rule self value. Text compares without case; numbers compare
numerically (equality within a millionth) when both sides are numbers.
FilterParampub enum FilterParam
A parameter a filter rule tests: any schedule field, or the element’s base elevation.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize
Variants
Field(ScheduleField)
A field as schedules show it (Mark, Type, Width…).
Elevation
Elevation of the element’s level, meters.
Methods
pub fn applies_to(self, category: Category) -> bool
Whether elements of category can have a value for this parameter.
FilterRulepub struct FilterRule
One test of a filter.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
param: FilterParamop: FilterOpvalue: String
Text, or a number in SI units (meters) for quantities.
ViewFilterpub struct ViewFilter
A named, project-wide selection of elements by category and rules.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
id: FilterIdname: Stringcategories: BTreeSet<Category>
Categories the filter applies to (empty: all).
rules: Vec<FilterRule>any: bool
Any rule is enough (false: all rules must pass).
Methods
pub fn inapplicable_param(&self) -> Option<FilterParam>
The first rule parameter that applies to none of the filter’s
categories, so the rule never passes; None when every rule can pass
or the filter covers all categories.
pub fn matches(&self, category: Category, rule: &mut dyn FnMut(&FilterRule) -> bool) -> bool
Whether the filter matches an element of category; rule tests
one rule against the element.
TemplateIncludespub struct TemplateIncludes
The view properties a template controls.
Traits: Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default
Fields
scale: bool
The view scale.
categories: bool
Category visibility and overrides.
filters: bool
The applied filters and their overrides.
cut_height: bool
Plans: the cut plane height.
discipline: bool
Floor plans: the building services shown over a faint architecture.
structural: bool
Floor plans: structural (formwork) display and structure tags.
phase_filter: bool
The phase filter (not the phase: views of one template can show different phases).
detail: bool
The detail level.
visual_style: bool
The visual style.
underlay: bool
Plans: the underlay (other levels’ plans drawn under them).
design_options: bool
The design option shown of each set (off by default: views keep their own choice).
ViewTemplatepub struct ViewTemplate
Named view properties views can copy or follow.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
id: TemplateIdname: Stringinclude: TemplateIncludesscale: u32graphics: ViewGraphics
Category visibility and overrides, and filters (element overrides are not kept).
cut_height: f64discipline: Option<MepDiscipline>structural: boolstructure_tags: boolphase_filter: Option<crate::PhaseFilterId>detail: crate::DetailLevelvisual_style: Option<crate::VisualStyle>
None: views keep the usual style of their kind.
underlay: crate::Underlay
Plans: other levels’ plans drawn under them.
design_options: BTreeMap<crate::OptionSetId, crate::OptionId>
The option shown of each design option set (sets left out: automatic).
Methods
pub fn from_view(id: TemplateId, name: String, view: &View) -> Self
A template holding the properties of view.
pub fn applies_to(kind: &ViewKind) -> bool
Whether views of kind can use templates.
pub fn apply(&self, view: &mut View)
Copy the included properties into view (those that apply to its kind).
pub fn repair(&mut self, filters: &BTreeMap<FilterId, ViewFilter>, phase_filters: &BTreeMap<crate::PhaseFilterId, crate::PhaseFilter>, levels: &[crate::LevelId]) -> usize
Reset invalid values; returns how many.
TemporaryVisibilitypub struct TemporaryVisibility
Elements hidden or isolated for a while in a view (not part of the model: not saved and not undone).
Traits: Debug, Clone, PartialEq, Default, Serialize, Deserialize
Fields
isolate: bool
true: only these elements and categories are shown; false: they are hidden.
elements: BTreeSet<ElementId>categories: BTreeSet<Category>Methods
pub fn is_empty(&self) -> boolpub fn shows(&self, id: ElementId, category: Category) -> bool
Whether an element of category is shown.
cc_core::gridcrates/cc_core/src/grid.rs
Grid naming and alignment.
Naming. A new grid continues the series of the grids parallel to it
(within SERIES_DEG): the name after that of the most recently placed
parallel grid (successor: 1 → 2, 09 → 10, A → B,
Z → AA, A1 → A2, 1.1 → 1.2). A grid with no parallel grid
starts a new series: numbers for the first series, letters for a series
across a numbered one (and numbers across a lettered one). The name is
then made unique among the existing grids by stepping the series on.
Alignment. The bubble lines of a grid are the lines through its ends
perpendicular to it. align_end snaps a grid end being drawn or
dragged onto the bubble line of a parallel grid’s end (keeping the grid
parallel to it), and aligned_ends gives a grid the extents of a
parallel reference grid.
Items: SERIES_DEG · PARALLEL_DEG · is_parallel · successor · next_name · EndAlignment · align_end · aligned_ends
SERIES_DEGpub const SERIES_DEG: f64
Grids whose directions differ by at most this many degrees (either way along the line) belong to the same series when naming.
PARALLEL_DEGpub const PARALLEL_DEG: f64
Grids whose directions differ by at most this many degrees are parallel when aligning ends.
is_parallelpub fn is_parallel(u: DVec2, v: DVec2, deg: f64) -> bool
Whether the lines along u and v are within deg degrees of each
other, either way along the line. Degenerate directions are not parallel.
successorpub fn successor(name: &str) -> Option<String>
The name after name in its series: the trailing number counts up
keeping its zero padding (A1 → A2, 1.9 → 1.10, 09 → 10), or
the trailing letters (up to three, all upper or all lower case) count
like spreadsheet columns (A → B, Z → AA, AZ → BA, b → c).
None when the name does not end in a counter (North, Sul, A').
next_namepub fn next_name<'a>(grids: impl IntoIterator<Item = (ElementId, &'a Grid)>, start: DVec2, end: DVec2) -> String
Name for a new grid from start to end among grids (see the module
documentation): it continues the series of the most recently placed
(highest id) parallel grid and is unique among grids.
EndAlignmentpub struct EndAlignment
A grid end snapped onto the bubble line of another grid’s end.
Traits: Debug, Clone, Copy, PartialEq
Fields
point: DVec2
The snapped end.
reference: DVec2
The end of the other grid it lines up with.
align_endpub fn align_end(others: &[(DVec2, DVec2)], fixed: Option<DVec2>, raw: DVec2, tol: f64) -> Option<EndAlignment>
Snap a grid end near raw to the bubble lines of the grids others
(start and end points), within tol (model units):
fixed (drawing the second point, or
dragging an end handle), the end goes where the line from fixed
parallel to another grid meets the bubble line of that grid’s start or
end, so the grid comes out parallel with its end lined up;None when none is within tol.aligned_endspub fn aligned_ends(grid: &Grid, reference: &Grid, start: bool, end: bool) -> Option<(DVec2, DVec2)>
New (start, end) of grid with the extents of the parallel grid
reference: each end moves along the grid’s own line onto the bubble
line of the reference end on its side (start/end pick which ends
move). None when the grids are not parallel (within PARALLEL_DEG)
or the result would be shorter than 1 cm.
cc_core::idscrates/cc_core/src/ids.rs
Items: Uid
Uidpub struct Uid(pub u128)
Globally unique, persistent identifier of a model object (128 bits), kept across saves so exports such as IFC keep stable ids. Zero means “not assigned yet”.
Traits: Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, Default, fmt::Display, Serialize, Deserialize<'de>
Methods
pub fn generate() -> Self
A new random identifier (version 4 UUID layout).
pub fn is_nil(self) -> bool
cc_core::level_markcrates/cc_core/src/level_mark.rs
Level marks: annotations that write the elevation of a point in a plan,
an elevation or a section — the finished level above a shelf line and
the raw (structural) level under it. Plans draw a circle with two filled
quarters on the point; elevations and sections a triangle pointing down
to it. Like text notes, a mark lives in one view (view).
The levels are measured from the model (see cc_geom::level_mark) unless
the mark sets them; the type adds its datum (the value written for the
project’s zero, e.g. 100.00) and the suffixes after each value.
Items: LevelMark · MAX_LEVEL · DEFAULT_TEXT_SIZE · default_type · repair_type
LevelMarkpub struct LevelMark
A level mark in a view.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
view: ViewIdposition: DVec2
The point measured, in the view’s drawing coordinates: a plan point,
or in elevations and sections a point whose y is its elevation.
flip: bool
The values on the left of the symbol instead of the right.
finished: Option<f64>
Finished level written instead of the measured one (meters, an elevation of the project, before the type’s datum is added).
raw: Option<f64>
Raw level written instead of the measured one.
show_raw: bool
Whether the raw level is written (when there is one: set, or measured on a floor with layers over its structure).
Methods
pub fn new(view: ViewId, position: DVec2) -> Selfpub fn repair(&mut self) -> usize
Replace invalid values (non-finite, out of range); returns how many changed.
MAX_LEVELpub const MAX_LEVEL: f64
Largest level a mark writes either way from zero, meters (datum included).
DEFAULT_TEXT_SIZEpub const DEFAULT_TEXT_SIZE: f64
Text size of the default type, paper millimeters.
default_typepub fn default_type(name: &dyn Fn(&str) -> String) -> crate::TypeData
The type a project gets with its first level mark, with the suffixes
name gives the keys tpl-level-mark-finished and tpl-level-mark-raw
(in the interface language).
repair_typepub fn repair_type(text_size: &mut f64, datum: &mut f64) -> usize
Replace invalid type values; returns how many changed.
cc_core::lightningcrates/cc_core/src/lightning.rs
Lightning protection: the conductors of a lightning protection system
(on the roof, down the walls and in the ground) and the protection
classes the coverage check uses.
Air terminals and earth electrodes are components (devices of the
DeviceKind::AirTerminal and
DeviceKind::EarthElectrode kinds);
conductors are runs like pipes (MepSegment), of a conductor type
that gives their diameter and material.
Items: ConductorRole · LightningConductor · EARTH_DEPTH · EARTH_RING_DISTANCE · MIN_CONDUCTOR_DIAMETER · MAX_CONDUCTOR_DIAMETER · LpsClass · protected_reach
ConductorRolepub enum ConductorRole
What a lightning protection conductor does.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
Air
Air termination: a conductor on the roof that intercepts strikes.
Down
Down conductor: from the roof down the walls to the earthing.
Earth
Earthing: a buried conductor (an earth ring) or a bonding conductor.
Methods
pub const ALL: [ConductorRole; 3]pub fn key(self) -> &'static strpub fn name(self) -> &'static str
Name in commands (air, down, earth).
pub fn of_run(run: &MepSegment) -> Self
The usual role of run: vertical runs are down conductors, runs
below the level are in the ground, the others on the roof.
LightningConductorpub struct LightningConductor
A conductor of a lightning protection system: a straight run (on a roof, down a wall or in the ground) with its role.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
run: MepSegmentrole: ConductorRoleEARTH_DEPTHpub const EARTH_DEPTH: f64
Depth of an earth ring and of the top of earth electrodes below the level, meters (the usual minimum burial depth).
EARTH_RING_DISTANCEpub const EARTH_RING_DISTANCE: f64
Usual distance of an earth ring from the building’s walls, meters.
MIN_CONDUCTOR_DIAMETERpub const MIN_CONDUCTOR_DIAMETER: f64
Smallest and largest conductor diameter, meters (values outside are cut in files).
MAX_CONDUCTOR_DIAMETERpub const MAX_CONDUCTOR_DIAMETER: f64
LpsClasspub enum LpsClass
Class of a lightning protection system (I is the most demanding). It sets the rolling sphere radius and the mesh width of the air termination, as in the public tables of the lightning protection standards.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
IIIIIIIVMethods
pub const ALL: [LpsClass; 4]pub fn sphere_radius(self) -> f64
Radius of the rolling sphere, meters.
pub fn mesh_width(self) -> f64
Width of the air termination mesh, meters.
pub fn name(self) -> &'static str
Name in commands (I to IV).
pub fn parse(name: &str) -> Option<Self>
The class named I to IV (or 1 to 4), in any case.
protected_reachpub fn protected_reach(tip: f64, height: f64, radius: f64) -> Option<f64>
Horizontal reach of the protected volume of an air termination point at
tip above a reference plane, at height above that plane, for a
rolling sphere of radius: the protected volume of a single rod (the
sphere resting on the plane and touching the rod). None when the
point is above what the rod protects.
cc_core::masscrates/cc_core/src/mass.rs
Conceptual masses: volumes for massing studies. A mass is a base outline
in plan extruded height up from its level (plus base_offset), or
lofted to a different top outline. Mass floors cut it at the levels it
lists: each gives the floor outline at that level, with its area and
perimeter, for gross floor areas before any wall or floor is drawn.
Items: MAX_OUTLINE · Mass · MassFloor · area · perimeter · MassFace · push_edge
MAX_OUTLINEpub const MAX_OUTLINE: usize
Largest outline a mass keeps (points).
Masspub struct Mass
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
outline: Vec<DVec2>
Base outline in plan (closed, either winding).
base_offset: f64
Offset of the base from the level elevation.
height: f64
Height of the mass above its base.
top: Option<Vec<DVec2>>
Top outline of a loft; None extrudes the base outline.
floors: Vec<LevelId>
Levels where mass floors are taken (those the mass spans).
sketch: Option<crate::sketch::Sketch>
The curves the outline was drawn with (see crate::sketch); dropped
when the outline is edited without them.
Methods
pub fn is_valid(&self) -> bool
Outlines of at least three finite points (bounded), a finite positive height and a finite base offset.
pub fn section(&self, t: f64) -> Vec<DVec2>
The outline at t of the height (0 at the base, 1 at the top),
counter-clockwise: the base outline of an extrusion, or the loft’s
section between its outlines.
pub fn pushed(&self, face: MassFace, d: f64) -> Option<Mass>
The mass with face moved d outward (inward when negative): the top
changes the height, the bottom the base offset and the height, and a
side moves its edge of the outline, the edges beside it keeping their
directions. Sides of a loft are not moved. None when the result is
not a valid mass (no height left, a side pushed through the others).
MassFloorpub struct MassFloor
A mass floor: the outline of a mass at a level, its area and perimeter.
Traits: Debug, Clone, PartialEq
Fields
level: LevelIdoutline: Vec<DVec2>area: f64perimeter: f64areapub fn area(poly: &[DVec2]) -> f64
Area of a closed polygon (either winding).
perimeterpub fn perimeter(poly: &[DVec2]) -> f64
Perimeter of a closed polygon.
MassFacepub enum MassFace
A face of a mass, for push/pull.
Traits: Debug, Clone, Copy, PartialEq, Eq
Variants
TopBottomSide(usize)
The side over edge i of the base outline (from point i to the next).
push_edgepub fn push_edge(outline: &[DVec2], i: usize, d: f64) -> Option<Vec<DVec2>>
outline with edge i (from point i to the next) moved d outward,
the edges beside it keeping their directions (they stretch or shrink).
None for a bad edge or when the outline would fold over.
cc_core::materialcrates/cc_core/src/material.rs
Materials: identity data, graphics in views (shading, transparency, surface and cut patterns), render appearance and physical properties. Types refer to materials by name.
Items: MaterialClass · Pattern · PatternFill · MaterialIdentity · MaterialGraphics · Finish · MAX_TEXTURE_BYTES · MAX_TEXTURE_PIXELS · MIN_TEXTURE_SIZE · MAX_TEXTURE_SIZE · MaterialTexture · MaterialAppearance · Behavior · MaterialPhysical · Material · template_properties
MaterialClasspub enum MaterialClass
Broad family of a material (filters, defaults and IFC categories).
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
GenericConcreteMasonryMortarMetalWoodGlassPlasticStoneCeramicGypsumInsulationFabricPaintEarthLiquidGasMethods
pub const ALL: [MaterialClass; 17]pub fn key(self) -> &'static strPatternpub enum Pattern
Fill pattern drawn on surfaces (elevations) or cuts (plans, sections).
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
NoneSolidDiagonal
Lines at 45°.
DiagonalBack
Lines at 135°.
Crosshatch
Both diagonals.
HorizontalVerticalGridBrick
Running bond courses.
Concrete
Scattered dots and small triangles.
Sand
Fine dots.
Insulation
Zig-zag batt insulation.
Earth
Earth: blocks of short strokes, alternately at 45° and 135° (a weave).
Custom(crate::FillPatternId)
One of the project’s own patterns (Project::fill_patterns).
Methods
pub const ALL: [Pattern; 13]
The built-in patterns (custom ones live in the project).
pub fn key(self) -> &'static str
PatternFillpub struct PatternFill
A pattern over an optional background pattern, each with its color.
Traits: Debug, Clone, Copy, PartialEq, Serialize, Deserialize, Default
Fields
foreground: Patternforeground_color: [u8; 3]background: Patternbackground_color: [u8; 3]Methods
pub fn lines(pattern: Pattern) -> Selfpub fn is_empty(&self) -> boolMaterialIdentitypub struct MaterialIdentity
Descriptive and product data.
Traits: Debug, Clone, PartialEq, Default, Serialize, Deserialize
Fields
description: Stringclass: MaterialClasscomments: Stringkeywords: Stringmanufacturer: Stringmodel: Stringcost: Option<f64>
Unit cost in the project currency.
url: Stringkeynote: Stringmark: StringMaterialGraphicspub struct MaterialGraphics
How the material looks in views.
Traits: Debug, Clone, PartialEq, Default, Serialize, Deserialize
Fields
use_appearance: bool
Shade with the appearance color instead of the material color.
transparency: f64
0 (opaque) to 1 (invisible).
surface: PatternFill
Pattern on faces seen in elevation and 3D.
cut: PatternFill
Pattern where the material is cut (plans, sections).
Finishpub enum Finish
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
MatteSatinGlossyPolishedMethods
pub const ALL: [Finish; 4]pub fn key(self) -> &'static strpub fn shininess(self) -> f64
Strength of the specular highlight, 0 to 1.
MAX_TEXTURE_BYTESpub const MAX_TEXTURE_BYTES: usize
Largest texture image file kept, bytes.
MAX_TEXTURE_PIXELSpub const MAX_TEXTURE_PIXELS: u64
Most pixels a texture image may have (width × height).
MIN_TEXTURE_SIZEpub const MIN_TEXTURE_SIZE: f64
Smallest and largest real-world size of one repeat of a texture, meters.
MAX_TEXTURE_SIZEpub const MAX_TEXTURE_SIZE: f64
MaterialTexturepub struct MaterialTexture
An image laid on a material’s surfaces in the textures style: one repeat
covers width × height meters, moved by offset and turned by
rotation_deg in the face’s plane coordinates (see Self::map).
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
image: std::sync::Arc<crate::raster::RasterImage>
The image file (shared: undo steps and copies do not copy the bytes).
width: f64height: f64offset: [f64; 2]
Where a repeat starts, meters along the face’s plane axes.
rotation_deg: f64Methods
pub fn new(image: crate::raster::RasterImage, width: f64, height: f64) -> Self
A texture of image repeating every width × height meters.
pub fn image_ok(&self) -> bool
Whether the image is one a texture may hold (valid, within the size limits).
pub fn repair(&mut self) -> usize
Replace sizes, offsets and angles that are not finite or out of range; returns the number of fixes (the image is checked by the caller).
pub fn map(&self, uv: [f64; 2]) -> [f64; 2]
Texture coordinates (in repeats, v up the image) of a point with
plane coordinates uv in meters: moved by the offset, turned by the
rotation and scaled by the size.
MaterialAppearancepub struct MaterialAppearance
Render appearance.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize, Default
Fields
color: [u8; 3]finish: Finishdescription: Stringtexture: Option<MaterialTexture>
An image mapped on the faces in the textures style (the color shows where it cannot be drawn).
Behaviorpub enum Behavior
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
IsotropicOrthotropicMethods
pub const ALL: [Behavior; 2]pub fn key(self) -> &'static strMaterialPhysicalpub struct MaterialPhysical
Physical properties (SI units); None when unknown.
Traits: Debug, Clone, PartialEq, Default, Serialize, Deserialize
Fields
behavior: Behaviordensity: Option<f64>
kg/m³.
thermal_conductivity: Option<f64>
W/(m·K).
specific_heat: Option<f64>
J/(kg·K).
thermal_expansion: Option<f64>
1/K.
youngs_modulus: Option<f64>
MPa.
poisson: Option<f64>
Poisson’s ratio.
compressive_strength: Option<f64>
MPa.
tensile_strength: Option<f64>
MPa.
Methods
pub fn values_mut(&mut self) -> [(&'static str, &mut Option<f64>); 8]
Values as (field key, value) pairs, in display order.
Materialpub struct Material
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
name: Stringcolor: [u8; 3]
sRGB shading color.
identity: MaterialIdentitygraphics: MaterialGraphicsappearance: MaterialAppearancephysical: MaterialPhysicalMethods
pub fn new(name: impl Into<String>, color: [u8; 3]) -> Self
A plain material: the appearance takes the shading color.
pub fn shading_color(&self) -> [u8; 3]
Color used to shade faces in views.
pub fn repair(&mut self) -> usize
Replace non-finite or out-of-range numbers; returns the number of fixes.
template_propertiespub fn template_properties(m: &mut Material, class: MaterialClass)
Template data for a default material: class, cut pattern and physical values.
cc_core::member_hostcrates/cc_core/src/member_host.rs
Member hosts: elements with no geometry of their own (steel buildings,
trusses, bracings, wall framings) that own ordinary columns and beams laid out from their
parameters. Every edit keeps them in step (crate::EditCtx runs
crate::EditCtx::sync_member_hosts): a changed host rewrites its
members in place, keeping their ids while their roles exist; a member
the user edited or deleted is detached, and the host leaves its role
alone from then on. Each host keeps its own typed roles; the shared code
sees them as RoleKeys, whose order is the typed roles’ order.
Items: RoleKey · MemberHost · within · reset · fix_type
RoleKeypub struct RoleKey(pub u64)
A member’s role as the shared code sees it: kind, group (frame, copy) and index packed so that the order is the typed role’s.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord
Methods
pub fn new(kind: u8, group: u16, index: u16) -> Selfpub fn parts(self) -> (u8, u16, u16)MemberHostpub trait MemberHost
A host of members: what the shared sync and repair need from it.
Implemented by (4): cc_core::bracing::Bracing, cc_core::steel_building::SteelBuilding, cc_core::truss::Truss, cc_core::wall_framing::WallFraming
Required and provided items
fn member_types(&self) -> Vec<ElementTypeId>
The member types it uses (an edit of one regenerates it).
fn member_layout(&self, project: &Project) -> Vec<(RoleKey, ElementTypeId, ElementKind)>
Its members as its parameters lay them out, in a fixed order.
fn member_list(&self) -> Vec<(RoleKey, ElementId)>
The members it manages, by role.
fn set_member_list(&mut self, members: &[(RoleKey, ElementId)])
Replace the managed members (keys it cannot read are left out).
fn detached_roles(&self) -> Vec<RoleKey>
Roles the user took over: not made again.
fn set_detached_roles(&mut self, roles: &[RoleKey])fn role_fits(&self, role: RoleKey, kind: &ElementKind) -> bool
Whether an element of kind can fill role.
fn check_parameters(&self, project: &Project) -> Result<(), String>
Whether its numbers are in range and its types of the right categories.
fn repair_parameters(&mut self, project: &Project) -> Option<usize>
From a file: numbers back to their defaults, types to the category’s
default; returns the repairs, None when the host must go.
fn inputs(&self, _project: &Project) -> Vec<ElementId>
Other elements whose change regenerates the host (a wall framing’s wall and the wall’s doors and windows). An edit regenerates the host when it changes, adds or removes one of them, edits one’s type, or touches an element one of them hosted before the edit (a removed or re-hosted door or window). None by default.
fn fed_by(&self, _e: &Element) -> bool
Whether an element like e can be one of its inputs (a wall, a door
or a window): an edit touching none, and no type, skips the scan.
fn member_level(&self, _project: &Project) -> Option<LevelId>
The level its members go on when it is not the host’s own (a wall framing’s members are on its wall’s level).
withinpub(crate) fn within(name: &str, v: f64, range: &RangeInclusive<f64>) -> Result<(), String>
Whether v is a finite number in range (else an error naming it).
resetpub(crate) fn reset(v: &mut f64, range: &RangeInclusive<f64>, default: f64) -> usize
Reset v to default when it is out of range; returns 1 when it did.
fix_typepub(crate) fn fix_type(p: &Project, slot: &mut ElementTypeId, category: Category) -> Option<usize>
slot if it is a type of category, else the category’s default type
(Some(1): one repair); None when there is none.
cc_core::mepcrates/cc_core/src/mep.rs
Building services (MEP): plumbing, electrical, structured cabling and
lightning protection systems, the pipe, conduit and cable tray segments
that run them, the valves on pipes, and the data that makes a component
a plumbing fixture or an electrical, communications or lightning
protection device.
A system (a water supply, a drain, an electrical circuit, the cabling of
a rack, a lightning protection system) is a project setting; pipes,
conduits, conductors and components refer to it by SystemId.
Defaults follow common Brazilian practice (fixture units and supply
weights as in the public tables of the drainage and water supply
standards; outlet mounting heights as usual in electrical plans).
Items: SystemKind · SystemClass · MepSystem · MepSegment · TrayStyle · TRAY_RUNG_SPACING · MAX_TRAY_WIDTH · MAX_TRAY_HEIGHT · ValveKind · Valve · DeviceKind · MAX_PORTS · MepData · CABLE_SLACK · MAX_LINK_LENGTH · cable_length
SystemKindpub enum SystemKind
What a system carries.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
ColdWaterHotWaterSanitary
Sanitary drainage (soil and waste).
Vent
Drainage vents.
RainwaterPower
An electrical circuit feeding outlets and equipment.
Lighting
An electrical circuit feeding lights.
Data
Structured cabling: the data and voice outlets cabled to a rack.
Lightning
A lightning protection system: air terminals, conductors and earth electrodes.
Methods
pub const ALL: [SystemKind; 9]pub fn key(self) -> &'static strpub fn name(self) -> &'static str
Name in commands and files exchanged with other programs (cold_water…).
pub fn class(self) -> SystemClass
The family of the system.
pub fn is_electrical(self) -> bool
An electrical circuit (carried by conduits, fed by a board).
pub fn is_cabled(self) -> bool
Carried by conduits and cable trays: circuits and structured cabling.
pub fn is_drainage(self) -> bool
Gravity drainage: its pipes slope down along the flow.
pub fn default_color(self) -> [u8; 3]
Color of the system’s pipes and conduits in plans and 3D.
SystemClasspub enum SystemClass
The families of systems: which elements each takes.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash
Variants
Plumbing
Pipes and plumbing fixtures.
Circuit
Electrical circuits: conduits, cable trays and electrical devices.
Data
Structured cabling: conduits, cable trays, data outlets and racks.
Lightning
Lightning protection: conductors, air terminals and earth electrodes.
Methods
pub const ALL: [SystemClass; 4]MepSystempub struct MepSystem
A plumbing system or an electrical circuit.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
name: Stringcode: String
Short code shown in plan tags (e.g. a system abbreviation or a circuit number).
kind: SystemKindcolor: Option<[u8; 3]>
Display color; None uses the kind’s color.
panel: Option<ElementId>
Circuits: the distribution board (a panel component) feeding it; structured cabling: the rack its outlets are cabled to.
voltage: f64
Circuits: nominal voltage, volts.
Methods
pub fn new(name: impl Into<String>, code: impl Into<String>, kind: SystemKind) -> Selfpub fn color(&self) -> [u8; 3]pub fn label(&self) -> &str
The code, or the name when it has none.
MepSegmentpub struct MepSegment
A straight pipe or conduit run between two points, each at its own elevation above the level: horizontal, sloped, or vertical (a riser, when both ends share the plan position).
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
start: DVec2end: DVec2start_offset: f64
Elevation of the center line above the level at the start.
end_offset: f64
Elevation of the center line above the level at the end.
systems: Vec<SystemId>
Systems it belongs to: one for a pipe, the circuits a conduit carries.
Methods
pub fn new(start: DVec2, end: DVec2, offset: f64) -> Selfpub fn plan_length(&self) -> f64
Length in plan.
pub fn rise(&self) -> f64
Rise from the start to the end.
pub fn length(&self) -> f64
True length along the run.
pub fn is_vertical(&self) -> bool
A vertical run (less than 1 mm long in plan).
pub fn slope(&self) -> f64
Fall per unit of plan length (positive when the end is lower); 0 for risers.
pub fn points(&self, level_z: f64) -> (DVec3, DVec3)
The end points in the world, on a level at level_z.
pub fn system(&self) -> Option<SystemId>
The first system, for pipes.
TrayStylepub enum TrayStyle
How a cable tray is built; it picks the 3D shape and the plan drawing.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
Ladder
Two side rails joined by rungs.
SolidBottom
A channel with a solid bottom.
Perforated
A channel with a perforated bottom.
Methods
pub const ALL: [TrayStyle; 3]pub fn key(self) -> &'static strpub fn name(self) -> &'static str
Name in commands (ladder, solid_bottom, perforated).
TRAY_RUNG_SPACINGpub const TRAY_RUNG_SPACING: f64
Distance between the rungs of a ladder tray, meters.
MAX_TRAY_WIDTHpub const MAX_TRAY_WIDTH: f64
Widest and tallest cable tray section, meters (larger values in files are cut down).
MAX_TRAY_HEIGHTpub const MAX_TRAY_HEIGHT: f64
ValveKindpub enum ValveKind
What a valve does; it picks the plan symbol and the IFC predefined type.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
Gate
Opens or shuts the flow with a sliding gate.
Ball
Opens or shuts the flow with a quarter turn.
Check
Lets the flow pass one way only.
Globe
Regulates the flow.
Methods
pub const ALL: [ValveKind; 4]pub fn key(self) -> &'static strpub fn name(self) -> &'static str
Name in commands (gate, ball, check, globe).
pub fn has_handle(self) -> bool
Whether it has a stem and handwheel (check valves work by themselves).
Valvepub struct Valve
A valve on a pipe: an inline accessory at meters along its host’s run
(true length from the start), of the pipe’s diameter. It moves, is
copied and is deleted with its pipe.
Traits: Debug, Clone, Copy, PartialEq, Serialize, Deserialize
Fields
host: ElementIdat: f64
Distance from the start of the host pipe along its run, meters (clamped to the run where it is read).
Methods
pub fn fraction(&self, run: &MepSegment) -> f64
Its position along run as a fraction (0 at the start, 1 at the end).
pub fn point(&self, run: &MepSegment, level_z: f64) -> DVec3
Its center in the world, on a host run whose level is at level_z.
DeviceKindpub enum DeviceKind
What an electrical device is; it picks the plan symbol and the IFC class.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
Outlet
General-purpose outlet.
DedicatedOutlet
Outlet dedicated to one appliance.
SwitchCeilingLight
Light point on the ceiling.
WallLight
Light point on a wall.
Panel
Distribution board.
DataOutlet
Data or voice outlet of the structured cabling (one or more jacks).
Rack
Communications rack (with its patch panels) the data outlets are cabled to.
AirTerminal
Air terminal (a lightning rod) of a lightning protection system.
EarthElectrode
Earth electrode (a driven rod) of a lightning protection system.
Methods
pub const ALL: [DeviceKind; 10]pub fn key(self) -> &'static strpub fn name(self) -> &'static str
Name in commands (outlet, data_outlet, air_terminal…).
pub fn is_light(self) -> bool
A light point (on a lighting circuit).
pub fn class(self) -> SystemClass
The family of systems it belongs to.
pub fn is_board(self) -> bool
What feeds a system of its family: a distribution board or a rack.
pub fn circuit_kind(self) -> Option<SystemKind>
The kind of system that serves it (None for boards, racks and switches).
MAX_PORTSpub const MAX_PORTS: u32
Most jacks on one data outlet (larger values in files are cut down).
MepDatapub enum MepData
Building-services data of a component definition.
Traits: Debug, Clone, Copy, PartialEq, Serialize, Deserialize
Variants
Fixture { drain_units: f64, supply_weight: f64, hot_water: bool }
A plumbing fixture: its drainage fixture units, its relative weight on the water supply and whether it takes hot water.
Device { device: DeviceKind, power: f64, #[serde(default = "one", skip_serializing_if = "is_one")] ports: u32, }
An electrical device with its apparent power in volt-amperes; a data
outlet with its number of jacks (ports), each cabled to its rack.
Methods
pub fn device_of(device: DeviceKind, power: f64) -> Self
An electrical device of power VA with one port.
pub fn device(&self) -> Option<DeviceKind>pub fn power(&self) -> f64
Apparent power of a device, VA (0 for fixtures).
pub fn cables(&self) -> u32
Cables a data outlet takes back to its rack: one per jack (0 for anything else).
CABLE_SLACKpub const CABLE_SLACK: f64
Allowance added to each horizontal cable for the slack left at the rack and at the outlet, meters.
MAX_LINK_LENGTHpub const MAX_LINK_LENGTH: f64
Longest horizontal cable (permanent link) of structured cabling, meters, as in the usual cabling standards.
cable_lengthpub fn cable_length(outlet: DVec3, rack: DVec3, ceiling: f64) -> f64
The estimated route of a horizontal cable from an outlet at outlet to
a rack at rack (world points): up from the outlet to ceiling (the
world height of the outlet’s ceiling, where the pathways run), across in
plan along the two axes, and down (or up) to the rack, plus
CABLE_SLACK.
cc_core::openingscrates/cc_core/src/openings.rs
Doors and windows as components: the built-in definitions that the
template’s door and window types use and that older files’ door and
window types become.
A door or window component (ComponentKind::Door or Window, with a
HostOpening) is placed in a wall: its frame has x along the wall
from the opening’s center, y across the wall from its location line
(positive on the side a door opens to) and z up from the sill; its
expressions may use WALL_THICKNESS, the host wall’s thickness.
Items: FRAME · STILE · BOTTOM_RAIL · OpeningNames · door_def · operable_door_def · french_door_def · window_def · niche_def · NICHE_MIN_BACK · operable_window_def
FRAMEpub const FRAME: f64
Width of frame members (jambs, head, sash rails), meters.
STILEpub const STILE: f64
Width of the stiles and top rail of a glazed door’s leaves, meters.
BOTTOM_RAILpub const BOTTOM_RAIL: f64
Height of a French door’s bottom rail (the solid lower part of each leaf), meters.
OpeningNamespub struct OpeningNames
Names of the built-in parameters and pieces, in the project’s language.
Traits: Debug, Clone, Default
Fields
door: Stringdouble_door: String
Swing doors of two leaves.
french_door: String
Glazed doors (see french_door_def), of one leaf and of two.
french_door_double: Stringwindow: Stringniche: String
The component of niches (see niche_def).
depth: String
The depth of a niche.
casement: String
The components of windows that open (see Self::window_for).
double_casement: Stringtop_hung: Stringpivot_horizontal: Stringpivot_vertical: Stringsliding: Stringwidth: Stringheight: Stringsill: Stringbottom_rail: String
The height of a French door’s bottom rail.
frame: Stringleaf: Stringsash: Stringglass: Stringsill_board: StringMethods
pub fn new(n: &dyn Fn(&str) -> String) -> Self
Names from n(key) (template keys tpl-*); parameter names that are
not valid in expressions fall back to the Portuguese ones.
pub fn window_for(&self, operation: WindowOperation) -> &String
The component of windows that open as operation says.
pub fn door_for(&self, operation: DoorOperation, glazed: bool) -> &String
The component of doors whose leaves swing as operation says,
glazed (French doors) or not.
door_defpub fn door_def(names: &OpeningNames, width: f64, height: f64, material: &str) -> ComponentDef
A swing door: two jambs and a head as deep as the wall, and a leaf of
material in the middle of the wall.
operable_door_defpub fn operable_door_def(names: &OpeningNames, (width, height): (f64, f64), material: &str, operation: DoorOperation) -> ComponentDef
A swing door whose leaves open as operation says: door_def with,
for a double door, two leaves meeting in the middle.
french_door_defpub fn french_door_def(names: &OpeningNames, (width, height, bottom_rail): (f64, f64, f64), (leaf_material, glass): (&str, &str), operation: DoorOperation) -> ComponentDef
A French door: a glazed swing door from the floor, whose leaves (one or
two, as operation says) are stiles and a top rail of leaf_material
around a pane of glass, over a solid bottom rail bottom_rail tall
(the OpeningNames::bottom_rail parameter), in a frame as deep as the wall.
window_defpub fn window_def(names: &OpeningNames, width: f64, height: f64, sill: f64, material: &str) -> ComponentDef
A window: a sash frame in the middle of the wall around a pane of
material, and a sill board across the wall under it.
niche_defpub fn niche_def(names: &OpeningNames, (width, height, depth, sill): (f64, f64, f64, f64)) -> ComponentDef
A niche: a recess width wide, height tall and depth deep in one
face of its wall, its bottom sill above the wall’s base. It has no
pieces: the wall shows inside it (pieces of a niche component are not
placed yet).
NICHE_MIN_BACKpub const NICHE_MIN_BACK: f64
The least a niche leaves of its wall behind it, meters: a deeper one stops there (an opening through the wall is a door or a window).
operable_window_defpub fn operable_window_def(names: &OpeningNames, (width, height, sill): (f64, f64, f64), material: &str, operation: WindowOperation) -> ComponentDef
A window whose panels open as operation says: window_def with,
for two side-hung panels, a stile where they meet and a pane in each,
and for sliding ones two panels on either side of the wall’s middle,
overlapping by a stile.
cc_core::padcrates/cc_core/src/pad.rs
Building pads: a flat area at an elevation, graded into the terrain that
hosts it, with cut and fill slopes running out from its edges to the
existing ground. The terrain’s surface becomes the graded one
(cc_geom::pad); the pad itself has no solid.
A pad lives on its terrain’s level (kept equal by every edit, see
crate::EditCtx), is deleted with it and moves with it.
Items: MAX_OUTLINE · MIN_SLOPE · MAX_SLOPE · DEFAULT_CUT_SLOPE · DEFAULT_FILL_SLOPE · Pad · slope_ok · clamp_slope
MAX_OUTLINEpub const MAX_OUTLINE: usize
Most points of a pad’s outline.
MIN_SLOPEpub const MIN_SLOPE: f64
Gentlest and steepest slope ratios (horizontal run per unit of rise).
MAX_SLOPEpub const MAX_SLOPE: f64
DEFAULT_CUT_SLOPEpub const DEFAULT_CUT_SLOPE: f64
Ratios of a new pad type’s cut and fill slopes.
DEFAULT_FILL_SLOPEpub const DEFAULT_FILL_SLOPE: f64
Padpub struct Pad
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
host: ElementId
The terrain it grades.
outline: Vec<DVec2>
Closed outline in plan (either winding).
elevation: f64
Elevation of the pad above the terrain’s level.
cut_slope: Option<f64>
Horizontal run per unit of rise of the cut slope; None uses the type’s.
fill_slope: Option<f64>
Horizontal run per unit of rise of the fill slope; None uses the type’s.
sketch: Option<crate::sketch::Sketch>
The curves the outline was drawn with (see crate::sketch).
Methods
pub fn is_valid(&self) -> bool
An outline of three to MAX_OUTLINE finite points enclosing an area,
and a finite elevation. Bad slope overrides are repaired instead.
pub fn repair(&mut self) -> usize
Drop slope overrides out of range; returns how many were dropped.
pub fn slopes(&self, project: &Project, type_id: crate::ElementTypeId) -> (f64, f64)
The cut and fill ratios in effect: the pad’s own, else its type’s.
slope_okpub fn slope_ok(r: f64) -> bool
Whether r is a slope ratio a pad keeps.
clamp_slopepub fn clamp_slope(r: f64, default: f64) -> f64
r brought into the slope range (default when not a number).
cc_core::paintcrates/cc_core/src/paint.rs
Painted faces: a material laid on one surface of an element, over the
material its type gives it (a painted wall face, a tiled floor top).
The geometry is derived and rebuilt after every edit, so a paint does not
hold a face index. It keeps what identifies the face from outside: a
point on it and its outward normal, in model coordinates. After a rebuild
the paint goes on the element’s face (of its body, framing left out)
whose normal is within NORMAL_TOLERANCE_DEG of the stored one and
that passes nearest the stored point, and from there on the faces of the
element in the same plane (a wall face split by its openings) and, for a
curved surface, the smooth facets joined to it (see cc_geom::paint).
Moving, rotating or mirroring the element in plan moves the point and
turns the normal with it; other edits (a longer wall, a thicker layer)
keep the paint on the face that is still nearest. A face turned beyond
the tolerance leaves the paint unshown until it is painted again.
Items: MAX_PAINTS · NORMAL_TOLERANCE_DEG · FacePaint · repair
MAX_PAINTSpub const MAX_PAINTS: usize
Most paints an element keeps.
NORMAL_TOLERANCE_DEGpub const NORMAL_TOLERANCE_DEG: f64
How far a face may have turned and still take its paint, degrees.
FacePaintpub struct FacePaint
A material painted on one surface of an element.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
point: DVec3
A point on the painted face, meters.
normal: DVec3
The face’s outward unit normal when it was painted.
material: String
The material’s name.
Methods
pub fn is_valid(&self) -> bool
Whether the numbers are usable (finite, a normal of unit length).
pub fn transform(&mut self, t: &crate::PlanTransform)
Move and turn with the element in plan.
pub fn translate(&mut self, delta: DVec2)
repairpub fn repair(paints: &mut Vec<FacePaint>, material_exists: &dyn Fn(&str) -> bool) -> usize
Drop paints with bad numbers, of materials that are gone, and past the limit; returns how many went. Normals are made unit length first.
cc_core::patcrates/cc_core/src/pat.rs
The plain-text .pat hatch pattern format many CAD programs read and
write, as publicly described:
;%UNITS=MM
*NAME, optional description
;%TYPE=MODEL
angle, x-origin, y-origin, delta-x, delta-y [, dash1, dash2, ...]
```rust
A header line starting with `*` opens a pattern; each following line is
a family of parallel lines through the origin at the angle (degrees),
the next line shifted by delta-x along it and delta-y across it, with
optional dashes (positive drawn, negative gaps, zero dots). Text after
`;` is a comment; the comments `;%UNITS=MM|INCH` and
`;%TYPE=MODEL|DRAFTING` are read as markers (a type marker before the
first header sets the file's default, one inside a pattern that
pattern's kind). Parsing is bounded: file size, line length, patterns,
families and dashes.
**Items:** [`MAX_PAT_BYTES`](#cc_core-pat-max_pat_bytes) · [`MAX_PAT_PATTERNS`](#cc_core-pat-max_pat_patterns) · [`MAX_LINE_CHARS`](#cc_core-pat-max_line_chars) · [`MM_PER_INCH`](#cc_core-pat-mm_per_inch) · [`PatUnits`](#cc_core-pat-patunits) · [`PatOptions`](#cc_core-pat-patoptions) · [`PatError`](#cc_core-pat-paterror) · [`ParsedPat`](#cc_core-pat-parsedpat) · [`parse`](#cc_core-pat-parse) · [`write`](#cc_core-pat-write)
<a id="cc_core-pat-max_pat_bytes"></a>
### const `MAX_PAT_BYTES`
```rust
pub const MAX_PAT_BYTES: usize
Largest file read, bytes.
MAX_PAT_PATTERNSpub const MAX_PAT_PATTERNS: usize
Most patterns read from one file.
MAX_LINE_CHARSpub const MAX_LINE_CHARS: usize
Longest line read, characters.
MM_PER_INCHpub const MM_PER_INCH: f64
Millimeters in an inch.
PatUnitspub enum PatUnits
The units a file’s lengths are in.
Traits: Debug, Clone, Copy, PartialEq, Eq, Default
Variants
Auto
The file’s ;%UNITS= marker, else millimeters.
MillimetersInchesPatOptionspub struct PatOptions
How a file is read.
Traits: Debug, Clone, Copy, PartialEq, Default
Fields
units: PatUnitskind: Option<FillPatternKind>
Every pattern’s kind, in place of the file’s markers.
scale: f64
The scale given to every pattern.
PatErrorpub struct PatError
A problem with a line of the file.
Traits: Debug, Clone, PartialEq
Fields
line: usize
Line number, from 1 (0: the whole file).
pattern: Option<String>
The pattern being read, if any (it is left out).
message: String
ParsedPatpub struct ParsedPat
What a file holds: the patterns read (ids 0, millimeters) and the problems found; a pattern with a problem is left out.
Traits: Debug, Clone, Default, PartialEq
Fields
patterns: Vec<FillPattern>errors: Vec<PatError>parsepub fn parse(text: &str, options: &PatOptions) -> ParsedPat
Read .pat text.
writepub fn write(patterns: &[FillPattern]) -> String
patterns as .pat text in millimeters, their scales applied.
cc_core::persistcrates/cc_core/src/persist.rs
.ccad project files: a versioned RON document.
Items: FORMAT_VERSION · MAX_FILE_BYTES · PersistError · to_ron · from_ron · from_ron_with_repairs · from_ron_with_repairs_localized · save · read_to_string_limited · load · load_with_repairs · load_with_repairs_localized
FORMAT_VERSIONpub const FORMAT_VERSION: u32
Current file format version. Bump when the schema changes incompatibly.
28: the ANSI and architectural sheet sizes, and the slope unit
RisePer12 (6:12), which older builds cannot read.
MAX_FILE_BYTESpub const MAX_FILE_BYTES: u64
Largest project file read, bytes (pictures and textures are kept in it).
PersistErrorpub enum PersistError
Traits: Debug, Error
Variants
Io(#[from] std::io::Error)Parse(#[from] ron::error::SpannedError)Serialize(#[from] ron::Error)Version(u32)TooLarge(u64)to_ronpub fn to_ron(project: &Project) -> Result<String, PersistError>
from_ronpub fn from_ron(text: &str) -> Result<Project, PersistError>
from_ron_with_repairspub fn from_ron_with_repairs(text: &str) -> Result<(Project, usize), PersistError>
Parse a project and repair invalid data (see Project::repair); also
returns how many repairs were needed.
from_ron_with_repairs_localizedpub fn from_ron_with_repairs_localized(text: &str, translate: &dyn Fn(&str) -> Option<String>) -> Result<(Project, usize), PersistError>
Like from_ron_with_repairs, naming what migration adds with
translate (template keys; Portuguese defaults when it gives none).
savepub fn save(project: &Project, path: &Path) -> Result<(), PersistError>
read_to_string_limitedpub fn read_to_string_limited(path: &Path, max: u64) -> std::io::Result<String>
The text of the file at path, refused past max bytes before it is
read (an I/O error of kind FileTooLarge): files are hostile input, and
one far larger than any real file would only exhaust memory.
loadpub fn load(path: &Path) -> Result<Project, PersistError>
load_with_repairspub fn load_with_repairs(path: &Path) -> Result<(Project, usize), PersistError>
load_with_repairs_localizedpub fn load_with_repairs_localized(path: &Path, translate: &dyn Fn(&str) -> Option<String>) -> Result<(Project, usize), PersistError>
Like load_with_repairs, naming what migration adds with translate
(see from_ron_with_repairs_localized).
cc_core::phasecrates/cc_core/src/phase.rs
Construction phases (renovation work).
The project holds an ordered list of Phases (the template has
“Existing” and “New Construction”). Every model element is created in a
phase and may be demolished in the same or a later one. Each model view
shows the model as of one phase, through a PhaseFilter: relative to
the view’s phase an element is
PhaseGraphics for that status (which combine with view graphics
below element overrides and view filters, above category overrides).
Hosted elements follow their hosts (see Project::phase_fixes): a door
or window (or a rebar set) is never created before its host nor survives
its host’s demolition; it can be demolished earlier on its own.
Annotation categories (dimensions, text, grids) have no phase.Items: Phase · PhaseStatus · PhaseState · PhaseDisplay · PhaseFilter · PhaseGraphics · phase_graphics_is_default · TEMPLATE_FILTERS · TEMPLATE_PHASES · phase_host
Phasepub struct Phase
A construction phase. The project keeps them in time order.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
id: PhaseIdname: Stringdescription: StringPhaseStatuspub enum PhaseStatus
An element’s status relative to a view’s phase.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize
Variants
ExistingDemolishedNewTemporaryMethods
pub const ALL: [PhaseStatus; 4]pub fn key(self) -> &'static str
Translation key of the status name.
pub fn ifc(self) -> &'static str
The IFC4 Status enumeration value (Pset_*Common).
pub fn from_ifc(value: &str) -> Option<Self>
Read an IFC Status value (case-insensitive).
PhaseStatepub enum PhaseState
Where an element stands in a view’s phase.
Traits: Debug, Clone, Copy, PartialEq, Eq
Variants
Unphased
Annotations: shown in every phase, never overridden.
Absent
Created later or demolished earlier: not part of the view.
Status(PhaseStatus)
PhaseDisplaypub enum PhaseDisplay
How a phase filter shows elements of one status.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
NotDisplayedByCategory
With the view’s graphics only.
Overridden
With the project’s graphics for the status.
Methods
pub const ALL: [PhaseDisplay; 3]pub fn key(self) -> &'static strPhaseFilterpub struct PhaseFilter
A named rule for which statuses a view shows, and how.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
id: PhaseFilterIdname: Stringexisting: PhaseDisplaydemolished: PhaseDisplaynew: PhaseDisplaytemporary: PhaseDisplayMethods
pub fn display(&self, status: PhaseStatus) -> PhaseDisplaypub fn set_display(&mut self, status: PhaseStatus, display: PhaseDisplay)pub fn is_show_all(&self) -> bool
Whether the filter shows everything, overriding all but new elements (the default filter of new views).
PhaseGraphicspub struct PhaseGraphics
Graphic overrides of each status (used where a filter says “Overridden”).
Traits: Debug, Clone, Copy, PartialEq, Serialize, Deserialize, Default
Fields
existing: GraphicOverridedemolished: GraphicOverridenew: GraphicOverridetemporary: GraphicOverrideMethods
pub fn get(&self, status: PhaseStatus) -> &GraphicOverridepub fn get_mut(&mut self, status: PhaseStatus) -> &mut GraphicOverridepub fn repair(&mut self) -> usize
Reset invalid values; returns how many.
phase_graphics_is_defaultpub(crate) fn phase_graphics_is_default(g: &PhaseGraphics) -> bool
TEMPLATE_FILTERSpub const TEMPLATE_FILTERS: [(&str, [PhaseDisplay; 4]); 7]
The template’s phase filters: name key and displays of existing, demolished, new and temporary elements.
TEMPLATE_PHASESpub const TEMPLATE_PHASES: [&str; 2]
The template’s phases (name keys), in order.
phase_hostpub fn phase_host(e: &Element) -> Option<ElementId>
The element that decides an element’s phases: the wall of a door or window, the beam or column of a rebar set, the stair of a railing, the wall of a wall framing, the member of a connection, the cap of a pile.
cc_core::pilecrates/cc_core/src/pile.rs
Piles and pile caps.
A pile (Pile, ElementKind::Pile, category Pile) is a vertical
shaft in the ground at a plan position: its head (cut_off) and its
toe (toe) are offsets from its level, its embedment how far the head
enters the cap above it; its type (TypeData::Pile) gives the section
(PileSection), the kind (PileKind) and the material. The length
is derived: cut_off - toe.
A pile cap is a foundation (ElementKind::Foundation placed by a
FoundationShape::Pad: position and rotation) whose type is of
FoundationKind::PileCap: the type’s PileCap gives the layout of
its piles, their spacing and edge distance, their type, length and
embedment; its thickness is the cap’s. The cap’s outline follows from
the layout (PileCap::outline), in the cap’s frame: the origin at its
position, u along its rotation and v to the left of it.
The piles of a cap are elements pointing at it (Pile::cap, with their
index in the layout). Every edit keeps them in step with the cap and its
type (see crate::EditCtx): piles are added or removed when the
layout’s count changes, and each one stands where the layout puts it
through the cap’s placement, on the cap’s level, its head at the cap’s
bottom plus the embedment, its toe the pile length below. They are
deleted, moved and copied with the cap; moved alone they go back. A pile
whose cap is gone (or is no pile cap) is dropped, like a building pad
without its terrain.
Items: MAX_PILES · MIN_PILE_SIZE · MAX_PILE_SIZE · MIN_PILE_LENGTH · MAX_PILE_LENGTH · MAX_OFFSET · MAX_EMBEDMENT · MIN_SPACING · MAX_SPACING · MIN_EDGE_DISTANCE · MAX_EDGE_DISTANCE · MIN_CIRCLE_RADIUS · MAX_CIRCLE_RADIUS · DEFAULT_DIAMETER · DEFAULT_PILE_LENGTH · DEFAULT_EMBEDMENT · DEFAULT_CAP_THICKNESS · PileKind · PileSection · PileCapRef · Pile · length_ok · PileLayout · CapOutline · PileCap · cap_of_type · cap_placement · CapPlacement · PileSync
MAX_PILESpub const MAX_PILES: u32
Most piles under one cap.
MIN_PILE_SIZEpub const MIN_PILE_SIZE: f64
Smallest and largest pile diameter (or square side), meters.
MAX_PILE_SIZEpub const MAX_PILE_SIZE: f64
MIN_PILE_LENGTHpub const MIN_PILE_LENGTH: f64
Shortest and longest pile, meters.
MAX_PILE_LENGTHpub const MAX_PILE_LENGTH: f64
MAX_OFFSETpub const MAX_OFFSET: f64
Largest offset of a pile’s head or toe from its level, meters.
MAX_EMBEDMENTpub const MAX_EMBEDMENT: f64
Deepest embedment of a pile’s head into its cap, meters.
MIN_SPACINGpub const MIN_SPACING: f64
Closest and widest pile spacing in a cap (center to center), meters.
MAX_SPACINGpub const MAX_SPACING: f64
MIN_EDGE_DISTANCEpub const MIN_EDGE_DISTANCE: f64
Smallest and largest edge distance (pile center to cap edge), meters.
MAX_EDGE_DISTANCEpub const MAX_EDGE_DISTANCE: f64
MIN_CIRCLE_RADIUSpub const MIN_CIRCLE_RADIUS: f64
Smallest and largest radius of a circle of piles, meters.
MAX_CIRCLE_RADIUSpub const MAX_CIRCLE_RADIUS: f64
DEFAULT_DIAMETERpub const DEFAULT_DIAMETER: f64
Defaults of a new pile type and pile cap type.
DEFAULT_PILE_LENGTHpub const DEFAULT_PILE_LENGTH: f64
DEFAULT_EMBEDMENTpub const DEFAULT_EMBEDMENT: f64
DEFAULT_CAP_THICKNESSpub const DEFAULT_CAP_THICKNESS: f64
PileKindpub enum PileKind
How a pile is made.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
Bored
Drilled and cast in place.
ContinuousFlightAuger
Continuous flight auger: concreted through the hollow auger as it is withdrawn.
Micro
Micropiles and root piles: small drilled and grouted piles.
PrecastDriven
Precast concrete driven into the ground.
Steel
Steel sections or tubes driven into the ground.
Other
Methods
pub const ALL: [PileKind; 6]pub fn key(self) -> &'static str
Translation key of the kind’s name.
pub fn code(self) -> &'static str
Short name used by commands (bored, cfa, micro, precast, steel, other).
pub fn from_code(code: &str) -> Option<PileKind>
The kind named by code (see Self::code), ignoring case.
PileSectionpub enum PileSection
A pile’s cross-section, centered on its axis.
Traits: Debug, Clone, Copy, PartialEq, Serialize, Deserialize, Default
Variants
Round { diameter: f64, }Square { side: f64, }
A square side wide, turned with the pile’s rotation.
Methods
pub fn size(&self) -> f64
The diameter, or the side of a square.
pub fn area(&self) -> f64
Exact area of the section.
pub fn is_valid(&self) -> bool
Whether the size is a finite number within the limits.
pub fn repair(&mut self) -> bool
Bring the size within the limits (the default when not a number); returns whether it changed.
PileCapRefpub struct PileCapRef
The cap a pile belongs to and its place in the cap’s layout.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize
Fields
cap: ElementIdindex: u32Pilepub struct Pile
A pile (see the module documentation).
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
position: DVec2
Axis in plan.
rotation_deg: f64
Rotation of a square section in plan, degrees counter-clockwise.
cut_off: f64
Top of the pile (its cut-off) above the level, meters (negative below).
toe: f64
Bottom of the pile above the level, meters (below cut_off).
embedment: f64
How far the head enters the cap above it, meters.
cap: Option<PileCapRef>
The pile cap that owns the pile (None: a free pile).
Methods
pub fn new(position: DVec2, cut_off: f64, length: f64) -> Self
A free pile from its head down length.
pub fn length(&self) -> f64
Length from the head to the toe.
pub fn is_valid(&self) -> bool
Every number finite, the offsets within MAX_OFFSET.
pub fn repair(&mut self) -> usize
Bring the embedment and the length within their limits (a toe not below the head goes the default length down); returns how many values changed.
length_okpub fn length_ok(length: f64) -> bool
Whether length is a pile length within the limits.
PileLayoutpub enum PileLayout
Where the piles of a cap stand, in the cap’s frame (spacing is the
distance between neighbors, except on a circle).
Traits: Debug, Clone, Copy, PartialEq, Serialize, Deserialize
Variants
Single
One pile at the center.
Pair
Two piles along u, spacing apart.
Triangle
Three piles at the corners of an equilateral triangle of side
spacing centered on the origin, the first on +u (the cap points
along its rotation).
Square
Four piles at the corners of a square of side spacing.
Line { count: u32 }
count piles along u, spacing apart, centered.
Circle { count: u32, radius: f64, #[serde(default, skip_serializing_if = "Option::is_none")] ring_width: Option<f64>, }
count piles on a circle of radius, the first on +u: a round
cap (radius plus the edge distance), or a ring ring_width wide
centered on the circle.
Methods
pub fn count(&self) -> u32
Number of piles.
pub fn key(&self) -> &'static str
Translation key of the layout’s name.
CapOutlinepub enum CapOutline
The plan of a pile cap in its frame.
Traits: Debug, Clone, PartialEq
Variants
Polygon(Vec<DVec2>)
A convex polygon, counter-clockwise.
Disk { radius: f64 }
A disk centered on the origin.
Ring { inner: f64, outer: f64 }
An annulus centered on the origin.
Methods
pub fn area(&self) -> f64
Exact plan area.
pub fn bounds(&self) -> (DVec2, DVec2)
The bounding box, (min, max).
pub fn loops(&self, segments: usize) -> Vec<Vec<DVec2>>
The outer boundary and the holes as polygons (counter-clockwise; a
circle as segments chords).
PileCappub struct PileCap
What a pile cap type holds besides its thickness and material: its piles.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize, Default
Fields
layout: PileLayoutspacing: f64
Center-to-center distance between neighboring piles (unused on a circle).
edge_distance: f64
Distance from a pile’s center to the cap’s edge (on a circle: to the outer edge of a round cap; a ring has its width).
pile_type: Option<ElementTypeId>
The type of the cap’s piles (None: the project’s first pile type).
pile_length: f64
Length of each pile, from its head to its toe.
embedment: f64
How far each pile’s head enters the cap.
Methods
pub fn positions(&self) -> Vec<DVec2>
Pile positions in the cap’s frame, in layout order.
pub fn outline(&self) -> CapOutline
The cap’s plan in its frame: a rectangle edge_distance around the
piles of one, two, four and a line; for three, the triangle whose
sides lie edge_distance off the piles with its corners cut square
edge_distance past the corner piles; on a circle a disk, or the
ring.
pub fn problem(&self, pile_size: f64) -> Option<String>
Why the layout cannot hold piles pile_size across (None when it
can): piles apart, inside the cap, numbers within the limits.
pub fn repair(&mut self) -> usize
Bring every value within its limits (a number that is not one takes
the default); returns how many changed. The pile type is checked
against the project by Project::repair.
cap_of_typepub fn cap_of_type(data: &TypeData) -> Option<(&PileCap, f64)>
The pile cap a foundation type describes, with the cap’s thickness.
cap_placementpub fn cap_placement(e: &Element) -> Option<(DVec2, f64, f64)>
A pile cap element’s placement: position, rotation (degrees) and top above its level.
CapPlacementpub struct CapPlacement<'a>
A pile cap element as the sync and the geometry see it.
Traits: Debug, Clone, PartialEq
Fields
cap: &'a PileCapthickness: f64position: DVec2rotation_deg: f64top_offset: f64Methods
pub fn world(&self, local: DVec2) -> DVec2
A point of the cap’s frame in plan.
pub fn pile_positions(&self) -> Vec<DVec2>
The piles’ axes in plan, in layout order.
pub fn cut_off(&self) -> f64
The head of the cap’s piles above its level: the cap’s bottom plus the embedment.
PileSyncpub(crate) struct PileSync
The changes that bring piles in step with their caps.
Traits: Debug, Default
Fields
types: Vec<(ElementTypeId, f64, f64)>
Cap types whose width and length differ from their outline’s size.
remove: Vec<ElementId>
Piles of no cap (or of a place another pile takes).
update: Vec<(ElementId, crate::LevelId, ElementTypeId, Pile)>
Piles to put where their cap wants them: level, type and pile.
add: Vec<(crate::LevelId, ElementTypeId, Pile)>
Missing piles of caps.
cc_core::profilecrates/cc_core/src/profile.rs
Profiles of component pieces: closed outlines of straight segments,
arcs and parts of ellipses drawn on one of the component’s planes (plan, front or side), with
every coordinate an crate::expr expression, and the solids made from
them: an extrusion across the plane or a revolution about an axis in it.
A profile’s plane is placed at offset along the axis normal to it (Z
for the plan, Y for the front, X for the side), and an extrusion runs
depth from there along that axis. The solids come out as closed meshes
with outward faces, in the component’s frame (X to the right, Y to the
back, Z up).
Items: SketchPlane · ProfilePoint · ProfileBezier · ProfileEllipse · Segment · vertices · segment_points · ProfileError · outline · extrude · revolve · from_curves · to_curves · written
SketchPlanepub enum SketchPlane
The plane a profile is drawn on, as seen in the matching view.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
Plan
Seen from above: U along X, V along Y; placed and extruded along Z.
Front
Seen from the front (-Y): U along X, V along Z; placed and extruded along Y.
Side
Seen from the right (+X): U along Y, V along Z; placed and extruded along X.
Methods
pub const ALL: [SketchPlane; 3]pub fn key(self) -> &'static strpub fn point(self, u: f64, v: f64, w: f64) -> DVec3
The point at u, v on the plane placed at w on its normal axis.
ProfilePointpub struct ProfilePoint
A vertex of a profile. The segment to the next vertex is straight, an
arc of radius when it is not empty (a positive radius bulges to the
right of the direction of travel, outwards in a counter-clockwise
profile; a negative one to the left), a part of ellipse, or a cubic
Bézier curve by its two bezier handles (a spline’s segment).
Traits: Debug, Clone, PartialEq, Default, Serialize, Deserialize
Fields
u: Stringv: Stringradius: Stringellipse: Option<ProfileEllipse>bezier: Option<ProfileBezier>Methods
pub fn new(u: impl Into<String>, v: impl Into<String>) -> Selfpub fn arc(u: impl Into<String>, v: impl Into<String>, radius: impl Into<String>) -> Selfpub fn expressions(&self) -> Vec<(&'static str, &String)>
Every expression of the point, with a field label (an arc’s radius and an ellipse’s rotation only when set).
pub fn expressions_mut(&mut self) -> Vec<&mut String>ProfileBezierpub struct ProfileBezier
The two handles of a cubic Bézier segment from a profile’s vertex to the
next: (u1, v1) leaving the vertex, (u2, v2) arriving at the next.
Traits: Debug, Clone, PartialEq, Default, Serialize, Deserialize
Fields
u1: Stringv1: Stringu2: Stringv2: StringProfileEllipsepub struct ProfileEllipse
The ellipse a profile segment runs along, from its vertex to the next:
center (u, v), semi-axes rx and ry along its own axes, turned
rotation degrees; counter-clockwise unless clockwise. The vertices
should lie on it (each is taken at the ellipse’s parameter of its
direction from the center).
Traits: Debug, Clone, PartialEq, Default, Serialize, Deserialize
Fields
u: Stringv: Stringrx: Stringry: Stringrotation: Stringclockwise: boolSegmentpub enum Segment
The segment from a profile’s vertex to the next, in numbers.
Traits: Debug, Clone, Copy, PartialEq
Variants
LineArc { radius: f64, }
An arc of radius (signed like ProfilePoint::radius).
Ellipse { center: DVec2, radii: DVec2, rotation_deg: f64, clockwise: bool, }Bezier { c1: DVec2, c2: DVec2, }
A cubic Bézier curve with these two handles.
verticespub fn vertices(points: &[ProfilePoint], lookup: &dyn Fn(&str) -> Option<f64>) -> Result<Vec<(DVec2, Segment)>, ProfileError>
The vertices of points and the segments from each to the next, in numbers.
segment_pointspub(crate) fn segment_points(a: DVec2, b: DVec2, segment: Segment, out: &mut Vec<DVec2>) -> Result<(), ProfileError>
The inner points of the segment from a to b.
ProfileErrorpub enum ProfileError
Why a profile could not be resolved.
Traits: Debug, Clone, PartialEq, std::fmt::Display
Variants
Expr { field: &'static str, error: ExprError, }Degenerate
Fewer than 3 distinct points, no area, an arc shorter than its chord, a zero size or a profile crossing its revolution axis.
outlinepub fn outline(points: &[ProfilePoint], lookup: &dyn Fn(&str) -> Option<f64>) -> Result<Vec<DVec2>, ProfileError>
The outline of points in plane coordinates, arcs divided into segments,
counter-clockwise.
extrudepub fn extrude(plane: SketchPlane, outline: &[DVec2], offset: f64, depth: f64) -> Vec<Vec<DVec3>>
The closed solid of a counter-clockwise outline on plane, from offset
along the plane’s normal to offset + depth.
revolvepub fn revolve(plane: SketchPlane, outline: &[DVec2], offset: f64, axis: f64, angle: f64) -> Result<Vec<Vec<DVec3>>, ProfileError>
The solid swept by a counter-clockwise outline on plane (placed
offset along its normal) turning angle degrees about the line
u = axis of the plane (parallel to V). The outline must lie on one side
of the axis; it may touch it.
from_curvespub fn from_curves(curves: &[SketchCurve], closed: bool) -> Result<Vec<(DVec2, Segment)>, SketchError>
The vertices and segments that draw the sketch curves: their one
closed loop when closed, or else the open path they make (its last
vertex ends it, with a straight segment that is not drawn). Arcs over
half a turn split in two, circles and whole ellipses into halves.
to_curvespub fn to_curves(vertices: &[(DVec2, Segment)], closed: bool) -> Vec<SketchCurve>
The sketch curves that draw vertices (the segment from the last vertex
back to the first only when closed).
writtenpub fn written(vertices: &[(DVec2, Segment)]) -> Vec<ProfilePoint>
Profile points that write vertices as plain numbers.
cc_core::profile_catalogcrates/cc_core/src/profile_catalog.rs
Built-in profile catalogs: the standard series of rolled, cold-formed,
timber and hollow sections, as tables (cells split by ;, since the
designations write decimals with a comma) compiled into the binary and
parsed once. Each row is a designation (the full name the standard gives,
e.g. W150x22,5 (H)) and the dimensions of the series’
ProfileShape in millimeters (taken from public dimension tables), plus
the tabulated area in cm², kept only to check the computed outlines.
Catalogs are not stored in projects: importing a row copies it in as a
ProfileDef that remembers its CatalogRef.
Items: MAX_ROWS · Series · CatalogRow · catalog · series · row_to_def
MAX_ROWSpub const MAX_ROWS: usize
Most rows read from one table.
Seriespub struct Series
A catalog series: rows of one shape and material.
Traits: Debug, Clone, PartialEq
Fields
code: &'static str
Stable code, e.g. "W", "NBR6355-Ue".
name_key: &'static str
The i18n key of the series’ name.
material: ProfileMaterialshape: &'static str
The ProfileShape::code of the rows.
rows: Vec<CatalogRow>CatalogRowpub struct CatalogRow
One row of a series.
Traits: Debug, Clone, PartialEq
Fields
designation: Stringvalues: Vec<(String, f64)>
The shape’s values by field name: meters, angle in degrees.
area: f64
The tabulated area, m² (reference only; 0 when the table has none).
catalogpub fn catalog() -> &'static [Series]
Every built-in series, parsed on first use; rows that do not parse are left out.
seriespub fn series(code: &str) -> Option<&'static Series>
The series of that code.
row_to_defpub fn row_to_def(series: &Series, row: &CatalogRow) -> Option<ProfileDef>
A profile for a row (id 0 and a new uid; the caller sets the id), named
by its designation, or None when the row does not make a valid outline.
Values the row lacks are 0, except a Z’s lip angle, which is square (90°).
cc_core::profile_sweepcrates/cc_core/src/profile_sweep.rs
Swept profiles: a closed profile, held by the element’s type, carried
along a path drawn in plan at a height above the element’s level. They
model what runs along walls, ceilings and roof edges: baseboards, crown
moldings, fascia boards, gutters, copings.
The profile is drawn in its own plane, square to the path: x across,
positive to the left of the path walking along it (flip mirrors it to
the right), and y up from the path’s height.
Items: MAX_PROFILE_POINTS · MAX_PROFILE_SIZE · MAX_PATH_POINTS · Sweep · ProfileProblem · check_profile · baseboard
MAX_PROFILE_POINTSpub const MAX_PROFILE_POINTS: usize
Most points of a profile.
MAX_PROFILE_SIZEpub const MAX_PROFILE_SIZE: f64
Largest extent of a profile, meters.
MAX_PATH_POINTSpub const MAX_PATH_POINTS: usize
Most points of a sweep’s path.
Sweeppub struct Sweep
A swept profile element.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
path: Vec<DVec2>
The path in plan, in order.
closed: bool
The path runs back from its last point to its first (around a room).
base_offset: f64
Height of the path above the level.
flip: bool
The profile on the right of the path instead of the left.
Methods
pub fn length(&self) -> f64
Plan length of the path.
pub fn is_valid(&self) -> bool
ProfileProblempub enum ProfileProblem
Why a profile is refused.
Traits: Debug, Clone, Copy, PartialEq, Eq
Variants
TooFewPointsTooManyPointsNotFiniteTooLargeNoAreaCrossingMethods
pub fn message(self) -> &'static strcheck_profilepub fn check_profile(points: &[DVec2]) -> Result<(), ProfileProblem>
Check a profile: a simple closed outline of a sensible size.
baseboardpub fn baseboard() -> Vec<DVec2>
The profile of a new project’s sweep type: a baseboard 1.5 cm thick and 10 cm tall, on the left of the path.
cc_core::profiles_projectcrates/cc_core/src/profiles_project.rs
Structural profiles in the project: lookups and repair of loaded files.
Items: TypeSection · section_name · section_name_in · SectorPlacement · type_profile · same_legacy · legacy_size
TypeSectionpub struct TypeSection
The section a column or beam type draws: its profile’s outline turned and mirrored, or the legacy section’s.
Traits: Debug, Clone, PartialEq
Fields
outline: SectionOutlineprofile: Option<ProfileId>
The profile it comes from; None for a legacy section.
material: ProfileMaterialcurved: bool
Whether the outline has arcs (drawn as short chords).
section_namepub fn section_name(shape: &ProfileShape, material: ProfileMaterial) -> String
The name a converted section’s profile gets: I 200x200x9x15,
Rect 20x40 (centimeters for concrete and timber rectangles and rounds,
as section tags show them), Ø30, Tube 150x150x6.
section_name_inpub fn section_name_in(shape: &ProfileShape, material: ProfileMaterial, system: crate::MeasurementSystem) -> String
section_name, or in an imperial project the same name with every
size in inches (I 8"x8"x5/16"x7/16", Rect 8"x8", Ø12").
SectorPlacementpub struct SectorPlacement
An annular sector section in its type’s frame: the ring’s center, the
unit axis from it through the middle of the sector, the radii and the
angle it turns (radians).
Traits: Debug, Clone, Copy, PartialEq
Fields
center: DVec2axis: DVec2r_in: f64r_out: f64sweep: f64type_profilepub(crate) fn type_profile(data: &TypeData) -> Option<ProfileId>
The profile a column or beam type points to.
same_legacypub(crate) fn same_legacy(a: &TypeData, b: &TypeData) -> bool
Whether two column or beam types have the same legacy section fields
(section, or width, height and shape).
legacy_sizepub(crate) fn legacy_size(data: &TypeData) -> Option<(f64, f64)>
The legacy box of a column or beam type, (width, depth or height).
cc_core::projectcrates/cc_core/src/project.rs
Items: ProjectField · ProjectInfo · Level · Project · Group · template_default · can_join_geometry · join_priority · natural_cmp
ProjectFieldpub struct ProjectField
A project value named by the user (shown by title blocks as {project:Name}).
Traits: Debug, Clone, PartialEq, Default, Serialize, Deserialize
Fields
name: Stringvalue: StringProjectInfopub struct ProjectInfo
Traits: Debug, Clone, PartialEq, Default, Serialize, Deserialize
Fields
uid: crate::Uid
Persistent unique id of the project.
name: Stringnumber: Stringclient: Stringaddress: Stringauthor: Stringfields: Vec<ProjectField>
Fields named by the user, in the order they were added.
site: Option<crate::site::SiteLocation>
Where the project stands on Earth (see crate::site).
Methods
pub fn field(&self, name: &str) -> Option<&str>
The value of the field called name.
Levelpub struct Level
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
id: LevelIdname: Stringelevation: f64
Elevation in meters.
Projectpub struct Project
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
info: ProjectInfolevels: Vec<Level>
Sorted by elevation.
materials: Vec<Material>types: BTreeMap<ElementTypeId, ElementType>elements: BTreeMap<ElementId, Element>views: BTreeMap<ViewId, View>units: crate::Units
How quantities are displayed and typed.
pinned: std::collections::BTreeSet<ElementId>
Elements protected from moving and deleting.
joins: std::collections::BTreeSet<(ElementId, ElementId)>
Joined geometry as (cutting, cut) pairs: where the two overlap,
the first keeps the volume and their cut outlines merge.
groups: BTreeMap<crate::GroupId, Group>
Named sets of elements selected, moved and copied together.
systems: BTreeMap<crate::SystemId, crate::MepSystem>
Plumbing systems and electrical circuits.
filters: BTreeMap<crate::FilterId, crate::ViewFilter>
Named view filters (categories and rules), applied by views.
templates: BTreeMap<crate::TemplateId, crate::ViewTemplate>
View templates.
phases: Vec<crate::Phase>
Construction phases, in time order (see crate::phase).
phase_filters: BTreeMap<crate::PhaseFilterId, crate::PhaseFilter>
Phase filters views choose from.
phase_graphics: crate::PhaseGraphics
Graphics of each phase status, where a phase filter overrides it.
graph_bindings: BTreeMap<ElementId, crate::graph_binding::GraphBinding>
Elements made by visual programming graphs, and the call that made
each (see crate::graph_binding).
line_styles: crate::detail::LineStyles
The project’s own line styles (see crate::detail), used by detail
lines and region boundaries next to the built-in ones.
fill_patterns: crate::fill_pattern::FillPatterns
The project’s own fill patterns (see crate::fill_pattern), used
by materials, filled regions and view overrides next to the built-in ones.
profiles: BTreeMap<crate::ProfileId, crate::structural_profile::ProfileDef>
Named structural profiles (tracked as settings).
option_sets: Vec<crate::OptionSet>
Design option sets (see crate::design_option).
browser: crate::browser::BrowserOrganization
How the project browser groups the views (see crate::browser).
bar_marking: crate::bar_marks::BarMarking
How reinforcing bars are marked (see crate::bar_marks).
sun_presets: Vec<crate::sun::SunPreset>
Named sun settings views can take (see crate::sun).
active_option: Option<crate::OptionId>
The design option new elements go into and views without a choice of
their own show for its set: session state, not saved nor undone (set
through crate::Document::set_active_option).
Some fields are private.
Methods
pub fn browser_tree(&self) -> Vec<Node> (in cc_core::browser)
The browser tree under the scheme in use.
pub fn callouts_in(&self, parent: ViewId) -> impl Iterator<Item = &View> (in cc_core::callout)
The views whose callouts are drawn in parent, in id order.
pub fn callout_parent(&self, view: ViewId) -> Option<&View> (in cc_core::callout)
The parent view of the view’s callout, if it has one.
pub fn detail_kind(&self, view: &View) -> Option<ViewKind> (in cc_core::callout)
The kind a detail view takes from its parent: a section’s or
elevation’s whole kind (its drawing coordinates are the parent’s),
a plan’s level (cut height, underlay and the rest stay its own).
None when nothing changes.
pub fn repair_callouts(&mut self) -> usize (in cc_core::callout)
Repair crops and callouts: drop invalid crops and crops of views that cannot have one, and callouts whose parent is missing, is the view itself or cannot hold them, of another kind than a detail view, or with no valid rectangle. Returns how many were fixed.
pub fn connections_of(&self, member: ElementId) -> impl Iterator<Item = (&Element, &Connection)> (in cc_core::connection)
The connections on member.
pub fn connection_at(&self, member: ElementId, end: MemberEnd) -> Option<ElementId> (in cc_core::connection)
The connection at member’s end, if it has one.
pub(crate) fn repair_connections(&mut self) -> usize (in cc_core::connection)
From a file: one connection per member end (the lowest id stays), numbers back in range; returns the repairs.
pub fn option_set(&self, id: OptionSetId) -> Option<&OptionSet> (in cc_core::design_option)pub fn option_set_of(&self, option: OptionId) -> Option<&OptionSet> (in cc_core::design_option)
The set an option belongs to.
pub fn design_option(&self, id: OptionId) -> Option<(&OptionSet, &DesignOption)> (in cc_core::design_option)
An option and its set.
pub fn option_label(&self, id: OptionId) -> String (in cc_core::design_option)
“Set: Option”, or empty for unknown options.
pub fn active_option(&self) -> Option<OptionId> (in cc_core::design_option)
The option being edited, when it still exists.
pub fn primary_options(&self) -> BTreeSet<OptionId> (in cc_core::design_option)
The primary option of every set (what exports write).
pub fn shown_options(&self, view: Option<&View>) -> BTreeSet<OptionId> (in cc_core::design_option)
The option of each set that view shows (see the module docs); with
no view, what views without a choice of their own show.
pub fn option_shows(&self, e: &Element, shown: &BTreeSet<OptionId>) -> bool (in cc_core::design_option)
Whether e is part of a model showing the options shown.
pub fn options_hide_any(&self, shown: &BTreeSet<OptionId>) -> bool (in cc_core::design_option)
Whether showing the options shown leaves any element out.
pub fn with_options(&self, shown: &BTreeSet<OptionId>) -> Option<Project> (in cc_core::design_option)
A copy of the project with only the main model and the options
shown (joins between what is left), or None when nothing would
be left out.
pub fn option_elements(&self, option: OptionId) -> impl Iterator<Item = &Element> (in cc_core::design_option)
Elements of one option.
pub fn option_fixes(&self) -> Vec<(ElementId, Option<OptionId>)> (in cc_core::design_option)
The options that would make elements consistent: annotations in no
option, unknown options reset to the main model, hosted elements in
their host’s option. Returns (element, option) for each element
that needs a change.
pub(crate) fn stale_choices(&self, choices: &BTreeMap<OptionSetId, OptionId>) -> bool (in cc_core::design_option)
Choices of choices that name no set, or an option outside its set.
pub(crate) fn clean_choices(&self, choices: &mut BTreeMap<OptionSetId, OptionId>) -> usize (in cc_core::design_option)
Drop the choices of choices that name no set, or an option outside
its set; returns how many.
pub(crate) fn repair_options(&mut self) -> usize (in cc_core::design_option)
Sets, options, element options and view choices; returns how many repairs were needed.
pub fn detail_def(&self, component: &str) -> Option<&ComponentDef> (in cc_core::detail_component)
The definition of the detail component named component (its
first type’s), if the project has one.
pub fn detail_nests(&self, component: &str, target: &str) -> bool (in cc_core::detail_component)
Whether the detail component component reaches target through
its nested pieces (or is it), within MAX_DEPTH.
pub fn dim_ref_at(&self, id: ElementId, p: DVec2) -> Option<DimRef> (in cc_core::dim_refs)
The reference of point p (plan coordinates) on element id, when
the element kind can carry one.
pub fn dim_ref_in_view(&self, view: &View, id: ElementId, p: DVec2) -> Option<DimRef> (in cc_core::dim_refs)
The reference of point p (in view’s drawing coordinates) on
element id: in plans as Project::dim_ref_at; in elevations and
sections a plan point of the element that projects to p.x, and a
height from the element’s base or top (whichever is nearer).
pub fn level_ref(&self, view: &View, level: LevelId) -> Option<DimRef> (in cc_core::dim_refs)
A level as a reference in an elevation or section.
pub fn resolve_dim_ref(&self, r: &DimRef) -> Option<DVec2> (in cc_core::dim_refs)
The current plan point of an element reference.
pub fn resolve_in_view(&self, r: &DimRef, view: &View, current: DVec2) -> Option<DVec2> (in cc_core::dim_refs)
The current point of a reference in view’s drawing coordinates;
current is the end’s present position (levels keep its x).
pub fn fill_pattern(&self, id: FillPatternId) -> Option<&FillPattern> (in cc_core::fill_pattern)
The custom pattern id.
pub fn fill_pattern_named(&self, name: &str) -> Option<&FillPattern> (in cc_core::fill_pattern)
The custom pattern called name (ignoring case).
pub fn has_pattern(&self, pattern: Pattern) -> bool (in cc_core::fill_pattern)
Whether pattern can be drawn here: a built-in, or a custom pattern
the project has.
pub fn fill_pattern_usage(&self, id: FillPatternId) -> PatternUsage (in cc_core::fill_pattern)
Everything that uses the custom pattern id.
pub fn pattern_usage(&self, p: Pattern) -> PatternUsage (in cc_core::fill_pattern)
Everything that uses p (a built-in or custom pattern).
pub fn visit_patterns(&mut self, v: &mut dyn FnMut(PatternSlot)) (in cc_core::fill_pattern)
Visits every pattern the project holds (materials, types, views, templates and phase graphics).
pub(crate) fn repair_fill_patterns(&mut self) -> usize (in cc_core::fill_pattern)
See crate::fill_pattern: ids that match their keys, patterns
within their limits, a bounded count, and references to patterns
that are gone dropped. Returns how many things it changed.
pub fn host_members_of(&self, host: ElementId) -> Vec<ElementId> (in cc_core::member_host)
The members a host manages (none for other elements).
pub fn member_host_of(&self, member: ElementId) -> Option<ElementId> (in cc_core::member_host)
The host that manages member, if any.
pub(crate) fn repair_member_hosts(&mut self) -> usize (in cc_core::member_host)
Member hosts from a file: numbers and types repaired by the host (it goes when a type has no fallback), members that are gone, do not fit their role, repeat a role or are another host’s dropped, and repeated detached roles dropped. Returns the repairs.
pub fn component_types(&self) -> impl Iterator<Item = &crate::ElementType> (in cc_core::openings)
Types of parametric components, of any category (doors and windows too).
pub fn convert_opening_types(&mut self, n: &dyn Fn(&str) -> String) -> usize (in cc_core::openings)
Turn door and window types of the old kind (fixed width, height and material) into types of the built-in door and window components, with the same sizes; elements keep their types. Returns how many changed.
pub fn pads_of(&self, host: ElementId) -> impl Iterator<Item = (&crate::Element, &Pad)> (in cc_core::pad)
The pads of terrain host, in id (creation) order.
pub(crate) fn pad_levels(&self) -> Vec<(ElementId, crate::LevelId)> (in cc_core::pad)
Pads whose level differs from their terrain’s and valves whose level differs from their pipe’s, with the level they take.
pub fn phase_index(&self, id: PhaseId) -> Option<usize> (in cc_core::phase)
Position of a phase in time order.
pub fn phase(&self, id: PhaseId) -> Option<&Phase> (in cc_core::phase)pub fn phase_name(&self, id: PhaseId) -> String (in cc_core::phase)pub fn last_phase(&self) -> Option<PhaseId> (in cc_core::phase)
The latest phase (where new elements and views go by default).
pub fn phase_filter(&self, id: PhaseFilterId) -> Option<&PhaseFilter> (in cc_core::phase)pub fn default_phase_filter(&self) -> Option<PhaseFilterId> (in cc_core::phase)
The filter new views get: the first that shows everything.
pub fn created_index(&self, e: &Element) -> usize (in cc_core::phase)
The phase an element is created in, as an index (see Self::resolved_index).
pub fn demolished_index(&self, e: &Element) -> Option<usize> (in cc_core::phase)
The phase an element is demolished in, as an index (None: standing).
pub fn view_phase(&self, view: &crate::View) -> Option<PhaseId> (in cc_core::phase)
The phase a view shows (its own, or the last one).
pub fn phase_state_at(&self, e: &Element, phase: usize) -> PhaseState (in cc_core::phase)
Status of e in phase number phase (an index into Project::phases).
pub fn phase_state(&self, e: &Element, phase: PhaseId) -> PhaseState (in cc_core::phase)
Status of e in phase phase (unknown phases mean the last one).
pub fn stands_after(&self, e: &Element, phase: usize) -> bool (in cc_core::phase)
Whether e stands at the end of phase number phase: created then
or before and not demolished by then (annotations always).
pub fn present_at(&self, e: &Element, phase: usize) -> bool (in cc_core::phase)
Whether e is part of phase number phase at all (standing at its
start or built in it).
pub fn phase_differs(&self, phase: usize) -> bool (in cc_core::phase)
Whether any element is absent from phase number phase (its views
then need geometry of their own).
pub fn phase_fixes(&self) -> Vec<(ElementId, PhaseId, Option<PhaseId>)> (in cc_core::phase)
The phases that would make elements consistent: a known created
phase (unassigned stays: it means the last), a demolition not before
creation (else none), hosted elements not created before their host
nor demolished after it, annotations without phases. Returns
(element, created, demolished) for each element that needs a
change; empty when the project has no phases.
pub fn ensure_phases(&mut self, name: &dyn Fn(&str) -> String) (in cc_core::phase)
Give a project without phases the template’s (named by name(key)),
its phase filters, and put every element and view in the last phase
with the “show all” filter. Used for files made before phases.
pub fn pile_cap(&self, e: &Element) -> Option<CapPlacement<'_>> (in cc_core::pile)
e as a pile cap: a foundation placed as a pad whose type is a pile cap type.
pub fn is_pile_cap(&self, id: ElementId) -> bool (in cc_core::pile)
Whether element id is a pile cap.
pub fn piles_of(&self, cap: ElementId) -> impl Iterator<Item = (&Element, &Pile)> (in cc_core::pile)
The piles of cap cap, in id order.
pub fn cap_pile_type(&self, cap: &PileCap) -> Option<ElementTypeId> (in cc_core::pile)
The type a cap’s piles take: its own when it names a pile type, else the project’s first pile type.
pub fn cap_piles(&self, e: &Element) -> Vec<(u32, ElementTypeId, Pile)> (in cc_core::pile)
The piles cap e should have: index, type and the pile itself.
pub(crate) fn pile_sync(&self) -> PileSync (in cc_core::pile)
What keeps the piles in step with their caps (see PileSync).
pub fn profile(&self, id: ProfileId) -> Option<&ProfileDef> (in cc_core::profiles_project)
A profile by id.
pub fn profile_named(&self, name: &str) -> Option<&ProfileDef> (in cc_core::profiles_project)
A profile by name, ignoring case and surrounding spaces.
pub fn type_profile_def(&self, data: &TypeData) -> Option<&ProfileDef> (in cc_core::profiles_project)
The profile a column or beam type points to, when it exists.
pub fn type_sector(&self, data: &TypeData) -> Option<SectorPlacement> (in cc_core::profiles_project)
The ring of a column or beam type whose section is an annular sector, as the type places it (turned and mirrored).
pub fn section_is_round(&self, data: &TypeData) -> bool (in cc_core::profiles_project)
Whether a column or beam type’s section is round (a solid or hollow circle): its profile’s shape, else its legacy section. The legacy fields of a profile-made type are only its box, so readers ask this.
pub fn exact_section_area(&self, data: &TypeData) -> Option<f64> (in cc_core::profiles_project)
The exact area of a column or beam type’s section (its profile’s,
else its legacy section’s): arcs count whole, where the outline only
follows them with chords. None when the shape makes no outline.
pub fn type_section_properties(&self, data: &TypeData, density: f64) -> Option<crate::SectionProperties> (in cc_core::profiles_project)
The properties of a column or beam type’s section for a material of
density kg/m³. The area and the mass per meter are exact for arcs
(Self::exact_section_area); the inertias are those of the outline,
which follows arcs with chords.
pub fn profile_users(&self, id: ProfileId) -> Vec<ElementTypeId> (in cc_core::profiles_project)
The column and beam types that use a profile.
pub fn profile_material_for(&self, material: &str) -> ProfileMaterial (in cc_core::profiles_project)
The profile material of a type’s material: steel for metals, timber for wood, concrete otherwise.
pub fn type_section(&self, data: &TypeData) -> Option<TypeSection> (in cc_core::profiles_project)
The section a column or beam type draws: its profile’s outline turned
and mirrored, or the legacy section’s (a legacy section whose shape
does not fit its box reads as the box). None for other types or a
profile whose outline fails.
pub fn type_section_without_radii(&self, data: &TypeData) -> Option<TypeSection> (in cc_core::profiles_project)
Self::type_section with every radius of the shape (r, ri,
ro, chamfer) at zero: arcs replaced by their corners, as medium
detail draws it. Falls back to the rounded outline when the shape
fails without its radii; sketch profiles are unchanged.
pub(crate) fn profile_box(&self, data: &TypeData) -> Option<TypeData> (in cc_core::profiles_project)
data with its legacy section fields rewritten as the bounding box of
its profile’s placed outline (Rectangular, or Solid width x
height), when the type points to a valid profile and its fields
differ from that box; None when nothing needs to change (no
profile, the legacy section is exactly the profile, or the outline
fails).
pub(crate) fn resync_profile_boxes(&mut self) -> usize (in cc_core::profiles_project)
Rewrite the legacy section fields of every type that points to a
valid profile as its box (see Self::profile_box), so what reads
them (beam depth, axes) cannot disagree with the profile in a loaded
file. Returns the number of types changed.
pub(crate) fn legacy_is_profile(&self, data: &TypeData) -> bool (in cc_core::profiles_project)
Whether a type’s legacy section is exactly its profile (unturned, unmirrored), so the legacy fields need no rewrite.
pub fn convert_sections_to_profiles(&mut self, _translate: &dyn Fn(&str) -> String) -> usize (in cc_core::profiles_project)
Point every column and beam type without a profile to one made from
its legacy section; identical (material, shape) pairs share one
profile, named by section_name. Types whose section makes no valid
outline are left as they are. Returns the number of types changed.
translate is the template’s key lookup (the names are made of
language-neutral symbols, so it is not needed yet).
pub(crate) fn legacy_profile(&self, data: &TypeData) -> Option<(ProfileMaterial, ProfileShape)> (in cc_core::profiles_project)
The (material, shape) of a column or beam type’s legacy section, when it makes a valid outline.
pub(crate) fn section_profile(&mut self, material: ProfileMaterial, shape: ProfileShape) -> Option<ProfileId> (in cc_core::profiles_project)
The profile of material and shape: an existing one equal to it, or
a new one named by section_name (a fresh id and uid). None when
the project has no room for another.
pub(crate) fn repair_type_profiles(&mut self) -> usize (in cc_core::profiles_project)
Clear references to profiles that are gone and turns that are not numbers; returns the number of fixes.
pub fn free_profile_name(&self, base: &str) -> String (in cc_core::profiles_project)
base, or base 2, base 3… the first name no profile has.
pub(crate) fn repair_profiles(&mut self) -> usize (in cc_core::profiles_project)
Fix the project’s profiles after loading; returns the number of fixes.
pub fn empty() -> Self
An empty project with no levels, types or views.
pub fn sheets_in_order(&self) -> Vec<ViewId>
The sheets by number (natural order), then id.
pub fn title_blocks(&self) -> Vec<ElementTypeId>
The title block types, by id.
pub fn from_template() -> Self
A new project from the default architectural template (Brazilian Portuguese names).
pub fn from_template_localized(translate: &dyn Fn(&str) -> Option<String>) -> Self
A new project from the metric template, naming levels, materials,
types and views with translate(key) (keys tpl-*), falling back to Portuguese.
pub fn from_template_system(system: crate::MeasurementSystem, translate: &dyn Fn(&str) -> Option<String>) -> Self
A new project from the template of system, named like
Self::from_template_localized. Both templates have the same
levels, types and views in the same order; the imperial one shows feet
and inches and sizes its types in round inches.
pub fn add_standard_title_block(&mut self, n: &dyn Fn(&str) -> String) -> ElementTypeId
Add the standard title block type (named by n) and return its id.
pub fn give_sheets_title_block(&mut self, id: ElementTypeId) -> usize
Point every sheet without a title block at id; returns how many.
pub fn ensure_uids(&mut self)
Assign persistent unique ids to the project, types and elements that lack one, and replace duplicates (e.g. from copied elements).
pub fn ensure_annotation_types(&mut self)
Add default room, grid and dimension types to projects created before those categories existed, sized and named (in Portuguese) like the template of the project’s measurement system.
pub fn measurement_system(&self) -> crate::MeasurementSystem
The measurement system of the project: imperial when its lengths
show in an imperial unit (see crate::Units::system).
pub fn defaults(&self) -> &'static crate::Defaults
The sizes and rules things made outside the template get in this project’s measurement system.
pub fn system(&self, id: crate::SystemId) -> Option<&crate::MepSystem>pub fn system_color(&self, element: &Element) -> [u8; 3]
Display color of a pipe, conduit, cable tray or device: its (first) system’s, or gray; a valve takes its pipe’s.
pub fn mep_data(&self, element: &Element) -> Option<crate::MepData>
The MEP data of a component element’s type.
pub fn feeder(&self, system: crate::SystemId) -> Option<&Element>
The board or rack feeding a system (its panel, when that is still a
component element).
pub fn component_point(&self, element: &Element) -> Option<glam::DVec3>
Where a component element stands in the world: its insertion point at
its base (None for other elements).
pub fn outlet_cable(&self, element: &Element) -> Option<(u32, f64)>
The estimated length of the horizontal cables of a data outlet: one
per jack, each routed to the rack of its data system as
crate::mep::cable_length says (up to the ceiling of the outlet’s
level, across and down to the rack). None for elements that are not
data outlets cabled to a rack.
pub fn segment_at(&self, element: &Element, level: LevelId) -> Option<crate::MepSegment>
A pipe, conduit or cable tray run as seen from level, with its elevations above
that level: the level’s own runs, and the vertical runs of other levels
that pass through it (risers between floors, reaching at least its floor
and starting below its top). None for other elements and runs.
pub fn segments_at(&self, level: LevelId) -> impl Iterator<Item = (&Element, crate::MepSegment)>
The pipe, conduit and cable tray runs seen from level (see Project::segment_at).
pub fn system_members(&self, id: crate::SystemId) -> impl Iterator<Item = &Element>
Elements in system id: its pipes, the conduits carrying the circuit
and the components connected to it.
pub fn level_height(&self, id: LevelId, fallback: f64) -> f64
The level above id, or id itself plus fallback meters: the default upper limit of rooms.
pub fn column_span(&self, element: &Element, column: &crate::Column) -> (f64, f64)
Base elevation and top elevation of a column (top at least 1 cm above).
pub fn stair_span(&self, element: &Element, stair: &crate::Stair) -> (f64, f64)
Base and top elevation of a stair (the top at least one riser above).
pub fn ramp_span(&self, element: &Element, ramp: &crate::Ramp) -> (f64, f64)
Base and top elevation of a ramp (the top at least 1 cm above).
pub fn wall_base_z(&self, element: &Element, wall: &crate::Wall) -> f64
Elevation of a wall’s base.
pub fn wall_top_z(&self, element: &Element, wall: &crate::Wall) -> f64
Elevation of a wall’s top, from its top constraint (at least 1 cm above the base).
pub fn wall_height(&self, element: &Element, wall: &crate::Wall) -> f64
Effective height of a wall.
pub fn wall_axis(&self, element: &Element, wall: &crate::Wall) -> (DVec2, DVec2)
Start and end of a wall’s body centerline: the location line shifted
across the wall according to location_line and the type’s layers
(listed from the exterior face, on the left of the line). An arc
wall’s centerline is concentric with its location line and has the
same bulge.
pub fn wall_length(&self, element: &Element, wall: &crate::Wall) -> f64
Length of a wall’s body centerline (the location line’s length for straight walls; arc walls measure along the centerline arc).
pub fn beam_axis(&self, element: &Element, beam: &crate::Beam) -> (DVec2, DVec2)
The beam’s body centerline: its location line moved across by the lateral justification.
pub fn beam_z(&self, element: &Element, beam: &crate::Beam) -> (f64, f64)
Bottom and top elevations of a beam at its start, from its location elevation and vertical justification. A sloped beam’s section stays square to its axis, so its vertical depth is a little more than its height.
pub fn next_id(&self) -> u64
Allocate a new unique id (shared by all id kinds). The id the next new element, view or type gets (every id after it is newer).
pub(crate) fn copy_with_types(&self, types: BTreeMap<ElementTypeId, ElementType>) -> Project
A copy of the project with types in place of its own (which are not copied).
pub fn alloc_id(&mut self) -> u64pub fn max_id(&self) -> u64
The largest id any object of the project uses (0 if none).
pub fn ensure_next_id(&mut self) -> bool
Move the id counter past every id in use, so new objects never take the id of an existing one (a file may carry a wrong counter), and back from the end of the range, where it could not move on. Returns whether it moved.
pub fn level(&self, id: LevelId) -> Option<&Level>pub fn level_elevation(&self, id: LevelId) -> f64pub fn level_name(&self, id: LevelId) -> &strpub fn is_pinned(&self, id: ElementId) -> boolpub fn join_of(&self, a: ElementId, b: ElementId) -> Option<(ElementId, ElementId)>
The join between two elements as (cutting, cut), if they are joined.
pub fn group_of(&self, id: ElementId) -> Option<crate::GroupId>
The group an element belongs to.
pub fn with_groups(&self, ids: impl IntoIterator<Item = ElementId>) -> std::collections::BTreeSet<ElementId>
ids plus every member of the groups they belong to.
pub fn joined_with(&self, id: ElementId) -> impl Iterator<Item = ElementId> + '_
Elements whose geometry is joined with id.
pub fn element(&self, id: ElementId) -> Option<&Element>pub fn element_type(&self, id: ElementTypeId) -> Option<&ElementType>pub fn type_name(&self, id: ElementTypeId) -> &strpub fn thickness_of(&self, element: &Element) -> f64
Wall thickness for an element’s type (0 if not a layered type).
pub fn types_of(&self, category: Category) -> impl Iterator<Item = &ElementType>pub fn default_type(&self, category: Category) -> Option<ElementTypeId>pub fn material_color(&self, name: &str) -> [u8; 3]pub fn material_transparency(&self, name: &str) -> f64
Transparency of material name (0 opaque, 1 invisible).
pub fn material(&self, name: &str) -> Option<&Material>pub fn material_users(&self, name: &str) -> Vec<ElementTypeId>
Types that use the material name.
pub fn material_instance_users(&self, name: &str) -> Vec<ElementId>
Components whose own value of a material parameter is name.
pub fn material_paint_users(&self, name: &str) -> Vec<ElementId>
Elements with a face painted in material name.
pub fn hosted_by(&self, wall: ElementId) -> impl Iterator<Item = &Element>
Doors and windows hosted by wall.
pub fn railings_of(&self, host: ElementId) -> impl Iterator<Item = &Element>
The railings that follow stair host.
pub fn rebar_of(&self, host: ElementId) -> impl Iterator<Item = (&Element, &crate::Rebar)>
The reinforcement sets of beam or column host.
pub fn bar_tags_of(&self, set: ElementId) -> impl Iterator<Item = (&Element, &crate::bar_tag::BarTag)>
The bar tags of reinforcement set set.
pub fn valves_of(&self, host: ElementId) -> impl Iterator<Item = (&Element, &crate::Valve)>
The valves on pipe host.
pub fn valve_host(&self, valve: &crate::Valve) -> Option<(&Element, &crate::MepSegment)>
A valve’s pipe element and its run.
pub fn elements_of(&self, category: Category) -> impl Iterator<Item = &Element>pub fn walls(&self) -> impl Iterator<Item = (&Element, &crate::Wall)>pub fn views_of(&self, category: ViewCategory) -> impl Iterator<Item = &View>pub fn view(&self, id: ViewId) -> Option<&View>pub fn filter(&self, id: crate::FilterId) -> Option<&crate::ViewFilter>pub fn line_style(&self, id: crate::LineStyleId) -> Option<&crate::LineStyleDef>pub fn line_style_users(&self, id: crate::LineStyleId) -> Vec<ElementId>
The detail lines and regions drawn with a project line style.
pub fn template(&self, id: crate::TemplateId) -> Option<&crate::ViewTemplate>pub fn next_mark(&self, category: Category) -> String
A fresh mark for a new element: the next number among its category.
pub fn level_above(&self, id: LevelId) -> Option<&Level>
The level directly above id, if any.
pub fn move_top_with_base(&self, e: &mut crate::Element, to: LevelId)
Before e moves from its level to to: a top attached to a level
moves up or down as many levels as the base (a column from the ground
floor to the first floor pasted on the first floor reaches the second).
When there is no such level, or it is not above the new base, the top
is unconnected at the element’s height.
pub fn sort_levels(&mut self)pub fn repair(&mut self) -> usize (in cc_core::repair)
Remove or reset invalid data; returns the number of repairs made.
pub fn repairs_needed(&self) -> usize (in cc_core::repair)
How many repairs Project::repair would make, without changing the
project: it repairs a copy. The copy leaves out the vertices and faces
of fixed mesh pieces, which repair never reads, so that checking every
edit of a model with imported meshes does not copy them.
pub fn shaft_span(&self, element: &Element, shaft: &Shaft) -> (f64, f64) (in cc_core::shaft)
Bottom and top elevation of a shaft (the top at least 1 cm above).
pub fn shaft_cuts(&self, element: &Element) -> Vec<Vec<DVec2>> (in cc_core::shaft)
The outlines of the shafts that cut element (a floor, ceiling or
roof): those that pass through its thickness and lie inside its
outline, clear of its own openings and of one another.
pub fn structural_material(&self, data: &TypeData) -> Option<StructuralMaterial> (in cc_core::structural_material)
The structural material of a column or beam type: its profile’s,
else its material’s class (metal is steel, wood timber, the rest
concrete). None for other types.
pub fn types_of_material(&self, category: Category, material: StructuralMaterial) -> impl Iterator<Item = &ElementType> + '_ (in cc_core::structural_material)
The types of category made of material, in id order.
pub fn sun_site(&self) -> SunSite (in cc_core::sun)
The site as the sun needs it: the project’s location, else the
equator at Greenwich in UTC with north up (known: false).
pub fn sun_state(&self, view: &View) -> Option<SunState> (in cc_core::sun)
Where view’s sun stands (None when the view has none).
pub fn sun_ground_height(&self, view: &View, bottom: Option<f64>) -> f64 (in cc_core::sun)
The height of the ground plane that catches view’s sun’s shadows
(and that the rendered image stands the model on): the sun’s ground
level, else the lowest level, else the bottom of the model
(bottom), else 0.
pub fn sun_preset(&self, name: &str) -> Option<&SunPreset> (in cc_core::sun)
The preset called name.
pub fn copy_set(&self, ids: &[ElementId]) -> Vec<Element> (in cc_core::transform)
The elements a copy of ids takes: the non-hosted ones, plus the
doors and windows of copied walls, the railings of copied stairs, the
pads of copied terrains, the valves of copied pipes and any selected
hosted element. Connections are never copied: they belong to their
member’s end.
The snapshot stays valid after the originals are deleted (cut).
pub fn wall_at(&self, level: crate::LevelId, p: DVec2, prefer: ElementId) -> Option<(ElementId, f64)> (in cc_core::transform)
The wall on level whose body contains plan point p, with the
distance of p along it; prefer wins when it contains p.
pub fn framings_of(&self, wall: ElementId) -> impl Iterator<Item = ElementId> + '_ (in cc_core::wall_framing)
The framings of wall (one in a consistent model).
pub fn wall_framing_of(&self, wall: ElementId) -> Option<ElementId> (in cc_core::wall_framing)
The framing of wall, if it has one.
pub(crate) fn repair_wall_framings(&mut self) -> usize (in cc_core::wall_framing)
One framing per wall: the later ones (higher ids) go, their members staying as plain elements. Returns how many went.
Grouppub struct Group
Elements kept together: selecting one selects them all. An element belongs to one group at most.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
name: Stringmembers: std::collections::BTreeSet<ElementId>template_defaultpub fn template_default(key: &str) -> &'static str
Portuguese names of the default template, keyed like the translation files.
can_join_geometrypub fn can_join_geometry(category: crate::Category) -> bool
Whether elements of category have a body whose geometry can be joined.
join_prioritypub fn join_priority(element: &crate::Element) -> u8
How strongly an element cuts the elements it is joined with: of two joined elements, the higher cuts the lower. Structural columns and beams cut hosts (walls, roofs, ceilings, floors); floors, ceilings and roofs cut walls; walls cut architectural columns.
natural_cmppub fn natural_cmp(a: &str, b: &str) -> std::cmp::Ordering
Compare texts with their digit runs as numbers (A2 before A10).
cc_core::propertiescrates/cc_core/src/properties.rs
Property and quantity sets carried over from IFC files: named sets of named values, each value keeping its IFC measure type. Lengths, areas, volumes and angles are stored in meters, square and cubic meters and radians, whatever the units of the file they came from.
Items: PropertySet · Property · PropertyValue · IfcValue · Atom · repair_sets
PropertySetpub struct PropertySet
A property set (IfcPropertySet) or quantity set (IfcElementQuantity).
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
name: Stringquantities: bool
A quantity set rather than a property set.
properties: Vec<Property>Propertypub struct Property
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
name: Stringvalue: PropertyValuePropertyValuepub enum PropertyValue
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Variants
Single(Option<IfcValue>)
One value (or none).
Enumerated(Vec<IfcValue>)
Values chosen from an enumeration.
List(Vec<IfcValue>)Bounded { lower: Option<IfcValue>, upper: Option<IfcValue>, set_point: Option<IfcValue>, }Table { defining: Vec<IfcValue>, defined: Vec<IfcValue>, }Complex { usage: String, properties: Vec<Property>, }
Nested properties with a usage name.
Quantity { kind: String, value: f64, }
A quantity: its entity (IFCQUANTITYLENGTH…) and value.
Methods
pub fn is_finite(&self) -> bool
Every number is finite (nested properties included).
IfcValuepub struct IfcValue
A value with its IFC defined type (IFCLABEL, IFCLENGTHMEASURE…).
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
measure: Stringvalue: AtomMethods
pub fn is_finite(&self) -> boolAtompub enum Atom
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Variants
Text(String)Real(f64)Integer(i64)Bool(bool)Enum(String)
Other enumeration literals (such as an unknown logical, U).
Methods
pub fn is_finite(&self) -> boolrepair_setspub fn repair_sets(sets: &mut [PropertySet]) -> usize
Drop properties with non-finite numbers; returns how many went.
cc_core::rampcrates/cc_core/src/ramp.rs
Ramps: the plan shapes of a ramp element and the accessibility rules of its type (steepest slope, highest rise of one flight, shortest landing).
Items: RampShape · RampLayout · RampRules · RampIssue · RampCheck · MAX_FLIGHTS · ramp_flights
RampShapepub enum RampShape
Plan shape of a ramp.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
Straight
Flights in line, with landings between them as the rules need.
LShaped
Two flights at a right angle around a corner landing.
UShaped
Flights going back and forth (switchback), joined by landings.
Spiral
One helical flight around a center.
Methods
pub const ALL: [RampShape; 4]pub fn key(self) -> &'static strpub fn turns(self) -> boolRampLayoutpub struct RampLayout
Plan layout of a ramp element.
Traits: Debug, Clone, Copy, PartialEq, Serialize, Deserialize, Default
Fields
shape: RampShapeturn: Turnslope: f64
Slope of the flights, rise over run (0: the steepest the type allows).
landing: f64
Landing length along the way (0: the type’s shortest landing).
gap: f64
Clear gap between the flights of a U-shaped ramp.
inner_radius: f64
Radius of the inner edge of a spiral ramp.
Methods
pub fn repair(&mut self) -> usize
Replace invalid values by defaults; returns how many changed.
RampRulespub struct RampRules
Accessibility rules of a ramp type (defaults after common accessibility codes: 8.33 % slope, 0.80 m rise per flight, 1.20 m landings).
Traits: Debug, Clone, Copy, PartialEq, Serialize, Deserialize, Default
Fields
max_slope: f64
Steepest slope, rise over run.
max_flight_rise: f64
Highest rise of one flight between landings.
min_landing: f64
Shortest landing along the way.
Methods
pub fn repair(&mut self) -> usize
Replace invalid limits by defaults; returns how many changed.
RampIssuepub enum RampIssue
A broken rule of a ramp.
Traits: Debug, Clone, Copy, PartialEq, Serialize
Variants
TooSteep { slope: f64, max: f64 }FlightTooHigh { rise: f64, max: f64 }LandingTooShort { landing: f64, min: f64 }Methods
pub fn key(&self) -> &'static strRampCheckpub struct RampCheck
Slope, flights and the rules a ramp breaks.
Traits: Debug, Clone, PartialEq, Serialize
Fields
slope: f64flights: usizeflight_rise: f64
Rise of each flight.
flight_run: f64
Plan length of each flight.
issues: Vec<RampIssue>Methods
pub fn ok(&self) -> boolMAX_FLIGHTSpub const MAX_FLIGHTS: usize
Most flights of one ramp.
ramp_flightspub fn ramp_flights(height: f64, rules: &RampRules, layout: &RampLayout) -> RampCheck
Slope, flight count, rise and run of each flight of a ramp rising
height laid out as layout, and what it breaks of rules. Straight
and U-shaped ramps get as many flights as the highest flight rise
needs; L-shaped ones two; spiral ones one.
cc_core::rastercrates/cc_core/src/raster.rs
Raster images kept in a project (imported pictures, scanned drawings): the file’s own bytes, unchanged, with the format and pixel size. Project files hold the bytes as base64 text.
Items: MAX_IMAGE_BYTES · MAX_IMAGE_PIXELS · RasterFormat · RasterImage · base64_encode · base64_decode
MAX_IMAGE_BYTESpub const MAX_IMAGE_BYTES: usize
Largest image file kept, bytes.
MAX_IMAGE_PIXELSpub const MAX_IMAGE_PIXELS: u64
Most pixels an image may have (width × height): decoding one takes up to 8 bytes per pixel, plus 4 for its RGBA copy.
RasterFormatpub enum RasterFormat
Encoding of an image’s bytes.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize
Variants
PngJpegGifBmpWebpMethods
pub fn sniff(bytes: &[u8]) -> Option<RasterFormat>
The format of bytes, from their signature.
pub fn mime(self) -> &'static str
Media type (for data URLs).
RasterImagepub struct RasterImage
An image file’s bytes with its format and size in pixels.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
format: RasterFormatwidth: u32height: u32data: Vec<u8>Methods
pub fn is_valid(&self) -> bool
Whether the size is usable and the bytes start like the format says.
pub fn dpi(&self) -> Option<(f64, f64)>
Resolution the file declares (dots per inch, x and y), if any: a PNG’s
pHYs chunk in dots per meter, or a JPEG’s JFIF density.
base64_encodepub fn base64_encode(bytes: &[u8]) -> String
Standard base64 with padding.
base64_decodepub fn base64_decode(text: &str) -> Option<Vec<u8>>
Decode standard base64 (whitespace ignored); None on any other character.
cc_core::recoverycrates/cc_core/src/recovery.rs
Crash recovery: while a project has unsaved changes, a copy of it is
written now and then to a recovery folder, so a crash (or a power cut)
loses at most the last few minutes of work. Each running session writes
its own entry: a plain .ccad file (it opens like any project) and a
small .meta file naming the project and where it was saved. Both are
written to a temporary file first and renamed, so an entry is never half
written. A clean save or close removes the entry; at start-up, the
entries left by earlier sessions are offered for restoring.
Items: RecoveryMeta · RecoveryEntry · now_seconds · write · remove · list · load · AutosaveAction · Autosave
RecoveryMetapub struct RecoveryMeta
What a recovery entry says about the project it holds.
Traits: Debug, Clone, PartialEq, Eq, Serialize, Deserialize, Default
Fields
name: String
The project’s name.
original: Option<PathBuf>
Where the project was saved, if it ever was.
saved_at: u64
When the copy was written, in seconds since the Unix epoch.
RecoveryEntrypub struct RecoveryEntry
A recovery entry found on disk.
Traits: Debug, Clone, PartialEq, Eq
Fields
id: String
The entry’s id (the session that wrote it).
project: PathBuf
The copy of the project.
meta: RecoveryMeta
now_secondspub fn now_seconds() -> u64
Seconds since the Unix epoch (0 if the clock is before it).
writepub fn write(dir: &Path, id: &str, project: &Project, meta: &RecoveryMeta) -> Result<PathBuf, PersistError>
Write the recovery entry id in dir (created if needed): the project
first, then its meta file, each atomically. Returns the project’s path.
removepub fn remove(dir: &Path, id: &str)
Remove the recovery entry id from dir (nothing if there is none).
listpub fn list(dir: &Path) -> Vec<RecoveryEntry>
The recovery entries in dir, the newest first: those whose project
file exists (a meta file that cannot be read still offers its project).
loadpub fn load(entry: &RecoveryEntry) -> Result<(Project, usize), PersistError>
Load the project of a recovery entry (repaired like any opened file).
AutosaveActionpub enum AutosaveAction
What Autosave::poll asks the caller to do.
Traits: Debug, Clone, Copy, PartialEq, Eq
Variants
NothingWrite
Write the document (its revision is the argument of Autosave::written).
Remove
The document has no unsaved changes: remove the entry.
Autosavepub struct Autosave
When to write a recovery copy: once the document has had unsaved changes
for interval, and only if its revision changed since the last copy.
Traits: Debug, Clone
Fields
interval: DurationSome fields are private.
Methods
pub fn new(interval: Duration) -> Selfpub fn poll(&mut self, revision: u64, dirty: bool, now: Instant) -> AutosaveAction
Called often (once a frame) with the document’s revision and
whether it has unsaved changes.
pub fn written(&mut self, revision: u64)
A copy of revision was written.
pub fn retry_later(&mut self, now: Instant)
Writing failed: try again an interval after now.
pub fn has_copy(&self) -> bool
Whether a copy is on disk.
pub fn removed(&mut self)
The entry was removed (the document was saved, closed or discarded).
cc_core::regioncrates/cc_core/src/region.rs
Regions: 2D areas drawn in one view, owned by it like detail lines and
text notes (Element::owner_view), in the view’s drawing coordinates
(meters). An outline with openings, usually drawn as a sketch
(crate::sketch::Sketch::profile), and an optional boundary line
style (none: no boundary is drawn).
ElementKind::FilledRegion) is filled as its type
says (TypeData::FilledRegion { fill }: a foreground and a background
pattern, each with its color, as for material cut patterns; a solid
pattern fills with its color).ElementKind::MaskingRegion, TypeData::MaskingRegion {})
is opaque white: it hides the model’s linework of the view under it,
while the view’s annotations (detail lines, dimensions, texts, tags)
stay on top.
Regions of a view are drawn in id order over the model and under its
annotations; they take no part in 3D views or IFC.Items: MAX_POINTS · MAX_OPENINGS · Region
MAX_POINTSpub const MAX_POINTS: usize
Most points of an outline or an opening, and most openings (a crafted file).
MAX_OPENINGSpub const MAX_OPENINGS: usize
Regionpub struct Region
A filled or masking region of one view.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
view: ViewId
The view that owns (and alone shows) the region.
outline: Vec<DVec2>
The outline, in the view’s drawing coordinates (meters).
openings: Vec<Vec<DVec2>>
Holes inside the outline.
sketch: Option<Sketch>
The curves the outline was drawn with (see crate::sketch).
boundary: Option<LineStyleRef>
The style of the boundary lines; None draws no boundary.
Methods
pub fn is_valid(&self) -> bool
An outline of three or more finite points within bounds, with some area, and openings of the same kind.
pub fn area(&self) -> f64
Area of the outline less its openings, square meters.
pub fn perimeter(&self) -> f64
Length of the outline and of the openings’ edges, meters.
pub fn points_mut(&mut self) -> impl Iterator<Item = &mut DVec2>
Every point of the outline and openings, to move them.
cc_core::render_settingscrates/cc_core/src/render_settings.rs
Per-view settings of photorealistic rendering (path tracing).
A view that takes them (crate::ViewKind::takes_render: 3D views)
keeps a RenderSettings in crate::View::render: the samples per
pixel, the light bounces, the output size, the field of view, the
exposure and tone mapping, the firefly clamp, the clay mode and the
environment (sky, sun and ground). Every field has a serde default, so
settings written by older or newer builds load; values out of range are
brought back by RenderSettings::repair.
Items: MIN_SAMPLES · MAX_SAMPLES · DEFAULT_SAMPLES · MIN_DEPTH · MAX_DEPTH · DEFAULT_DEPTH · MIN_SIZE · MAX_SIZE · MAX_PIXELS · DEFAULT_WIDTH · DEFAULT_HEIGHT · MIN_FOV_DEG · MAX_FOV_DEG · DEFAULT_FOV_DEG · MIN_EXPOSURE · MAX_EXPOSURE · DEFAULT_EXPOSURE · MIN_CLAMP · MAX_CLAMP · DEFAULT_CLAMP · MIN_STRENGTH · MAX_STRENGTH · DEFAULT_SKY_STRENGTH · DEFAULT_SUN_STRENGTH · DEFAULT_GROUND_COLOR · ToneMap · RenderEnvironment · RenderSettings
MIN_SAMPLESpub const MIN_SAMPLES: u32
Fewest samples per pixel.
MAX_SAMPLESpub const MAX_SAMPLES: u32
Most samples per pixel.
DEFAULT_SAMPLESpub const DEFAULT_SAMPLES: u32
Samples per pixel of new settings.
MIN_DEPTHpub const MIN_DEPTH: u32
Fewest light bounces.
MAX_DEPTHpub const MAX_DEPTH: u32
Most light bounces.
DEFAULT_DEPTHpub const DEFAULT_DEPTH: u32
Light bounces of new settings.
MIN_SIZEpub const MIN_SIZE: u32
Smallest output width or height, pixels.
MAX_SIZEpub const MAX_SIZE: u32
Largest output width or height, pixels.
MAX_PIXELSpub const MAX_PIXELS: u64
Most output pixels (7680 x 4320).
DEFAULT_WIDTHpub const DEFAULT_WIDTH: u32
Output width of new settings, pixels.
DEFAULT_HEIGHTpub const DEFAULT_HEIGHT: u32
Output height of new settings, pixels.
MIN_FOV_DEGpub const MIN_FOV_DEG: f64
Narrowest vertical field of view, degrees.
MAX_FOV_DEGpub const MAX_FOV_DEG: f64
Widest vertical field of view, degrees.
DEFAULT_FOV_DEGpub const DEFAULT_FOV_DEG: f64
Vertical field of view of new settings, degrees (the 3D viewport’s).
MIN_EXPOSUREpub const MIN_EXPOSURE: f64
Lowest exposure, stops.
MAX_EXPOSUREpub const MAX_EXPOSURE: f64
Highest exposure, stops.
DEFAULT_EXPOSUREpub const DEFAULT_EXPOSURE: f64
Exposure of new settings, stops.
MIN_CLAMPpub const MIN_CLAMP: f64
Lowest sample clamp (0 turns it off).
MAX_CLAMPpub const MAX_CLAMP: f64
Highest sample clamp.
DEFAULT_CLAMPpub const DEFAULT_CLAMP: f64
Sample clamp of new settings.
MIN_STRENGTHpub const MIN_STRENGTH: f64
Lowest sky or sun strength.
MAX_STRENGTHpub const MAX_STRENGTH: f64
Highest sky or sun strength.
DEFAULT_SKY_STRENGTHpub const DEFAULT_SKY_STRENGTH: f64
Sky strength of new settings.
DEFAULT_SUN_STRENGTHpub const DEFAULT_SUN_STRENGTH: f64
Sun strength of new settings.
DEFAULT_GROUND_COLORpub const DEFAULT_GROUND_COLOR: [u8; 3]
Ground color of new settings: a neutral warm gray.
ToneMappub enum ToneMap
How the rendered radiance is mapped to display colors.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
Filmic
A filmic curve: soft highlights, no hard clipping.
Standard
Plain clipping to the display range.
Methods
pub const ALL: [ToneMap; 2]pub fn name(self) -> &'static str
The name commands use: filmic or standard.
RenderEnvironmentpub struct RenderEnvironment
The light around the model: sky, sun and ground.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize, Default
Fields
sky_strength: f64
Multiplier of the sky’s light.
sun_strength: f64
Multiplier of the sun’s light (the view’s sun, see crate::sun).
ground_color: [u8; 3]
Color of the ground, sRGB.
ground_plane: bool
An endless-looking ground under the model that catches shadows.
Methods
pub fn is_valid(&self) -> bool
Every value finite and in range.
pub fn repair(&mut self) -> bool
Bring values back in range (non-finite ones to their defaults); whether anything changed.
RenderSettingspub struct RenderSettings
How a view is rendered photorealistically.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize, Default
Fields
samples: u32
Samples per pixel.
max_depth: u32
Light bounces.
width: u32
Output width, pixels.
height: u32
Output height, pixels.
fov_deg: f64
Vertical field of view, degrees.
exposure: f64
Exposure, stops (EV).
tone_map: ToneMap
How radiance maps to display colors.
clamp: f64
Largest radiance of a sample (removes fireflies); 0 turns it off.
clay: bool
Render every opaque surface in one white matte (glass stays clear glass), lit by the same sky, sun and ground as a normal render.
environment: RenderEnvironment
Sky, sun and ground.
Methods
pub fn is_valid(&self) -> bool
Every value finite and in range, and the output not over MAX_PIXELS.
pub fn pixels(&self) -> u64
Output pixels.
pub fn aspect(&self) -> f64
Output width over height.
pub fn repair(&mut self) -> bool
Bring values back in range (non-finite ones to their defaults) and
scale an output over MAX_PIXELS down, keeping its aspect;
whether anything changed.
cc_core::repaircrates/cc_core/src/repair.rs
Repair of projects read from files, which may be damaged or crafted: invalid numbers and dangling references are removed or reset so the rest of the program can rely on a consistent model.
cc_core::roofingcrates/cc_core/src/roofing.rs
Roof coverings and framing. A roof type may name its tiles (a kind from
a built-in catalog, with reference values: the least slope they take,
their weight, how many make a square meter, the batten gauge and the
widest span between purlins) and its framing: purlins with rafters and
battens (timber), or purlins only (steel, for sheets). The framing is
derived from the roof’s sloped faces (see cc_geom::roof_framing).
The catalog’s values are typical figures from public product data, for
early design; manufacturers’ figures prevail.
Items: TileKind · TileSpec · FramingSystem · MemberSize · RoofFraming
TileKindpub enum TileKind
Kinds of roof covering.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize
Variants
CeramicColonial
Ceramic tiles laid as caps and channels (colonial).
CeramicFrench
Ceramic interlocking tiles (French).
CeramicRoman
Ceramic interlocking tiles (Roman).
CeramicPortuguese
Ceramic interlocking tiles (Portuguese).
Concrete
Concrete tiles.
FiberCement
Corrugated fiber cement sheets (6 mm).
MetalTrapezoidal
Trapezoidal metal sheets.
Sandwich
Insulated sandwich panels.
Methods
pub const ALL: [TileKind; 8]pub fn key(self) -> &'static str
Translation key of the name.
pub fn code(self) -> &'static str
The name written in files (IFC property sets).
pub fn from_code(code: &str) -> Option<Self>
The kind written as code.
pub fn spec(self) -> TileSpec
The catalog’s figures for this kind.
TileSpecpub struct TileSpec
What a kind of covering takes and weighs.
Traits: Debug, Clone, Copy, PartialEq
Fields
min_slope: f64
Least slope, rise over run.
weight: f64
Weight of the covering, kg per square meter of roof (wet tiles).
per_m2: Option<f64>
Tiles per square meter of roof; None for sheets and panels.
batten_gauge: Option<f64>
Distance between battens along the slope (the tile’s gauge); None
when the covering lies on purlins.
purlin_span: f64
Widest distance between purlins along the slope.
framing: FramingSystem
The framing the covering usually lies on.
Methods
pub fn accepts(&self, slope: f64) -> bool
Whether a roof at slope (rise over run) is steep enough.
pub fn tiles(&self, area: f64) -> Option<f64>
Tiles for area square meters of roof, rounded up; None for sheets.
pub fn weight_on(&self, area: f64) -> f64
Weight of the covering on area square meters of roof, kg.
FramingSystempub enum FramingSystem
How a roof is framed.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
None
No framing drawn (a concrete slab, or framing left out).
Timber
Timber purlins carrying rafters, the rafters carrying battens.
TimberTrusses
Timber trusses carrying the purlins, rafters and battens of Timber.
Steel
Steel purlins carrying sheets or panels directly.
Methods
pub const ALL: [FramingSystem; 4]pub fn code(self) -> &'static str
The name written in files (IFC property sets).
pub fn from_code(code: &str) -> Option<Self>
The system written as code.
pub fn key(self) -> &'static strMemberSizepub struct MemberSize
A member’s section: width and height, meters.
Traits: Debug, Clone, Copy, PartialEq, Serialize, Deserialize
Fields
width: f64height: f64Methods
pub const fn new(width: f64, height: f64) -> SelfRoofFramingpub struct RoofFraming
The framing of a roof type: members under its sloped faces.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize, Default
Fields
system: FramingSystemmaterial: String
Material of the members.
purlin: MemberSize
Purlins, along the eaves.
purlin_spacing: f64
Widest distance between purlins along the slope (the covering’s span is used when smaller).
rafter: MemberSize
Rafters (timber), down the slope.
rafter_spacing: f64batten: MemberSize
Battens (timber), along the eaves at the tile’s gauge.
truss: MemberSize
Trusses (TimberTrusses): the section of their members and the
widest distance between them along the ridge.
truss_spacing: f64Methods
pub fn timber(material: String) -> Self
Timber framing of common sizes: 6 x 16 cm purlins at most 1.5 m
apart, 5 x 6 cm rafters every 50 cm, 1.5 x 5 cm battens; None until
a system is chosen.
pub fn repair(&mut self) -> usize
Sizes and spacings that are positive and finite; the others are reset to the defaults. Returns how many were reset.
pub fn purlin_step(&self, covering: Option<TileKind>) -> f64
Distance between purlins along the slope for covering.
pub fn batten_step(&self, covering: Option<TileKind>) -> f64
Distance between battens along the slope for covering.
cc_core::scalecrates/cc_core/src/scale.rs
Drawing scales as people read them: 1:50 in metric projects, the
customary 1/4" = 1'-0" in imperial ones. A view keeps its scale as the
ratio N of 1:N (View::scale); this only names and reads it.
Items: IMPERIAL · label · choices · parse
IMPERIALpub const IMPERIAL: [(u32, &str); 19]
The customary imperial scales: ratio and label (architectural, then engineering).
labelpub fn label(system: MeasurementSystem, n: u32) -> String
The scale 1:n as a project of system writes it: the customary label
of an imperial scale in the table, else 1:n.
choicespub fn choices(system: MeasurementSystem) -> &'static [u32]
The scales a scale picker offers in a project of system, ascending.
parsepub fn parse(text: &str) -> Option<u32>
Reads a scale typed as 1:48, 48 or a label of the imperial table
(1/4" = 1'-0", spaces optional, 1' for 1'-0"). Zero is refused.
cc_core::schedulecrates/cc_core/src/schedule.rs
Schedule definitions: which fields a schedule shows, how rows are
filtered, sorted and grouped, how each column is formatted and how the
table looks on paper. The values are computed by cc_views::schedule.
Items: ScheduleField · ScheduleDef · MAX_BENDING_PARTITIONS · MAX_WASTE_PERCENT · BendingOptions · MAX_FILTERS · MAX_SORT_LEVELS · MAX_SCHEDULE_TEXT · MIN_SCHEDULE_TEXT_SIZE · MAX_SCHEDULE_TEXT_SIZE · ScheduleFilter · SortLevel · ColumnAlign · ColumnFormat · ScheduleAppearance
ScheduleFieldpub enum ScheduleField
A column a schedule can show.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize
Variants
MarkTypeLevelCommentsTypeMarkDescriptionManufacturerModelFireRatingCostLengthHeightWidthThicknessAreaPerimeterVolumeSillHostFunctionStructuralNumberNameRisersRiserHeightRunDepthComponentNameComponentKindSection
Section size of a column or beam.
Profile
Name of the profile of a column or beam type, whatever its material (tags show it only for steel and cold-formed profiles).
LinearMass
Mass per meter of a column or beam, kg/m.
CutLength
Length of a beam’s body after its joins.
Material
Main material of the type.
Diameter
Bar diameter of reinforcement.
BarCount
Number of bars in a reinforcement set.
BarLength
Length of one bar.
Weight
Steel weight, kilograms.
Partition
The part of the structure a reinforcement set belongs to.
CutOff
Elevation of a pile’s head (its cut-off).
Toe
Elevation of a pile’s toe.
PileKind
How a pile is made.
PileCount
Number of piles under a pile cap.
System
Plumbing system or electrical circuits.
Slope
Fall of a pipe per unit of length.
Power
Apparent power of an electrical device, VA.
DrainUnits
Drainage fixture units of a plumbing fixture.
PhaseCreated
The phase the element is built in.
PhaseDemolished
The phase the element is demolished in.
FloorArea
Gross floor area of a mass: the sum of its mass floors.
TileCount
Number of tiles on a roof.
FramingLength
Total length of a roof’s framing members.
FramingVolume
Volume of a roof’s framing members.
FloorCount
How many mass floors a mass has.
PanelCount
Number of panels of a curtain wall.
GlazedArea
Area of a curtain wall’s glass panels.
MullionLength
Total length of a curtain wall’s mullions.
Elevation
Elevation of a building pad above its level.
CutVolume
Volume of earth cut by a pad (a terrain: by its pads).
FillVolume
Volume of earth filled by a pad (a terrain: by its pads).
CableLength
Estimated length of the horizontal cables from a data outlet to its rack.
ConnectionKind
Kind of a connection (base plate, end plate…).
PlateMass
Steel mass of a connection’s plates, kilograms.
BoltCount
Number of bolts of a connection.
BoltDiameter
Bolt diameter of a connection.
Count
How many elements the row stands for (1, or the group’s when rows are not itemized).
Methods
pub fn key(self) -> &'static str
Translation key of the column header.
pub fn key_in(self, system: crate::MeasurementSystem) -> &'static str
Translation key of the column header in a project of system. The
metric headers of lengths, areas and volumes name their unit
(Length (m)); imperial values carry their own marks and symbols
(12'-6", 100.00 ft²), so those headers name none.
pub fn available(category: Category) -> Vec<ScheduleField>
Fields that make sense for category, in a sensible order.
pub fn applies_to(self, category: Category) -> bool
Whether elements of category can have a value for this field: the
fields available to its schedules, plus the type,
level, main material, volume and count, which most elements have. A filter
rule on a field that applies to none of its categories never matches.
pub fn defaults(category: Category) -> Vec<ScheduleField>
Fields shown by a new schedule of category.
ScheduleDefpub struct ScheduleDef
What a schedule shows. Empty fields means the category defaults (files
written before schedules were configurable).
Traits: Debug, Clone, PartialEq, Default, Serialize, Deserialize
Fields
fields: Vec<ScheduleField>sort_by: Option<ScheduleField>
Sort rows by this field (the default order is by mark or number).
The first level of sorting of files written before Self::sorting.
descending: boolfilter: Option<(ScheduleField, String)>
Keep only rows whose value of the field contains the text
(case-insensitive). The filter of files written before Self::filters.
hide_totals: bool
Hide the totals row.
filters: Vec<ScheduleFilter>
Keep only the rows that pass every one of these.
sorting: Vec<SortLevel>
Sort the rows by these, the first outermost; a level may head and foot the rows it groups.
collapse: bool
One row for the elements alike in every sorting level, instead of one per element: values that differ among them read as varying, and totaled columns add up.
columns: Vec<ColumnFormat>
How columns are written, for the fields that differ from the usual.
appearance: ScheduleAppearance
How the table looks on paper.
bending: Option<BendingOptions>
A reinforcement schedule as a bending schedule: one row per bar mark instead of one per set (the fields, sort and filter do not apply).
Methods
pub fn fields_for(&self, category: Category) -> Vec<ScheduleField>
The fields to show for category.
pub fn all_filters(&self) -> Vec<ScheduleFilter>
Every filter: the older single one (a text the value contains), then Self::filters.
pub fn all_sorting(&self) -> Vec<SortLevel>
Every level of sorting: Self::sorting, or the older single field.
pub fn format_of(&self, field: ScheduleField) -> ColumnFormat
How the column of field is written.
pub fn normalize(&mut self)
The older single filter and sort field moved into Self::filters
and Self::sorting, which the dialogs edit.
pub fn check(&self) -> Option<String>
Why the definition cannot be kept (None: it can), as a message.
pub fn repair(&mut self) -> usize
Bring the definition within its limits; returns how many values changed.
MAX_BENDING_PARTITIONSpub const MAX_BENDING_PARTITIONS: usize
Most partitions a bending schedule is limited to.
MAX_WASTE_PERCENTpub const MAX_WASTE_PERCENT: f64
Largest waste a bending schedule adds, percent.
BendingOptionspub struct BendingOptions
What a bending schedule shows: one row per bar mark (mark, diameter, grade, shape sketch with its dimensions, length of one bar, count, total length, weight; rows of bars longer than the stock length noted), then a summary per diameter and grade (total length and weight, with the waste added when given).
Traits: Debug, Clone, PartialEq, Default, Serialize, Deserialize
Fields
partitions: Vec<String>
Only the sets of these partitions (none: every set; an empty text stands for the sets without one).
group_by_partition: bool
Rows under a heading per partition (each partition’s marks counted on their own).
waste_percent: Option<f64>
Waste added in the summary, percent (none: no waste columns).
Methods
pub fn check(&self) -> Option<String>
Why the options cannot be kept (None: they can), as a message.
pub fn repair(&mut self) -> usize
Bring the options into range; returns how many changed.
pub fn shows(&self, partition: &str) -> bool
Whether a set of partition is shown.
MAX_FILTERSpub const MAX_FILTERS: usize
Most filters of one schedule.
MAX_SORT_LEVELSpub const MAX_SORT_LEVELS: usize
Most levels of sorting of one schedule.
MAX_SCHEDULE_TEXTpub const MAX_SCHEDULE_TEXT: usize
Longest filter value or column heading, in characters.
MIN_SCHEDULE_TEXT_SIZEpub const MIN_SCHEDULE_TEXT_SIZE: f64
Smallest and largest text of a schedule on paper, millimeters.
MAX_SCHEDULE_TEXT_SIZEpub const MAX_SCHEDULE_TEXT_SIZE: f64
ScheduleFilterpub struct ScheduleFilter
One filter: rows whose field compares as op says with value stay.
A number is compared as a number when the row’s value is one (lengths in
meters, areas in square meters, and so on), else as text without case.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
field: ScheduleFieldop: FilterOp
The comparison, as view filters have them (FilterOp::test).
value: StringSortLevelpub struct SortLevel
One level of sorting: rows in the order of field; a level may write a
heading before each group of rows alike in it, a footer after it (the
group’s count and totals) and leave a blank line between groups.
Traits: Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize
Fields
field: ScheduleFielddescending: boolheader: boolfooter: boolblank_line: boolMethods
pub fn new(field: ScheduleField) -> Selfpub fn groups(&self) -> bool
Whether the level groups its rows (a heading, a footer or a blank line).
ColumnAlignpub enum ColumnAlign
Where a column’s texts stand in their cells.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
Auto
Numbers to the right, texts to the left.
LeftCenterRightMethods
pub const ALL: [ColumnAlign; 4]pub fn key(self) -> &'static str
Translation key of the alignment’s name.
ColumnFormatpub struct ColumnFormat
How the column of field is written: its own heading, its alignment,
whether it is left out of the table (a hidden field still sorts and
filters) and whether it is totaled (None: as the field usually is).
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
field: ScheduleFieldheading: Option<String>align: ColumnAlignhidden: booltotal: Option<bool>Methods
pub fn new(field: ScheduleField) -> Selfpub fn is_plain(&self) -> bool
Whether nothing differs from the usual (the entry may be dropped).
ScheduleAppearancepub struct ScheduleAppearance
How a schedule looks on paper (sheets and exports): its rules, its title and headers, and the sizes of its texts in millimeters.
Traits: Debug, Clone, Copy, PartialEq, Serialize, Deserialize, Default
Fields
grid_lines: bool
Rules between rows and columns.
outline: bool
The heavier rule around the table.
show_title: bool
The row with the schedule’s name.
show_headers: bool
The row with the columns’ headings.
title_size: f64header_size: f64text_size: f64Methods
pub fn is_default(&self) -> boolpub fn repair(&mut self) -> usize
Bring the text sizes within their limits; returns how many changed.
cc_core::section_propscrates/cc_core/src/section_props.rs
Geometric properties of a section outline (area, centroid, second moments, moduli, radii of gyration, torsion constant, mass per length), computed exactly for the polygon with Green’s theorem. SI units.
Items: SectionProperties
SectionPropertiespub struct SectionProperties
Properties of a section. Units: m, m², m⁴, m³ and kg/m.
Traits: Debug, Clone, Copy, PartialEq, Default, Serialize
Fields
area: f64
Area, m².
centroid: [f64; 2]
Centroid in the outline’s own coordinates, m.
ix: f64
Second moment about the centroidal x axis, m⁴.
iy: f64
Second moment about the centroidal y axis, m⁴.
ixy: f64
Product of inertia about the centroidal axes, m⁴.
wx: f64
Elastic modulus about x (ix over the farthest fiber in y), m³.
wy: f64
Elastic modulus about y, m³.
rx: f64
Radius of gyration about x, m.
ry: f64
Radius of gyration about y, m.
j: f64
Torsion constant, m⁴. Approximate: Bredt’s 4A²t/s on the mid-wall for
closed shapes, perimeter * t³ / 6 (t = 2 * area / perimeter) for open ones.
perimeter: f64
Outer perimeter plus the perimeters of the holes, m.
linear_mass: f64
Mass per length, kg/m.
cc_core::shaftcrates/cc_core/src/shaft.rs
Shaft openings: a vertical opening with an outline in plan, from its
level (plus base_offset) up to a level or a height, that cuts every
floor, ceiling and roof it passes through. The cuts are written into
those elements (cuts) by every edit (see crate::EditCtx), so plans,
schedules, 3D views and IFC export see the holes like any opening.
A shaft cuts an element only where its outline lies inside the element’s
outline, clear of its own openings.
Items: MAX_OUTLINE · Shaft · fits
MAX_OUTLINEpub const MAX_OUTLINE: usize
Most points of a shaft’s outline.
Shaftpub struct Shaft
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
outline: Vec<DVec2>
Closed outline in plan (either winding).
base_offset: f64
Bottom of the shaft above its level.
height: f64
Height when top is unconnected.
top: WallTopsketch: Option<crate::sketch::Sketch>
The curves the outline was drawn with (see crate::sketch).
Methods
pub fn is_valid(&self) -> boolfitspub fn fits(outline: &[DVec2], boundary: &[DVec2], holes: &[Vec<DVec2>]) -> bool
Whether outline lies inside boundary and clear of each of holes
(no shared edges or points either): a hole it can cut.
cc_core::sitecrates/cc_core/src/site.rs
Where the project stands on Earth: the geographic position of the project origin, its height above sea level, the direction of true north and the parts of its postal address, plus the conversion between latitude/longitude and the project’s own coordinates (meters) used to bring map data in.
Items: ELEVATION_RANGE · MAX_TEXT · SiteLocation · SiteAddress · normalize_angle · to_dms · from_dms
ELEVATION_RANGEpub const ELEVATION_RANGE: std::ops::RangeInclusive<f64>
Lowest and highest site elevation accepted, meters (the Dead Sea shore to above Everest).
MAX_TEXTpub const MAX_TEXT: usize
Longest text kept in one address part, bytes.
SiteLocationpub struct SiteLocation
The geographic location of the project origin ([0, 0] at level
elevation 0) with its postal address.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
latitude: f64
Latitude in degrees (WGS 84), north positive.
longitude: f64
Longitude in degrees (WGS 84), east positive.
elevation: f64
Height of the project’s elevation 0 above sea level, meters.
true_north: f64
Angle from the project’s north (+Y) to true north, degrees counter-clockwise.
place: String
The place as the map search named it.
address: SiteAddress
Parts of the postal address.
utc_offset: Option<f64>
Local time’s offset from UTC, hours east (within
crate::sun::UTC_OFFSET_RANGE); None: the offset of the
longitude’s time zone (see SiteLocation::offset_hours).
Methods
pub fn at(latitude: f64, longitude: f64) -> SiteLocation
A location at latitude, longitude with nothing else set.
pub fn offset_hours(&self) -> f64
Local time’s offset from UTC, hours east: the one set, else the
longitude’s nominal zone (longitude / 15, rounded).
pub fn is_valid(&self) -> bool
Finite coordinates on Earth, a finite elevation in range, a finite north angle and an offset from UTC in range, if set.
pub fn repair(&mut self) -> (bool, usize)
Fix what can be fixed (north angle into (-180, 180], texts cut to
MAX_TEXT, an offset from UTC out of range dropped); false when
the location is beyond repair.
pub fn east_north(&self, latitude: f64, longitude: f64) -> DVec2
Meters east and north of the site for a point at latitude,
longitude, on the plane tangent to the ellipsoid at the site
(radii of curvature at its latitude; within a few centimeters over a
kilometer).
pub fn lat_lon(&self, east_north: DVec2) -> (f64, f64)
Latitude and longitude of a point east_north meters from the site (the inverse of Self::east_north).
pub fn north(&self) -> DVec2
The project’s direction of true north (unit vector in plan).
pub fn to_project(&self, latitude: f64, longitude: f64) -> DVec2
Project coordinates of a point at latitude, longitude.
pub fn from_project(&self, p: DVec2) -> (f64, f64)
Latitude and longitude of a point in project coordinates.
SiteAddresspub struct SiteAddress
Parts of a postal address (any may be empty).
Traits: Debug, Clone, PartialEq, Default, Serialize, Deserialize
Fields
street: Stringnumber: Stringdistrict: Stringcity: Stringregion: Stringpostcode: Stringcountry: StringMethods
pub fn parts(&self) -> [(&'static str, &str); 7]
The parts with their keys, in display order.
pub fn part_mut(&mut self, key: &str) -> Option<&mut String>
The part called key, to change it.
pub fn one_line(&self) -> String
One line: “street, number - district, city - region, postcode, country”, empty parts left out.
pub fn is_empty(&self) -> bool
normalize_anglepub fn normalize_angle(a: f64) -> f64
a degrees in (-180, 180].
to_dmspub fn to_dms(deg: f64) -> [i64; 4]
Degrees as IFC’s compound plane angle: degrees, minutes, seconds and millionths of a second, all with the sign of the angle.
from_dmspub fn from_dms(parts: &[i64]) -> Option<f64>
Degrees from IFC’s compound plane angle (three or four parts; the sign of any part makes it negative).
cc_core::sketchcrates/cc_core/src/sketch.rs
Sketches: the curves an outline is drawn with (lines, arcs, circles and
ellipses; rectangles and polygons are drawn as lines). A floor, ceiling,
roof, foundation slab or mass keeps the sketch it was drawn from, so its
boundary can be edited again curve by curve; its outline (the polygon the
geometry is built from) is the sketch’s loops, arcs and ellipses split
into short chords.
Sketch::profile chains the curves into closed loops: the one around
all the others is the outline, the others are openings in it. Ends meet
within JOIN_TOL; open ends, curves branching at a point, loops that
cross themselves or each other, and loops apart from or nested in each
other are errors, with the point where they happen.
Items: JOIN_TOL · MAX_CURVES · MAX_POINTS · SketchCurve · SketchError · Profile · Sketch
JOIN_TOLpub const JOIN_TOL: f64
Ends closer than this (meters) join.
MAX_CURVESpub const MAX_CURVES: usize
Most curves a sketch holds (a guard against crafted files).
MAX_POINTSpub const MAX_POINTS: usize
Most points the loops of a sketch make.
SketchCurvepub enum SketchCurve
A curve of a sketch, in plan coordinates (meters).
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Variants
Line { a: DVec2, b: DVec2, }Arc { a: DVec2, b: DVec2, bulge: f64, }
A circular arc from a to b, by its bulge (see crate::arc).
Circle { center: DVec2, radius: f64, }Ellipse { center: DVec2, radii: DVec2, rotation_deg: f64, #[serde(default)] start_deg: f64, #[serde(default = "full_turn")] sweep_deg: f64, }
An ellipse with semi-axes radii (along its own x and y), its x axis
turned rotation_deg from the plan’s; a part of it from the angle
start_deg (of its parameter) turning by sweep_deg, or all of it
when the sweep is a full turn.
Spline { points: Vec<DVec2>, }
A chain of cubic Bézier segments through its control points
(3n + 1 of them, see crate::spline); closed when it ends where
it starts.
Methods
pub fn ellipse(center: DVec2, radii: DVec2, rotation_deg: f64) -> Self
A whole ellipse.
pub fn is_valid(&self) -> bool
Finite numbers and a size: lines and arcs with distinct ends, positive radii.
pub fn is_closed(&self) -> bool
Whether the curve closes on itself (a circle, a whole ellipse).
pub fn ends(&self) -> Option<(DVec2, DVec2)>
The start and end of an open curve.
pub fn points(&self) -> Vec<DVec2>
The curve as points from its start to its end (closed curves end
where they start), arcs and ellipses split every ARC_STEP.
pub fn swept_area(&self) -> f64
The signed area the curve sweeps around the origin, the integral of
(x dy - y dx) / 2 along it: summed around a closed loop, the loop’s
exact area (positive counter-clockwise), arcs and ellipses as the true
curves rather than the points they are split into.
pub fn is_curved(&self) -> bool
Whether the curve is curved (an arc, a circle, an ellipse).
pub fn reversed(&self) -> Self
The same curve run the other way.
pub fn transform(&mut self, t: &PlanTransform)
Move, rotate or mirror the curve.
SketchErrorpub enum SketchError
Why a sketch makes no outline.
Traits: Debug, Clone, Copy, PartialEq, std::fmt::Display
Variants
Empty
No curves.
InvalidCurve(usize)
A curve with invalid numbers or no size.
TooLarge
Too many curves or points.
OpenEnd(DVec2)
A curve ends here without meeting another.
Branch(DVec2)
More than two curves meet here.
Crossing(DVec2)
Loops cross or touch here (themselves or each other).
Apart(DVec2)
A loop lies outside the others (more than one outline), near here.
Nested(DVec2)
A loop lies inside an opening, near here.
Openings(DVec2)
The outline has openings where none are allowed, near here.
NoArea(DVec2)
A loop encloses no area, near here.
Methods
pub fn key(&self) -> &'static str
Translation key of the message.
pub fn point(&self) -> Option<DVec2>
Where it happens, to show it.
Profilepub struct Profile
An outline and the openings in it, from a sketch.
Traits: Debug, Clone, PartialEq, Default
Fields
outline: Vec<DVec2>openings: Vec<Vec<DVec2>>Sketchpub struct Sketch
The curves an outline is drawn with.
Traits: Debug, Clone, PartialEq, Default, Serialize, Deserialize
Fields
curves: Vec<SketchCurve>Methods
pub fn from_polygons(outline: &[DVec2], openings: &[Vec<DVec2>]) -> Self
Lines around outline and each of openings.
pub fn transform(&mut self, t: &PlanTransform)
Move, rotate or mirror every curve.
pub fn is_valid(&self) -> bool
Valid curves and not too many of them.
pub fn loops(&self) -> Result<Vec<Vec<DVec2>>, SketchError>
The closed loops the curves make, each as points without the closing repeat.
pub fn area(&self) -> Result<f64, SketchError>
The exact area the sketch encloses: its outline less its openings, arcs, circles and ellipses as the true curves (the outline’s points split them into chords, which cut a little off).
pub fn is_curved(&self) -> bool
Whether any curve is curved: only then does Self::area differ
from the area of the points.
pub fn profile(&self) -> Result<Profile, SketchError>
The outline (the loop around all the others) and the openings in it.
pub fn outline(&self) -> Result<Vec<DVec2>, SketchError>
Self::profile for outlines that take no openings.
pub fn makes(&self, outline: &[DVec2], openings: &[Vec<DVec2>]) -> bool
Whether the sketch still makes outline and openings (the same
points, in order from any start and either way round): an outline
edited without its sketch leaves it behind.
cc_core::sketch_editcrates/cc_core/src/sketch_edit.rs
Editing the curves of a sketch: where two curves (or the lines, circles
and ellipses they lie on) cross, a curve trimmed or extended to a point,
split in two, and offset alone or along the chain of curves joined to it.
The sketch tools of the app use these; None means the edit makes no
valid curve (closed curves have no end to trim, ellipses no offset that
is an ellipse, curves that never meet).
Items: crossings · nearest · param · span · between · trim_to · trim_corner · trim_extend · split · offset_left · offset · chain · offset_chain
crossingspub fn crossings(a: &SketchCurve, b: &SketchCurve) -> Vec<DVec2>
Where the lines, circles and ellipses curves a and b lie on cross
(lines run on past their ends, arcs round their circle, partial
ellipses round the whole ellipse). Tangent contacts may be missed.
nearestpub fn nearest(points: &[DVec2], to: DVec2) -> Option<DVec2>
The point of points nearest to.
parampub fn param(c: &SketchCurve, p: DVec2) -> Option<f64>
Where p lies along an open curve from its start: meters along lines
and arcs, radians of the parameter along ellipses; before the start it
is negative and past the end greater than span, where the curve runs
on. None for closed curves.
spanpub fn span(c: &SketchCurve) -> Option<f64>
The parameter of an open curve’s end (see param).
betweenpub fn between(c: &SketchCurve, u0: f64, u1: f64) -> Option<SketchCurve>
The part of an open curve between the parameters u0 < u1 (see
param); beyond its ends the curve runs on, so this also extends it.
trim_topub fn trim_to(c: &SketchCurve, keep: DVec2, at: DVec2) -> Option<SketchCurve>
The open curve c ending at at (a point on it or where it runs on),
keeping the side of at where keep is: trimmed or extended.
trim_cornerpub fn trim_corner(c1: &SketchCurve, k1: DVec2, c2: &SketchCurve, k2: DVec2) -> Option<(SketchCurve, SketchCurve)>
Two curves trimmed or extended to meet where they cross, each keeping
the side clicked (k1, k2); the crossing nearest the clicks.
trim_extendpub fn trim_extend(c: &SketchCurve, keep: DVec2, boundary: &SketchCurve) -> Option<SketchCurve>
Curve c trimmed or extended to the curve boundary, keeping the side
clicked (keep); the crossing nearest the click.
splitpub fn split(c: &SketchCurve, p: DVec2) -> Option<(SketchCurve, SketchCurve)>
Curve c split in two at the point of it nearest p. A circle or a
whole ellipse splits into halves, from p and from the point opposite.
offset_leftpub fn offset_left(c: &SketchCurve, v: f64) -> Option<SketchCurve>
Curve c moved v to its left (to its right when negative); None
for ellipses and when an arc’s or a circle’s radius would vanish.
offsetpub fn offset(c: &SketchCurve, distance: f64, toward: DVec2) -> Option<SketchCurve>
A copy of curve c distance away from it, on the side of toward.
chainpub fn chain(curves: &[SketchCurve], i: usize) -> (Vec<(usize, bool)>, bool)
The curves joined end to end with curve i, in order along the chain,
each with whether it runs backwards in it, and whether the chain
closes. The chain stops where more than two curves meet.
offset_chainpub fn offset_chain(curves: &[SketchCurve], i: usize, distance: f64, toward: DVec2) -> Option<Vec<SketchCurve>>
Copies of the chain of curve i (see chain) distance away on the
side of toward, neighbors meeting where their copies cross (or joined
by a line where they do not); None when a curve has no offset.
cc_core::splinecrates/cc_core/src/spline.rs
Splines of sketches: a chain of cubic Bézier segments, kept as their
control points p0 c1 c2 p1 c1 c2 p2 … (3n + 1 points for n
segments). The drawing tool passes through the points clicked
(interpolate); splitting (split_at), reversing, moving and the
enclosed area (swept_area) stay exact on that form.
Items: MAX_SEGMENTS · STEPS · segment_count · segment · segments · is_valid · is_closed · point · derivative · point_at · direction_at · flatten · length · swept_area · split · split_at · between · nearest · reversed · interpolate · offset
MAX_SEGMENTSpub const MAX_SEGMENTS: usize
Most segments a spline holds (a guard against crafted files).
STEPSpub const STEPS: usize
Points each segment is split into to draw it.
segment_countpub fn segment_count(points: &[DVec2]) -> Option<usize>
The number of segments of points, when they are a spline’s control points.
segmentpub fn segment(points: &[DVec2], i: usize) -> Option<[DVec2; 4]>
The control points of segment i.
segmentspub fn segments(points: &[DVec2]) -> impl Iterator<Item = [DVec2; 4]> + '_
The segments of points.
is_validpub fn is_valid(points: &[DVec2]) -> bool
A whole number of segments, not too many, finite, and not all in one point.
is_closedpub fn is_closed(points: &[DVec2]) -> bool
Whether the spline ends where it starts (with more than one segment).
pointpub fn point([p0, p1, p2, p3]: [DVec2; 4], t: f64) -> DVec2
The point of a segment at t in 0..=1.
derivativepub fn derivative([p0, p1, p2, p3]: [DVec2; 4], t: f64) -> DVec2
The derivative of a segment at t.
point_atpub fn point_at(points: &[DVec2], s: f64) -> Option<DVec2>
The point at the spline’s parameter s in 0..=n (segment floor(s)).
direction_atpub fn direction_at(points: &[DVec2], s: f64) -> Option<DVec2>
The unit direction of travel at the parameter s.
flattenpub fn flatten(points: &[DVec2]) -> Vec<DVec2>
The spline as points from its start to its end, each segment split in
STEPS; the ends are exact.
lengthpub fn length(points: &[DVec2]) -> f64
The length of the drawn spline.
swept_areapub fn swept_area(points: &[DVec2]) -> f64
The signed area the spline sweeps around the origin, the integral of
(x dy - y dx) / 2 along it, exact: the integrand is a polynomial of
degree 5, which 3-point Gauss-Legendre integrates exactly.
splitpub fn split([p0, p1, p2, p3]: [DVec2; 4], t: f64) -> ([DVec2; 4], [DVec2; 4])
A segment split at t: the part before and the part after.
split_atpub fn split_at(points: &[DVec2], s: f64) -> Option<(Vec<DVec2>, Vec<DVec2>)>
The spline split at its parameter s: the part before and the part
after (either may be empty at an end).
betweenpub fn between(points: &[DVec2], s0: f64, s1: f64) -> Option<Vec<DVec2>>
The part of the spline between the parameters s0 and s1 (s0 < s1).
nearestpub fn nearest(points: &[DVec2], q: DVec2) -> Option<(f64, DVec2, f64)>
The nearest point of the spline to q: its parameter, the point and the distance.
reversedpub fn reversed(points: &[DVec2]) -> Vec<DVec2>
The same spline run the other way.
interpolatepub fn interpolate(fit: &[DVec2], closed: bool) -> Vec<DVec2>
A spline through the fit points (closed back to the first when
closed): tangents from the neighbors, spaced by the distances between
the points, so it neither overshoots short spans nor flattens long ones.
Points repeated in a row count once; fewer than two distinct points make
no spline.
offsetpub fn offset(points: &[DVec2], d: f64) -> Vec<DVec2>
A spline d to the left of this one (to the right when negative), as
near as offsetting each segment’s control points along its end normals
allows (exact for straight segments, close for gentle curves).
cc_core::staircrates/cc_core/src/stair.rs
Stairs: the plan shapes of a stair element, how its type is built (solid,
cast in place, assembled) and the rules that size its steps (riser limits
and Blondel’s formula 2 × riser + tread).
Items: StairShape · Turn · StairLayout · MAX_STEP_NUMBER · MAX_WINDERS · MAX_RISERS · StairConstruction · Stringers · LandingBeams · PostAt · LandingPosts · StairBuild · TreadRule · StairRules · stair_steps · StairIssue · StairCheck · StairSide · StairRailing
StairShapepub enum StairShape
Plan shape of a stair.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
Straight
One straight flight.
StraightLanding
Two straight flights in line with a landing between them.
LShaped
Two flights at a right angle, with a landing or winders at the corner.
UShaped
Two parallel flights going opposite ways, joined by a landing.
ThreeFlight
Three flights turning twice at right angles, with a landing at each corner: the third comes back beside the first.
Spiral
Treads around a center (spiral or helical stair).
Methods
pub const ALL: [StairShape; 6]pub fn key(self) -> &'static strpub fn turns(self) -> bool
Whether the stair turns (so the side it turns to matters).
pub fn has_split(self) -> bool
Whether the stair has flights split by landings (or winders).
Turnpub enum Turn
Side a stair turns to, walking up.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
Left
Counter-clockwise in plan.
Right
Clockwise in plan.
Methods
pub const ALL: [Turn; 2]pub fn key(self) -> &'static strpub fn sign(self) -> f64
+1 to the left, -1 to the right.
pub fn flipped(self) -> TurnStairLayoutpub struct StairLayout
Plan layout of a stair element (all fields have defaults, so files from before shaped stairs read as straight ones).
Traits: Debug, Clone, Copy, PartialEq, Serialize, Deserialize, Default
Fields
shape: StairShapeturn: Turnsplit: u32
Risers of the first flight (0: half of them; a third on a three-flight stair).
split2: u32
Risers of the second flight of a three-flight stair (0: half of those left after the first).
risers: u32
Riser count (0: the fewest within the type’s maximum riser); the riser height is the stair’s height over it.
tread: f64
Tread depth (0: the type’s, or Blondel’s formula when its rules say so).
landing: f64
Landing depth along the first flight (0: the stair width); straight and U-shaped stairs.
gap: f64
Clear gap between the flights of a U-shaped stair.
winders: u32
Winder treads in the corner of an L-shaped stair (0: a landing).
inner_radius: f64
Radius of the inner edge of a spiral stair (0: treads meet at the center).
posts: [LandingPosts; 2]
Posts under the landings of an assembled stair, down to its base: one set per landing, in order up the stair.
numbers: bool
Number the steps in plans: the treads (winders included, landings
not) from number_start up, and the floor the stair arrives at.
number_start: i32
Number of the first tread (another value continues a count from a stair below, for instance).
Methods
pub fn repair(&mut self) -> usize
Replace invalid values by defaults; returns how many changed.
pub fn steps(&self, height: f64, max_riser: f64, tread: f64, rules: &StairRules) -> (usize, f64, f64)
Riser count, riser height and tread depth of a stair of height of a
type with max_riser, tread and rules, with this layout’s riser
count and tread when it sets them.
MAX_STEP_NUMBERpub const MAX_STEP_NUMBER: i32
Largest step number, either way from zero.
MAX_WINDERSpub const MAX_WINDERS: u32
Most winder treads in one corner.
MAX_RISERSpub const MAX_RISERS: u32
Most risers in one stair.
StairConstructionpub enum StairConstruction
How a stair is built.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
Solid
Steps filled down to the base (a solid block, e.g. on fill).
CastInPlace
Reinforced concrete cast in place: steps on an inclined waist slab
waist thick (landings are slabs of the same thickness).
Assembled
Assembled (precast, steel or timber): treads tread_thickness thick
on stringers, with or without riser boards.
Methods
pub const ALL: [StairConstruction; 3]pub fn key(self) -> &'static strStringerspub enum Stringers
Where the stringers of an assembled stair go.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
Sides
One under each side of the treads.
Center
One under the middle of the treads (a central column on spirals).
Methods
pub const ALL: [Stringers; 2]pub fn key(self) -> &'static strLandingBeamspub enum LandingBeams
How the beams under a landing of an assembled stair with a central stringer run (with side stringers they frame the landing’s edge).
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
Cross
The lines of the stringers of the flights the landing joins carried across it, crossing (a beam across the middle on straight and U-shaped landings).
Tee
One beam across the landing and the other springing from it: on a corner, the beam of the arriving flight’s stringer, with the leaving flight’s from its middle to the edge the flight leaves; on a U-shaped landing, a beam across the middle with the stringers’ beams from the front up to it.
Methods
pub const ALL: [LandingBeams; 2]pub fn key(self) -> &'static strPostAtpub enum PostAt
A place round the edge of a landing where a post can stand: a corner or the middle of an edge, named walking onto the landing (front: the edge the stair arrives at; inner: the side the stair turns to).
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize
Variants
FrontOuterFrontFrontInnerInnerBackInnerBackBackOuterOuterMethods
pub const ALL: [PostAt; 8]
Round the edge, from the front corner on the outer side.
pub fn name(self) -> &'static str
The name in commands and files.
pub fn from_name(name: &str) -> Option<PostAt>pub fn key(self) -> &'static strLandingPostspub struct LandingPosts
Where posts stand under one landing (only places where the landing’s
beams reach its edge take one, see cc_geom::StairLanding::post_spots).
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Fields
front_outer: boolfront: boolfront_inner: boolinner: boolback_inner: boolback: boolback_outer: boolouter: boolMethods
pub fn get(mut self, at: PostAt) -> boolpub fn set(&mut self, at: PostAt, on: bool)pub fn any(self) -> boolStairBuildpub struct StairBuild
Construction of a stair type.
Traits: Debug, Clone, Copy, PartialEq, Serialize, Deserialize, Default
Fields
construction: StairConstructionwaist: f64
Thickness of the waist slab of a cast-in-place stair, square to its pitch.
stringers: Stringersstringer_width: f64
Width and depth of the stringers of an assembled stair.
stringer_depth: f64tread_thickness: f64
Thickness of the treads of an assembled stair.
closed_risers: bool
Riser boards closing the gap between treads (assembled stairs).
landing_beams: LandingBeams
Layout of the beams under the landings of an assembled stair with a central stringer (they are as wide and deep as the stringers, under a deck as thick as the treads).
post_width: f64
Side of the square posts under the landings of an assembled stair.
Methods
pub fn repair(&mut self) -> usize
Replace invalid sizes by defaults; returns how many changed.
TreadRulepub enum TreadRule
How the tread depth of a stair type is set.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
Fixed
The type’s tread depth.
Blondel
From Blondel’s formula: the middle of the step range minus twice the riser.
Methods
pub const ALL: [TreadRule; 2]pub fn key(self) -> &'static strStairRulespub struct StairRules
Comfort and safety limits of a stair type (defaults after common
building codes: risers 16-18 cm, treads at least 28 cm and
2 × riser + tread between 63 and 65 cm).
Traits: Debug, Clone, Copy, PartialEq, Serialize, Deserialize, Default
Fields
tread_rule: TreadRulemin_riser: f64min_tread: f64blondel_min: f64
Range of Blondel’s step 2 × riser + tread.
blondel_max: f64Methods
pub fn repair(&mut self) -> usize
Replace invalid limits by defaults; returns how many changed.
pub fn tread_for(&self, riser: f64, tread: f64) -> f64
Tread depth for a riser height: tread for a fixed rule, else the
middle of the Blondel range minus twice the riser (at least 10 cm).
stair_stepspub fn stair_steps(height: f64, max_riser: f64, tread: f64, rules: &StairRules) -> (usize, f64, f64)
Riser count, riser height and tread depth of a stair of height: the
fewest risers at most max_riser high; the tread from the rules.
StairIssuepub enum StairIssue
A broken rule of a stair.
Traits: Debug, Clone, Copy, PartialEq, Serialize
Variants
RiserTooHigh { riser: f64, max: f64 }RiserTooLow { riser: f64, min: f64 }TreadTooShort { tread: f64, min: f64 }BlondelOutOfRange { step: f64, min: f64, max: f64 }LandingTooShort { landing: f64, min: f64 }Methods
pub fn key(&self) -> &'static strStairCheckpub struct StairCheck
Riser, tread (on the walking line), Blondel’s step and the rules they break.
Traits: Debug, Clone, PartialEq, Serialize
Fields
risers: usizeriser: f64tread: f64blondel: f64
2 × riser + tread.
issues: Vec<StairIssue>Methods
pub fn new(risers: usize, riser: f64, tread: f64, max_riser: f64, rules: &StairRules, landing: Option<(f64, f64)>) -> Self
Check a riser and tread against rules, max_riser and, when the
stair has one, a landing at least width deep.
pub fn ok(&self) -> bool
StairSidepub enum StairSide
Side of a stair, walking up.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
LeftRightMethods
pub const ALL: [StairSide; 2]pub fn flipped(self) -> StairSideStairRailingpub struct StairRailing
A railing that follows a side of a stair (host), inset in from its edge.
Traits: Debug, Clone, Copy, PartialEq, Serialize, Deserialize
Fields
host: crate::ElementIdside: StairSideinset: f64cc_core::steel_buildingcrates/cc_core/src/steel_building.rs
Parametric steel buildings: a host element that holds the parameters of
a steel shed (span, eave height, roof slope and shape, bays, the types of
its members, purlins and girts) and owns ordinary columns and beams made
from them. Every edit keeps the members in step (see
crate::EditCtx): a changed building rewrites its members in place,
keeping their ids while their roles exist; a member the user edited or
deleted is detached, and the building leaves its role alone from then on.
Local coordinates: x across the span (from the first column line), y
along the building (frame k at k * bay_spacing), mapped to plan
through origin and rotation_deg.
Items: MAX_MEMBERS · MISSING_SECTION · SPAN · EAVE_HEIGHT · SLOPE · BAYS · BAY_SPACING · SPACING · DEFAULT_SPAN · DEFAULT_EAVE_HEIGHT · DEFAULT_SLOPE · DEFAULT_BAYS · DEFAULT_BAY_SPACING · DEFAULT_SECONDARY_SPACING · FrameRoof · RoleKind · MemberRole · Secondary · FrameMember · SteelBuilding · section_box · host_type
MAX_MEMBERSpub const MAX_MEMBERS: usize
Most members one building makes; the layout stops there.
MISSING_SECTIONpub const MISSING_SECTION: f64
The width and depth of a type whose section cannot be read, meters.
SPANpub const SPAN: RangeInclusive<f64>
EAVE_HEIGHTpub const EAVE_HEIGHT: RangeInclusive<f64>
SLOPEpub const SLOPE: RangeInclusive<f64>
BAYSpub const BAYS: RangeInclusive<u32>
BAY_SPACINGpub const BAY_SPACING: RangeInclusive<f64>
SPACINGpub const SPACING: RangeInclusive<f64>
Purlin and girt spacing.
DEFAULT_SPANpub const DEFAULT_SPAN: f64
DEFAULT_EAVE_HEIGHTpub const DEFAULT_EAVE_HEIGHT: f64
DEFAULT_SLOPEpub const DEFAULT_SLOPE: f64
DEFAULT_BAYSpub const DEFAULT_BAYS: u32
DEFAULT_BAY_SPACINGpub const DEFAULT_BAY_SPACING: f64
DEFAULT_SECONDARY_SPACINGpub const DEFAULT_SECONDARY_SPACING: f64
FrameRoofpub enum FrameRoof
The roof of the frames: two rafters meeting at mid-span, or one rising
toward x = span.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
GableMonoMethods
pub const ALL: [FrameRoof; 2]pub fn code(self) -> &'static strpub fn from_code(code: &str) -> Option<Self>RoleKindpub enum RoleKind
What a member is in its building.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize
Variants
ColumnRafterPurlinGirtMethods
pub const ALL: [RoleKind; 4]MemberRolepub struct MemberRole
A member’s place: its kind, its frame (columns, rafters) or bay
(purlins, girts), and its index there (girts: side * 1000 + row).
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize
Fields
kind: RoleKindframe: u16index: u16Methods
pub fn fits(self, kind: &ElementKind) -> bool
Whether an element of kind can fill this role: a column for
columns, a beam for the rest.
pub fn key(self) -> RoleKey
Its key for the shared member-host code (same order as the role).
pub fn from_key(key: RoleKey) -> Option<Self>
Secondarypub struct Secondary
Purlins or girts: their beam type and the distance between lines (purlins: along the rafter’s plan run; girts: up the wall).
Traits: Debug, Clone, Copy, PartialEq, Serialize, Deserialize
Fields
type_id: ElementTypeIdspacing: f64FrameMemberpub struct FrameMember
A member the building manages.
Traits: Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize
Fields
role: MemberRoleid: ElementIdSteelBuildingpub struct SteelBuilding
Traits: Debug, Clone, PartialEq, Serialize, Deserialize, MemberHost
Fields
origin: DVec2
Plan point of the first frame’s left column.
rotation_deg: f64
Turn of the local x axis (across the span), degrees counter-clockwise.
span: f64
Column axis to column axis, meters.
eave_height: f64
Column top above the level (the rafters’ underside at the column axis), meters.
slope_percent: f64
Roof slope, percent.
roof: FrameRoofbays: u32
Bays between frames (frames = bays + 1).
bay_spacing: f64
Frame to frame, meters.
column_type: ElementTypeIdrafter_type: ElementTypeIdpurlins: Option<Secondary>girts: Option<Secondary>members: Vec<FrameMember>
The members it manages, by role.
detached: Vec<MemberRole>
Roles the user took over (edited or deleted members): not made again.
Methods
pub fn new(column_type: ElementTypeId, rafter_type: ElementTypeId, secondary: Option<ElementTypeId>) -> Self
A building with the default parameters at the origin; secondary
gives purlins and girts of that beam type.
pub fn check(&self) -> Result<(), String>
Whether every number is in its range (the first one that is not, named).
pub fn check_types(&self, project: &Project) -> Result<(), String>
Whether the column type is a column type and the others beam types.
pub fn reset_out_of_range(&mut self) -> usize
Put every out-of-range number back to its default; returns how many.
pub fn type_ids(&self) -> impl Iterator<Item = ElementTypeId> + '_
The member types it uses.
pub fn length(&self) -> f64
Frame line to frame line, meters.
pub fn to_plan(&self, local: DVec2) -> DVec2
A local point in plan.
pub fn footprint(&self) -> [DVec2; 4]
The column lines’ rectangle in plan, counter-clockwise from the origin.
pub fn transform(&mut self, t: &PlanTransform)
Move, turn or mirror it. A mirror flips the local frame’s handedness, so the far gable’s corner becomes the origin (the frames run the other way and the footprint stays where the mirror puts it).
pub fn layout(&self, project: &Project) -> Vec<(MemberRole, ElementTypeId, ElementKind)>
Its members: role, type and element, in a fixed order (columns,
rafters, purlins, girts), at most MAX_MEMBERS. Empty when a
number is out of range.
section_boxpub fn section_box(project: &Project, type_id: ElementTypeId) -> (f64, f64)
The width (across) and depth (up) of a column or beam type’s section
box, MISSING_SECTION each when it cannot be read.
host_typepub fn host_type(id: ElementTypeId, name: String) -> ElementType
The type a project gets with its first steel building.
cc_core::structural_materialcrates/cc_core/src/structural_material.rs
The structural material of a column or beam type: concrete, steel (rolled or cold-formed) or timber. It comes from the type’s profile, else from the type’s own material (a legacy section that makes no outline).
Items: StructuralMaterial
StructuralMaterialpub enum StructuralMaterial
What a column or beam is made of, as the Structure tab groups its tools.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Default
Variants
ConcreteSteelTimberMethods
pub const ALL: [StructuralMaterial; 3]pub fn code(self) -> &'static strpub fn from_code(c: &str) -> Option<Self>pub fn key(self) -> &'static str
The i18n key of its name (shared with the profile materials).
pub fn of_profile(m: ProfileMaterial) -> Self
The structural material of a profile’s: cold-formed steel is steel.
cc_core::structural_profilecrates/cc_core/src/structural_profile.rs
Structural profiles: the cross-sections of columns, beams and framing
members as named project objects (Project::profiles). A profile is a
standard parametric shape (rolled, welded, cold-formed, timber or
concrete) or a parametric sketch (ParamSketch). Lengths are meters.
Outlines are laid out as in steel tables: the depth along +y, the web of
an I or channel vertical, the flanges of a channel and the legs of an
angle pointing to +x; centered on the bounding box.
Items: ARC_SEGMENTS · MAX_POINTS · MAX_OPENINGS · MIN_THICKNESS · MAX_SIZE · MAX_NAME · MAX_DESCRIPTION · MAX_PROFILES · ProfileMaterial · ProfileShape · MAX_SKETCH_PARAMS · ParamSketch · SectionOutline · ProfileError · CatalogRef · ProfileDef
ARC_SEGMENTSpub const ARC_SEGMENTS: usize
Segments of an arc that turns a quarter circle (fillets use this many).
MAX_POINTSpub const MAX_POINTS: usize
Most points in an outline, holes included.
MAX_OPENINGSpub const MAX_OPENINGS: usize
Most holes in an outline.
MIN_THICKNESSpub const MIN_THICKNESS: f64
Smallest dimension, meters.
MAX_SIZEpub const MAX_SIZE: f64
Largest dimension, meters.
MAX_NAMEpub const MAX_NAME: usize
Longest profile name, characters.
MAX_DESCRIPTIONpub const MAX_DESCRIPTION: usize
Longest description, characters.
MAX_PROFILESpub const MAX_PROFILES: usize
Most profiles in a project (a crafted file).
ProfileMaterialpub enum ProfileMaterial
What a profile is made of; decides the material a type made for it gets.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
SteelColdFormedTimberConcreteMethods
pub const ALL: [ProfileMaterial; 4]pub fn code(self) -> &'static strpub fn from_code(c: &str) -> Option<Self>pub fn key(self) -> &'static str
The i18n key of its name.
pub fn material_class(self) -> crate::MaterialClass
The MaterialClass a type made for this profile gets its material from.
ProfileShapepub enum ProfileShape
A standard parametric cross-section; every field is a length in meters
except ColdZ::angle (degrees).
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Variants
I { d: f64, bf: f64, tw: f64, tf: f64, r: f64, }
Rolled or welded I/H: depth, flange width, web and flange thickness, root radius.
IAsym { d: f64, bf_top: f64, tf_top: f64, bf_bot: f64, tf_bot: f64, tw: f64, }
I with different flanges.
Channel { d: f64, bf: f64, tw: f64, tf: f64, r: f64, }
Channel, web on the left, flanges to +x.
T { d: f64, bf: f64, tw: f64, tf: f64, r: f64, }
T with the flange on top.
Angle { h: f64, b: f64, t: f64, r: f64, }
Angle, legs to +x (b) and +y (h).
ColdU { d: f64, bf: f64, t: f64, ri: f64, }
Cold-formed channel without lips; ri is the inner bend radius.
ColdLippedU { d: f64, bf: f64, lip: f64, t: f64, ri: f64, }
Cold-formed channel with lips.
ColdZ { d: f64, bf: f64, lip: f64, t: f64, ri: f64, angle: f64, }
Cold-formed Z; angle turns the lips from the flange (90 = square).
ColdHat { d: f64, bf: f64, lip: f64, t: f64, ri: f64, }
Cold-formed hat (omega): crown width, brims of length lip.
RectTube { h: f64, b: f64, t: f64, ro: f64, }RoundTube { d: f64, t: f64, }Rect { b: f64, h: f64, chamfer: f64, }
Solid rectangle (timber or concrete), optionally chamfered.
Round { d: f64, }ConcreteT { h: f64, bf: f64, hf: f64, bw: f64, }
Concrete T beam, flange on top.
ConcreteL { h: f64, bf: f64, hf: f64, bw: f64, }
Concrete L beam, flange on top to +x.
AnnularSector { r_in: f64, r_out: f64, sweep: f64, }
An annular sector: the part of a ring between the radii r_in (0
for a circular sector) and r_out turning by sweep degrees,
symmetric about the Y axis with its outer face up, as the piece of a
cylindrical wall a column continues.
Sketch(ParamSketch)Methods
pub fn from_column_section(s: ColumnSection) -> ProfileShape (in cc_core::profiles_project)
The profile shape of a legacy column section (width along x,
depth along y).
pub fn from_beam(width: f64, height: f64, shape: SectionShape) -> ProfileShape (in cc_core::profiles_project)
The profile shape of a legacy width x height section filled by shape.
pub fn close_to(&self, other: &ProfileShape, tol: f64) -> bool (in cc_core::profiles_project)
Whether two shapes are the same kind with every parameter within
tol (meters; degrees for angles), so float noise from a file does
not make a new profile. Sketches compare exactly.
pub fn is_cold_formed(&self) -> bool (in cc_core::profiles_project)
Whether this is a cold-formed shape (bent from sheet).
pub fn has_arcs(&self) -> bool (in cc_core::profiles_project)
Whether the outline has arcs: a round, a radius above zero, or a sketch with arc or ellipse segments.
pub const MAX_SECTOR_SWEEP: f64
Largest turn of an annular sector, degrees.
pub fn sector_center(&self) -> Option<DVec2>
The center of an annular sector’s ring in the section’s own frame
(the outline is centered on its bounding box): below the origin on
the Y axis. None for other shapes and invalid values.
pub const CODES: &'static [&'static str]
Codes of the shapes, in the order a picker lists them.
pub fn code(&self) -> &'static strpub fn default_for(code: &str) -> Option<ProfileShape>
A shape with sensible values for code.
pub fn params(&self) -> Vec<(String, f64)>
The named values of the shape, in declaration order.
pub fn set_param(&mut self, name: &str, v: f64) -> bool
Sets a value by name; false when the shape has none of that name. The value is checked when the outline is built.
pub fn outline(&self) -> Result<SectionOutline, ProfileError>
The outline, centered on its bounding box.
pub fn area(&self) -> Result<f64, ProfileError>
The section’s area, exact for its arcs: the areas of outlines with
arcs of ARC_SEGMENTS and twice as many chords, extrapolated (the
chords’ error falls with the square of their number), so a circle or a
root radius is not counted short. Sketches give their outline’s area.
MAX_SKETCH_PARAMSpub const MAX_SKETCH_PARAMS: usize
Most parameters of a sketch.
ParamSketchpub struct ParamSketch
A parametric sketch: an outline and openings whose points are expressions over named numeric parameters (meters).
Traits: Debug, Clone, PartialEq, Default, Serialize, Deserialize
Fields
params: Vec<ComponentParam>outline: Vec<ProfilePoint>openings: Vec<Vec<ProfilePoint>>Methods
pub fn square(b: f64, h: f64) -> ParamSketch
A centered b by h rectangle with parameters b and h.
pub fn resolve(&self) -> Result<SectionOutline, ProfileError>
The outline, wound and centered on its bounding box.
SectionOutlinepub struct SectionOutline
An outline: outer runs counter-clockwise, holes clockwise.
Traits: Debug, Clone, PartialEq, Default
Fields
outer: Vec<DVec2>holes: Vec<Vec<DVec2>>Methods
pub fn properties(&self, density: f64) -> SectionProperties (in cc_core::section_props)
The section’s properties for a material of density kg/m³ (a
non-finite or negative density counts as 0). A degenerate outline
gives all zeros.
pub fn bbox(&self) -> (DVec2, DVec2)
Corners of the bounding box of the outer loop.
ProfileErrorpub enum ProfileError
Traits: Debug, Clone, PartialEq, Error
Variants
Value(&'static str)Range(&'static str)DoesNotFit(String)Sketch(String)TooBigCatalogRefpub struct CatalogRef
Where a profile comes from in a manufacturer’s or standard’s table.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
series: Stringdesignation: StringProfileDefpub struct ProfileDef
A named profile of the project.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
id: ProfileIduid: Uidname: Stringmaterial: ProfileMaterialshape: ProfileShapecatalog: Option<CatalogRef>description: StringMethods
pub fn repair(&mut self, id: ProfileId) -> usize (in cc_core::profiles_project)
Fix what a hostile file can break without dropping the profile: the id (it must be the map key), the name and a missing uid. Returns the number of fixes.
pub fn outline(&self) -> Result<SectionOutline, ProfileError>
cc_core::suncrates/cc_core/src/sun.rs
The sun of a view: where it stands in the sky for a date, a time and the
project’s site, and the settings each view keeps to place it.
A view that takes a sun (ViewKind::takes_sun: plans, ceiling plans,
3D views, elevations and sections) may keep SunSettings in
View::sun: a SunMode that is either a still moment, a study
over one day or several days (a list of SunFrames, the current one
chosen by SunSettings::frame), or a lighting direction given by hand.
SunSettings::state (or Project::sun_state for a view) resolves
them into a SunState: the sun’s azimuth and altitude and the unit
vector towards it in project coordinates, turned by the site’s true
north (SunSite, from crate::site::SiteLocation).
The solar position uses the usual public low-precision formulas: the
sun’s mean longitude and anomaly in Julian centuries from J2000 give its
apparent longitude, the declination and the equation of time (good to
about a hundredth of a degree and a few seconds for centuries around
2000), the true solar time gives the hour angle, and spherical
trigonometry the altitude and azimuth. No atmospheric refraction is applied to positions; sunrise and
sunset are when the sun’s upper limb meets the horizon, its center at
HORIZON_ALTITUDE (refraction and the sun’s radius together).
Named SunPresets live in Project::sun_presets, tracked as
project settings (EditCtx::sun_presets_mut).
Dates and times are local to the site: a date is a SunDate and a
time of day is minutes after local midnight (u16, 0..=MAX_MINUTE
in settings; f64 in frames and results). Everything is deterministic:
nothing reads the clock.
Items: MAX_MINUTE · MAX_FRAMES · MAX_DAYS · MAX_PRESETS · MAX_PRESET_NAME · MIN_YEAR · MAX_YEAR · UTC_OFFSET_RANGE · HORIZON_ALTITUDE · CONVENTIONAL_AZIMUTH · conventional_altitude · SunDate · is_leap_year · days_in_month · SunPosition · Daylight · solar_position · solar_noon · daylight · day_path · sun_direction · SunSite · SunInterval · SunMode · SunFrame · SunSettings · SunState · view_forward · camera_forward · SunPreset · clean_preset_name · repair_presets
MAX_MINUTEpub const MAX_MINUTE: u16
The last minute of a day (23:59).
MAX_FRAMESpub const MAX_FRAMES: usize
Most frames a study yields; longer ones are cut.
MAX_DAYSpub const MAX_DAYS: usize
Most days a study walks through (a bound for studies spanning polar nights).
MAX_PRESETSpub const MAX_PRESETS: usize
Most presets a project keeps.
MAX_PRESET_NAMEpub const MAX_PRESET_NAME: usize
Longest preset name, characters.
MIN_YEARpub const MIN_YEAR: i32
Earliest and latest year of a SunDate.
MAX_YEARpub const MAX_YEAR: i32
UTC_OFFSET_RANGEpub const UTC_OFFSET_RANGE: std::ops::RangeInclusive<f64>
Accepted offsets from UTC, hours.
HORIZON_ALTITUDEpub const HORIZON_ALTITUDE: f64
Altitude of the sun’s center, degrees, when its upper limb touches the horizon (34’ of refraction plus 16’ of radius).
CONVENTIONAL_AZIMUTHpub const CONVENTIONAL_AZIMUTH: f64
The conventional sun’s azimuth relative to the view: behind the viewer, to the left (clockwise from the look direction).
conventional_altitudepub fn conventional_altitude() -> f64
The conventional sun’s altitude, degrees: that of
a cube’s diagonal, atan(1 / √2) (about 35.26°).
SunDatepub struct SunDate
A calendar date (proleptic Gregorian), local to the site.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize, Default, std::fmt::Display
Fields
year: i32month: u8
1 to 12.
day: u8
1 to the month’s length.
Methods
pub fn new(year: i32, month: u8, day: u8) -> Option<SunDate>
The date, when it is a real one within MIN_YEAR..=MAX_YEAR.
pub fn is_valid(self) -> bool
A real date within MIN_YEAR..=MAX_YEAR.
pub fn clamped(self) -> SunDate
The nearest valid date: year, month and day each brought into range.
pub fn parse(text: &str) -> Option<SunDate>
Reads an ISO YYYY-MM-DD date (surrounding spaces ignored).
pub fn iso(self) -> String
The ISO YYYY-MM-DD form (the same as to_string).
pub fn days_in_year(self) -> u16
Days in the date’s year: 365 or 366.
pub fn day_of_year(self) -> u16
The day of the year, 1 for January 1 (of the clamped date).
pub fn to_days(self) -> i64
Days from 1970-01-01 (negative before it).
pub fn from_days(days: i64) -> Option<SunDate>
The date days after 1970-01-01, when its year is in range.
pub fn next_day(self) -> Option<SunDate>
The next day (None past MAX_YEAR).
pub fn add_days(self, n: i64) -> Option<SunDate>
The date n days later (earlier when negative), when in range.
pub fn add_weeks(self, n: i64) -> Option<SunDate>
The date n weeks later, when in range.
pub fn add_months(self, n: i64) -> Option<SunDate>
The date n months later, its day cut to the new month’s length
(January 31 plus one month is February 28 or 29), when in range.
is_leap_yearpub fn is_leap_year(year: i32) -> bool
Whether year has a February 29.
days_in_monthpub fn days_in_month(year: i32, month: u8) -> u8
Days in month (1 to 12) of year; 0 for a month out of range.
SunPositionpub struct SunPosition
Where the sun stands in the sky, degrees.
Traits: Debug, Clone, Copy, PartialEq, Default
Fields
azimuth: f64
Clockwise from true north seen from above (0 north, 90 east), in [0, 360).
altitude: f64
Above the horizon (negative below it), in [-90, 90]; no refraction.
Daylightpub enum Daylight
When the sun rises and sets on a day.
Traits: Debug, Clone, Copy, PartialEq
Variants
Normal { sunrise: f64, sunset: f64 }
Sunrise and sunset, minutes after local midnight (may fall outside
0..1440 when the time zone is far from the longitude).
PolarDay
The sun never sets.
PolarNight
The sun never rises.
solar_positionpub fn solar_position(latitude: f64, longitude: f64, utc_offset_hours: f64, date: SunDate, minutes: f64) -> SunPosition
The sun’s position seen from latitude, longitude (degrees, WGS 84,
north and east positive) on date at minutes after local midnight,
local time being utc_offset_hours east of UTC. Azimuth clockwise from
true north, altitude without atmospheric refraction. Inputs that are not
numbers or out of range are brought into range; nothing returns NaN.
solar_noonpub fn solar_noon(longitude: f64, utc_offset_hours: f64, date: SunDate) -> f64
Local solar noon on date at longitude, minutes after local midnight.
daylightpub fn daylight(latitude: f64, longitude: f64, utc_offset_hours: f64, date: SunDate) -> Daylight
Sunrise and sunset on date at the site (see Daylight).
day_pathpub fn day_path(site: &SunSite, date: SunDate, step_minutes: f64) -> Vec<(f64, SunPosition)>
The sun’s path over date at the site, every step_minutes (1 to
1440; 15 when not a number) from 00:00 to 24:00, both included, for sun
path diagrams: callers keep the part above the horizon. At most 1441 points.
sun_directionpub fn sun_direction(north: DVec2, azimuth: f64, altitude: f64) -> DVec3
The unit vector from the model towards the sun, in project
coordinates, for a sun at azimuth (clockwise from true north) and
altitude degrees, true north being north in plan.
SunSitepub struct SunSite
What the sun needs of the project’s site.
Traits: Debug, Clone, Copy, PartialEq, Default
Fields
latitude: f64
Degrees, north positive.
longitude: f64
Degrees, east positive.
utc_offset: f64
Local time’s offset from UTC, hours east.
north: DVec2
True north in plan (unit vector).
known: bool
The project has a site location (otherwise the values above are the defaults: the equator at Greenwich, north up).
Methods
pub fn position(&self, date: SunDate, minutes: f64) -> SunPosition
The sun’s position here on date at minutes after local midnight.
pub fn daylight(&self, date: SunDate) -> Daylight
Sunrise and sunset here on date.
pub fn north_dir(&self) -> DVec2
True north as a unit vector (+Y when not one).
SunIntervalpub enum SunInterval
The step between frames of a sun study.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
Minutes15Minutes30Minutes45HourDayWeekMonthMethods
pub const ALL: [SunInterval; 7]pub const SUB_DAY: [SunInterval; 4]
The steps within a day: the only ones a single-day study takes.
pub fn key(self) -> &'static str
Translation key of its name.
pub fn name(self) -> &'static str
The name commands use: minutes_15, minutes_30, minutes_45,
hour, day, week or month.
pub fn from_name(name: &str) -> Option<SunInterval>
The interval called name (any case; spaces and - read as _).
pub fn minutes(self) -> Option<f64>
Minutes between frames for a step within a day; None for days, weeks and months.
pub fn is_sub_day(self) -> bool
A step within a day (what a single-day study accepts).
SunModepub enum SunMode
How a view places its sun.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize, Default
Variants
Still { #[serde(default)] date: SunDate, #[serde(default = "default_time")] time: u16, }
One moment.
SingleDay { #[serde(default)] date: SunDate, #[serde(default = "day_from")] from: u16, #[serde(default = "day_to")] to: u16, #[serde(default)] sunrise_to_sunset: bool, #[serde(default)] interval: SunInterval, }
Frames over one day, from from to to (or sunrise to sunset)
every interval (a step within the day).
MultiDay { #[serde(default = "year_start")] from_date: SunDate, #[serde(default = "year_end")] to_date: SunDate, #[serde(default = "noon")] from: u16, #[serde(default = "noon")] to: u16, #[serde(default)] sunrise_to_sunset: bool, #[serde(default = "month_interval")] interval: SunInterval, }
Frames over several days: with a step within a day, every day from
from_date to to_date as a single-day study; with a day, week or
month, one frame per step at from (at 12:00 with sunrise_to_sunset).
Lighting { #[serde(default = "light_azimuth")] azimuth: f64, #[serde(default = "light_altitude")] altitude: f64, #[serde(default = "yes")] relative_to_view: bool, }
A light from a direction given by hand, with no date.
Methods
pub const NAMES: [&'static str; 4]
The names commands use, in display order.
pub fn name(&self) -> &'static str
The name commands use: still, single_day, multi_day or lighting.
pub fn key(&self) -> &'static str
Translation key of its name.
pub fn from_name(name: &str) -> Option<SunMode>
A mode of the kind called name (any case; spaces and - read as
_) with its default values.
pub fn conventional() -> SunMode
The conventional sun of façade drawings: a light relative to the
view whose rays run along the diagonal of a cube, coming from in
front of the view, over the viewer’s left shoulder (CONVENTIONAL_AZIMUTH
from the look direction, conventional_altitude high), so a
shadow falls down and to the right of what casts it, as far down
and as far across as its depth in front of the face that catches it.
pub fn is_conventional(&self) -> bool
Whether this is the conventional sun (within a thousandth of a degree).
pub fn interval(&self) -> Option<SunInterval>
The step of a study (None for a still sun or lighting).
pub fn is_dated(&self) -> bool
Whether the mode places the sun by date and time (all but lighting).
pub fn is_valid(&self) -> bool
Whether the mode’s values are all in range (see Self::repair).
pub fn repair(&mut self) -> usize
Bring every value into range: dates valid and in order, times
within the day and from <= to, a single day’s step within the
day (else hourly), a light’s azimuth in [0, 360) and altitude in
0..=90 (defaults when not numbers). Returns how many it fixed.
SunFramepub struct SunFrame
One moment of a sun study.
Traits: Debug, Clone, Copy, PartialEq
Fields
date: SunDateminutes: f64
Minutes after local midnight.
SunSettingspub struct SunSettings
A view’s sun: how it is placed, the frame of a study shown, and what is drawn.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize, Default
Fields
mode: SunModeframe: u32
The frame of a study shown (clamped to the frames when read).
show_path: bool
Draw the sun path diagram.
shadows: bool
Cast shadows: in 3D views, and in plans, elevations and sections drawn in the shaded, consistent colors or textures style.
ground: Option<LevelId>
The level whose plane receives the shadows (None: the lowest level,
as the rendered image stands the model on it).
Methods
pub fn default_for(kind: &ViewKind) -> SunSettings
The sun a view of kind starts with when it is given one: the
conventional sun casting shadows for
elevations and sections (the façade drawing’s convention), the
default for the others.
pub fn frames(&self, site: &SunSite) -> Vec<SunFrame>
The frames of the study at site, in time order, at most
MAX_FRAMES: one for a still sun; a single day from from to
to (or sunrise to sunset) every interval, the end included even
off the step (a polar night falls back to one frame at 12:00);
several days as described at SunMode::MultiDay (dates stepped
from from_date up to to_date, which is not added when off the
step; no frames at all fall back to 12:00 on from_date); none for
lighting.
pub fn current_frame(&self, site: &SunSite) -> Option<SunFrame>
The frame shown: Self::frame clamped to the frames (None for lighting).
pub fn is_valid(&self) -> bool
Whether every value is in range (see SunMode::repair).
pub fn repair(&mut self) -> usize
Bring the mode’s values into range; returns how many it fixed. (A missing ground level is the project’s to check.)
pub fn state(&self, site: &SunSite, view_forward: Option<DVec2>) -> SunState
Where the sun stands for these settings at site. Dated modes take
the current frame’s solar position. Lighting takes its azimuth from
true north, or, relative_to_view, clockwise (seen from above) from
view_forward, the plan direction the viewer looks along (0: the
sun ahead of the viewer, 135: behind and to the right), which is
project +Y when None or not a direction.
pub fn follows_view(&self) -> bool
Whether the sun is placed relative to the direction the viewer
looks along (lighting relative_to_view): it turns with the view.
SunStatepub struct SunState
Where a view’s sun stands, resolved.
Traits: Debug, Clone, Copy, PartialEq
Fields
azimuth: f64
Degrees clockwise from true north, in [0, 360).
altitude: f64
Degrees above the horizon.
direction: DVec3
Unit vector from the model towards the sun, project coordinates.
frame: Option<SunFrame>
The study frame shown (None for lighting).
above_horizon: bool
The sun is above the horizon (it lights and casts shadows).
view_forwardpub fn view_forward(view: &View) -> Option<DVec2>
The plan direction a view looks along, for a sun placed relative to
it: a 3D view’s camera heading, an elevation’s or section’s look
direction; None for plans and other views.
camera_forwardpub fn camera_forward(camera: &crate::CameraState) -> Option<DVec2>
The plan direction a 3D camera looks along (its heading); None when
its yaw is not a number. A live camera the viewer turns places a sun
relative to the view as the stored one does in view_forward.
SunPresetpub struct SunPreset
A named sun setting the views can take.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
name: Stringmode: SunModeclean_preset_namepub fn clean_preset_name(name: &str) -> Option<String>
A preset name: trimmed, cut to MAX_PRESET_NAME characters; None when empty.
repair_presetspub fn repair_presets(presets: &mut Vec<SunPreset>) -> usize
Clean names, drop presets with no name or a name already taken, past
MAX_PRESETS, and repair their modes; returns how many it fixed.
cc_core::sweepcrates/cc_core/src/sweep.rs
Sweeps and blends of component pieces.
A sweep carries a closed profile along an open path drawn on one of the
sketch planes: the profile’s u runs to the left of the path (in the
path’s plane) and its v along the plane’s normal, and at each corner
of the path the section is mitered (it lies in the plane that bisects
the corner). A blend joins two closed outlines drawn on the same sketch
plane at two positions along its normal (a bottom and a top), the faces
between them ruled from points spaced evenly around each outline.
Both come out as closed meshes with outward faces, in the component’s
frame.
Items: path · sweep_closed · sweep · counter_clockwise · blend_section · blend · volume · eval_field
pathpub fn path(points: &[ProfilePoint], lookup: &dyn Fn(&str) -> Option<f64>) -> Result<Vec<DVec2>, ProfileError>
An open path of lines, arcs and parts of ellipses (a point’s radius
makes the segment to the next point an arc, positive bulging to the
right of travel; its ellipse a part of that ellipse).
sweep_closedpub fn sweep_closed(plane: SketchPlane, path: &[DVec2], offset: f64, profile: &[DVec2]) -> Result<Vec<Vec<DVec3>>, ProfileError>
The solid of a counter-clockwise profile carried around the closed
path (on plane, placed offset along its normal): mitered at every
corner, the last point joined back to the first, with no end caps.
sweeppub fn sweep(plane: SketchPlane, path: &[DVec2], offset: f64, profile: &[DVec2]) -> Result<Vec<Vec<DVec3>>, ProfileError>
The solid of a counter-clockwise profile carried along path (on
plane, placed offset along its normal), mitered at the corners.
counter_clockwisepub fn counter_clockwise(outline: &[DVec2]) -> Vec<DVec2>
outline in counter-clockwise order.
blend_sectionpub fn blend_section(bottom: &[DVec2], top: &[DVec2], t: f64) -> Vec<DVec2>
The section of blend between counter-clockwise bottom and top at
t (0 at the bottom, 1 at the top): its outlines resampled alike and
joined point by point, as the blend’s faces are.
blendpub fn blend(plane: SketchPlane, bottom: &[DVec2], top: &[DVec2], offset: f64, depth: f64) -> Result<Vec<Vec<DVec3>>, ProfileError>
The solid between a counter-clockwise bottom outline on plane at
offset and a top outline depth farther along its normal.
volumepub fn volume(faces: &[Vec<DVec3>]) -> f64
Signed volume of a closed mesh (for tests and checks).
eval_fieldpub fn eval_field(field: &'static str, text: &str, lookup: &dyn Fn(&str) -> Option<f64>) -> Result<f64, ProfileError>
Evaluate an expression of a piece, naming the field on failure.
cc_core::template_speccrates/cc_core/src/template_spec.rs
The sizes and names that differ between the metric and the imperial
templates. crate::Project::from_template_system builds both from the
same code and reads only these tables, so the two templates have the same
types, views and ids, in the same order.
Lengths are meters, except annotation sizes (paper millimeters); imperial
values are written in inches or feet and kept exact multiples of 1/16”.
Items: Sized1 · Sized2 · Sized3 · SizedLibraryType · TemplateSpec · Defaults
Sized1pub(crate) type Sized1 = (&'static str, f64)
A name key and a value.
Sized2pub(crate) type Sized2 = (&'static str, f64, f64)
A name key and two values.
Sized3pub(crate) type Sized3 = (&'static str, f64, f64, f64)
A name key and three values.
SizedLibraryTypepub(crate) type SizedLibraryType = (&'static str, &'static str, &'static [Sized1])
A library type whose name states a size: the library’s name key, the key used instead, and the parameters (keys) set to that size.
TemplateSpecpub(crate) struct TemplateSpec
Fields
system: MeasurementSystem
The system the template measures in.
first_level: f64
Elevation of the upper level.
masonry: [Sized2; 2]
The two masonry walls: key, plaster on each side, masonry core.
partition: Sized1
The gypsum partition: key, thickness.
doors: [Sized2; 2]
The swing doors: key, width, height.
windows: [Sized3; 2]
The fixed windows: key, width, height, sill.
operable: [Sized3; 4]
The operable windows (side-hung, double side-hung, top-hung, sliding): key, width, height, sill.
slab: Sized2
The floor slab: key, screed, concrete.
ceiling: f64
Thickness of the gypsum ceiling.
column_rect: Sized1
Square concrete column: key, side.
column_round: Sized1
Round concrete column: key, diameter.
beam: Sized2
Concrete beam: key, width, height.
column_steel_h: Sized3
Steel H column: key, width and depth, web, flange.
column_steel_tube: Sized2
Steel square tube column: key, side, wall.
beam_steel_i: (&'static str, [f64; 4])
Steel I beam: key, (width, height, web, flange).
rebars: [Sized1; 5]
Reinforcing bars: key, diameter.
footings: [Sized3; 3]
Pad, strip and slab footings: key, width, length, thickness.
stair: Sized3
Stair: key, width, maximum riser, tread.
railing: Sized2
Railing: key, height, post spacing.
pipes: [Sized1; 7]
Supply pipes, then drain pipes: key, diameter.
conduits: [Sized1; 3]
Conduits: key, diameter.
grid: Sized1
Grid: key, bubble size (paper mm).
dimension: Sized1
Linear dimension: key, text size (paper mm).
texts: [Sized1; 2]
Texts: key, size (paper mm).
roof: (f64, f64)
Roof layers: tiles, wood.
french_doors: [Sized2; 2]
French doors (one leaf, two leaves): key, width, height.
plan_scale: u32
Scale of plans, ceiling plans and the legend.
model_scale: u32
Scale of the 3D view and the elevations.
sheet: (SheetSize, [DVec2; 2])
The sheet’s paper and where the plan and the 3D view sit on it.
library: &'static [SizedLibraryType]
Library types whose name states a size: the library’s key, the key used instead, and the parameters (keys) set to that size.
Methods
pub(crate) fn of(system: MeasurementSystem) -> &'static TemplateSpecpub(crate) fn library_key<'a>(&self, key: &'a str) -> &'a str
The key a library name is read from in this system.
pub(crate) fn sized_library(&self, n: &dyn Fn(&str) -> String, mut library: Vec<(String, String, crate::ComponentDef)>) -> Vec<(String, String, crate::ComponentDef)>
library (component, type name, definition, as the component
library makes it with names from n) with the types whose name
states a size given that size in this system; in imperial projects
the other sizes rounded to whole inches (feet and half feet above a
foot, see crate::units::round_imperial).
Defaultspub struct Defaults
Sizes and rules that commands and tools give what they create outside
the template, per measurement system (meters; see Defaults::of and
crate::Project::defaults). The metric values are the ones these
places always used; the imperial ones are round customary sizes.
Traits: Debug, Clone, PartialEq
Fields
story: f64
Story height when there is no level above (walls, columns, stairs, ramps, masses, shafts, roofs).
ceiling: f64
Ceiling height when there is no level above (conduits, cable trays, ceiling lights, air terminals).
ceiling_offset: f64
Height of new ceilings above their level.
ramp: (&'static str, f64, f64)
The ramp type made with the first ramp: name key, width, slab.
ramp_rules: RampRules
The rules of new ramp types.
stair_rules: StairRules
The rules of the template’s stair type.
flights: (f64, f64, f64)
New stairs and ramps: the gap between U-shaped flights, the inner radius of a spiral stair and of a spiral ramp.
baseboard: (&'static str, f64, f64)
The baseboard made with the first sweep: name key, thickness, height.
tray: (f64, f64)
The cable tray type made with the first tray: width, height.
tray_clearance: f64
How far a new cable tray runs under the level above.
conductor: (&'static str, f64)
The conductor type made with the first conductor: name key (with a
diameter placeholder), diameter.
door: [f64; 5]
New door types: width of one leaf, of two leaves, height, French door height, French door bottom rail.
pipes: (f64, f64)
Elevation of new supply pipes and of new drains above their level.
drain_fall: (f64, f64, f64)
Least fall of a horizontal drain: up to the first diameter the second slope, larger ones the third.
devices: [f64; 6]
Mounting height of new outlets, switches, wall lights, boards, data outlets and racks.
terrain: (f64, f64)
New terrain types: contour interval; new terrains: base depth.
curtain: (f64, f64, f64, f64)
New curtain wall types: grid spacing, mullion width and depth, glass.
rebar: [f64; 5]
Rebar: cover, stirrup spacing, and the diameters of the bar types sought for main bars, top bars and stirrups.
Methods
pub fn of(system: MeasurementSystem) -> &'static Defaultscc_core::title_blockcrates/cc_core/src/title_block.rs
Title blocks: components of kind ComponentKind::TitleBlock whose 2D
pieces (ComponentDef::sheet) draw a whole sheet (border, title
block, logo) in paper millimeters, origin at the paper’s bottom-left
corner. Expressions read the parameters and SHEET_WIDTH and
SHEET_HEIGHT; texts keep {fields} for the sheet to fill in.
Items: SHEET_WIDTH · SHEET_HEIGHT · MAX_SHEET_PIECES · MAX_STROKE_POINTS · MAX_SHEET_TEXT · MAX_SHEET_POINTS · DEFAULT_WEIGHT · MAX_TEXT_SIZE · STANDARD_KEY · standard · SheetItem · TextAnchor · SheetShape · MAX_NAME · SheetStroke · SheetText · SheetImage · SheetPieces · SheetNested · repair_def · MAX_FIELD_KEY · PROJECT_FIELD_PREFIX · project_field_name_ok · FieldPart · field_parts · rename_field_param · is_iso_date · parse_iso_date
SHEET_WIDTHpub const SHEET_WIDTH: &str
Name of the paper width (millimeters) in expressions.
SHEET_HEIGHTpub const SHEET_HEIGHT: &str
Name of the paper height (millimeters) in expressions.
MAX_SHEET_PIECESpub const MAX_SHEET_PIECES: usize
MAX_STROKE_POINTSpub const MAX_STROKE_POINTS: usize
MAX_SHEET_TEXTpub const MAX_SHEET_TEXT: usize
MAX_SHEET_POINTSpub const MAX_SHEET_POINTS: usize
Most points a title block’s strokes may have in all, once arcs are flattened.
DEFAULT_WEIGHTpub const DEFAULT_WEIGHT: f64
Pen width of a stroke without one, millimeters.
MAX_TEXT_SIZEpub const MAX_TEXT_SIZE: f64
Largest text height in millimeters (larger sizes are drawn at this one).
STANDARD_KEYpub const STANDARD_KEY: &str
Name key of the standard title block (component and type).
standardpub fn standard(n: &dyn Fn(&str) -> String) -> ComponentDef
The title block every sheet had before title blocks were components:
a border 10 mm in, and a 170 × 42 mm block in the bottom-right corner
with the project, sheet and client rows and the sheet number cell.
Captions are looked up by n (template keys tpl-tb-*).
SheetItempub struct SheetItem
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
name: Stringshape: SheetShapeTextAnchorpub enum TextAnchor
Where a text’s position sits: on the baseline at its start, middle or end, or at its center.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
LeftCenterRightMiddleSheetShapepub enum SheetShape
A 2D piece; every String is an expression in millimeters (degrees for rotations).
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Variants
Stroke { points: Vec<ProfilePoint>, #[serde(default)] closed: bool, #[serde(default, skip_serializing_if = "String::is_empty")] weight: String, #[serde(default, skip_serializing_if = "Option::is_none")] color: Option<[u8; 3]>, #[serde(default, skip_serializing_if = "Option::is_none")] fill: Option<[u8; 3]>, #[serde(default, skip_serializing_if = "is_solid")] pattern: crate::LinePattern, #[serde(default, skip_serializing_if = "Option::is_none")] hatch: Option<crate::PatternFill>, }
Lines and arcs: points run straight, or along an arc (radius) to the next.
Text { x: String, y: String, text: String, size: String, #[serde(default)] anchor: TextAnchor, #[serde(default, skip_serializing_if = "String::is_empty")] rotation: String, }
Fixed words and {fields}; line breaks start new lines.
Image { x: String, y: String, width: String, height: String, image: Arc<RasterImage> }
A picture filling the rectangle from (x, y) (its bottom-left corner).
Nested { component: String, x: String, y: String, #[serde(default, skip_serializing_if = "String::is_empty")] rotation: String, #[serde(default, skip_serializing_if = "String::is_empty")] scale: String, #[serde(default, skip_serializing_if = "std::ops::Not::not")] mirrored: bool, }
Another detail component placed inside this one (detail components
only): the component named component (with the parameter values
of its first type), its origin at (x, y), turned rotation
degrees counter-clockwise, sized by scale (empty for 1) and, when
mirrored, flipped across its own X axis first.
Methods
pub fn expressions_mut(&mut self) -> Vec<&mut String>
Every expression of the piece, for renaming parameters.
pub fn stroke(points: Vec<ProfilePoint>, closed: bool) -> SheetShape
A stroke through points with the default pen.
MAX_NAMEpub const MAX_NAME: usize
Most characters of a nested component’s name.
SheetStrokepub struct SheetStroke
Traits: Debug, Clone, PartialEq
Fields
item: usizepoints: Vec<DVec2>closed: boolweight: f64color: [u8; 3]fill: Option<[u8; 3]>pattern: crate::LinePatternhatch: Option<crate::PatternFill>SheetTextpub struct SheetText
Traits: Debug, Clone, PartialEq
Fields
item: usizeposition: DVec2text: String
As written: {fields} are filled in by the sheet.
size: f64anchor: TextAnchorrotation_deg: f64SheetImagepub struct SheetImage
Traits: Debug, Clone, PartialEq
Fields
item: usizecorner: DVec2
Bottom-left corner.
size: DVec2image: Arc<RasterImage>SheetPiecespub struct SheetPieces
Traits: Debug, Clone, PartialEq, Default
Fields
strokes: Vec<SheetStroke>texts: Vec<SheetText>images: Vec<SheetImage>nested: Vec<SheetNested>
Nested detail components (detail components only).
errors: Vec<(usize, PartError)>SheetNestedpub struct SheetNested
A nested detail component, resolved: where its frame goes.
Traits: Debug, Clone, PartialEq
Fields
item: usizecomponent: Stringposition: DVec2rotation_deg: f64scale: f64mirrored: boolrepair_defpub fn repair_def(def: &mut ComponentDef) -> usize
Keep a definition’s pieces to its kind and within the limits: title blocks keep only sheet pieces, other kinds none. Returns the fixes.
MAX_FIELD_KEYpub const MAX_FIELD_KEY: usize
Most bytes a field key may have (a longer {…} is not a field).
PROJECT_FIELD_PREFIXpub const PROJECT_FIELD_PREFIX: &str
What a project field’s key starts with ({project:Name}).
project_field_name_okpub fn project_field_name_ok(name: &str) -> bool
Whether name can name a project field a text reads as
{project:Name}: not blank, without braces, and short enough for the
key to stay within MAX_FIELD_KEY.
FieldPartpub enum FieldPart<'a>
A run of a title block text, as field_parts splits it.
Traits: Debug, Clone, Copy, PartialEq, Eq
Variants
Text { raw: &'a str, shown: &'a str }
Words as written (raw) and as shown (shown: {{ and }} as one brace).
Field { key: &'a str, raw: &'a str }
{key}: the key between the braces and the whole field as written.
field_partspub fn field_parts<'a>(text: &'a str, mut f: impl FnMut(FieldPart<'a>))
Splits text into words and {key} fields, in order: {{ and }}
are literal braces, and a { closed by no } within MAX_FIELD_KEY
bytes (before another {) is a brace like any other character.
rename_field_parampub fn rename_field_param(text: &str, old: &str, new: &str) -> String
text with every {param:old} field reading {param:new}.
is_iso_datepub fn is_iso_date(s: &str) -> bool
Whether s is a real YYYY-MM-DD date.
parse_iso_datepub fn parse_iso_date(s: &str) -> Option<(i32, u32, u32)>
Year, month and day of a YYYY-MM-DD date: exactly four, two and two
ASCII digits.
cc_core::topographycrates/cc_core/src/topography.rs
Terrain: a topography surface from measured points (x, y, z) inside a
closed boundary drawn in plan. The geometry (cc_geom::topography)
triangulates the points with the boundary, whose vertices take the
elevation the points give them, and closes the surface down to a flat base
base_depth below its lowest point, so sections cut the earth as a solid.
Points outside the boundary are kept: they give the boundary its
elevations but are not vertices of the surface.
Items: MAX_POINTS · MAX_OUTLINE · POINT_TOL · DEFAULT_BASE_DEPTH · DEFAULT_CONTOUR_INTERVAL · DEFAULT_MAJOR_EVERY · MIN_CONTOUR_INTERVAL · EARTH_COLOR · earth_material · Topography · clean_points
MAX_POINTSpub const MAX_POINTS: usize
Most measured points a topography keeps.
MAX_OUTLINEpub const MAX_OUTLINE: usize
Most points of a topography’s boundary.
POINT_TOLpub const POINT_TOL: f64
Points closer than this in plan are one point (the first is kept).
DEFAULT_BASE_DEPTHpub const DEFAULT_BASE_DEPTH: f64
Depth of the base below the lowest point, meters, unless given.
DEFAULT_CONTOUR_INTERVALpub const DEFAULT_CONTOUR_INTERVAL: f64
Spacing of the contour lines of a new terrain type, meters.
DEFAULT_MAJOR_EVERYpub const DEFAULT_MAJOR_EVERY: u32
Every this many contours of a new terrain type, a major one.
MIN_CONTOUR_INTERVALpub const MIN_CONTOUR_INTERVAL: f64
Smallest contour interval a terrain type keeps, meters.
EARTH_COLORpub const EARTH_COLOR: [u8; 3]
Color of an earth material added for terrain.
earth_materialpub fn earth_material(p: &crate::Project) -> Option<&str>
The project’s earth material: the first of the earth class.
Topographypub struct Topography
Traits: Debug, Clone, PartialEq, Serialize, Deserialize, Default
Fields
points: Vec<DVec3>
Measured points; z is relative to the element’s level elevation.
boundary: Vec<DVec2>
Closed boundary in plan (either winding).
base_depth: f64
Depth of the flat base below the lowest point of the surface.
sketch: Option<crate::sketch::Sketch>
The curves the boundary was drawn with (see crate::sketch).
Methods
pub fn is_valid(&self) -> bool
A boundary of three to MAX_OUTLINE finite points enclosing an area.
Points and the base depth are repaired instead (see Self::repair).
pub fn repair(&mut self) -> usize
Drop non-finite points, points over MAX_POINTS and points that
repeat another in plan, and reset a bad base depth; returns how many
repairs were made.
clean_pointspub fn clean_points(points: &[DVec3]) -> Vec<DVec3>
The finite points of points, the first of those that coincide in plan
(within POINT_TOL), at most MAX_POINTS.
cc_core::transformcrates/cc_core/src/transform.rs
Rigid transforms in plan (move, rotate, mirror) applied to elements.
Items: PlanTransform
PlanTransformpub struct PlanTransform
p ↦ R·M·p + t: an optional reflection across the X axis (M), a
rotation by angle radians (R) and a translation t.
Traits: Debug, Clone, Copy, PartialEq, Default
Fields
angle: f64mirror: booltranslation: DVec2Methods
pub const IDENTITY: Selfpub fn translate(delta: DVec2) -> Selfpub fn rotate_about(center: DVec2, angle: f64) -> Self
Rotation by angle radians about center.
pub fn mirror_across(a: DVec2, dir: DVec2) -> Self
Reflection across the line through a with direction dir.
pub fn then(self, next: Self) -> Self
self after first (apply first, then self).
pub fn apply_vector(&self, v: DVec2) -> DVec2pub fn apply(&self, p: DVec2) -> DVec2pub fn apply_angle_deg(&self, deg: f64) -> f64
A plan direction given in degrees, transformed.
pub fn is_identity(&self) -> boolcc_core::trusscrates/cc_core/src/truss.rs
Parametric trusses: a host element that holds the parameters of a plane
truss (its span line, shape, height, web pattern, panels, member types
and copies) and owns the ordinary beams (chords, diagonals) and columns
(verticals) made from them, kept in step like a steel building’s (see
crate::member_host).
Members are laid out as they are built: each chord is one continuous
beam per straight run (a gable’s top chord is two), verticals stand
between the chords where their sections let them seat (inside a channel
that opens toward the web, else on the chord’s face; see Sections),
and where a truss ends on a vertical the chords run on over it and the
one at the far end is turned around, so both ends are closed.
Local coordinates: x along start → end (L long), the copies to the
left of it every spacing, heights above the level from base_offset
(the bottom chord’s axis).
Items: MAX_MEMBERS · MIN_VERTICAL · LENGTH · HEIGHT · PANELS · COPIES · SPACING · BASE_OFFSET · DEFAULT_LENGTH · DEFAULT_HEIGHT · DEFAULT_SPACING · PANEL_LENGTH · TrussShape · TrussPattern · TrussRoleKind · TrussRole · TrussMember · Truss · default_panels · host_type · Sections
MAX_MEMBERSpub const MAX_MEMBERS: usize
Most members one truss (all copies) may make; Truss::check refuses
a truss whose layout would make more.
MIN_VERTICALpub const MIN_VERTICAL: f64
A vertical shorter than this is skipped, and so is a diagonal whose ends differ less in height (it would lie on the bottom chord), meters.
LENGTHpub const LENGTH: RangeInclusive<f64>
HEIGHTpub const HEIGHT: RangeInclusive<f64>
PANELSpub const PANELS: RangeInclusive<u32>
COPIESpub const COPIES: RangeInclusive<u32>
SPACINGpub const SPACING: RangeInclusive<f64>
BASE_OFFSETpub const BASE_OFFSET: RangeInclusive<f64>
The bottom chord’s axis above the level, meters.
DEFAULT_LENGTHpub const DEFAULT_LENGTH: f64
DEFAULT_HEIGHTpub const DEFAULT_HEIGHT: f64
DEFAULT_SPACINGpub const DEFAULT_SPACING: f64
PANEL_LENGTHpub const PANEL_LENGTH: f64
The panel length the default panel count aims at, meters.
TrussShapepub enum TrussShape
The outline of the truss: chords parallel, the top chord rising toward the end (mono), or toward mid-span from both supports (gable).
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
FlatMonoGableMethods
pub const ALL: [TrussShape; 3]pub fn code(self) -> &'static strpub fn from_code(code: &str) -> Option<Self>pub fn key(self) -> &'static str
The i18n key of its name.
TrussPatternpub enum TrussPattern
The web between the chords.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
PrattHoweWarrenKingPostQueenPostFinkMethods
pub const ALL: [TrussPattern; 6]pub fn code(self) -> &'static strpub fn from_code(code: &str) -> Option<Self>pub fn key(self) -> &'static strpub fn needs_gable(self) -> bool
Whether it is made for a gable only.
pub fn min_panels(self) -> u32
The fewest panels it can be laid out on.
TrussRoleKindpub enum TrussRoleKind
What a member is in its truss.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize
Variants
TopChordBottomChordDiagonalVerticalMethods
pub const ALL: [TrussRoleKind; 4]TrussRolepub struct TrussRole
A member’s place: its kind, its copy and its index there (chords: the straight run, 0 or, past a gable’s apex, 1; verticals: the panel point; diagonals: their place in the pattern).
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize
Fields
kind: TrussRoleKindcopy: u16index: u16Methods
pub fn fits(self, kind: &ElementKind) -> bool
A column for verticals, a beam for the rest.
pub fn key(self) -> RoleKeypub fn from_key(key: RoleKey) -> Option<Self>TrussMemberpub struct TrussMember
A member the truss manages.
Traits: Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize
Fields
role: TrussRoleid: ElementIdTrusspub struct Truss
Traits: Debug, Clone, PartialEq, Serialize, Deserialize, MemberHost
Fields
start: DVec2
The span line in plan, between the supports.
end: DVec2base_offset: f64
The bottom chord’s axis above the level at the supports, meters.
shape: TrussShapeheight: f64
Chord axis to chord axis (flat), or the rise at the apex or high end, meters.
pattern: TrussPatternpanels: u32
Bottom-chord panels (even on a gable).
top_chord_type: ElementTypeIdbottom_chord_type: ElementTypeIdweb_type: ElementTypeIdpost_type: ElementTypeId
The column type of the verticals.
copies: u32spacing: f64
Copy to copy, to the left of start → end, meters.
members: Vec<TrussMember>detached: Vec<TrussRole>Methods
pub fn new(chord_type: ElementTypeId, web_type: ElementTypeId, post_type: ElementTypeId) -> Self
A flat Pratt truss 6 m long on the x axis, 1 m deep, at the level.
pub fn length(&self) -> f64pub fn direction(&self) -> DVec2
The unit vector along start → end (zero when they meet).
pub fn left(&self) -> DVec2
The unit vector to the left of start → end, where copies go.
pub fn rise(&self, x: f64) -> f64
The top chord’s axis above the bottom chord’s at distance x from the start.
pub fn pattern_used(&self) -> TrussPattern
The pattern it is laid out with: a gable-only pattern falls back to Pratt on another shape, or on fewer panels than it needs.
pub fn span_lines(&self) -> Vec<[DVec2; 2]>
Each copy’s span line.
pub fn check(&self) -> Result<(), String>
Whether every number is in its range (the first one that is not, named).
pub fn members_per_copy(&self) -> usize
The most members one copy makes (a vertical that is too short once it is cut to the chords is left out of the layout).
pub fn check_types(&self, project: &Project) -> Result<(), String>
Whether the chord and web types are beam types and the post type a column type.
pub fn reset_out_of_range(&mut self) -> usize
Put every out-of-range number back to its default (an odd gable count up to the next even one); returns how many.
pub fn type_ids(&self) -> impl Iterator<Item = ElementTypeId> + '_
The member types it uses.
pub fn transform(&mut self, t: &PlanTransform)
Move, turn or mirror it. A mirror maps the whole row of copies: the new span line is the mirrored last copy’s, so the copies stay where the mirror puts them and a mono truss keeps its high end.
pub fn layout(&self, s: &Sections) -> Vec<(TrussRole, ElementTypeId, ElementKind)>
Its members: role, type and element, copy by copy (chords, verticals,
diagonals), for member sections s. Empty when a number is out of
range or the members would be more than MAX_MEMBERS (see
Truss::check).
default_panelspub fn default_panels(length: f64, shape: TrussShape) -> u32
About one panel per PANEL_LENGTH, 2 to 64, even on a gable.
host_typepub fn host_type(id: ElementTypeId, name: String) -> ElementType
The type a project gets with its first truss.
Sectionspub struct Sections
What a layout needs to know of the member types’ sections, in meters. The default (all zero) lays members out axis to axis.
Traits: Debug, Clone, Copy, PartialEq, Default
Fields
bottom_seat: f64
From the bottom chord’s axis up to where a vertical seats on it: its top face, or the inside of its web when it is a channel open upward that the vertical fits in (then negative).
top_seat: f64
From the top chord’s axis down to where a vertical seats, square to the chord.
post_along: f64
The vertical’s size along the truss.
post_turned: bool
Whether the verticals are turned a quarter, their depth along the truss.
Methods
pub fn of(project: &Project, truss: &Truss) -> Self
The sections of truss’s member types in project. The verticals
are turned so the side nearest the chords’ width lies across the truss.
cc_core::typescrates/cc_core/src/types.rs
Items: Category · LayerFunction · Layer · WallFunction · TypeInfo · TypeData · default_cut_slope · default_fill_slope · default_contour_interval · default_major_every · ColumnSection · SectionShape · FoundationKind · StripHaunch · ElementType · stair_layout
Categorypub enum Category
BIM category of an element or element type.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize
Variants
WallDoorWindowFloorCeilingRoofRoomGridDimensionTextColumnBeamStairRailingComponentFoundationRebarPipe
Plumbing pipes (water supply, drainage, vent, rainwater).
Conduit
Electrical conduits.
RampCadImport
Imported DWG/DXF drawings (underlays).
Mass
Conceptual masses (massing studies).
Sweep
Profiles swept along paths (baseboards, moldings, fascias, gutters).
Shaft
Shaft openings through floors, ceilings and roofs.
SteelBuilding
Parametric steel buildings: hosts of portal frames, purlins and girts.
Truss
Parametric trusses: hosts of chords, diagonals and posts.
Bracing
Parametric bracings: hosts of the braces of a bay of a frame.
WallFraming
Light steel and wood framing of walls: hosts of studs, tracks, headers and sills.
Topography
Terrain surfaces.
Pad
Building pads graded into terrain.
TitleBlock
Title blocks: sheet layouts (components drawn on sheets).
DetailLine
Detail lines: 2D lines of one view.
FilledRegion
Filled regions: 2D areas of one view filled with a pattern.
MaskingRegion
Masking regions: 2D areas of one view hiding the model under them.
LevelMark
Level marks: the elevation of a point in a plan, elevation or section.
BarTag
Bar tags: the bars of a reinforcement set written in a view.
Pile
Piles (deep foundations), free or under pile caps.
DetailComponent
Detail components: reusable 2D components placed in one view.
CableTray
Cable trays: open runs carrying electrical circuits.
Valve
Valves on pipes.
LightningConductor
Conductors of lightning protection systems.
Connection
Steel and timber connections: plates and bolts at member ends.
Niche
Niches: recesses in one face of a wall, hosted like doors and windows.
Methods
pub fn is_phased(self) -> bool (in cc_core::phase)
Whether elements of the category belong to phases (annotations do not).
pub const ALL: [Category; 42]pub const NAMED: [Category; Category::ALL.len() + 1]
Every category by name: Category::ALL (the ones views draw and
filter) and title blocks, whose types sheets use.
pub const MODEL: [Category; 24]
Categories with physical elements (shown in legends and 3D).
pub const SCHEDULABLE: [Category; 27]
Categories that can be listed in a schedule.
pub fn is_model(self) -> boolpub fn key(self) -> &'static str
Translation key for the category name.
pub fn is_mep(self) -> bool
Whether the category belongs to the building services (MEP).
LayerFunctionpub enum LayerFunction
Role of a layer in a compound type. The core (structure layers) is the reference for core-based wall location lines.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
StructureSubstrateInsulationFinishMembraneMethods
pub const ALL: [LayerFunction; 5]pub fn key(self) -> &'static str
Translation key of the function name.
Layerpub struct Layer
One material layer of a compound wall/floor/roof type, listed exterior first.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
material: Stringthickness: f64
Thickness in meters.
function: LayerFunctionWallFunctionpub enum WallFunction
Purpose of a wall type.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
InteriorExteriorFoundationRetainingMethods
pub const ALL: [WallFunction; 4]pub fn key(self) -> &'static strpub fn is_external(self) -> bool
Whether walls of this function face the outside of the building.
TypeInfopub struct TypeInfo
Descriptive data shared by all instances of a type.
Traits: Debug, Clone, PartialEq, Default, Serialize, Deserialize
Fields
type_mark: String
Short code shown in tags and schedules.
description: Stringmanufacturer: Stringmodel: Stringurl: Stringkeynote: Stringclassification: String
Classification or assembly code (e.g. a national construction classification).
fire_rating: Stringcomments: Stringcost: Option<f64>
Unit cost in the project currency.
TypeDatapub enum TypeData
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Variants
Wall { layers: Vec<Layer>, #[serde(default)] function: WallFunction, #[serde(default, skip_serializing_if = "Option::is_none")] curtain: Option<crate::curtain::CurtainSystem>, }Door { width: f64, height: f64, material: String, }Window { width: f64, height: f64, default_sill: f64, material: String, }Floor { layers: Vec<Layer>, }Ceiling { thickness: f64, material: String, }Roof { layers: Vec<Layer>, #[serde(default, skip_serializing_if = "Option::is_none")] covering: Option<crate::roofing::TileKind>, #[serde(default)] framing: crate::roofing::RoofFraming, }Room {}
Rooms have no type parameters yet; the type groups them in schedules.
Grid { bubble: f64, }
Grid line with a bubble of bubble paper millimeters.
Dimension { text_size: f64, #[serde(default)] style: crate::dim_style::DimensionStyle, }
Dimensions with text of text_size paper millimeters, drawn as style says.
Text { size: f64, #[serde(default)] symbol: crate::LeaderSymbol, }
Text notes of size paper millimeters; new leaders get symbol.
BarTag { text_size: f64, }
Level marks with text of text_size paper millimeters, writing
datum plus each level, followed by finished_suffix (the finished
level) or raw_suffix (the raw, structural one).
Bar tags with text of text_size paper millimeters.
LevelMark { text_size: f64, #[serde(default)] datum: f64, #[serde(default)] finished_suffix: String, #[serde(default)] raw_suffix: String, }Column { section: ColumnSection, material: String, #[serde(default, skip_serializing_if = "Option::is_none")] profile: Option<crate::ProfileId>, #[serde(default, skip_serializing_if = "is_zero")] profile_rotation_deg: f64, #[serde(default, skip_serializing_if = "std::ops::Not::not")] profile_mirror: bool, }Beam { width: f64, height: f64, material: String, #[serde(default)] shape: SectionShape, #[serde(default, skip_serializing_if = "Option::is_none")] profile: Option<crate::ProfileId>, #[serde(default, skip_serializing_if = "is_zero")] profile_rotation_deg: f64, #[serde(default, skip_serializing_if = "std::ops::Not::not")] profile_mirror: bool, }
Beam section width x height, solid or a profile within that box.
Rebar { diameter: f64, material: String, #[serde(default, skip_serializing_if = "String::is_empty")] grade: String, #[serde(default, skip_serializing_if = "Option::is_none")] mass_per_meter: Option<f64>, }
Reinforcing bars of diameter.
Pipe { diameter: f64, material: String, }
Pipes of outside diameter.
Conduit { diameter: f64, material: String, }
Conduits of outside diameter.
CableTray { width: f64, height: f64, #[serde(default)] style: crate::TrayStyle, material: String, }
Cable trays of outside width x height, built as style says.
Valve { #[serde(default)] kind: crate::ValveKind, material: String, }
Valves of kind (their diameter is their pipe’s).
LightningConductor { diameter: f64, material: String, }
Lightning protection conductors: round conductors of diameter.
Foundation { kind: FoundationKind, width: f64, length: f64, thickness: f64, material: String, #[serde(default, skip_serializing_if = "Option::is_none")] haunch: Option<StripHaunch>, #[serde(default, skip_serializing_if = "Option::is_none")] pile_cap: Option<crate::pile::PileCap>, }
Foundation: a pad width x length, a strip width wide or a slab,
each thickness deep. A strip with a haunch is an inverted T: a
footing slab thickness deep at the faces of a beam on top of it.
Pile { section: crate::pile::PileSection, #[serde(default)] kind: crate::pile::PileKind, material: String, }
Piles of section made as kind says, in material.
Stair { width: f64, max_riser: f64, tread: f64, material: String, #[serde(default)] build: crate::StairBuild, #[serde(default)] rules: crate::StairRules, }
Stair: risers at most max_riser high, treads tread deep (or from
Blondel’s formula, see rules), built as build says.
Ramp { width: f64, thickness: f64, material: String, #[serde(default)] rules: crate::RampRules, }
Ramp: a slab thickness thick, width wide, within rules.
Railing { height: f64, post_spacing: f64, material: String, }
Railing with a top rail at height and posts every post_spacing.
Component { component: String, def: crate::component::ComponentDef, }
Parametric component: component names the definition shared by its
types; the parameter values in def are this type’s.
CadImport {}
Imported CAD drawings have no type parameters; the type names them.
DetailLine {}
Detail lines have no type parameters (each line has its style).
FilledRegion { #[serde(default)] fill: crate::PatternFill, }
Filled regions: how they are filled (see crate::region).
MaskingRegion {}
Masking regions have no type parameters (they are opaque white).
Mass { material: String, }
Conceptual masses, shown in material.
Sweep { profile: Vec<glam::DVec2>, material: String, #[serde(default, skip_serializing_if = "Option::is_none")] sketch: Option<crate::sketch::Sketch>, }
Swept profiles: the closed profile (x across, to the left of the
path; y up), shown in material.
Shaft {}
Shaft openings (no properties of their own).
SteelBuilding {}
Steel buildings (no properties of their own; types name them).
Truss {}
Trusses (no properties of their own; types name them).
Bracing {}
Bracings (no properties of their own; types name them).
Connection {}
Connections (no properties of their own; types name them).
WallFraming {}
Wall framings (no properties of their own; types name them).
Topography { material: String, #[serde(default = "crate::types::default_contour_interval")] contour_interval: f64, #[serde(default = "crate::types::default_major_every")] major_every: u32, }
Terrain surfaces: the earth material they are cut in, and the
spacing of their contour lines, every major_every-th one a major.
Pad { #[serde(default = "crate::types::default_cut_slope")] cut_slope: f64, #[serde(default = "crate::types::default_fill_slope")] fill_slope: f64, }
Building pads: the horizontal run per unit of rise of their cut and fill slopes.
Methods
pub fn rebar(diameter: f64, material: String) -> TypeData
A type of reinforcing bars of diameter in material, with no grade
and the mass per meter of a round bar.
pub fn materials(&self) -> Vec<&str>
Material names referenced by this type.
pub fn cut_material(&self) -> &str
Material shown where the type is cut as a whole (sections): the first structure layer of layered types (else the thickest), or the main material.
pub fn uses_material(&self, name: &str) -> boolpub fn rename_material(&mut self, old: &str, new: &str)
Point references to material old at new.
pub fn foundation_depth(&self) -> f64
Depth of a foundation from its top to its bottom: its thickness, plus the beam on top of a haunched strip. 0 for other types.
pub fn strip_haunch(&self) -> Option<StripHaunch>
The haunch of a strip footing type (None for a plain strip and other types).
default_cut_slopepub(crate) fn default_cut_slope() -> f64
default_fill_slopepub(crate) fn default_fill_slope() -> f64
default_contour_intervalpub(crate) fn default_contour_interval() -> f64
default_major_everypub(crate) fn default_major_every() -> u32
ColumnSectionpub enum ColumnSection
Cross-section of a column type.
Traits: Debug, Clone, Copy, PartialEq, Serialize, Deserialize
Variants
Rectangular { width: f64, depth: f64, }Round { diameter: f64, }Profile { width: f64, depth: f64, shape: SectionShape, }
A profile (I, channel, angle, tube) within a width x depth box.
Pipe { diameter: f64, wall: f64, }
A circular hollow section.
Methods
pub fn size(&self) -> (f64, f64)
The bounding box, (width, depth).
SectionShapepub enum SectionShape
What fills a section’s width x depth box. Profiles are laid out as in
steel tables: the web of an I or channel runs along the depth, the legs of
an angle lie on the left and bottom sides of the box, and the flanges of a
channel point to the right.
Traits: Debug, Clone, Copy, PartialEq, Default, Serialize, Deserialize
Variants
SolidI { web: f64, flange: f64 }
I or H: two flanges flange thick joined by a web web thick.
Channel { web: f64, flange: f64 }
Channel (U): a web on the left and two flanges.
Angle { thickness: f64 }
Angle (L): two legs thickness thick.
Tube { wall: f64 }
Rectangular hollow section with walls wall thick.
Methods
pub fn key(&self) -> &'static strpub fn fitted(self, width: f64, depth: f64) -> Self
The same shape with each thickness clamped to fit a width x depth box.
FoundationKindpub enum FoundationKind
What a foundation type is: a pad under a column, a strip under a wall, a
slab, or a cap on piles (see crate::pile).
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
PadStripSlabPileCapMethods
pub const ALL: [FoundationKind; 4]pub fn key(self) -> &'static strStripHaunchpub struct StripHaunch
The section of a strip footing with a beam on top (an inverted T): the
footing slab is the type’s thickness deep at the faces of the beam and
edge_thickness at its edges, its top sloping between them (a haunch;
flat when the two are equal), and the beam beam_width wide rises
beam_height above the slab (0: a sloped footing with a flat middle).
Traits: Debug, Clone, Copy, PartialEq, Serialize, Deserialize
Fields
edge_thickness: f64beam_width: f64beam_height: f64Methods
pub const MAX_HEIGHT: f64
Highest beam, meters.
pub fn fits(&self, width: f64, thickness: f64) -> bool
Whether the values make a section in a strip width wide and
thickness deep at the beam: an edge no thicker than that, a beam
narrower than the strip.
pub fn outline(&self, width: f64, thickness: f64) -> Vec<glam::DVec2>
The section of a strip width wide and thickness deep at the beam:
x across (centered), y up from the bottom, counter-clockwise.
pub fn area(&self, width: f64, thickness: f64) -> f64
Area of that section.
ElementTypepub struct ElementType
An element type: the shared parameters of a group of instances.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
id: ElementTypeIdname: Stringdata: TypeDatainfo: TypeInfouid: UidMethods
pub fn category(&self) -> Categorypub fn layers(&self) -> &[Layer]
The layers of a layered type (none for curtain walls).
pub fn thickness(&self) -> f64
Total thickness for layered types, 0 for openings.
pub fn diameter(&self) -> Option<f64>
Outside diameter of pipe, conduit and rebar types.
pub fn tray_section(&self) -> Option<(f64, f64, crate::TrayStyle)>
Outside width, height and style of cable tray types.
pub fn valve_kind(&self) -> Option<crate::ValveKind>
What valves of a valve type do.
pub fn curtain(&self) -> Option<&crate::curtain::CurtainSystem>
The curtain grid of a curtain wall type.
pub fn wall_function(&self) -> Option<WallFunction>
Wall function, for wall types.
pub fn core_range(&self) -> (f64, f64)
Distances from the exterior (first) face to the exterior and interior faces of the core: the span from the first to the last structure layer, or the whole thickness when there is none.
pub fn location_offset(&self, line: crate::LocationLine) -> f64
Position of a wall’s location line line across a wall of this type,
measured from the centerline towards the exterior (left) face.
pub fn opening_size(&self) -> Option<(f64, f64)>
Width/height of an opening type (doors, windows).
pub fn opening_depth(&self) -> Option<f64>
The depth of a niche type’s recess; None for types that open their
wall through (doors, windows) and for anything else.
pub fn window_operation(&self) -> crate::WindowOperation
How the panels of a window type open (fixed for anything else).
pub fn door_operation(&self) -> crate::DoorOperation
How the leaves of a door type swing (one leaf hinged on the left for anything else).
pub fn default_sill(&self) -> f64
Sill height of new elements of a door or window type.
pub fn main_material(&self) -> &str
Material used to color the element in shaded views: the exterior finish layer for walls and roofs, the thickest layer for floors.
stair_layoutpub fn stair_layout(height: f64, max_riser: f64, tread: f64) -> (usize, f64, f64)
Riser count, riser height and run length of a straight stair of height
with at most max_riser per riser and tread-deep treads (one tread fewer
than risers: the last riser lands on the upper floor).
cc_core::unitscrates/cc_core/src/units.rs
Project units: how lengths, areas, volumes, angles, slopes and money are displayed and typed. Values in the model stay in meters and degrees; these settings only affect presentation.
Items: INCH · FOOT · MeasurementSystem · inch_text · round_imperial · LengthUnit · AreaUnit · VolumeUnit · SlopeUnit · NumberStyle · MAX_DECIMALS · Format · Units
INCHpub const INCH: f64
Meters in an inch (exact, by definition).
FOOTpub const FOOT: f64
Meters in a foot (exact, by definition).
MeasurementSystempub enum MeasurementSystem
The system a project measures in: what its template sizes its types in
and what its units show. Not stored: a project is imperial when its
length unit is (see Units::system).
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default
Variants
Metric
Meters and millimeters.
Imperial
US customary feet and inches.
Methods
pub const ALL: [MeasurementSystem; 2]pub fn code(self) -> &'static str
The code commands use: metric or imperial.
pub fn from_code(code: &str) -> Option<Self>
The system of a code (case and surrounding spaces ignored).
pub fn units(self) -> Units
The units a new project of this system shows.
inch_textpub fn inch_text(meters: f64) -> String
A length in inches with sixteenths as a fraction, with the inch mark:
8", 6 1/2", 5/16" (rounded to the nearest sixteenth).
round_imperialpub fn round_imperial(meters: f64) -> f64
A metric size turned into a round imperial one: the nearest inch up to a foot, else the nearest 6” (0.1 m is 4”, 0.6 m 2’-0”, 2.4 m 8’-0”).
LengthUnitpub enum LengthUnit
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
MillimeterCentimeterMeterFoot
Decimal feet.
Inch
Decimal inches.
FeetInches
Feet and fractional inches (12'-6 1/2").
FractionalInch
Fractional inches (150 1/2").
Methods
pub const ALL: [LengthUnit; 7]pub fn per_meter(self) -> f64
Display units per meter (feet for feet and inches, inches for fractional inches: the unit a bare typed number is read in).
pub fn symbol(self) -> &'static strpub fn is_fractional(self) -> bool
Shown with fractions of an inch: the decimals setting d is then
the precision, 1/2^d of an inch.
pub fn is_imperial(self) -> bool
A US customary (imperial) unit.
AreaUnitpub enum AreaUnit
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
SquareMeterSquareCentimeterSquareFootSquareInchMethods
pub const ALL: [AreaUnit; 4]pub fn per_square_meter(self) -> f64pub fn symbol(self) -> &'static strVolumeUnitpub enum VolumeUnit
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
CubicMeterLiterCubicFootCubicYardGallon
US liquid gallon.
Methods
pub const ALL: [VolumeUnit; 5]pub fn per_cubic_meter(self) -> f64pub fn symbol(self) -> &'static strSlopeUnitpub enum SlopeUnit
How slopes (rise over run) are shown.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
PercentDegreesRisePer12
The rise per 12 of run, the customary way of US roofs (6:12).
Methods
pub const ALL: [SlopeUnit; 3]pub fn symbol(self) -> &'static strNumberStylepub enum NumberStyle
Decimal symbol and digit grouping.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
Language
Decimal symbol of the interface language, no grouping.
CommaDecimalPointGroups
1.234.567,89
CommaDecimalSpaceGroups
1 234 567,89
CommaDecimal
1234567,89
PointDecimalCommaGroups
1,234,567.89
PointDecimal
1234567.89
Methods
pub const ALL: [NumberStyle; 6]pub fn separators(self, language_comma: bool) -> (char, Option<char>)
Decimal symbol and group separator, given the language’s decimal comma.
MAX_DECIMALSpub const MAX_DECIMALS: u8
Most decimals any unit may show.
Formatpub struct Format<U>
Traits: Debug, Clone, Copy, PartialEq, Serialize, Deserialize
Fields
unit: Udecimals: u8symbol: bool
Append the unit symbol (dimensions usually omit it).
Unitspub struct Units
Display settings for every kind of quantity.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize, Default
Fields
length: Format<LengthUnit>area: Format<AreaUnit>volume: Format<VolumeUnit>angle: Format<()>
Angles are always degrees.
slope: Format<SlopeUnit>currency: String
Currency symbol written before amounts (empty for none).
currency_decimals: u8style: NumberStyleMethods
pub fn imperial() -> Self
US customary units: feet and inches to 1/16”, square feet, cubic
feet, slopes as the rise per 12 (6:12), point decimals with comma
groups.
pub fn system(&self) -> MeasurementSystem
The measurement system these units belong to: imperial when lengths are in an imperial unit, else metric.
pub fn repair(&mut self) -> bool
Clamp decimals to MAX_DECIMALS; returns whether anything changed.
cc_core::viewcrates/cc_core/src/view.rs
Items: ViewCategory · Direction · CameraState · MIN_PAPER_MM · MAX_PAPER_MM · SheetSize · Viewport · ViewKind · View · ShadingSettings · VisualStyle · DetailLevel · MAX_SECTION_SEGMENT · MepDiscipline · Underlay · UnderlayPlan · UnderlayLevel · Looking
ViewCategorypub enum ViewCategory
Grouping used by the Project Browser.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize
Variants
FloorPlanCeilingPlanThreeDElevationSectionLegendDrafting
2D views drawn by hand, independent of the model.
ScheduleDiagram
Single-line diagrams of distribution boards.
SheetMethods
pub const ALL: [ViewCategory; 10]pub fn key(self) -> &'static str
Translation key for the browser group heading.
Directionpub enum Direction
Elevation direction, named by the side the viewer stands on.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize
Variants
NorthSouthEastWestMethods
pub fn look(self) -> DVec2
Unit vector the viewer looks along (from their side towards the model).
CameraStatepub struct CameraState
Traits: Debug, Clone, Copy, PartialEq, Serialize, Deserialize, Default
Fields
target: DVec3yaw_deg: f64
Rotation around Z, degrees; 0 looks along +Y.
pitch_deg: f64
Elevation angle above the horizon, degrees.
distance: f64Methods
pub fn forward(&self) -> DVec3
Unit vector from the eye towards the target.
pub fn eye(&self) -> DVec3
MIN_PAPER_MMpub const MIN_PAPER_MM: f64
Smallest and largest side of a custom sheet, millimeters.
MAX_PAPER_MMpub const MAX_PAPER_MM: f64
SheetSizepub enum SheetSize
Traits: Debug, Clone, Copy, PartialEq, Serialize, Deserialize
Variants
A0A1A2A3A4Custom { width: f64, height: f64, }
Any size, millimeters (width and height as typed; portrait puts the long side up).
AnsiA
ANSI A, 11” × 8 1/2” (US letter).
AnsiB
ANSI B, 17” × 11” (tabloid).
AnsiC
ANSI C, 22” × 17”.
AnsiD
ANSI D, 34” × 22”.
AnsiE
ANSI E, 44” × 34”.
ArchA
Architectural A, 12” × 9”.
ArchB
Architectural B, 18” × 12”.
ArchC
Architectural C, 24” × 18”.
ArchD
Architectural D, 36” × 24”.
ArchE1
Architectural E1, 42” × 30”.
ArchE
Architectural E, 48” × 36”.
Methods
pub const ALL: [SheetSize; 16]
Every named size: the ISO A sizes, then ANSI, then architectural.
pub fn choices(system: MeasurementSystem) -> Vec<SheetSize>
Every named size, the system’s own first (metric: the A sizes; imperial: ANSI and architectural), for pickers.
pub fn default_for(system: MeasurementSystem) -> SheetSize
The paper of a new sheet: A3, or ANSI B in imperial projects.
pub fn size_mm(self) -> DVec2
Landscape paper size in millimeters (a custom size as typed, kept
within MIN_PAPER_MM and MAX_PAPER_MM).
pub fn label(self) -> String
The size’s name (A3, ANSI B, ARCH D); a custom size in
millimeters (see SheetSize::label_in).
pub fn label_in(self, system: MeasurementSystem) -> String
The size’s name; a custom size in the system’s paper unit
(1000 × 594 mm, 17" × 11").
pub fn from_name(name: &str) -> Option<SheetSize>
The named size called name, any case, with spaces, _ or -
between its parts or none (A3, ANSI B, ansi_b, ArchD).
pub fn is_valid(self) -> bool
A custom size within the limits, finite.
Viewportpub struct Viewport
A view placed on a sheet.
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
view: ViewIdcenter: DVec2
Center of the viewport on the sheet, millimeters from the bottom-left corner.
ViewKindpub enum ViewKind
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Variants
FloorPlan { level: LevelId, cut_height: f64, #[serde(default)] structural: bool, #[serde(default)] structure_tags: bool, #[serde(default, skip_serializing_if = "Option::is_none")] mep: Option<MepDiscipline>, #[serde(default, skip_serializing_if = "Underlay::is_empty")] underlay: Underlay, }CeilingPlan { level: LevelId, cut_height: f64, #[serde(default, skip_serializing_if = "Underlay::is_empty")] underlay: Underlay, }ThreeD { camera: CameraState, #[serde(default)] analytical: bool, #[serde(default)] rebar: bool, }Elevation { direction: Direction, }Section { start: DVec2, end: DVec2, depth: f64, #[serde(default, skip_serializing_if = "Option::is_none")] segments: Option<[f64; 2]>, }
Section line from start to end; looks to the right of the line.
Legend { types: Vec<ElementTypeId>, }Drafting {}
A 2D view independent of the model, with its own scale: it shows no model geometry, only what is drawn in it (the elements it owns, such as text notes, dimensions and imported CAD drawings).
Schedule { category: Category, #[serde(default)] def: crate::ScheduleDef, }Sheet { number: String, size: SheetSize, #[serde(default, skip_serializing_if = "std::ops::Not::not")] portrait: bool, viewports: Vec<Viewport>, #[serde(default, skip_serializing_if = "Option::is_none")] title_block: Option<crate::ElementTypeId>, #[serde(default, skip_serializing_if = "std::collections::BTreeMap::is_empty")] fields: std::collections::BTreeMap<String, String>, #[serde(default, skip_serializing_if = "String::is_empty")] issue_date: String, }Diagram { panel: crate::ElementId, }
The single-line diagram and load schedule of a distribution board.
Methods
pub fn croppable(&self) -> bool (in cc_core::callout)
Whether views of this kind can be cropped and hold callouts: floor and ceiling plans, sections and elevations.
pub fn flip_section(&mut self) -> bool
Turn a section to look the other way: its ends swap, and the pieces
of a split line go with them. false for other views.
pub fn has_graphics(&self) -> bool
Whether views of this kind have visibility/graphics settings: the views of the model (those that take templates) and drafting views.
pub fn is_phased(&self) -> bool
Whether views of this kind show the model in a phase (plans, elevations, sections, 3D views and schedules).
pub fn takes_sun(&self) -> bool
Whether views of this kind can have a sun (View::sun): plans,
ceiling plans, 3D views, elevations and sections.
pub fn takes_render(&self) -> bool
Whether views of this kind can have render settings (View::render):
3D views only.
pub fn ceiling_plan(level: LevelId) -> Self
An ordinary ceiling plan of level cut at 1.20 m.
pub fn underlay(&self) -> Option<&Underlay>
The underlay of a floor or ceiling plan.
pub fn underlay_mut(&mut self) -> Option<&mut Underlay>pub fn floor_plan(level: LevelId) -> Self
An ordinary floor plan of level cut at 1.20 m.
Viewpub struct View
Traits: Debug, Clone, PartialEq, Serialize, Deserialize
Fields
id: ViewIdname: Stringscale: u32
Scale denominator (50 means 1:50).
kind: ViewKindgraphics: crate::ViewGraphics
Category visibility and overrides, filters, element overrides.
template: Option<crate::TemplateId>
The template the view follows: the properties it controls are copied from it on every edit.
phase: crate::PhaseId
The phase the view shows the model in (see crate::phase).
phase_filter: Option<crate::PhaseFilterId>
Which statuses the view shows, and how (None: all, by category).
design_options: std::collections::BTreeMap<crate::OptionSetId, crate::OptionId>
The option the view shows of each design option set; sets left out
show automatically (see crate::design_option).
tag_offsets: std::collections::BTreeMap<crate::ElementId, glam::DVec2>
Tags moved by hand in this view: their offset in plan from where they sit by default, by the element they tag.
detail: DetailLevel
How much of the elements the view draws (see DetailLevel).
visual_style: Option<VisualStyle>
How the view shows the model’s surfaces (None: the usual style of
its kind, see View::style).
crop: Option<crate::callout::CropBox>
The rectangle of the view’s drawing outside which the model is not
drawn (plans, sections and elevations; see crate::callout).
callout: Option<crate::callout::Callout>
The callout standing for this view in another one: a detail view of the model (cropped to it) or a drafting view it points to.
sun: Option<crate::sun::SunSettings>
The view’s sun: a date and time, a study or a light direction
(see crate::sun); only views that take one.
render: Option<crate::render_settings::RenderSettings>
How the view is rendered photorealistically (see
crate::render_settings); only views that take them.
shading: ShadingSettings
How light and dark the shaded, consistent colors and textures
styles shade faces and cast shadows (see ShadingSettings); used
by the views that take a sun, kept at the
defaults on the others.
Methods
pub fn callout_rect(&self) -> Option<CropBox> (in cc_core::callout)
The rectangle of the view’s callout in its parent: the crop of a detail view, the callout’s own rectangle for a drafting view.
pub fn set_callout_rect(&mut self, rect: CropBox) -> bool (in cc_core::callout)
Move or resize the view’s callout (the crop of a detail view);
false when it has none.
pub fn is_detail(&self) -> bool (in cc_core::callout)
A detail view of the model made from a callout (not a drafting view).
pub fn projection(&self) -> Option<Projection> (in cc_core::dim_refs)
The projection of an elevation or section view.
pub fn is_plan(&self) -> bool (in cc_core::dim_refs)pub fn paper_mm(&self) -> Option<DVec2>
A sheet’s paper size in millimeters, after its orientation.
pub fn style(&self) -> VisualStyle
The style the view is drawn in: its own, else plans in hidden line (as drawn before styles existed) and other views shaded.
pub fn new(id: ViewId, name: impl Into<String>, scale: u32, kind: ViewKind) -> Self
A view with default graphics, no template, in the (default) last phase.
pub fn category(&self) -> ViewCategorypub fn level(&self) -> Option<LevelId>
Level for plan views, where new elements are placed.
pub fn is_drafting(&self) -> bool
Whether the view is a drafting view: 2D, drawn by hand, showing no model geometry.
pub fn takes_dimensions(&self) -> bool
Whether dimensions can be drawn in the view: plans, elevations, sections, legends and drafting views.
pub fn placeable(&self) -> bool
Whether the view can be placed on a sheet.
ShadingSettingspub struct ShadingSettings
How a view shades faces and casts shadows in the styles that show more
than white faces (shaded, consistent colors, textures), in 2D and in
the 3D view (not in photorealistic renders). The defaults are the
look of VisualStyle::shaded_grey and VisualStyle::SHADED_SHADOW.
Traits: Debug, Clone, Copy, PartialEq, Serialize, Deserialize, Default
Fields
ambient: f64
The light of a face turned away from the light, as displayed:
ShadingSettings::MIN_AMBIENT (dark grey) to 1 (as bright as a
face square to the light: no shading).
shadow: f64
How dark cast shadows are: 0 (no visible shadow) to 1 (black).
In the shaded style a shadow’s grey is 1 - shadow (never lighter
than the face it falls on); the ground’s and the other styles’
shadows grow from none to black with it, their defaults at the default.
Methods
pub const MIN_AMBIENT: f64pub const MAX_AMBIENT: f64pub const DEFAULT_AMBIENT: f64pub const MIN_SHADOW: f64pub const MAX_SHADOW: f64pub const DEFAULT_SHADOW: f64
The intensity whose shaded shadow is VisualStyle::SHADED_SHADOW.
pub fn is_default(&self) -> boolpub fn is_valid(&self) -> bool
Both values are numbers within their ranges.
pub fn repair(&mut self) -> usize
Bring the values into range (the defaults when not numbers); returns how many it fixed.
pub fn clamped(mut self) -> Self
The values brought into range (see Self::repair).
pub fn grey(&self, cos: f64) -> f64
The shaded style’s grey, as displayed (0 black, 1 white), of a face
whose unit normal has the cosine cos with the direction towards the
light: white square to it, Self::ambient edge-on or turned away;
not a number reads as turned away.
pub fn shadow_grey(&self, lit: f64) -> f64
The grey of a cast shadow in the shaded style on a face whose grey
is lit: 1 - shadow, never lighter than the face.
pub fn darkening(&self, at_default: f64) -> f64
A shadow’s darkening (0 none, 1 black) that grows with
Self::shadow from none to black and is at_default at the
default intensity (at_default between 0 and 1, exclusive): for
the shadows whose darkness is not the shaded style’s grey (the
ground’s, the unlit styles’).
VisualStylepub enum VisualStyle
How a view shows the model’s surfaces.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
Wireframe
Every edge, seen through the model; no faces.
HiddenLine
Faces in the paper’s color hide what is behind them; only edges show.
Shaded
White faces with the hidden line’s edges, shaded grey by the light
(the view’s sun, else a light from the viewer’s side; see
VisualStyle::shaded_grey) and, where the view’s sun casts
shadows, a darker grey in them; no material colors.
ConsistentColors
Faces in their material’s color, the same on every side (no light).
Textures
Faces in their material’s appearance color with its surface pattern, lit.
Methods
pub const ALL: [VisualStyle; 5]pub fn key(self) -> &'static strpub fn name(self) -> &'static str
The name commands use: wireframe, hidden_line, shaded, consistent_colors or textures.
pub fn from_name(name: &str) -> Option<VisualStyle>pub fn fills(self) -> bool
Faces are filled (every style but the wireframe).
pub fn colored(self) -> bool
Faces show more than the paper’s white: grey shading (shaded), their material’s color (consistent colors) or appearance (textures).
pub const SHADED_AMBIENT: f64
The grey of a face lit in the shaded style where nothing casts a shadow on it, as displayed (0 black, 1 white).
pub const SHADED_DIFFUSE: f64
How much a face square to the light adds to Self::SHADED_AMBIENT: it is white.
pub const SHADED_SHADOW: f64
The grey of a cast shadow in the shaded style: darker than a face turned away from the light, so shadows read apart from shade.
pub fn shaded_grey(cos: f64) -> f64
The shaded style’s grey, as displayed (0 black, 1 white), of a face
whose unit normal has the cosine cos with the direction towards the
light: white square to it, Self::SHADED_AMBIENT (a mid grey, never
black) edge-on or turned away; not a number reads as turned away.
The default shading’s; a view’s own is View::shading.
DetailLevelpub enum DetailLevel
How much a view draws of elements: at Coarse, layered walls, floors
and roofs are cut as one region with a plain fill (no layers, no
material patterns); at Medium and Fine they show their layers and
patterns. Component pieces show at the levels they are set for
(crate::component::DetailLevels), so a component can draw a simple
shape at Coarse and its details at Fine.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
CoarseMediumFineMethods
pub const ALL: [DetailLevel; 3]pub fn key(self) -> &'static strpub fn name(self) -> &'static str
The name commands use: coarse, medium or fine.
pub fn is_medium(&self) -> boolpub fn shows_layers(self) -> bool
Layered elements show their layers and material patterns.
MAX_SECTION_SEGMENTpub const MAX_SECTION_SEGMENT: f64
Longest piece of a split section line kept next to a head, meters.
MepDisciplinepub enum MepDiscipline
The building services shown by a services plan.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize
Variants
Plumbing
Water supply, drainage, their valves and fixtures.
Electrical
Conduits, cable trays, outlets, switches, lights and boards.
Communications
Structured cabling: cable trays, conduits carrying it, data outlets and racks.
Lightning
Lightning protection: air terminals, conductors and earth electrodes.
Methods
pub const ALL: [MepDiscipline; 4]pub fn name(self) -> &'static str
Name in commands (plumbing, electrical, communications, lightning).
pub fn key(self) -> &'static strUnderlaypub struct Underlay
Other levels’ plans drawn halftone under a floor or ceiling plan, for
reference while drawing: a plan below and one above, each seen looking
down (as a floor plan) or up (as a ceiling plan). They are not picked,
selected or snapped to, and are printed only when printed.
Traits: Debug, Clone, Copy, PartialEq, Default, Serialize, Deserialize
Fields
below: Option<UnderlayPlan>
The plan of a level below.
above: Option<UnderlayPlan>
The plan of a level above.
printed: bool
Show it on sheets and in exports too (by default only on screen).
Methods
pub fn is_empty(&self) -> boolpub fn plans(&self, levels: &[crate::Level], level: LevelId) -> Vec<(LevelId, Looking)>
The levels shown under a plan of level and how they are seen,
lowest first: the next level is the nearest below (or above) by
elevation, a given level is shown when it still exists.
pub fn repair(&mut self, exists: impl Fn(LevelId) -> bool) -> usize
Drop references to levels that no longer exist; returns how many.
UnderlayPlanpub struct UnderlayPlan
One plan shown under a view: which level, and from which side.
Traits: Debug, Clone, Copy, PartialEq, Default, Serialize, Deserialize
Fields
level: UnderlayLevellooking: LookingUnderlayLevelpub enum UnderlayLevel
The level of an underlay: the next one (below or above the view’s level, so a template works for every level), or a given level.
Traits: Debug, Clone, Copy, PartialEq, Eq, Default, Serialize, Deserialize
Variants
NextLevel(LevelId)Lookingpub enum Looking
Which way a plan looks: down (a floor plan) or up (a ceiling plan).
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
DownUpMethods
pub const ALL: [Looking; 2]pub fn key(self) -> &'static str
The translation key of its name.
cc_core::wall_framingcrates/cc_core/src/wall_framing.rs
Light steel and wood framing of walls: a host element attached to one
straight wall that owns ordinary columns (studs, king and jack studs,
cripples) and beams (tracks or plates, headers, sills, blocking) laid
out from its parameters, its wall and the doors and windows the wall
hosts. They are kept in step like a steel building’s members (see
crate::member_host), and any change of the wall or its openings
regenerates them.
The wall frame: u along the wall’s body centerline
(Project::wall_axis) from its start to its length L, heights above
the wall’s level.
Items: MAX_MEMBERS · MIN_PIECE · END_STUD · SPACING · LIGHT_STEEL_SPACING · WOOD_SPACING · FramingSystem · FramingRoleKind · FramingRole · FramingMember · WallFraming · host_type
MAX_MEMBERSpub const MAX_MEMBERS: usize
Most members one framing makes; the layout stops there.
MIN_PIECEpub const MIN_PIECE: f64
A jack, cripple or blocking piece shorter than this is left out, meters.
END_STUDpub const END_STUD: u16
The index of the stud at the wall’s end (its key does not depend on the length).
SPACINGpub const SPACING: RangeInclusive<f64>
LIGHT_STEEL_SPACINGpub const LIGHT_STEEL_SPACING: f64
WOOD_SPACINGpub const WOOD_SPACING: f64
FramingSystempub enum FramingSystem
How the wall is framed.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default, Serialize, Deserialize
Variants
LightSteel
Cold-formed steel studs between tracks.
Wood
Sawn timber studs between plates.
Methods
pub const ALL: [FramingSystem; 2]pub fn code(self) -> &'static strpub fn from_code(code: &str) -> Option<Self>pub fn key(self) -> &'static str
The i18n key of its name.
pub fn default_spacing(self) -> f64pub fn default_double_top(self) -> bool
Wood frames get a double top plate by default.
FramingRoleKindpub enum FramingRoleKind
What a member is in its framing.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize
Variants
BottomTrackTopTrackStudKingStudJackStudHeaderSillCrippleBlockingMethods
pub const ALL: [FramingRoleKind; 9]pub fn is_stud(self) -> bool
Studs are columns; tracks, headers, sills and blocking are beams.
FramingRolepub struct FramingRole
A member’s place in its framing:
k for the stud at k · spacing, 0 at the wall start, END_STUD at its end;opening is the opening’s order along the wall, index 0 on the start side, 1 on the end side;2k above the header and 2k + 1 below the sill;(0, k) after stud k and (j + 1, 0)/(j + 1, 1) after opening j’s end-side/start-side king.Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord, Serialize, Deserialize
Fields
kind: FramingRoleKindopening: u16index: u16Methods
pub fn fits(self, kind: &ElementKind) -> boolpub fn key(self) -> RoleKey
Its key for the shared member-host code (same order as the role).
pub fn from_key(key: RoleKey) -> Option<Self>FramingMemberpub struct FramingMember
A member the framing manages.
Traits: Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize
Fields
role: FramingRoleid: ElementIdWallFramingpub struct WallFraming
Traits: Debug, Clone, PartialEq, Serialize, Deserialize, MemberHost
Fields
wall: ElementId
The framed wall (straight; one framing per wall).
system: FramingSystemstud_type: ElementTypeId
Column type of the studs, king and jack studs and cripples.
track_type: ElementTypeId
Beam type of the bottom and top tracks or plates, and of the blocking.
header_type: ElementTypeId
Beam type of the headers and sills.
spacing: f64
Stud spacing on center from the wall start, meters.
double_top: bool
An extra top plate (wood only; ignored for light steel).
blocking: bool
A row of blocking at mid-height between full-height studs.
members: Vec<FramingMember>detached: Vec<FramingRole>Methods
pub fn new(wall: ElementId, system: FramingSystem, stud_type: ElementTypeId, track_type: ElementTypeId, header_type: ElementTypeId) -> Self
A framing of wall with the system’s default spacing and top plates, no blocking.
pub fn top_plates(&self) -> u16
Top tracks or plates: two for a wood frame with double_top, else one.
pub fn check(&self) -> Result<(), String>
Whether the spacing is in range.
pub fn check_types(&self, project: &Project) -> Result<(), String>
Whether the stud type is a column type and the track and header types beam types.
pub fn check_wall(&self, project: &Project) -> Result<(), String>
Whether its wall is a wall of the project.
pub fn reset_out_of_range(&mut self) -> usize
Put an out-of-range spacing back to the system’s default; returns how many (0 or 1).
pub fn type_ids(&self) -> impl Iterator<Item = ElementTypeId> + '_
The member types it uses.
pub fn wall_length(&self, project: &Project) -> f64
Its wall’s centerline length (0 when the wall is gone).
pub fn layout(&self, project: &Project) -> Vec<(FramingRole, ElementTypeId, ElementKind)>
Its members: role, type and element. Empty when the spacing is out of
range or the wall is gone, curved, shorter than two studs or too low
for its tracks, and when the members would be more than
MAX_MEMBERS (see WallFraming::check_size): never cut short.
pub fn check_size(&self, project: &Project) -> Result<(), String>
Whether the members fit in MAX_MEMBERS.
host_typepub fn host_type(id: ElementTypeId, name: String) -> ElementType
The type a project gets with its first wall framing.
cc_core::wall_opscrates/cc_core/src/wall_ops.rs
Geometry edits of linear elements (walls, beams, grids): trim or extend
to a corner or to a reference line, split, offset and align. Arc walls
take part on their circle: they trim and extend along it, and meet lines
and other arcs where the circles cross.
Picks are plan points on the element: the picked part is the part kept.
Detail lines take part too, through their curve and
crate::sketch_edit: they trim and extend to other detail lines and
to the lines of walls, beams and grids, split and offset.
Items: Path · path_of · curve_of · line_of · connected_ends · EditError · path
Pathpub enum Path
Where a linear element runs: a straight line, or an arc (arc walls and arc beams).
Traits: Debug, Clone, Copy, PartialEq
Variants
Line(DVec2, DVec2)Arc(Arc)path_ofpub fn path_of(e: &Element) -> Option<Path>
The path of a linear element, if it has one.
curve_ofpub fn curve_of(e: &Element) -> Option<SketchCurve>
The curve of an element as a sketch curve: a detail line’s own, or the location line of a wall or beam (an arc for arc walls and arc beams) or grid.
line_ofpub fn line_of(e: &Element) -> Option<(DVec2, DVec2)>
Location line of a linear element, if it has one.
connected_endspub fn connected_ends(project: &Project, id: ElementId, point: DVec2) -> Vec<(ElementId, bool)>
Ends of other walls on the same level that meet point (within 1 cm),
as (wall, is_start).
EditErrorpub enum EditError
Why an edit could not be made.
Traits: Debug, Clone, Copy, PartialEq, Eq
Variants
NotLinear
The element has no location line (or does not exist).
Parallel
The lines are parallel.
Degenerate
The result would have no length.
Curved
The edit needs a straight line and the wall is an arc.
pathpub fn path(project: &Project, id: ElementId) -> Result<Path, EditError>
The path of an element (line or arc).