ConstructCraft

cc_engine API

← API reference · Generated from the source by cargo run -p api_doc; edit the doc comments, not this page.

The ConstructCraft engine: every user-facing operation as a named command that runs on a Session without a GUI. A command is a struct of typed parameters (deserialized from JSON, with a JSON Schema generated from the same type) and a run method. The catalog lists them; Session::execute runs one by name. The command line (ccad), the MCP server and, area by area, the desktop app all go through this one catalog, so an operation behaves the same wherever it is called from. Lengths are in meters, angles in degrees, points are [x, y] in plan. Edits go through Document::edit, so each command is one undo step. Levels, types, views and materials can be named by id or by name; elements by id.

Modules

Module Items Summary
cc_engine 5 The ConstructCraft engine: every user-facing operation as a named command that runs on a Session without a GUI.
cc_engine::commands 10 The commands, by area.
cc_engine::commands::analytical 2 The analytical model of the structure, for structural analysis programs.
cc_engine::commands::annotate 9 Dimensions: place (associated with what they measure) and drive by value.
cc_engine::commands::bar_marks 13 Bar marks, bending schedules, bar tags and the check of bar lengths (see cc_core::bar_marks, cc_core::bar_tag, cc_geom::bar_marks and cc_views::bending).
cc_engine::commands::bracing 4 Parametric bracing: bracing_create makes a host that keeps the braces of one bay of a frame in step with its pattern, storeys and brace type.
cc_engine::commands::browser 7 Project browser organization (see cc_core::browser): named schemes that group the browser’s views by view type, level, discipline or phase.
cc_engine::commands::cable_tray 5 Cable trays: open rectangular runs carrying electrical circuits, joined like conduits (see cc_core::mep, cc_geom::mep_net).
cc_engine::commands::cabling 3 Structured cabling: racks, data outlets and the horizontal cables between them.
cc_engine::commands::cad 11 Imported CAD drawings (DWG, DXF and SVG underlays, and pictures): importing a file into a 2D view and showing or hiding its layers.
cc_engine::commands::cad_explode 3 Exploding an imported drawing (cad_explode): its visible primitives become native, editable elements of its view in one undo step.
cc_engine::commands::callout 7 Callouts and detail views (see cc_core::callout).
cc_engine::commands::component 18 Editing a component’s definition piece by piece: parameters, reference planes and lines, and dimensions between planes that parameters drive (see cc_core::component_ref).
cc_engine::commands::component_connector 5 Connectors of a component: the points where pipes and conduits join it (a toilet’s water inlet and sewer outlet, an outlet’s electrical connection), each with the kind of system it takes, a position and a diameter as expressions, and the direction runs leave it.
cc_engine::commands::component_piece 9 Pieces of a component drawn as sketches: an outline on the plan, front or side plane extruded along the plane’s normal, revolved about an axis in it, swept along a path or blended into a second outline; solid or void.
cc_engine::commands::component_script 5 Scripted components: writing a script piece (its declarations become the component’s parameters and hotspots), reading and setting parameter values of a type or of placed elements, and moving hotspots.
cc_engine::commands::connection 5 Steel and timber connections (see cc_core::connection): placing them on member ends, the checks element_set runs on them and the values element_get derives.
cc_engine::commands::create 31 Creating elements, with the same defaults as the drawing tools.
cc_engine::commands::curtain 7 Curtain walls: walls of a type with a curtain grid (see cc_core::curtain).
cc_engine::commands::design_options 15 Design options: option sets, their options and primary option, the option elements belong to, the option each view shows and the option being edited (see cc_core::design_option).
cc_engine::commands::detail 5 Detail lines: 2D lines, arcs, circles and ellipses drawn in one view (see cc_core::detail).
cc_engine::commands::detail_component 7 Detail components: reusable 2D components placed in one view (see cc_core::detail_component).
cc_engine::commands::devices 7 Device types the engine provides on demand: a project that has no type for a kind of device (a data outlet, a rack, an air terminal, an earth electrode…) gets the built-in one with the first device placed, in the same undo step (see cc_core::component::device_library).
cc_engine::commands::doors 1 Door types: swing doors of one or two leaves and French doors (glazed, from the floor), built from the definitions of cc_core::openings.
cc_engine::commands::edit 4 Changing element parameters (the Properties panel).
cc_engine::commands::fill_patterns 13 Fill patterns (hatches): the built-in patterns and the project’s own (see cc_core::fill_pattern), which materials (cut and surface patterns), filled region types and view overrides use.
cc_engine::commands::foundation 6 Foundations: pads under columns, strips (ground beams) under walls and slabs, placed one by one or under existing columns and walls.
cc_engine::commands::framing 8 Bracing and trusses: sloped members between points in space, braces between columns and trusses laid out from a span, a height and a pattern.
cc_engine::commands::graph 8 Visual programming graphs (see crate::graph): run a .ccgraph, check it, list the nodes a graph can use, and see or release the elements a graph made.
cc_engine::commands::graphics 28 View graphics: category visibility and overrides, element overrides and hiding in a view, view filters, view templates and temporary hiding and isolation.
cc_engine::commands::grid_frame 3 A multi-storey grid frame: on every storey of a range of levels, columns at the grid intersections (tops attached to the level above) and beams along the grids on the upper level, plus optional secondary beams, in one undo step.
cc_engine::commands::io 13 Files: IFC import/export, SketchUp and OBJ import, sheet PDF/SVG, view PNG/SVG/PDF, schedule CSV, component files.
cc_engine::commands::level_mark 2 Level marks: the elevation of a point written in a plan, an elevation or a section (see cc_core::level_mark).
cc_engine::commands::levels 5 Levels: create (with their plans, also as a storey above or below another), rename, change elevation or storey height, delete.
cc_engine::commands::lightning 7 Lightning protection: conductors on the roof, down the walls and in the ground (an earth ring), air terminals on the roof, earth electrodes, and a coverage check of the roofs (see cc_core::lightning, cc_geom::lightning).
cc_engine::commands::line_style 5 Line styles: the built-in styles and the project’s own (see cc_core::detail), used by detail lines and region boundaries.
cc_engine::commands::mass 11 Conceptual masses: creating them (an extrusion, or a loft to another outline) and choosing and reading their mass floors.
cc_engine::commands::materials 8 Materials: create, duplicate, rename, change, delete.
cc_engine::commands::mep 21 Building services: pipes and conduits, plumbing systems and electrical circuits, and what they add up to (lengths, loads, fixture units).
cc_engine::commands::modify 25 Modifying elements: delete, move, copy/array, rotate, mirror, pin, flip, joins, trim/extend, split, offset, align, end points.
cc_engine::commands::niche 2 Niches (issue #304): recesses in one face of a wall, hosted like doors and windows.
cc_engine::commands::pad 5 Building pads: flat areas graded into a terrain, with cut and fill slopes out to the existing ground (see cc_core::pad).
cc_engine::commands::paint 4 Painted faces: a material on one surface of an element (see cc_core::paint for how a paint finds its face after the model changes).
cc_engine::commands::phases 18 Construction phases: the project’s phases, the phases of elements (built, demolished), phase filters and the graphics of each status (see cc_core::phase).
cc_engine::commands::piles 12 Piles and pile caps (see cc_core::pile): free piles, pile and pile cap types, caps placed one by one or under columns (their piles made with them), and tie beams between caps.
cc_engine::commands::profiles 12 Structural profiles (see cc_core::structural_profile): the named cross-sections column and beam types are drawn and built with.
cc_engine::commands::project 10 The session’s project: new, open, save, information, undo, units, language.
cc_engine::commands::query 18 Reading the model: categories, levels, types, elements, views, materials, schedules.
cc_engine::commands::ramp 6 Ramps: creating them in any shape and checking them against the accessibility rules of their type.
cc_engine::commands::rebar 6 Reinforcement: sets of bars in beams and columns, and copying a host’s sets to others.
cc_engine::commands::region 6 Filled and masking regions: 2D areas drawn in one view (see cc_core::region), sketched like floors (curves: an outline and the loops inside it as openings).
cc_engine::commands::render 1 Photorealistic rendering of 3D views (path tracing, cc_raytracing).
cc_engine::commands::roofing 2 Roof coverings and framing: checking a roof against its tiles.
cc_engine::commands::schedule 2 Schedule definitions (see cc_core::schedule): the fields a schedule shows, its filters, its sorting and grouping, how each column is written and how the table looks on paper.
cc_engine::commands::shaft 3 Shaft openings: vertical openings through the floors, ceilings and roofs between their base and top (see cc_core::shaft).
cc_engine::commands::sheets 14 Sheets and their title blocks: paper, title block, fields and issue date of a sheet; title block components and their 2D pieces.
cc_engine::commands::site 4 The site location (latitude, longitude, elevation, true north and the postal address) and the map data brought in around it (a site drawing and context masses from OpenStreetMap).
cc_engine::commands::sketch 7 Sketched outlines: the curves of floors, ceilings, roofs and masses (see cc_core::sketch), given to the commands that create them as curves, read with sketch_get and drawn again with sketch_set.
cc_engine::commands::slab_rebar 2 Slab reinforcement: a mesh, or ring and radial bars, in the top and bottom layers of floors and foundation slabs, and trimming bars around their openings.
cc_engine::commands::stair 6 Stairs: creating them in any shape, checking their steps and adding the railings that follow them.
cc_engine::commands::steel_building 6 Parametric steel buildings (see cc_core::steel_building): the host element and the catalog types its members get by default.
cc_engine::commands::strip_rebar 2 Strip footing reinforcement: bars across and along the footing slab, and stirrups, side bars and longitudinal bars for the beam on top.
cc_engine::commands::structure 11 Structural layout from grids: columns at grid intersections and beams between the columns along grid lines or in a given order.
cc_engine::commands::structure_material 9 Column and beam types by structural material (concrete, steel, timber): the first type of a material, else a default made from the profile catalog (steel W200x26,6, timber MLC 9x32) or a 20 x 40 concrete rectangle, in one undo step.
cc_engine::commands::sun 13 The sun of a view (see cc_core::sun): its settings as commands show and take them (view_get, view_set), where it stands, the frames of a study, and the project’s named presets.
cc_engine::commands::sweep 4 Swept profiles: a profile (a closed outline held by the type) carried along a path in plan, for baseboards, crown moldings, fascias, gutters and copings.
cc_engine::commands::topography 8 Terrain: topography surfaces from measured points inside a boundary (see cc_core::topography).
cc_engine::commands::types 7 Types and components: change, duplicate, delete, create components.
cc_engine::commands::valve 4 Valves on pipes: inline accessories hosted by a pipe at a distance along its run (see cc_core::mep::Valve).
cc_engine::commands::views 11 Views and sheets: create, change, duplicate, delete, place on sheets.
cc_engine::commands::wall_framing 5 Light steel and wood framing of walls (see cc_core::wall_framing): the host element and the catalog types its members get by default.
cc_engine::commands::wall_rebar 6 Wall reinforcement: horizontal (ring) and vertical bars near each face of a wall, and ties between the faces.
cc_engine::defaults 11 Defaults applied when elements are created (shared by the drawing tools).
cc_engine::dimensions 3 Dimensions that follow and drive the model.
cc_engine::error 3  
cc_engine::extension 3 Commands added at run time (plugins).
cc_engine::gltf 3 glTF 2.0 models (.glb, or .gltf with its buffers embedded as data URIs or in files next to it) as component types: each node of the scene’s root, with everything below it, becomes a type of fixed mesh pieces, one per material, placed by an element at the center of its footprint and the bottom of its extent.
cc_engine::graph 15 Visual programming graphs: nodes joined by wires, evaluated as a dataflow over the engine’s commands.
cc_engine::graph::builtin 11 The built-in nodes: input values, math, lists, geometry (as the JSON values commands take: points [x, y] and curves) and element parameters.
cc_engine::graph::eval 8 Running a graph: nodes in dataflow order, lists mapped over, the elements edit nodes create bound to their calls.
cc_engine::graph::lace 4 Lacing: a node given lists where it takes single values runs once per item, and its outputs become lists of the same shape.
cc_engine::graph::ports 4 Ports of graph nodes: their types, read from command schemas, and how deep a value runs past what a port takes (the lists a node maps over).
cc_engine::i18n 11 Localization: a Fluent-compatible subset (key = value messages with { $var } placeholders).
cc_engine::import_material 7 Materials of imported models (SketchUp, OBJ, glTF): name, color, opacity and texture.
cc_engine::obj 6 Wavefront OBJ models as component types: each object (o, or g in a file without objects) becomes a type of fixed mesh pieces, one per material of its .mtl library, placed by an element at the center of its footprint and the bottom of its extent.
cc_engine::osm 13 OpenStreetMap data around the project site: the JSON an Overpass query returns, turned into a site drawing (buildings, streets, paths, railways, water, green areas, trees and street names, in project coordinates) and building footprints with heights for context masses; plus the answers of the address search (Nominatim) and of an elevation service.
cc_engine::reference 1 The command reference (docs/commands.md), generated from the catalog so it always matches the engine: ccad reference > docs/commands.md.
cc_engine::refs 32 Naming model objects in commands: levels, types, views, materials and systems by numeric id or by name; elements by id.
cc_engine::registry 4  
cc_engine::script 10 Scripts (macros): a list of commands with their arguments, as a JSON array of {"command": ..., "args": {...}} objects or one such object per line (// lines are comments).
cc_engine::session 4  
cc_engine::skp 9 SketchUp (.skp) models as component types: the geometry of each placed component or group becomes a type of fixed mesh pieces (one per material), placed by an element at the instance’s position and plan rotation.

cc_engine

crates/cc_engine/src/lib.rs

Re-exports

Items: params_of · element_params · params_patch · value_patch · element_params_patch

fn params_of

pub fn params_of<T: serde::Serialize>(value: &T) -> serde_json::Value

The fields of an enum value’s variant as *_get shows them in params.

fn element_params

pub fn element_params(kind: &cc_core::ElementKind) -> serde_json::Value

An element’s params as element_get shows them (an imported drawing without the drawing itself, which is not a parameter).

fn params_patch

pub fn params_patch<T>(old: &T, new: &T) -> serde_json::Value where T: serde::Serialize + serde::de::DeserializeOwned + PartialEq

The params patch a *_set command needs to turn the enum value old (a view kind, type data) into new. Unlike params_of(new), it also clears the fields new leaves out of its JSON form (an option set back to none, a list emptied, a flag turned off), which a merge patch would otherwise keep.

fn value_patch

pub fn value_patch<T>(old: &T, new: &T) -> serde_json::Value where T: serde::Serialize + serde::de::DeserializeOwned + PartialEq

The merge patch that turns a whole value old (a struct a command takes as a patch, such as a template’s underlay) into new, clearing the fields new leaves out as params_patch does.

fn element_params_patch

pub fn element_params_patch(old: &cc_core::ElementKind, new: &cc_core::ElementKind) -> serde_json::Value

params_patch for an element’s kind, as element_set applies it.

cc_engine::commands

crates/cc_engine/src/commands/mod.rs

The commands, by area. Each is a parameter struct implementing crate::Command; crate::catalog lists them all.

Items: edit · check · add_element · variant · merge · clearing_patch · patch_variant · patch_value · created · ids_json

fn edit

pub(crate) fn edit<R>(s: &mut Session, tx: String, f: impl FnOnce(&mut EditCtx) -> Result<R>) -> Result<R>

Run an edit as one undo step, kept only if it succeeds and leaves a project that needs no repair (no dangling references, no invalid numbers).

fn check

pub(crate) fn check(p: &Project) -> Result<()>

The project is consistent: repairing a copy would change nothing.

fn add_element

pub(crate) fn add_element(e: &mut EditCtx, level: LevelId, type_id: ElementTypeId, kind: ElementKind) -> ElementId

Add an element (doors and windows get the next free mark).

fn variant

pub(crate) fn variant(v: Value) -> (String, Value)

The fields of an enum value’s single variant: {"Wall": {...}} gives ("Wall", {...}); unit variants give an empty object.

fn merge

pub(crate) fn merge(target: &mut Value, patch: &Value)

Merge patch: objects merge key by key, anything else (arrays, numbers, null for an optional value) replaces. Unlike RFC 7396, null sets a field to null rather than removing it (model fields are never absent). An enum value given as another variant ({"Round": ..} over {"Rectangular": ..}) replaces the old one.

fn clearing_patch

pub(crate) fn clearing_patch(old: &Value, new: &Value, check: &dyn Fn(&Value) -> Option<bool>) -> Value

A merge patch from old to new (two JSON forms of one value, which leave out empty fields): new itself, plus a value clearing each field old has and new leaves out. check merges a whole patch into the old value and tells whether the result is valid (Some) and is the new value (true). Each missing field takes the first of null, false, [], "" and 0 that keeps the patch valid, or, for an object, its own fields cleared the same way. When that does not give new (a field cannot be cleared this way), the patch is new as before.

fn patch_variant

pub(crate) fn patch_variant<T: serde::Serialize + serde::de::DeserializeOwned>(value: &T, patch: &Value) -> Result<T>

Apply a merge patch to the fields of an enum value (keeping its variant).

fn patch_value

pub(crate) fn patch_value<T: serde::Serialize + serde::de::DeserializeOwned>(value: &T, patch: &Value) -> Result<T>

Apply a merge patch to a whole serializable value.

fn created

pub(crate) fn created(s: &mut Session, id: ElementId) -> Value

What a created or changed element looks like now.

fn ids_json

pub(crate) fn ids_json(ids: &[ElementId]) -> Value

cc_engine::commands::analytical

crates/cc_engine/src/commands/analytical.rs

The analytical model of the structure, for structural analysis programs.

Items: AnalyticalModelGet · AnalyticalExport

struct AnalyticalModelGet

pub struct AnalyticalModelGet

The analytical model of the structure: structural columns and beams as members along their center lines between shared nodes. Beams framed into columns end on the column axis, beams ending on beams end on their line, and members are split where others connect. Each member carries its section: the profile’s name, width and height (m), area (m²), ix, iy and j (m⁴).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

struct AnalyticalExport

pub struct AnalyticalExport

Write the analytical model (as analytical_model returns it) to a JSON file.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

cc_engine::commands::annotate

crates/cc_engine/src/commands/annotate.rs

Dimensions: place (associated with what they measure) and drive by value.

Items: DimensionCreate · DimensionChainCreate · DimensionOrdinateCreate · DimensionSetValue · LeaderArgs · TextCreate · TextAddLeader · TextRemoveLeader · TagMove

struct DimensionCreate

pub struct DimensionCreate

Place a dimension in a 2D view (points in the view’s drawing coordinates: plan X/Y in plans; horizontal position and height in elevations and sections). Its ends follow the elements (or level lines) their points lie on, so it keeps measuring them. Aligned dimensions measure from a to b, linear ones along a horizontal or vertical direction, ordinate ones from the origin a to b along that direction (a running dimension; see dimension_ordinate_create), angular ones the angle at vertex between the rays through a and b, radial and diameter ones the arc centered at a through b.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct DimensionChainCreate

pub struct DimensionChainCreate

Place a chain of dimensions on one dimension line (continuous dimensioning): one dimension from each point to the next, all measured along the same direction and drawn on the same line, in one undo step. Points are in the view’s drawing coordinates, as for dimension_create, and each end follows the element (or level line) it lies on. In an aligned chain, segments along the direction are aligned dimensions and the others measure along that direction.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct DimensionOrdinateCreate

pub struct DimensionOrdinateCreate

Place running (ordinate) dimensions on one dimension line: one dimension from the origin (the first point) to each other point, measured along the same direction, each showing its running total from the origin, in one undo step. Points are in the view’s drawing coordinates, as for dimension_create, and each end follows the element (or level line) it lies on, so the totals follow the model; giving one a new value with dimension_set_value moves what its point measures, keeping the origin.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct DimensionSetValue

pub struct DimensionSetValue

Give a dimension a new value (meters; degrees for angular dimensions): in plans what its moving end measures moves or stretches; between level lines in elevations and sections the upper level moves. Radial and diameter dimensions are read-only.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct LeaderArgs

pub struct LeaderArgs

A leader of a new text note.

Traits: Debug, Deserialize, Serialize, JsonSchema, Clone, Default

Fields

struct TextCreate

pub struct TextCreate

Place a text note in a 2D view (points in the view’s drawing coordinates, as for dimensions). Without width it is single-line text (only line breaks in text break it); with width (paper millimeters) it is multiline text wrapped to that width. Leaders point from the text to what it describes, each with one segment or two (with an elbow).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct TextAddLeader

pub struct TextAddLeader

Add a leader to a text note.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct TextRemoveLeader

pub struct TextRemoveLeader

Remove a leader from a text note.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct TagMove

pub struct TagMove

Move the tag of an element in a plan (the tag of a door, window, beam, column or footing): by delta from where it is, to offset from its default spot, or back there with reset. A tag moved away from its element gets a leader to it. Each plan keeps its own tag positions.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

cc_engine::commands::bar_marks

crates/cc_engine/src/commands/bar_marks.rs

Bar marks, bending schedules, bar tags and the check of bar lengths (see cc_core::bar_marks, cc_core::bar_tag, cc_geom::bar_marks and cc_views::bending).

Items: shape_json · mark_json · BarMarksList · BarMarksUpdate · BarMarksRenumber · BarMarkingSet · BarLengthCheck · BendingScheduleCreate · takes_tags · TagParts · BarTagCreate · check_tag · tag_text

fn shape_json

pub(crate) fn shape_json(s: &ShapeSummary) -> Value

A shape as the queries show it: lengths in meters, turns in degrees.

fn mark_json

pub(crate) fn mark_json(m: &Mark) -> Value

A mark as the queries show it.

struct BarMarksList

pub struct BarMarksList

Every bar mark of the model, sorted naturally (N2 before N10): its diameter and grade, its shape (code, e.g. L 30-470, and the legs), the length of one bar (unit_length, the mean of its bars), how many bars have it, their total length and weight, the longest bar, the sets using it, and where it comes from (source: frozen, override or numbered). Frozen marks no bar uses are listed with a count of 0. Also the marking settings. A mark names one shape: the same diameter, grade, legs and bends within the length tolerance (default 5 mm) and 1 degree, read from either end or mirrored. Lengths in meters, angles in degrees, weights in kilograms.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

struct BarMarksUpdate

pub struct BarMarksUpdate

Freeze the bar marks: the marks numbered for shapes the frozen marks table does not hold yet are added to it, so they stay when the model changes (entries already there are kept, overrides stay on their sets). With drop_unused, entries no bar uses any more are dropped. Changes nothing (and makes no undo step) when there is nothing to freeze or drop. bar_marks_list shows the result.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct BarMarksRenumber

pub struct BarMarksRenumber

Number the bar marks afresh: the frozen marks table is cleared, and so are the sets’ bar_mark overrides unless keep_overrides; then every shape is numbered from start (default: the current one) with prefix (default: the current one) in the stable order (partition, diameter descending, length descending, shape) and the numbering is frozen. One undo step; returns the new marks.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct BarMarkingSet

pub struct BarMarkingSet

Change how bars are marked: the prefix and start of numbered marks (used by marks numbered from now on; bar_marks_renumber renumbers the frozen ones), the length tolerance within which bars are one shape, and the stock length bars are bought in (bar_length_check and bending schedules flag longer bars). One undo step.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct BarLengthCheck

pub struct BarLengthCheck

Bars longer than max_length (default: the project’s stock length, 12 m unless bar_marking_set changed it): the bars that need splices, listed by set and mark with how many there are and the longest. A set with a max_length of its own cuts its bars into lapped pieces, which then pass.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct BendingScheduleCreate

pub struct BendingScheduleCreate

Create a bending schedule: a reinforcement schedule view with one row per bar mark (mark, diameter, grade, a sketch of the shape with its dimensions, the length of one bar in centimeters, the count, the total length and the weight, from the type’s mass per meter or the diameter; rows of bars longer than the stock length noted) and, under it, a summary per diameter and grade (total length and weight; with waste_percent, the weight with the waste added). Totals add the bars exactly. It is placed on sheets, exported (view_export) and written to CSV (schedule_export_csv, shapes as codes such as L 30-470) like any schedule; view_set changes its def.bending options later.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

fn takes_tags

pub(crate) fn takes_tags(view: &View) -> bool

Whether view takes bar tags: plans, elevations and sections.

struct TagParts

pub struct TagParts

The parts of a tag’s text to write.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Clone, Copy

Fields

struct BarTagCreate

pub struct BarTagCreate

Tag a reinforcement set in a plan, an elevation or a section: a text such as 25 N1 Ø12.5 c/12 C=500 (the count, the mark, the diameter in millimeters, the spacing in centimeters for sets with one, the length of one bar in centimeters, C=var when they differ; a set of several marks shows its first and +), derived from the set each time; multiplier writes 2x first for a set repeated on both faces. The view draws the set’s bars as thin lines (dots where seen end-on), so the tag points at them. The tag goes with its view and its set. A project gets a bar tag type (2.5 mm text) with its first tag; element_get gives the text (derived.text) and element_set changes the tag’s params.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

fn check_tag

pub(crate) fn check_tag(p: &cc_core::Project, tag: &BarTag) -> Result<()>

Refuse a changed tag a view or set would not take, or with bad values.

fn tag_text

pub(crate) fn tag_text(s: &mut Session, tag: &BarTag) -> Option<String>

The text of tag tag as its view writes it.

cc_engine::commands::bracing

crates/cc_engine/src/commands/bracing.rs

Parametric bracing: bracing_create makes a host that keeps the braces of one bay of a frame in step with its pattern, storeys and brace type.

Items: brace_row · new_bracing_type · BracingCreate · derived

fn brace_row

pub fn brace_row(m: StructuralMaterial) -> Option<(&'static str, &'static str)>

The catalog row the braces of a material get by default: (series, designation); None for concrete (give a beam type).

fn new_bracing_type

pub fn new_bracing_type(id: ElementTypeId) -> ElementType

The type a project gets with its first bracing.

struct BracingCreate

pub struct BracingCreate

Brace one bay of a frame, storey by storey: the bay runs from start to end in plan (the axes of its two columns), or between two columns, whose level, base and height it then takes. pattern is x (default: both diagonals), diagonal (one, rising toward end; flip turns it, alternate turns every other storey), v (from the top corners down to the middle of the bay), chevron (from the bottom corners up to the middle, an inverted V) or k (from the mid-height of each column to the middle of the bay at the top and at the bottom of the storey). stories storeys of height are braced one above the other from base_offset. The braces are ordinary beams the bracing keeps in step with its parameters (element_set regenerates them, keeping their ids); a brace edited or deleted by hand is detached and left alone. The default brace type comes from the profile catalog for the material (steel: SHS 100x100x4; timber: Peça 6x12), made when missing; concrete needs a type. Out-of-range values are refused. One undo step; returns the bracing’s id and its members.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

fn derived

pub(crate) fn derived(b: &Bracing, out: &mut serde_json::Map<String, Value>)

element_get’s derived values of a bracing: its brace ids, how many roles are detached, the bay width and the height of all its storeys.

cc_engine::commands::browser

crates/cc_engine/src/commands/browser.rs

Project browser organization (see cc_core::browser): named schemes that group the browser’s views by view type, level, discipline or phase. The schemes and the one in use are project settings, changed in one undo step each; browser_tree gives the tree the browser shows.

Items: NEW_SCHEME · BrowserSchemesList · BrowserSchemeCreate · BrowserSchemeSet · BrowserSchemeDelete · BrowserSchemeUse · BrowserTree

const NEW_SCHEME

pub const NEW_SCHEME: [GroupBy; 2]

The criteria a new scheme groups by when none are given.

struct BrowserSchemesList

pub struct BrowserSchemesList

The project browser’s organization schemes: each with its name and the criteria it groups the views by, outermost first, and whether it is in use. in_use is null while the browser lists the views by type alone (the default), and criteria are the names group_by takes.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

struct BrowserSchemeCreate

pub struct BrowserSchemeCreate

Create a project browser organization scheme: a named way to group the browser’s views. group_by lists the criteria from the outermost group in (view_type, level, discipline, phase); a view without a value for one (a section has no level) stays beside that criterion’s groups. The new scheme is put in use unless use_it is false.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct BrowserSchemeSet

pub struct BrowserSchemeSet

Change a project browser organization scheme: its name or the criteria it groups the views by. The browser follows at once when it is in use.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct BrowserSchemeDelete

pub struct BrowserSchemeDelete

Delete a project browser organization scheme. When it was in use the browser goes back to listing the views by type.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct BrowserSchemeUse

pub struct BrowserSchemeUse

Choose the scheme the project browser follows. Without scheme (or with null) the browser lists the views by type alone, the default.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct BrowserTree

pub struct BrowserTree

The project browser’s tree: the views grouped as the scheme in use (or scheme, or the criteria in group_by) says. A group row has group (its criterion), name, value (the view type, level id, discipline or phase id), how many views it holds and its children; a view row has view (its id) and name. Plans come in the order of their levels.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

cc_engine::commands::cable_tray

crates/cc_engine/src/commands/cable_tray.rs

Cable trays: open rectangular runs carrying electrical circuits, joined like conduits (see cc_core::mep, cc_geom::mep_net).

Items: metal · new_tray_type · parse_style · CableTrayCreate · CableTrayTypeCreate

fn metal

pub(crate) fn metal(p: &Project) -> String

The material of new cable trays and valves: the project’s first metal, else its first material.

fn new_tray_type

pub fn new_tray_type(id: ElementTypeId, width: f64, height: f64, style: TrayStyle, material: String) -> ElementType

A cable tray type of width × height and style, named by its section (in millimeters, or in inches in imperial units).

fn parse_style

pub(crate) fn parse_style(name: &str) -> Result<TrayStyle>

struct CableTrayCreate

pub struct CableTrayCreate

Create a cable tray from start to end (or a vertical run at start to end_offset) carrying circuits. Its center line runs offset above the level (default: where it starts on another cable tray, such as the end of a run; else 0.30 m under the level above). Trays meet other trays at their ends or along them (elbows, tees and crosses are derived), not conduits or pipes. A project without a cable tray type gets one (200 × 100 mm, 8” × 4” in imperial projects; ladder).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct CableTrayTypeCreate

pub struct CableTrayTypeCreate

Create a cable tray type: an open channel width × height (meters; default 0.2 × 0.1, 8” × 4” in imperial projects; at most 2 × 1), built as style says (ladder, the default, solid_bottom or perforated), in material (default: the project’s first metal). The name defaults to its section.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

cc_engine::commands::cabling

crates/cc_engine/src/commands/cabling.rs

Structured cabling: racks, data outlets and the horizontal cables between them. Each rack feeds a data system (SystemKind::Data, its panel the rack), created with the rack; outlets belong to it like devices to a circuit, and each jack takes a cable to the rack, whose length is estimated along the ceiling (see cc_core::mep::cable_length). Cable trays and conduits carry the data systems like circuits.

Items: RackPlace · DataOutletPlace · CablingList

struct RackPlace

pub struct RackPlace

Place a communications rack at position (on the wall, offset above the level, default 1.40 m, 4’-6” in imperial projects) and create the data system its outlets are cabled to. The rack’s mark and the system’s code are mark (default the next free R1, R2…). A project without a rack type gets one.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct DataOutletPlace

pub struct DataOutletPlace

Place a data (or voice) outlet at position (on the wall, offset above the level, default 0.30 m, 1’-6” in imperial projects), cabled to rack (a rack element: its data system) or to the data system system; by default to the project’s only rack, if it has one. ports picks a type with that many jacks (one cable each), made when the project has none; a project without a data outlet type gets one (two jacks).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct CablingList

pub struct CablingList

The structured cabling per rack: for each data system, its rack, its outlets with their jacks and the estimated length of each cable (up to the ceiling of the outlet’s level, across along the two axes, down to the rack, plus 3 m of slack), the totals, and the cables longer than the 90 m of a permanent link. rack limits it to one rack.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

cc_engine::commands::cad

crates/cc_engine/src/commands/cad.rs

Imported CAD drawings (DWG, DXF and SVG underlays, and pictures): importing a file into a 2D view and showing or hiding its layers. The placement (units, scale, position, rotation, colors) is edited with element_set; moving, rotating, pinning and deleting use the generic commands.

Items: light · params · patch · derived · cad_type · CadImportFile · ImageImport · IMAGE_EXTENSIONS · cad_of · CadLayers · CadLayersSet

fn light

pub(crate) fn light(kind: &ElementKind) -> std::borrow::Cow<'_, ElementKind>

The element kind without its drawing (what params show and patch): the drawing is data read from the file, not a parameter.

fn params

pub fn params(kind: &ElementKind) -> Value

params of an element kind (its variant’s fields), without an imported drawing.

fn patch

pub(crate) fn patch(c: &CadImport, patch: &Value) -> Result<ElementKind>

Apply a params patch to an imported drawing’s element, keeping its drawing.

fn derived

pub(crate) fn derived(c: &CadImport, out: &mut serde_json::Map<String, Value>)

Derived values of an imported drawing for element_get.

fn cad_type

pub(crate) fn cad_type(e: &mut cc_core::EditCtx) -> ElementTypeId

The imported drawing type, creating one if the project has none.

struct CadImportFile

pub struct CadImportFile

Import a DWG or DXF file into a 2D view (plan, ceiling plan, elevation, section, legend or drafting view) as a drawing to trace over, in one undo step. DXF (ASCII or binary, any version) is read entirely by ConstructCraft; DWG (R12 to 2018 and later) through the acadrust library. Blocks are inserted, curves kept as arcs, texts kept; entities that are not drawn (3D solids, images, infinite lines…) are counted in skipped. The element starts pinned, with the layers that are off or frozen in the file hidden, and in the view’s level. It is drawn in the view only, under the model, and is left out of 3D views and IFC export.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ImageImport

pub struct ImageImport

Import a picture (PNG, JPEG, GIF, BMP or WebP) or an SVG drawing into a 2D view (plan, ceiling plan, elevation, section, legend or drafting view), in one undo step, as an imported drawing under the model: placed, scaled, rotated, pinned, hidden and printed like an imported DWG or DXF. A picture is as large as its resolution makes it on paper (96 dpi when the file declares none), times scale, unless width sets its width in the view; the file’s bytes are kept in the project. An SVG keeps its paths (curves as polylines), fills and embedded pictures in their own colors; its texts are not read.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

const IMAGE_EXTENSIONS

pub const IMAGE_EXTENSIONS: [&str; 7]

File extensions read by image_import.

fn cad_of

pub(super) fn cad_of(s: &Session, id: u64) -> Result<(ElementId, CadImport)>

struct CadLayers

pub struct CadLayers

The layers of an imported drawing: name, color, whether the view shows it, whether it was on in the file, and how many primitives it holds.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct CadLayersSet

pub struct CadLayersSet

Show or hide layers of an imported drawing (by name; all of them when layers is empty).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

cc_engine::commands::cad_explode

crates/cc_engine/src/commands/cad_explode.rs

Exploding an imported drawing (cad_explode): its visible primitives become native, editable elements of its view in one undo step. Lines, polylines (bulged segments as arcs), arcs and circles become detail lines, one per segment, in a project line style per layer; fills become filled regions of a solid type per color; texts become text notes of a text type per size; pictures stay in an imported drawing with the same placement. The element’s color mode and halftone are not carried over: the line styles take the layer colors.

Items: MAX_ELEMENTS · MAX_NEW_TYPES · CadExplode

const MAX_ELEMENTS

pub const MAX_ELEMENTS: usize

Most elements one explode makes: a larger drawing is refused (explode a part of it after hiding layers, or keep it as an imported drawing).

const MAX_NEW_TYPES

pub const MAX_NEW_TYPES: usize

Most types (text sizes and fill colors) one explode adds.

struct CadExplode

pub struct CadExplode

Explode an imported DWG, DXF or SVG drawing into native elements of its view, in one undo step: its lines, polylines, arcs and circles become detail lines (one element per segment, bulged segments as arcs; ellipses and splines are stored as polylines and come out as their segments), its fills filled regions (no boundary, a solid filled region type of the fill’s color, reused when the project has one), and its texts text notes (same place, height, rotation and alignment; a text type of that size on paper at the view’s scale, reused when one exists). Each layer becomes a project line style of its name and color (light colors darkened for paper), reused when a style of that name exists. Layers hidden in the element (which starts with the layers off or frozen in the file) are left out; the placement (units, scale, position, rotation, mirror) is applied. Pictures stay in an imported drawing in the same view with the same placement; without them the element is removed. The color mode and halftone are not carried over. Refused above 100,000 elements.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

cc_engine::commands::callout

crates/cc_engine/src/commands/callout.rs

Callouts and detail views (see cc_core::callout).

Items: detail_scale · crop_box · rect_json · view_callout_json · CalloutCreate · CalloutRemove · CalloutsList

fn detail_scale

pub fn detail_scale(system: MeasurementSystem, parent: u32) -> u32

The default scale of a detail of a view at 1:parent: the largest standard scale of the project’s system at most a fifth of it (1:50 gives 1:10; 1/4" = 1'-0" gives 1 1/2" = 1'-0").

fn crop_box

pub(crate) fn crop_box(corners: [Point; 2]) -> Result<CropBox>

The rectangle with corners a and b, checked.

fn rect_json

pub(crate) fn rect_json(r: CropBox) -> Value

A rectangle as commands show it: [[min x, min y], [max x, max y]].

fn view_callout_json

pub(crate) fn view_callout_json(p: &Project, v: &View) -> (Value, Value)

A view’s crop and callout as view_get shows them.

struct CalloutCreate

pub struct CalloutCreate

Draw a callout in a plan, ceiling plan, section or elevation: a rectangle (two opposite corners in the view’s drawing coordinates) standing for a detail view of that region. By default a new detail view is made: of the parent’s kind (it stays live with the model, following the parent’s level, section line or direction), cropped to the rectangle, at a larger scale, with its own detail lines, regions, detail components, text and dimensions. With drafting, the callout points to that existing drafting view instead (no crop). The parent draws the rectangle with rounded corners and a tag with the detail number and the sheet number once the view is placed on a sheet. Moving the callout is changing the detail view’s crop (view_set); deleting the detail view removes it (callout_remove keeps the view).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct CalloutRemove

pub struct CalloutRemove

Remove a view’s callout from its parent; the view stays (a detail view keeps its crop and becomes an ordinary view of its kind).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct CalloutsList

pub struct CalloutsList

The callouts drawn in a view: the detail or drafting view each stands for and its rectangle.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

cc_engine::commands::component

crates/cc_engine/src/commands/component.rs

Editing a component’s definition piece by piece: parameters, reference planes and lines, and dimensions between planes that parameters drive (see cc_core::component_ref). Every command names a component type; the change goes to every type of that component in one undo step, each type keeping its own parameter values (a value set here changes only the type named).

Items: edit_def · check_expr · number · sketch_plane · ComponentGet · ComponentParamAdd · ComponentParamSet · ComponentParamDelete · ComponentRefPlaneAdd · ComponentRefPlaneSet · ComponentRefPlaneDelete · ComponentRefLineAdd · ComponentRefLineDelete · ComponentDimensionAdd · ComponentDimensionSet · ComponentDimensionDelete · ComponentEqualAdd · ComponentEqualDelete

fn edit_def

pub(crate) fn edit_def<T>(s: &mut Session, r: &Ref, renames: &[(String, String)], change: impl FnOnce(&mut ComponentDef) -> Result<T>) -> Result<T>

Change the definition of the component of type r with change, check it and write it to every type of the component in one undo step. The type named takes the new parameter values; the others keep theirs (following renames, [old, new]), and take new parameters’ values.

fn check_expr

pub(crate) fn check_expr(text: &str) -> Result<String>

An expression that must evaluate: a number, or names of the component.

fn number

pub(crate) fn number(v: f64) -> String

A number written so the expression parser reads it back exactly.

fn sketch_plane

pub(crate) fn sketch_plane(name: &str) -> Result<SketchPlane>

struct ComponentGet

pub struct ComponentGet

The component of a type, as the modeling environment shows it: the definition, the value of every parameter and reference plane, the value of each dimension, where each connector is, the problems found, and the component’s types with their parameter values. A title block’s pictures show as format, width, height (pixels) and bytes, not their bytes.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ComponentParamAdd

pub struct ComponentParamAdd

Add a parameter to a component (to every type, with the same value).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ComponentParamSet

pub struct ComponentParamSet

Change a component parameter: its value (for the type named only), kind, whether elements may override it, or its name (every expression, dimension and type follows a rename).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ComponentParamDelete

pub struct ComponentParamDelete

Remove a component parameter; refused while an expression reads it. Dimensions it labels lose the label (their planes keep their place).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ComponentRefPlaneAdd

pub struct ComponentRefPlaneAdd

Add a reference plane to a component: square to axis (x: a left/right plane, y: front/back, z: a height), at the position at, an expression that may read parameters and other planes (Left + Width).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ComponentRefPlaneSet

pub struct ComponentRefPlaneSet

Move or rename a reference plane: at is its new position (an expression); a rename follows into every expression and dimension.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ComponentRefPlaneDelete

pub struct ComponentRefPlaneDelete

Remove a reference plane and the dimensions on it; refused while an expression reads it.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ComponentRefLineAdd

pub struct ComponentRefLineAdd

Add a reference line on one of the sketch planes (plan, front or side, standing at offset along its normal axis): its ends are [u, v] pairs of expressions in that plane.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ComponentRefLineDelete

pub struct ComponentRefLineDelete

Remove a reference line.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ComponentDimensionAdd

pub struct ComponentDimensionAdd

Dimension two parallel reference planes in a view (plan, front or side, one that sees them edge-on). With label, a length parameter drives it: the second plane moves to the first plus the parameter (the parameter is created with the current distance when missing).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ComponentDimensionSet

pub struct ComponentDimensionSet

Change a dimension between reference planes: label it with a parameter (label, created when missing), take its label off (label: "", the planes stay), move its line (place) or give it a new value (the label’s parameter for this type, or the moving plane’s position).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ComponentDimensionDelete

pub struct ComponentDimensionDelete

Remove a dimension between reference planes (the planes stay).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ComponentEqualAdd

pub struct ComponentEqualAdd

Keep the plane middle halfway between the parallel planes a and b (an equality, EQ): its position becomes (a + b) / 2, so it follows whatever moves them. Shown in view (plan, front or side) as two equal dimensions.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ComponentEqualDelete

pub struct ComponentEqualDelete

Remove an equality (EQ); its middle plane stays halfway as written.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

cc_engine::commands::component_connector

crates/cc_engine/src/commands/component_connector.rs

Connectors of a component: the points where pipes and conduits join it (a toilet’s water inlet and sewer outlet, an outlet’s electrical connection), each with the kind of system it takes, a position and a diameter as expressions, and the direction runs leave it. A reference plane’s name in a coordinate locks the connector to that plane.

Items: DIRECTIONS · direction_name · ComponentConnectorAdd · ComponentConnectorSet · ComponentConnectorDelete

const DIRECTIONS

pub const DIRECTIONS: [(&str, ConnectorDirection); 6]

Names of the connector directions in commands.

fn direction_name

pub fn direction_name(d: ConnectorDirection) -> &'static str

The command name of a direction.

struct ComponentConnectorAdd

pub struct ComponentConnectorAdd

Add a connector to a component: where a pipe or conduit of system joins it. x, y and z place it in the component’s frame (numbers or expressions; a reference plane’s name locks it to that plane), and direction is the way runs leave it.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ComponentConnectorSet

pub struct ComponentConnectorSet

Change a connector of a component: its name, kind of system, position (x, y, z, numbers or expressions; a reference plane’s name locks it to that plane), direction or diameter (empty to clear it).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ComponentConnectorDelete

pub struct ComponentConnectorDelete

Remove a connector of a component.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

cc_engine::commands::component_piece

crates/cc_engine/src/commands/component_piece.rs

Pieces of a component drawn as sketches: an outline on the plan, front or side plane extruded along the plane’s normal, revolved about an axis in it, swept along a path or blended into a second outline; solid or void. Coordinates are expressions, so a reference plane’s name locks a point (or the start and end) to that plane.

Items: ExprArg · SketchPointArg · BezierArg · EllipseArg · profile_points · ComponentPieceAdd · ComponentPieceSet · depth_end · ComponentPieceDelete

enum ExprArg

pub enum ExprArg

A number or an expression of the component.

Traits: Debug, Clone, PartialEq, Deserialize, Serialize, JsonSchema

Variants

Methods

struct SketchPointArg

pub struct SketchPointArg

A point of a sketch: u, v in its plane (numbers or expressions; a plane’s name locks the coordinate to it), and radius to make the segment to the next point an arc (positive bulging outwards), ellipse a part of an ellipse, or bezier a cubic Bézier curve (a spline’s segment) by its two handles.

Traits: Debug, Clone, PartialEq, Deserialize, Serialize, JsonSchema

Fields

Methods

struct BezierArg

pub struct BezierArg

The two handles of a cubic Bézier segment to the next point.

Traits: Debug, Clone, PartialEq, Deserialize, Serialize, JsonSchema

Fields

struct EllipseArg

pub struct EllipseArg

The ellipse the segment to the next point runs along.

Traits: Debug, Clone, PartialEq, Deserialize, Serialize, JsonSchema

Fields

fn profile_points

pub(crate) fn profile_points(points: &[SketchPointArg]) -> Result<Vec<ProfilePoint>>

struct ComponentPieceAdd

pub struct ComponentPieceAdd

Add a piece drawn as a sketch on the plan, front or side plane: an extrusion of the closed outline from start to end along the plane’s normal (Z for the plan, Y for the front, X for the side); a revolution about the line u = axis of the plane, angle degrees (default 360); a sweep of the closed outline (points: u to the left of the path, v along the normal) along the open path drawn on the plane at start, mitered at its corners; or a blend from the outline at start to the top outline at end. Coordinates are numbers or expressions; a reference plane’s name locks a coordinate (or start, end, axis) to that plane, so the piece follows it. With void, the piece is cut out of the solid pieces it overlaps.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ComponentPieceSet

pub struct ComponentPieceSet

Change a piece of a component: its name, material, whether it is a void or drawn in plans, and for sketched pieces their outline, start, end (extrusions), axis and angle (revolutions).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

fn depth_end

pub fn depth_end(start: &str, depth: &str) -> String

Where an extrusion ends, as an expression: start + depth, read back plainly when the depth was written as end - start.

struct ComponentPieceDelete

pub struct ComponentPieceDelete

Remove a piece of a component (it may be left with none while it is shaped).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

cc_engine::commands::component_script

crates/cc_engine/src/commands/component_script.rs

Scripted components: writing a script piece (its declarations become the component’s parameters and hotspots), reading and setting parameter values of a type or of placed elements, and moving hotspots. See cc_script::object for the scripts themselves.

Items: ComponentScriptSet · script_errors · ComponentParamsGet · ComponentParamsSet · ComponentHotspotMove

struct ComponentScriptSet

pub struct ComponentScriptSet

Write the Lua source of a script piece of a component: the piece named, or a new script piece. What the script declares becomes the component’s parameters and hotspots (values of those still declared are kept); a script that does not load is refused, one that fails while building its pieces is kept and its error returned.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

fn script_errors

pub(crate) fn script_errors(p: &Project, ty: ElementTypeId, def: &ComponentDef, element: Option<ElementId>) -> Vec<String>

The errors of a type’s script pieces, run with the type’s values or an element’s.

struct ComponentParamsGet

pub struct ComponentParamsGet

The parameters and hotspots of a component type, with the type’s values; or of placed components (all of one component), with the value they share or mixed where they differ.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ComponentParamsSet

pub struct ComponentParamsSet

Set a parameter of a component type (every element of the type follows) or the instance value of placed components (all of one component; the parameter must be an instance one). Values: numbers (meters, degrees), true/false, texts, choice keys or material names. One undo step; when any target refuses the value nothing changes.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ComponentHotspotMove

pub struct ComponentHotspotMove

Move a hotspot of a placed component (what its script reads as p.<name>). The point is in the component’s frame (meters from the insertion point, x to its right, y to its back, z up) unless world.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

cc_engine::commands::connection

crates/cc_engine/src/commands/connection.rs

Steel and timber connections (see cc_core::connection): placing them on member ends, the checks element_set runs on them and the values element_get derives.

Items: new_connection_type · params_arg · ConnectionsCreate · check · derived

fn new_connection_type

pub fn new_connection_type(id: ElementTypeId) -> ElementType

The type a project gets with its first connection.

fn params_arg

pub(crate) fn params_arg(kind: ConnectionKind, patch: &Value) -> Result<ConnectionParams>

kind’s defaults with patch merged in, every name known and every value in range.

struct ConnectionsCreate

pub struct ConnectionsCreate

Place steel or timber connections of one kind at every member end that suits it: base_plate under columns; end_plate and timber_bolts at beam ends that stop at a column; fin_plate at beam ends at a column or another beam; hanger at beam ends at another beam. Ends that already have a connection are skipped. Plates and bolts follow their member. One undo step; returns the new ids (created) and how many ends were skipped.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

fn check

pub(crate) fn check(old: &Connection, new: &Connection) -> Result<()>

element_set on a connection: it keeps its member, end and kind, and its sizes stay in range.

fn derived

pub(crate) fn derived(g: &cc_geom::connection::ConnectionGeom, out: &mut serde_json::Map<String, Value>)

element_get’s derived values of a connection.

cc_engine::commands::create

crates/cc_engine/src/commands/create.rs

Creating elements, with the same defaults as the drawing tools.

Items: top · create · WallCreate · arc_bulge · check_bulge · check_arc · check_beam_arc · HostedArgs · hosted_at · DoorCreate · WindowCreate · SketchArgs · sketched · sketch · FloorCreate · CeilingCreate · RoofCreate · check_roof_holes · check_openings · RoofEdgeSet · FloorOpeningAdd · FloorOpeningRemove · RoofOpeningRemove · RoomCreate · grids · GridCreate · ColumnCreate · BeamCreate · justification · RailingCreate · ComponentPlace

fn top

pub(crate) fn top(p: &Project, top_level: Option<&Ref>, top_offset: Option<f64>) -> Result<Option<WallTop>>

A top constraint: attached to a level (with an offset) or a fixed height.

fn create

pub(crate) fn create(s: &mut Session, tx: String, level: LevelId, category: Category, ty: Option<&Ref>, kind: ElementKind) -> Result<Value>

struct WallCreate

pub struct WallCreate

Create a wall from start to end on a level: straight, or an arc through mid (or with a bulge or a radius). Its top is height above its base, or attached to top_level (plus top_offset).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

fn arc_bulge

pub(crate) fn arc_bulge(start: glam::DVec2, end: glam::DVec2, mid: Option<Point>, bulge: Option<f64>, radius: Option<f64>, major: Option<bool>) -> Result<f64>

The bulge of the line or arc from start to end: through mid, else bulge, else of radius (signed: positive counter-clockwise; the longer arc when major), else 0 (straight).

fn check_bulge

pub(crate) fn check_bulge(bulge: f64) -> Result<f64>

A bulge within the range arcs accept.

fn check_arc

pub(crate) fn check_arc(p: &Project, type_id: cc_core::ElementTypeId, wall: &Wall) -> Result<()>

An arc wall must leave room inside its curve for its thickness.

fn check_beam_arc

pub(crate) fn check_beam_arc(p: &Project, type_id: cc_core::ElementTypeId, beam: &Beam) -> Result<()>

An arc beam is level and must leave room inside its curve for its width.

struct HostedArgs

pub struct HostedArgs

Parameters shared by doors and windows.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default

Fields

fn hosted_at

pub(crate) fn hosted_at(p: &Project, a: &HostedArgs, ty: &cc_core::ElementType) -> Result<(Hosted, LevelId)>

Where an element of type ty (a door, a window, a niche) goes in the wall the arguments name, and that wall’s level.

struct DoorCreate

pub struct DoorCreate

Place a door in a wall (centered on the wall unless offset or point is given).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct WindowCreate

pub struct WindowCreate

Place a window in a wall (centered on the wall unless offset or point is given).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct SketchArgs

pub struct SketchArgs

Parameters shared by floors, ceilings and roofs.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default

Fields

fn sketched

pub(crate) fn sketched(s: &Session, a: &SketchArgs, category: Category) -> Result<(LevelId, cc_core::sketch::Profile, Option<cc_core::sketch::Sketch>)>

The level, outline and openings of a sketched element, and the curves it was drawn with (curves).

fn sketch

pub(crate) fn sketch(s: &Session, a: &SketchArgs, category: Category) -> Result<(LevelId, Vec<DVec2>)>

The level and outline of an element with no openings.

struct FloorCreate

pub struct FloorCreate

Create a floor slab from an outline (or the loop of walls).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct CeilingCreate

pub struct CeilingCreate

Create a ceiling from an outline (or the inside of the loop of walls).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct RoofCreate

pub struct RoofCreate

Create a roof over an outline (or the loop of walls): flat by default; change its shape (shed, gable, hip) with element_set.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

fn check_roof_holes

pub(crate) fn check_roof_holes(roof: &Roof) -> Result<()>

A roof’s openings must be outlines with an area, inside its footprint (clear of its edges) and apart from each other.

fn check_openings

pub(crate) fn check_openings(boundary: &[DVec2], openings: &[Vec<DVec2>]) -> Result<()>

Openings of a floor or roof must be outlines with an area, inside the boundary (clear of its edges) and apart from each other.

struct RoofEdgeSet

pub struct RoofEdgeSet

Set the slope of one edge of a gable or hip roof’s outline (edge i runs from outline point i to the next): 0 makes it a gable end, a positive slope an eave rising at that slope, null returns it to the shape’s own.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct FloorOpeningAdd

pub struct FloorOpeningAdd

Add an opening (a shaft, a stairwell) to a floor: a closed outline inside its boundary, apart from its other openings.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct FloorOpeningRemove

pub struct FloorOpeningRemove

Remove one opening of a floor (by its index in the floor’s openings).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct RoofOpeningRemove

pub struct RoofOpeningRemove

Remove one opening of a roof (by its index in the roof’s holes).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct RoomCreate

pub struct RoomCreate

Create a room at a point enclosed by room-bounding walls (its boundary follows the walls).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

fn grids

pub fn grids(p: &Project) -> impl Iterator<Item = (ElementId, &Grid)>

The grids of p with their ids.

struct GridCreate

pub struct GridCreate

Create a grid line. Without name it takes the next name of its series: the one after the most recently placed grid parallel to it (1 → 2, A → B, Z → AA, A1 → A2, 1.1 → 1.2); a grid across the existing ones starts a new series (letters across numbered grids, numbers otherwise). Names given this way are unique among the grids.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct ColumnCreate

pub struct ColumnCreate

Place a column; its top goes to the level above (or height when there is none).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct BeamCreate

pub struct BeamCreate

Create a beam from start to end, straight or, for an arc beam, through mid (or with a bulge or a radius); its location line is top_offset above the level (default: the level’s height), at the top of the section unless vertical says otherwise. An arc beam is level and joins columns and other beams at its ends like a straight one.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

fn justification

pub(crate) fn justification<T: Copy>(value: Option<&str>, all: &[(&str, T)], what: &str) -> Result<Option<T>>

A beam justification by name.

struct RailingCreate

pub struct RailingCreate

Create a railing along a path (at least 2 points).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct ComponentPlace

pub struct ComponentPlace

Place a component (furniture, plumbing fixture, electrical device…) of a component type. Electrical devices default to their usual mounting height (outlets 0.30 m, switches 1.10 m, boards 1.30 m, wall lights 2.10 m, ceiling lights at the level height, data outlets 0.30 m, racks 1.40 m, air terminals on the roof under them, earth electrodes 0.50 m below the level; in imperial projects outlets 1’-6”, switches 4’-0”, boards and racks 4’-6”, wall lights 7’-0”) and may be put on a circuit or system of their kind; lightning protection devices join the first lightning protection system by default.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

cc_engine::commands::curtain

crates/cc_engine/src/commands/curtain.rs

Curtain walls: walls of a type with a curtain grid (see cc_core::curtain). They are created with wall_create like other walls; these commands make curtain wall types and adjust one wall’s grid and panels.

Items: CurtainTypeCreate · CurtainGet · Axis · CurtainGridSet · PanelArg · PanelKind · CurtainPanelSet

struct CurtainTypeCreate

pub struct CurtainTypeCreate

Create a curtain wall type: walls of it are a grid of panels and mullions. curtain changes the defaults (vertical and horizontal lines every 1.5 m, glass panels, 5 x 15 cm mullions inside and around; in imperial projects lines every 5’-0” and 2” x 6” mullions) and is shaped like params.curtain in type_get: vertical and horizontal {layout: None, FixedDistance, FixedNumber or MaxSpacing, spacing, count, justification: Start, Center or End}, panel {kind: Glass or Solid, thickness, material} or {kind: Empty} or {kind: Component, component: type id}, and vertical_mullion, horizontal_mullion, border_mullion {width, depth, material} or null for none. Place walls of it with wall_create.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct CurtainGet

pub struct CurtainGet

Show a curtain wall’s grid: its interior lines (vertical: distances along the wall from its start; horizontal: heights above its base), the panels by column and row (from the start and from the base; merged cells give their lowest) with their extent, kind and whether they are swapped, and its panel count, glazed area and mullion length.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

enum Axis

pub enum Axis

A direction of a curtain grid.

Traits: Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize, JsonSchema

Variants

struct CurtainGridSet

pub struct CurtainGridSet

Adjust one curtain wall’s grid on one axis. Lines are numbered from 0 in the order curtain_get lists them (vertical or horizontal); positions are distances along the wall from its start for vertical lines and heights above the base for horizontal ones. In order: reset goes back to the type’s lines; lines gives all of them; move moves lines [index, to]; remove takes lines out; add puts lines in. Any of these gives the wall its own lines (later type changes no longer move them). Segments are a line’s pieces between the lines across it ([line, segment], segment numbered from the base or from the start, as the grid was before this command): remove_segments merges the cells on both sides into one panel with no mullion between, restore_segments puts them back.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct PanelArg

pub struct PanelArg

What a curtain panel becomes.

Traits: Debug, Clone, Deserialize, Serialize, JsonSchema

Fields

enum PanelKind

pub enum PanelKind

The kinds of curtain panels.

Traits: Debug, Clone, Copy, PartialEq, Eq, Deserialize, Serialize, JsonSchema

Variants

struct CurtainPanelSet

pub struct CurtainPanelSet

Swap panels of one curtain wall: the panels of cells [column, row] (numbered from the start and from the base, as curtain_get lists them; a cell of merged cells swaps all of them) become panel, or the type’s again when panel is null.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

cc_engine::commands::design_options

crates/cc_engine/src/commands/design_options.rs

Design options: option sets, their options and primary option, the option elements belong to, the option each view shows and the option being edited (see cc_core::design_option).

Items: option_ref_json · view_options_json · OptionsList · OptionSetCreate · OptionSetRename · OptionSetDelete · OptionCreate · OptionSetProps · OptionDelete · OptionAcceptPrimary · ElementsOptionSet · ViewOptionsSet · OptionChoice · choices · OptionActiveSet

fn option_ref_json

pub(crate) fn option_ref_json(p: &Project, id: Option<OptionId>) -> Value

An option as other queries show it: {id, name, set}, or null.

fn view_options_json

pub(crate) fn view_options_json(p: &Project, v: &cc_core::View) -> Value

The option of each set a view shows, as view_get shows it: the view’s own choice (null: automatic) and the option shown.

struct OptionsList

pub struct OptionsList

The project’s design option sets with their options (the primary one marked, how many elements each holds) and the option being edited.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

struct OptionSetCreate

pub struct OptionSetCreate

Add a design option set: a named group of alternatives, of which views show one at a time. It starts with the options named in options (the first is primary), or one option.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct OptionSetRename

pub struct OptionSetRename

Rename a design option set.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct OptionSetDelete

pub struct OptionSetDelete

Delete a design option set with all its options and the elements in them (the main model stays).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct OptionCreate

pub struct OptionCreate

Add an option to a design option set (at the end).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct OptionSetProps

pub struct OptionSetProps

Rename a design option, make it its set’s primary option, or move it to another place in the set’s list (index, 0 = first).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct OptionDelete

pub struct OptionDelete

Delete a design option and the elements in it (with what they host). The primary option cannot be deleted: make another option primary first, or delete the whole set.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct OptionAcceptPrimary

pub struct OptionAcceptPrimary

Accept a set’s primary option: its elements join the main model, and the set is deleted with its other options and their elements.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct ElementsOptionSet

pub struct ElementsOptionSet

Move elements into a design option, or back to the main model with null. Doors, windows and other hosted elements follow their host’s option (moving a wall moves them); annotations belong to no option.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct ViewOptionsSet

pub struct ViewOptionsSet

Choose the option a view (plan, elevation, section, 3D view or schedule) shows of a design option set; null shows it automatically: the option being edited when it is in that set, else the primary one.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct OptionChoice

pub struct OptionChoice

A choice of option for one set (templates).

Traits: Debug, Clone, Deserialize, Serialize, JsonSchema, Default

Fields

fn choices

pub(crate) fn choices(p: &Project, list: &[OptionChoice]) -> Result<BTreeMap<OptionSetId, OptionId>>

The choices as a template keeps them (automatic ones left out).

struct OptionActiveSet

pub struct OptionActiveSet

Set the design option this session edits (null: the main model): new model elements go into it, and views without a choice of their own show it for its set. Display state: not saved, not undone.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

cc_engine::commands::detail

crates/cc_engine/src/commands/detail.rs

Detail lines: 2D lines, arcs, circles and ellipses drawn in one view (see cc_core::detail). They are moved, copied, rotated, mirrored, trimmed, split, offset and deleted with the generic commands, and element_get/element_set show and change their curve and style.

Items: MAX_CURVES · style_arg · DetailLineCreate · normalize_patch · check

const MAX_CURVES

pub const MAX_CURVES: usize

Most curves one detail_line_create makes.

fn style_arg

pub fn style_arg(p: &cc_core::Project, code: &str) -> Result<LineStyleRef>

A line style named by its code: a built-in style’s code, or the name of one of the project’s line styles.

struct DetailLineCreate

pub struct DetailLineCreate

Draw detail lines in a 2D view (plan, ceiling plan, elevation, section, legend or drafting view): lines, arcs, circles and ellipses in the view’s drawing coordinates (meters, as for dimensions and text notes), shown only in that view, on top of the model. Each curve becomes one element (a polyline is its segments; rectangles and polygons their sides), all in one undo step. Detail lines are left out of 3D views and IFC export; DXF export puts them on a layer named after their style.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

fn normalize_patch

pub(crate) fn normalize_patch(p: &cc_core::Project, patch: &Value) -> Result<Value>

A params patch for a detail line with its style given by code ("style": "wide") turned into the model’s form.

fn check

pub(crate) fn check(old: &DetailLine, new: &DetailLine) -> Result<()>

Check a patched detail line: the view stays, the curve is valid.

cc_engine::commands::detail_component

crates/cc_engine/src/commands/detail_component.rs

Detail components: reusable 2D components placed in one view (see cc_core::detail_component). detail_component_create makes a type from 2D pieces or from detail lines, regions, text notes and detail components of a view; detail_component_place places one. Pieces are added, changed and deleted with the component_sheet_piece_* commands, parameters with component_param_*, and placed elements move, rotate, mirror, copy and delete with the generic commands; element_set changes position, rotation_deg, scale, mirrored and overrides. cad_import with blocks brings a DWG or DXF file’s blocks in as detail components (see cad_blocks).

Items: DetailComponentCreate · DetailComponentPlace · check · derived · CadBlocks · cad_blocks · insert_place

struct DetailComponentCreate

pub struct DetailComponentCreate

Make a detail component (a reusable 2D component for construction details) as a new type named name, in one undo step: from pieces (meters in its frame), or from elements of view (detail lines, filled and masking regions, text notes and other detail components), whose point origin (default: the lower left corner of their extents) becomes the component’s origin. With replace (the default when elements are given) those elements are deleted and the new component is placed where they were. Detail lines keep their pen, regions their fill (solid or pattern; openings as outlines), text notes their text at its printed height, and detail components become nested pieces.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct DetailComponentPlace

pub struct DetailComponentPlace

Place a detail component in a 2D view (plan, ceiling plan, elevation, section, legend or drafting view): its origin at position (view coordinates, meters), turned rotation degrees, sized by scale and flipped across its own X axis first when mirrored. It is drawn only in that view, over the model and its regions, and goes with the view.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

fn check

pub(crate) fn check(old: &DetailComponent, new: &DetailComponent) -> Result<()>

Check a patched detail component: the view stays, the placement is valid.

fn derived

pub(crate) fn derived(p: &Project, e: &cc_core::Element, out: &mut serde_json::Map<String, Value>)

Derived values of a placed detail component for element_get.

struct CadBlocks

pub(crate) struct CadBlocks

What cad_blocks made.

Traits: Debug, Default

Fields

fn cad_blocks

pub(crate) fn cad_blocks(read: &cc_cad::CadRead, layers: &[cc_core::CadLayer], f: f64, names: &std::collections::BTreeMap<String, String>) -> CadBlocks

The kept blocks of a DWG or DXF read as detail component definitions: each block’s primitives (on visible layers) scaled to meters by f, in its color (its own or its layer’s), and its inserts of other kept blocks as nested pieces; names gives each block’s component name.

fn insert_place

pub(crate) fn insert_place(i: &cc_cad::CadInsert, f: f64, import: &PlanTransform) -> Place

Where an insert of a kept block lands in the view, for an import whose drawing units are f meters and whose placement is import.

cc_engine::commands::devices

crates/cc_engine/src/commands/devices.rs

Device types the engine provides on demand: a project that has no type for a kind of device (a data outlet, a rack, an air terminal, an earth electrode…) gets the built-in one with the first device placed, in the same undo step (see cc_core::component::device_library).

Items: parse_device · type_mep · device_type · add_device_type · NewDevice · add_device · DeviceTypeCreate

fn parse_device

pub(crate) fn parse_device(name: &str) -> Result<DeviceKind>

fn type_mep

pub(crate) fn type_mep(p: &Project, id: ElementTypeId) -> Option<MepData>

The MEP data of a component type.

fn device_type

pub(crate) fn device_type(p: &Project, device: DeviceKind, ports: Option<u32>) -> Option<ElementTypeId>

The first component type that is a device (and, for data outlets, has ports jacks when given).

fn add_device_type

pub(crate) fn add_device_type(e: &mut EditCtx, device: DeviceKind, ports: Option<u32>) -> Result<ElementTypeId>

The built-in type of device (data outlets with ports jacks, default two) added to the project: its materials too, when missing.

struct NewDevice

pub(crate) struct NewDevice

A device to add to the project.

Fields

fn add_device

pub(crate) fn add_device(e: &mut EditCtx, d: NewDevice) -> Result<ElementId>

Add a device (and its type, when the project has none).

struct DeviceTypeCreate

pub struct DeviceTypeCreate

Give the project the built-in component type of a kind of device, if it has none: device is outlet, dedicated_outlet, switch, ceiling_light, wall_light, panel, data_outlet (with ports jacks, default 2), rack, air_terminal or earth_electrode. Returns the type (the existing one when there is one).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

cc_engine::commands::doors

crates/cc_engine/src/commands/doors.rs

Door types: swing doors of one or two leaves and French doors (glazed, from the floor), built from the definitions of cc_core::openings.

Items: DoorTypeCreate

struct DoorTypeCreate

pub struct DoorTypeCreate

Create a door type. style is swing (a solid leaf, the default) or french (a French door: glazed leaves of stiles and rails around a pane, over a solid bottom rail bottom_rail tall, a parameter of the type); leaves is 1 (hinged on the left; flip an element’s hand for the right) or 2 (a double door, leaves hinged on either jamb meeting in the middle, drawn with two swings in plans and written to IFC as DOUBLE_DOOR_SINGLE_SWING). Doors stand on the floor (sill 0). Place them with door_create.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

cc_engine::commands::edit

crates/cc_engine/src/commands/edit.rs

Changing element parameters (the Properties panel).

Items: ElementSet · patch_kind · ElementsSet · ElementsSetType

struct ElementSet

pub struct ElementSet

Change an element: its level (doors and windows of a wall follow it), type (of the same category), mark, comments, and any of its params as element_get shows them (merged: only the fields given change, e.g. {"height": 2.8} for a wall or {"shape": {"Gable": {"slope": 0.5, "ridge_deg": 0}}} for a roof). The edit is refused if it would leave the model invalid.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

fn patch_kind

pub(crate) fn patch_kind(kind: &cc_core::ElementKind, patch: &Value) -> Result<cc_core::ElementKind>

kind with patch merged into its parameters as element_set merges them (an imported drawing keeps its drawing), before any checks.

struct ElementsSet

pub struct ElementsSet

Change several elements at once, in one undo step: a new level (doors and windows of a wall follow it), the same params merged into each (as element_set takes them, e.g. {"base_offset": -1.5} for columns), and the same mark or comments. Every element must take the change, or none changes.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ElementsSetType

pub struct ElementsSetType

Give elements a type (all must be of the type’s category), like Match Type.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

cc_engine::commands::fill_patterns

crates/cc_engine/src/commands/fill_patterns.rs

Fill patterns (hatches): the built-in patterns and the project’s own (see cc_core::fill_pattern), which materials (cut and surface patterns), filled region types and view overrides use. The project’s patterns are project settings: each command changes them in one undo step. They come from .pat files (fill_pattern_import, see cc_core::pat) or are drawn up line family by line family (fill_pattern_create). Where a command takes a pattern by code it accepts a built-in code (diagonal, brick…) or a project pattern’s name; in model values (material_set, view overrides, type_set) a project pattern is written {"Custom": <id>}, as fill_patterns_list shows in value.

Items: builtin_code · pattern_code · pattern_arg · LineArg · FillPatternsList · FillPatternGet · FillPatternCreate · FillPatternSet · FillPatternDuplicate · FillPatternDelete · OnClash · FillPatternImport · FillPatternExport

fn builtin_code

pub fn builtin_code(p: Pattern) -> String

A built-in pattern’s code: none, solid, diagonal, diagonal_back, crosshatch, horizontal, vertical, grid, brick, concrete, sand, insulation or earth (custom for a project pattern).

fn pattern_code

pub fn pattern_code(p: &Project, pattern: Pattern) -> String

A pattern’s code: a built-in code, or a project pattern’s name.

fn pattern_arg

pub fn pattern_arg(p: &Project, code: &str) -> Result<Pattern>

A pattern by code: a built-in code or a project pattern’s name.

struct LineArg

pub struct LineArg

One line family of a pattern, lengths in millimeters (on paper for a drafting pattern, in the world for a model pattern).

Traits: Debug, Clone, Deserialize, Serialize, JsonSchema, Default

Fields

struct FillPatternsList

pub struct FillPatternsList

The fill patterns materials, filled regions and view overrides can use: the built-in ones (by code) and the project’s (by name, with their kind, scale and line families), each with how many materials, types, views, templates and phase graphics use it, and its value in model values.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

struct FillPatternGet

pub struct FillPatternGet

One project fill pattern: its definition and everything that uses it (materials, types, views, templates, phase graphics).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct FillPatternCreate

pub struct FillPatternCreate

Create a project fill pattern from line families: a unique name (not a built-in code), drafting (sized on paper, the default) or model (sized in the world, scaling with the view), a scale and the families.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct FillPatternSet

pub struct FillPatternSet

Change a project fill pattern: name, description, kind, scale or line families. What is drawn with it follows.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct FillPatternDuplicate

pub struct FillPatternDuplicate

Copy a project fill pattern under a new name (default: the name with a number).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct FillPatternDelete

pub struct FillPatternDelete

Delete a project fill pattern. Refused while something uses it, unless replace_with names the pattern (a built-in code or another project pattern) that takes its place there, in the same undo step.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

enum OnClash

pub enum OnClash

What to do with an imported pattern whose name the project already has.

Traits: Debug, Clone, Copy, PartialEq, Eq, Default, Deserialize, Serialize, JsonSchema

Variants

struct FillPatternImport

pub struct FillPatternImport

Import fill patterns from a .pat file (the plain-text hatch pattern format CAD programs share: *NAME, description headers, then lines of angle, x-origin, y-origin, delta-x, delta-y [, dashes…]). All the file’s patterns or those named; each pattern is drafting or model as its ;%TYPE=MODEL marker says unless kind is given, lengths in the file’s ;%UNITS= (else millimeters) unless units is given. Patterns with a problem are left out and listed in errors with their line. With preview, nothing changes: the result lists what the file holds.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct FillPatternExport

pub struct FillPatternExport

Write project fill patterns as .pat text (millimeters, each pattern’s scale applied, a ;%TYPE= marker per pattern): to path when given; the text is returned either way.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

cc_engine::commands::foundation

crates/cc_engine/src/commands/foundation.rs

Foundations: pads under columns, strips (ground beams) under walls and slabs, placed one by one or under existing columns and walls.

Items: FootingCreate · check_strip_arc · StripFootingCreate · FoundationSlabCreate · FootingsUnderColumns · StripFootingsUnderWalls

struct FootingCreate

pub struct FootingCreate

Place a pad footing centered at position; its top is top_offset above the level (default 0).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

fn check_strip_arc

pub(crate) fn check_strip_arc(p: &Project, type_id: ElementTypeId, shape: &FoundationShape) -> Result<()>

An arc strip must leave room inside its curve for its width.

struct StripFootingCreate

pub struct StripFootingCreate

Place a strip footing (a ground beam) centered on the line start-end, or on an arc through mid (or with a bulge or a radius); its top is top_offset above the level (default 0). Strips meet at corners and tees like beams, arcs at the true crossings of their faces.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct FoundationSlabCreate

pub struct FoundationSlabCreate

Create a foundation slab (a raft) from an outline, from curves (lines, arcs, circles: a circular raft keeps its true curve, area and volume) or under the loop of walls of the level; offset is its top above the level (default 0).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct FootingsUnderColumns

pub struct FootingsUnderColumns

Place a pad footing under each column (default: every column of the level), centered and turned with it, its top at the column’s base. Columns that already stand on a pad are skipped.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct StripFootingsUnderWalls

pub struct StripFootingsUnderWalls

Place a strip footing under each wall (default: every wall of the level), along its body’s centerline (an arc under an arc wall), its top at the wall’s base. Walls that already have a strip, and arc walls too tight for the strip’s width, are skipped; strips meet at corners like beams.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

cc_engine::commands::framing

crates/cc_engine/src/commands/framing.rs

Bracing and trusses: sloped members between points in space, braces between columns and trusses laid out from a span, a height and a pattern.

Items: Point3 · BraceCreate · BracesBetweenColumns · TrussRows · truss_rows · new_truss_type · TrussCreate · derived

type alias Point3

pub type Point3 = [f64; 3]

A point in space: [x, y, z], z above the level.

struct BraceCreate

pub struct BraceCreate

Create a brace: a member between two points in space ([x, y, z], z above the level), its axis through both. Its ends must not be one above the other.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct BracesBetweenColumns

pub struct BracesBetweenColumns

Brace the bay between two columns: x (default) crosses two members from the base of each column to the top of the other, diagonal places one from the base of the first to the top of the second.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct TrussRows

pub struct TrussRows

The catalog rows a truss of a material gets by default: (series, designation) of the chords and of the web (the posts are a column type of the web’s row).

Traits: Debug, Clone, Copy

Fields

fn truss_rows

pub fn truss_rows(m: StructuralMaterial) -> Option<TrussRows>

Steel and timber rows; None for concrete (trusses are not offered).

fn new_truss_type

pub fn new_truss_type(id: ElementTypeId) -> ElementType

The type a project gets with its first truss.

struct TrussCreate

pub struct TrussCreate

Lay out a parametric plane truss from start to end: a flat (default), mono or gable outline height deep (the rise at the apex or high end for mono and gable), panels bottom-chord panels and the web of pattern (pratt, the default, howe, warren, or for gables kingpost, queenpost and fink; a gable-only pattern on another shape is laid out as Pratt). Chords and diagonals are beams, verticals are columns, all ordinary elements the truss keeps in step with its parameters (element_set regenerates them, keeping their ids); a member edited or deleted by hand is detached and left alone. Each chord is one continuous beam per straight run (two top chords on a gable). Verticals stand between the chords: on the faces of solid chords, or inside a channel that opens toward the web, and they are turned so the side nearest the chords’ width lies across the truss. Where the truss ends on a vertical (both ends of a flat truss, the high end of a mono one) the chords run on over it and the vertical at the far end is turned around, so the ends are closed. copies trusses are made spacing apart to the left of start → end. Default types come from the profile catalog for the material (steel: Ue 150x60x20x2,00 chords laid on their sides, the bottom one open upward and the top one downward, Ue 100x50x17x2,00 diagonals laid the same way and posts inside the chords; timber: Peça 6x16 chords, Peça 6x12 web and posts), made when missing; concrete is refused. Out-of-range values are refused. One undo step; returns the truss’s id and its members.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

fn derived

pub(crate) fn derived(t: &Truss, out: &mut serde_json::Map<String, Value>)

element_get’s derived values of a truss: its member ids by role kind, how many roles are detached, its span length and the pattern it is laid out with (a gable-only pattern falls back to Pratt).

cc_engine::commands::graph

crates/cc_engine/src/commands/graph.rs

Visual programming graphs (see crate::graph): run a .ccgraph, check it, list the nodes a graph can use, and see or release the elements a graph made.

Items: GraphRun · GraphCheck · problems · NodeInfo · node_catalog · GraphNodes · GraphElements · GraphRelease

struct GraphRun

pub struct GraphRun

Run a visual programming graph (a .ccgraph file, or the graph as JSON) as one undo step. Elements its nodes create are bound to the node and the item that made them: running the graph again changes them in place (keeping their ids), makes the new ones and deletes the ones it no longer makes. Returns each node’s outputs or error, the values of its output nodes and how many elements were created, changed and deleted.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct GraphCheck

pub struct GraphCheck

Check a graph without running it: nodes that cannot run here (unknown commands or nodes, file commands the graph does not allow), wires to ports that do not exist or whose types do not fit, required inputs with no value, and what reading the file fixed.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

fn problems

pub fn problems(s: &Session, graph: &Graph) -> Vec<Value>

The problems graph_check reports, as {node, message}.

struct NodeInfo

pub struct NodeInfo

A node of the catalog as graph_nodes lists it.

Traits: Debug, Clone, Serialize

Fields

fn node_catalog

pub fn node_catalog(s: &Session) -> Vec<NodeInfo>

Every node a graph can use on this session: built-in nodes, a Lua node, then a node per command.

struct GraphNodes

pub struct GraphNodes

The nodes a graph can use: built-in nodes (inputs, math, logic, lists, geometry, element parameters, outputs), the Lua node and a node per engine command, each with its inputs and outputs (name, type, whether required, default). Filter by words of the name or description, or by group.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct GraphElements

pub struct GraphElements

The elements a graph made, with the node and item (lacing path) that made each.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct GraphRelease

pub struct GraphRelease

Release elements from the graph that made them: they become ordinary elements, and the next run of the graph makes new ones in their place. Without elements, every element of the graph is released.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

cc_engine::commands::graphics

crates/cc_engine/src/commands/graphics.rs

View graphics: category visibility and overrides, element overrides and hiding in a view, view filters, view templates and temporary hiding and isolation.

Items: patched · overrides_json · ViewGraphicsGet · ViewGraphicsSet · ElementOverrideSet · ElementHideInView · RuleArg · param · param_name · filter_json · FiltersList · FilterCreate · FilterSet · FilterDelete · FilterElements · ViewFilterAdd · ViewFilterSet · ViewFilterRemove · ViewFilterMove · template_json · TemplatesList · TemplateCreate · TemplateSet · TemplateDelete · ViewTemplateApply · ViewTemplateAssign · ViewTemporary · ViewTemporaryApply

fn patched

pub(crate) fn patched(current: &GraphicOverride, patch: Option<&Value>, reset: bool) -> Result<GraphicOverride>

Apply a merge patch (null resets an attribute) to overrides.

fn overrides_json

pub(crate) fn overrides_json(o: &GraphicOverride) -> Value

struct ViewGraphicsGet

pub struct ViewGraphicsGet

The visibility/graphics of a view (or of a view template): every category’s visibility and overrides, the applied filters in order, the element overrides and hidden elements, the view’s template and what it controls, and what is temporarily hidden or isolated. Overrides are objects like {"cut_lines": {"color": [255, 0, 0], "weight": 0.5, "pattern": "Dash"}, "projection_lines": {..}, "cut_fill": {"color": [..], "pattern": "Solid"}, "surface_fill": {..}, "halftone": true, "transparency": 0.5} (absent attributes are not overridden).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct ViewGraphicsSet

pub struct ViewGraphicsSet

Show or hide a category in a view (or view template) and change its graphic overrides: overrides is merged into the current ones (null resets one attribute; see view_graphics_get), reset clears them first. Refused when the view’s template controls its categories.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct ElementOverrideSet

pub struct ElementOverrideSet

Override the graphics of elements in one view (they keep their category’s and filters’ graphics for what is not overridden): overrides is merged into each element’s (null resets an attribute), reset clears them first, so reset alone removes the overrides.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct ElementHideInView

pub struct ElementHideInView

Hide elements in one view (hidden: false shows them again). Hidden elements stay in the model and in other views.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct RuleArg

pub struct RuleArg

A rule as commands take it.

Traits: Debug, Clone, Deserialize, Serialize, JsonSchema

Fields

fn param

pub(crate) fn param(name: &str) -> Result<FilterParam>

fn param_name

pub fn param_name(p: FilterParam) -> String

fn filter_json

pub(crate) fn filter_json(p: &Project, f: &ViewFilter) -> Value

struct FiltersList

pub struct FiltersList

The project’s view filters with their categories and rules.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

struct FilterCreate

pub struct FilterCreate

Create a view filter: the elements of categories (all when empty) that pass its rules — all of them, or any with any; a filter without rules matches every element of its categories. Apply it to views with view_filter_add.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct FilterSet

pub struct FilterSet

Change a view filter: name, categories, rules (replaced as a whole) or how rules combine. Views that apply it follow.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct FilterDelete

pub struct FilterDelete

Delete a view filter (views and templates stop applying it).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct FilterElements

pub struct FilterElements

The elements a view filter matches (only those drawn in view when given).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct ViewFilterAdd

pub struct ViewFilterAdd

Apply a filter to a view (or view template), at index in the list (default last: the first matching filter wins for each attribute), hiding what it matches (visible: false) or overriding its graphics.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct ViewFilterSet

pub struct ViewFilterSet

Change how a view (or view template) applies a filter: visibility of the matching elements, whether it is enabled, and its overrides (merged; reset clears them first).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct ViewFilterRemove

pub struct ViewFilterRemove

Stop applying a filter in a view (or view template).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct ViewFilterMove

pub struct ViewFilterMove

Move a filter to index in a view’s (or view template’s) filter list (0 = first, the highest priority).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

fn template_json

pub(crate) fn template_json(p: &Project, t: &ViewTemplate) -> Value

struct TemplatesList

pub struct TemplatesList

The project’s view templates: the properties each holds, which of them it controls (include) and the views that follow it.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

struct TemplateCreate

pub struct TemplateCreate

Create a view template, from the properties of view when given (scale, category graphics, filters, plan cut height, building services display, structural display), else with defaults. Every property is controlled (include) until changed with template_set.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct TemplateSet

pub struct TemplateSet

Change a view template: name, properties and which of them it controls (include, merged: {"scale": false} lets views keep their own scale). Views that follow the template change with it, in the same undo step.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct TemplateDelete

pub struct TemplateDelete

Delete a view template; views that follow it keep their current properties and become free.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct ViewTemplateApply

pub struct ViewTemplateApply

Copy a template’s properties into views once (they stay free to change). Views that follow another template are refused.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct ViewTemplateAssign

pub struct ViewTemplateAssign

Make views follow a template (template: null frees them): the properties it controls are copied now and whenever the template changes, and cannot be changed in the view.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct ViewTemporary

pub struct ViewTemporary

Temporarily hide or isolate elements or categories in a view, or reset. This is display state, not a model change: it is not saved, not undone and not printed (sheets and exports show the view as it is); the application marks the view while it is active. action: hide and isolate (the elements ids), hide_category and isolate_category (categories, and the categories of ids), or reset. Hiding adds to what is already hidden; isolating replaces it.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct ViewTemporaryApply

pub struct ViewTemporaryApply

Make a view’s temporary hiding permanent: hidden elements become hidden in the view and hidden categories are turned off; when isolating, every other element drawn in the view is hidden in it. The temporary state is then reset. One undo step.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

cc_engine::commands::grid_frame

crates/cc_engine/src/commands/grid_frame.rs

A multi-storey grid frame: on every storey of a range of levels, columns at the grid intersections (tops attached to the level above) and beams along the grids on the upper level, plus optional secondary beams, in one undo step.

Items: MAX_MEMBERS · SecondaryArg · GridFrameCreate

const MAX_MEMBERS

pub const MAX_MEMBERS: usize

Most members one run creates.

struct SecondaryArg

pub struct SecondaryArg

Secondary beams in each bay, parallel to a grid.

Traits: Debug, Clone, Deserialize, Serialize, JsonSchema, Default

Fields

struct GridFrameCreate

pub struct GridFrameCreate

Frame a range of levels on the grids: on every storey (each pair of consecutive levels from base_level to top_level), a column at each grid intersection of the lower level with its top attached to the upper one, and beams on the upper level along each grid between neighboring columns. Columns and beams already modeled are skipped. With secondary, each bay between two grids parallel to parallel_to and two crossing grids gets beams parallel to it, at most spacing apart. One undo step; returns the new columns, beams and secondary beams and how many were skipped (and bays skipped_bays).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

cc_engine::commands::io

crates/cc_engine/src/commands/io.rs

Files: IFC import/export, SketchUp and OBJ import, sheet PDF/SVG, view PNG/SVG/PDF, schedule CSV, component files.

Items: IfcImport · IfcExport · SheetExport · ViewExport · ScheduleExportCsv · ComponentLoad · SkpImport · ObjUnits · ObjImport · GltfImport · SkpComponentLoad · ComponentLibraryList · ComponentSave

struct IfcImport

pub struct IfcImport

Import an IFC file (IFC2X3 or IFC4), replacing the session’s project. The result has no file yet; save it with project_save and a path.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct IfcExport

pub struct IfcExport

Export the project as IFC4.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct SheetExport

pub struct SheetExport

Export a sheet as vector PDF or SVG, or as DXF in paper millimeters (by format, else by the file extension).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ViewExport

pub struct ViewExport

Export any view with a drawing (plan, elevation, section, 3D view as a hidden-line axonometric, legend, drafting view, diagram or sheet) as a PNG image, as vector SVG or PDF, or as DXF for other CAD programs (by format, else by the file extension). The view is drawn at its scale as printed, without temporary hiding, on a page that fits it; sheets keep their paper size. A DXF holds the view at full size in millimeters (a sheet in paper millimeters), each element on the layer of its category (detail lines, and regions with a boundary, on the layer named after their line style; region fills as SOLID triangles, their patterns as lines), colors as the nearest color index and line patterns as line types.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

Methods

struct ScheduleExportCsv

pub struct ScheduleExportCsv

Export a schedule view as CSV (UTF-8; semicolons when the decimal comma is used).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ComponentLoad

pub struct ComponentLoad

Load a component file (.ccomp): its types and missing materials join the project.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct SkpImport

pub struct SkpImport

Import a SketchUp model (.skp) into the project. Each placed component or group becomes a component element on level, of a component type holding its faces as fixed mesh pieces (one per material): placements that differ only by a move or a plan rotation share a type, anything else in their transform (tilt, scale, mirror) is built into the type. Faces outside any component make one more element at the file’s origin. Missing materials are added by name, color, opacity and texture; hidden objects and those on hidden layers are left out.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

enum ObjUnits

pub enum ObjUnits

Units of the coordinates in an OBJ file (the format does not say).

Traits: Debug, Clone, Copy, Default, PartialEq, Eq, Deserialize, Serialize, JsonSchema

Variants

struct ObjImport

pub struct ObjImport

Import a Wavefront OBJ model (.obj) into the project. Each object (or, in a file without objects, each group) becomes a component element on level, of a component type holding its faces as fixed mesh pieces, one per material, inserted at the center of its footprint and the bottom of its extent. Materials come from the .mtl libraries next to the file: color (Kd), opacity (d, Tr) and texture (map_Kd, the picture next to the file, repeating as the faces’ vt coordinates say); missing materials are added by name. Faces not flat are split into triangles; lines, points and normals are ignored.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct GltfImport

pub struct GltfImport

Import a glTF 2.0 model (.glb, or .gltf with its buffers embedded or in files next to it) into the project. Each node of the scene’s root, with everything below it, becomes a component element on level, of a component type holding its triangles as fixed mesh pieces, one per material, inserted at the center of its footprint and the bottom of its extent. glTF is in meters with Y up. Materials take their base color times its texture’s average, the texture itself (repeating as the texture coordinates say) and, when blended, their opacity; missing materials are added by name. Lines and points are ignored, and compressed meshes (Draco, meshopt) are refused.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct SkpComponentLoad

pub struct SkpComponentLoad

Load a SketchUp model (.skp) as one component type, named after the file, to place like any component: its faces become fixed mesh pieces (one per material) with the file’s origin as the insertion point. Missing materials are added by name and color.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ComponentLibraryList

pub struct ComponentLibraryList

List the component library: the component files (.ccomp) in folders and their subfolders, each with its component, kind, category (doors and windows have their own), types, parameters and connectors; search keeps those whose component, type names or descriptions contain it. Files that do not load are listed with the reason.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ComponentSave

pub struct ComponentSave

Save a component (all its types and the materials they use) to a .ccomp file.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

cc_engine::commands::level_mark

crates/cc_engine/src/commands/level_mark.rs

Level marks: the elevation of a point written in a plan, an elevation or a section (see cc_core::level_mark).

Items: LevelMarkCreate · LevelMarkTypeCreate

struct LevelMarkCreate

pub struct LevelMarkCreate

Place a level mark in a plan, an elevation or a section: the finished level of a point above a shelf line and its raw (structural) level under it, each after the type’s datum (the value written for the project’s zero) is added. Plans draw a circle with two filled quarters on the point and measure the top of the highest floor of the plan’s level under it (the level where there is none), with the top of that floor’s structure as the raw level; elevations and sections draw a triangle pointing down to the point and measure its height (position y), with the raw level of a floor whose top the point lies on, in sections. element_get gives the levels and texts (derived); element_set changes the mark’s params.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct LevelMarkTypeCreate

pub struct LevelMarkTypeCreate

Create a level mark type: the text size, the datum (the value written for the project’s zero, e.g. 100 when the ground floor is +100.00) and the suffixes after the finished and raw levels. A project gets one with its first level mark; type_set changes them.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

cc_engine::commands::levels

crates/cc_engine/src/commands/levels.rs

Levels: create (with their plans, also as a storey above or below another), rename, change elevation or storey height, delete.

Items: height_above · height_below · LevelCreate · LevelSet · LevelDelete

fn height_above

pub fn height_above(p: &Project, id: LevelId) -> Option<f64>

The height from level id up to the next level, if there is one.

fn height_below

pub fn height_below(p: &Project, id: LevelId) -> Option<f64>

The height from the level below id up to it, if there is one.

struct LevelCreate

pub struct LevelCreate

Add a level (default: 3 m above the highest, named “Level n”) with its floor and ceiling plans. With above or below it is a new storey next to that level: the levels beyond it move away by the new storey’s height, so the other storeys keep theirs and the order of the levels stays.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct LevelSet

pub struct LevelSet

Rename a level, change its elevation or the height up to the next level (what is attached to a moved level moves along). A new height moves every level above it by the difference, so the levels keep their order and the other storeys their heights. Renaming it leaves its plans’ names as they are: a level and its views are named apart.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct LevelDelete

pub struct LevelDelete

Delete a level no element is on, with its plan views; walls rising to it keep their current height, unconnected. The last level is kept.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

cc_engine::commands::lightning

crates/cc_engine/src/commands/lightning.rs

Lightning protection: conductors on the roof, down the walls and in the ground (an earth ring), air terminals on the roof, earth electrodes, and a coverage check of the roofs (see cc_core::lightning, cc_geom::lightning). Elements placed without a system join the project’s first lightning protection system, created with the first of them.

Items: new_conductor_type · LpsConductorCreate · EarthRingCreate · AirTerminalPlace · EarthElectrodePlace · LpsConductorTypeCreate · LpsCheck

fn new_conductor_type

pub fn new_conductor_type(id: ElementTypeId, diameter: f64, material: String) -> ElementType

A conductor type of diameter, named by it (in millimeters, or in inches in imperial units).

struct LpsConductorCreate

pub struct LpsConductorCreate

Create a lightning protection conductor from start to end, or a down conductor straight down from start (no end). Without offsets, a conductor lies on the roof under its ends (else where it starts on another conductor, else at the level); a down conductor runs from the roof over start (else the level above) down to the earthing, 0.5 m below the level. role is air (a roof conductor), down or earth; by default vertical runs are down conductors, runs below the level earth conductors and the others roof conductors. Conductors join each other where their ends meet. A project without a conductor type gets one (8 mm, copper); without a lightning protection system, one is made.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct EarthRingCreate

pub struct EarthRingCreate

Create an earth ring: buried conductors (role earth) around points (a closed outline), or by default around the walls of the level, distance (default 1 m) out from their outer faces, depth (default 0.5 m) below the level, one conductor per side.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct AirTerminalPlace

pub struct AirTerminalPlace

Place an air terminal (a lightning rod) at position: on the roof (or floor) surface under it by default, else at the level above; height is the rod’s height (default: its type’s, 1 m for the built-in type). A project without an air terminal type gets one.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct EarthElectrodePlace

pub struct EarthElectrodePlace

Place an earth electrode (a driven rod) at position: its top depth (default 0.5 m) below the level, length long (default: its type’s, 2.4 m for the built-in type). A project without an earth electrode type gets one.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct LpsConductorTypeCreate

pub struct LpsConductorTypeCreate

Create a lightning protection conductor type: a round conductor of diameter (meters, 2 to 50 mm; default 8 mm, 3/8” in imperial projects) in material (default: copper, else the first metal), named by its diameter unless name is given.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct LpsCheck

pub struct LpsCheck

Check how the air termination (air terminals and roof conductors) covers the roofs, for a protection class (I to IV, default III): the exposed upper faces of roofs (and of floors above the lowest level that nothing covers) are sampled about spacing meters apart (default 1 m; more on large roofs) and each point is protected when one air termination point protects it by itself, by the rolling sphere method (sphere radius 20, 30, 45 or 60 m by class) over a horizontal plane at the roof’s lowest exposed point, or, on flat parts, when it lies within half the class’s mesh width (5, 10, 15 or 20 m) of a roof conductor. Mutual protection between terminals and the shielding by the building itself are left out, which errs on the safe side. Returns the counts, the share protected and up to 200 unprotected points.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

cc_engine::commands::line_style

crates/cc_engine/src/commands/line_style.rs

Line styles: the built-in styles and the project’s own (see cc_core::detail), used by detail lines and region boundaries. The project’s styles are project settings: line_style_create, line_style_set and line_style_delete change them in one undo step each; deleting a style moves what uses it to another style.

Items: pattern_code · LineStylesList · LineStyleCreate · LineStyleSet · LineStyleDelete

fn pattern_code

pub fn pattern_code(p: LinePattern) -> &'static str

A dash pattern’s code: solid, dash, short_dash, dot or dash_dot.

struct LineStylesList

pub struct LineStylesList

The line styles detail lines and region boundaries can use: the built-in ones (by code) and the project’s (by name), each with its weight on paper (mm), color, dash pattern and how many elements use it.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

struct LineStyleCreate

pub struct LineStyleCreate

Create a project line style for detail lines and region boundaries: a unique name (not a built-in code), a weight on paper, a color and a dash pattern. Commands then name it like a built-in style.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct LineStyleSet

pub struct LineStyleSet

Change a project line style: name, weight, color or pattern. The lines and boundaries drawn with it follow.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct LineStyleDelete

pub struct LineStyleDelete

Delete a project line style. The detail lines and region boundaries drawn with it move to replace_with (a built-in code or another project style’s name; default thin) in the same undo step.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

cc_engine::commands::mass

crates/cc_engine/src/commands/mass.rs

Conceptual masses: creating them (an extrusion, or a loft to another outline) and choosing and reading their mass floors.

Items: MassCreate · spanned_levels · new_mass_type · MassFloorsSet · MassFloors · floors_json · MassTypeCreate · MassFaceMove · MassWallsCreate · MassSlabsCreate · MassRoofCreate

struct MassCreate

pub struct MassCreate

Create a conceptual mass: outline extruded height up from its level (plus base_offset), or lofted to another outline (top, or the base outline set in by top_inset). Mass floors are taken at every level the mass spans unless floors lists them. A project without a mass type gets one.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

fn spanned_levels

pub fn spanned_levels(p: &Project, base: f64, top: f64) -> Vec<LevelId>

The levels a mass from base to top (elevations) spans: at or above the base, below the top.

fn new_mass_type

pub fn new_mass_type(p: &Project, id: ElementTypeId) -> ElementType

A mass type for a project that has none, in its first material.

struct MassFloorsSet

pub struct MassFloorsSet

Choose the levels where a mass takes mass floors: levels (ids or names), or every level it spans when levels is left out; an empty list takes none.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct MassFloors

pub struct MassFloors

The mass floors of a mass: for each, its level, elevation, area and perimeter (and outline), with the gross floor area and the volume.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

fn floors_json

pub fn floors_json(p: &Project, g: &cc_geom::mass::MassGeom) -> Vec<Value>

A mass’s floors as JSON.

struct MassTypeCreate

pub struct MassTypeCreate

Create a mass type, shown in material (default: the project’s first material).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct MassFaceMove

pub struct MassFaceMove

Push or pull a face of a mass distance meters outward (inward when negative): top changes its height, bottom its base offset and height, and side (with side, the index of the base outline’s edge from that point to the next) moves that side, the sides beside it keeping their directions. A loft’s sides are not moved.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct MassWallsCreate

pub struct MassWallsCreate

Walls by face: a wall over each side of a mass extruded straight up (sides: the base outline’s edges, by default all), its exterior face on the mass’s face, from the mass’s base up its height. Walls meeting at the mass’s corners join. A loft’s slanted sides take no walls.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct MassSlabsCreate

pub struct MassSlabsCreate

Floors from mass floors: a floor on each mass floor of a mass (or those at levels), its outline the mass’s at that level and its top at the level.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct MassRoofCreate

pub struct MassRoofCreate

Roof by face: a flat roof on the top face of a mass, over its top outline, on the mass’s level at the height of its top.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

cc_engine::commands::materials

crates/cc_engine/src/commands/materials.rs

Materials: create, duplicate, rename, change, delete.

Items: material_json · MaterialCreate · MaterialDuplicate · MaterialRename · MaterialSet · MaterialDelete · MaterialTextureSet · MaterialTextureClear

fn material_json

pub(crate) fn material_json(m: &Material) -> Value

A material’s fields as JSON, its texture’s image as a summary (format, size in pixels and bytes) instead of its bytes.

struct MaterialCreate

pub struct MaterialCreate

Create a material (default name “Material”; a number is added when taken).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct MaterialDuplicate

pub struct MaterialDuplicate

Copy a material under a new name (default “ (copy)").

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct MaterialRename

pub struct MaterialRename

Rename a material; every type using it follows.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct MaterialSet

pub struct MaterialSet

Change a material’s fields (merged into what material_get shows: description, class, colors, patterns, transparency, finish, physical values…). Use material_rename to rename it.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct MaterialDelete

pub struct MaterialDelete

Delete a material no type uses.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct MaterialTextureSet

pub struct MaterialTextureSet

Give a material an image texture (shown on its faces in the textures visual style of 3D views), or change how its texture is laid out. The image comes from path or from data (base64); with neither, the current texture’s size, offset and rotation change. One repeat covers width × height meters on the faces: on floors and other horizontal faces along plan X and Y, on walls and slopes level across the face and up it.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct MaterialTextureClear

pub struct MaterialTextureClear

Take a material’s texture away (its faces show the appearance color).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

cc_engine::commands::mep

crates/cc_engine/src/commands/mep.rs

Building services: pipes and conduits, plumbing systems and electrical circuits, and what they add up to (lengths, loads, fixture units).

Items: parse_kind · CABLED · check_fits · mep_classes · segment · joined_offset · PipeCreate · ConduitCreate · SystemsList · cabling_totals · SystemCreate · new_system · SystemSet · SystemDelete · SystemAssign · CircuitLoads · MepFittings · MepConnect · nearest_on · MepSizing · MepSizeApply

fn parse_kind

pub(crate) fn parse_kind(name: &str) -> Result<SystemKind>

const CABLED

pub(crate) const CABLED: &[SystemClass]

Runs of circuits and structured cabling: conduits and cable trays.

fn check_fits

pub(crate) fn check_fits(p: &Project, classes: &[SystemClass], system: SystemId) -> Result<()>

Whether system is of one of the families classes (any, when empty).

fn mep_classes

pub(crate) fn mep_classes(mep: Option<MepData>) -> &'static [SystemClass]

The families of systems a component of this MEP data belongs to: plumbing for fixtures, the device’s own family for devices, any without.

fn segment

pub(crate) fn segment(start: Point, end: Option<Point>, offset: f64, end_offset: Option<f64>) -> Result<MepSegment>

Where a segment ends: end, or straight up or down from start (a riser).

fn joined_offset

pub(crate) fn joined_offset(p: &Project, level: cc_core::LevelId, start: Point, category: Category, system: Option<SystemId>, wanted: f64) -> Option<f64>

The elevation above level where a new run starting at start joins a run of its network there (runs of category: pipes of system, any conduit or cable tray; risers of other floors included): the run’s elevation at that point, or on a riser the height nearest wanted within it.

struct PipeCreate

pub struct PipeCreate

Create a pipe from start to end (or a vertical riser at start up or down to end_offset), in a plumbing system. Its center line starts offset above the level (default: where it starts on a pipe of its system, such as the end of a run or a riser; else 0.60 m for supply and vent pipes, -0.30 m for drains; 2’-0” and -1’-0” in imperial projects). Drains fall along the flow by slope (percent; default 2 % up to 75 mm, 1 % above; in imperial projects 1/4” per foot up to 3”, 1/8” above); other pipes are level unless end_offset or slope says otherwise.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct ConduitCreate

pub struct ConduitCreate

Create a conduit from start to end (or a vertical drop at start to end_offset) carrying circuits. It runs offset above the level (default: where it starts on another conduit, such as the end of a run or a vertical drop; else in the slab above, at the level height).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct SystemsList

pub struct SystemsList

List the plumbing systems and electrical circuits with what is in them: element count, pipe or conduit length, fixture units and supply weights of plumbing fixtures, and the devices and load of circuits.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

fn cabling_totals

pub(crate) fn cabling_totals(p: &Project, id: SystemId) -> serde_json::Map<String, Value>

What the structured cabling of a rack adds up to: its data outlets, the cables (one per jack) and their estimated length.

struct SystemCreate

pub struct SystemCreate

Create a plumbing system, an electrical circuit, the structured cabling of a rack or a lightning protection system. kind is cold_water, hot_water, sanitary, vent, rainwater, power, lighting, data or lightning; circuits may name the board (panel, a component element; default: the project’s only board, if it has one) feeding them and their voltage (default 127 V), and cabling the rack (panel; default: the only rack) its outlets are cabled to. The code of a circuit or of cabling defaults to the next free number on its board or rack.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

fn new_system

pub(crate) fn new_system(p: &Project, kind: SystemKind, panel: Option<ElementId>, code: Option<String>, name: Option<String>) -> Result<MepSystem>

A new system of kind: fed by panel (checked; default: the project’s only board or rack for circuits and cabling), with code (default: the next free number on its board or rack) and name (default: after the code or the kind).

struct SystemSet

pub struct SystemSet

Change a system or circuit: params is a merge patch over the values systems_list shows (name, code, kind, color, panel, voltage).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct SystemDelete

pub struct SystemDelete

Delete a system or circuit; its pipes, conduits and devices stay, outside any system.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct SystemAssign

pub struct SystemAssign

Put elements in a system or circuit, or take them out (remove). A pipe or a lightning conductor belongs to one system (it moves); a conduit or cable tray carries several circuits and cabling systems (one is added); a fixture or device connects to one (a data outlet to the cabling of a rack).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct CircuitLoads

pub struct CircuitLoads

The load schedule of the circuits (of one board, or all): per circuit its devices, installed load (VA) and current at its voltage, with the total per board.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct MepFittings

pub struct MepFittings

The fittings where pipes and conduits meet, counted by category, kind, angle (elbows), diameters and system: the fittings takeoff.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct MepConnect

pub struct MepConnect

Connect plumbing fixtures and electrical devices to the nearest pipe or conduit of their level (or riser of another floor passing through it). A fixture gets a branch to the nearest sanitary drain (falling towards it, with a drop from the floor), and to the nearest cold (and, when it takes it, hot) water pipe; a device gets a conduit to the nearest conduit, with a drop from its mounting height, carrying its circuit. A component with connectors gets a branch from each connector to the nearest run of a system of the connector’s kind, from the connector’s position and of its diameter (leaving vertically or horizontally as the connector points). Branches end on the runs, which forms tees. system connects only to that system or circuit.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

fn nearest_on

pub(crate) fn nearest_on(s: &MepSegment, p: glam::DVec2, wanted_z: f64) -> (glam::DVec2, f64)

The nearest point in plan of run s to p, and the run’s elevation there (on a riser, the height nearest wanted_z).

struct MepSizing

pub struct MepSizing

Size the building services from their networks (simplified tables of common Brazilian practice): drains by the fixture units upstream, water pipes by the flow from the fixtures’ weights (at most 3 m/s), circuits by their current (breaker, copper conductor) and the voltage drop to the farthest device (at most 4 %). Diameters in mm, lengths in m.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

struct MepSizeApply

pub struct MepSizeApply

Give each sized pipe the smallest pipe type of the project at least as wide as mep_sizing requires. Pipes already wide enough keep their type unless downsize is set.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

cc_engine::commands::modify

crates/cc_engine/src/commands/modify.rs

Modifying elements: delete, move, copy/array, rotate, mirror, pin, flip, joins, trim/extend, split, offset, align, end points.

Items: ElementsDelete · ElementsMove · ElementsCopy · ElementsRotate · ElementsMirror · ElementsPin · ElementFlip · WallJoin · GeometryJoin · GeometryUnjoin · GroupCreate · GroupUngroup · TrimCorner · TrimExtend · ElementSplit · ElementOffset · ElementAlign · align_line · ElementMoveEnd · GridsAlignEnds · ElementsTurn · ElementsExport · ElementsPaste · retarget · WallAttach

struct ElementsDelete

pub struct ElementsDelete

Delete elements (doors and windows of deleted walls go too, piles with their caps; pinned elements stay, and so do the piles of a cap that is not deleted).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ElementsMove

pub struct ElementsMove

Move elements by delta (walls take their doors and windows; doors and windows alone slide along their wall).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ElementsCopy

pub struct ElementsCopy

Copy elements by delta; with count > 1, a linear array of that many copies spaced by delta.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ElementsRotate

pub struct ElementsRotate

Rotate elements by angle degrees (counter-clockwise) about center (default: the center of their extents); with copy, rotated copies.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ElementsMirror

pub struct ElementsMirror

Mirror elements across an axis: two points, or the line of a wall, grid, beam or railing (axis_element). Copies by default (copy: false moves them).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ElementsPin

pub struct ElementsPin

Pin elements (they cannot be moved or deleted) or unpin them.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ElementFlip

pub struct ElementFlip

Flip a door or window to the other side of its wall (facing) and/or to the other jamb (hand).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct WallJoin

pub struct WallJoin

Allow or disallow joining at one end of a wall or beam. A wall end joins other walls; a beam end stops at the face of a structural column it lies in, or meets other beams at the same depth (mitered corners, butt joints).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct GeometryJoin

pub struct GeometryJoin

Join the geometry of two elements that touch or overlap (walls, floors, ceilings, roofs, columns, beams, stairs, railings, components). Where they overlap, one cuts the other: structural columns and beams cut walls, floors, ceilings and roofs; floors, ceilings and roofs cut walls; walls cut architectural columns; between equals the first cuts the second. The shared volume is counted once, and plans and sections draw two elements cut in the same material as one piece.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct GeometryUnjoin

pub struct GeometryUnjoin

Unjoin the geometry of two joined elements: each keeps its whole body again.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct GroupCreate

pub struct GroupCreate

Group elements: selecting one of them selects them all, so they move, copy and rotate together. Elements already in a group leave it.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct GroupUngroup

pub struct GroupUngroup

Ungroup: the group goes, its elements stay.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct TrimCorner

pub struct TrimCorner

Trim or extend two linear elements (walls, beams, grids) to meet at a corner; each pick point marks the part of its element to keep. Arc walls meet lines and other arcs where their circles cross them. Two detail lines meet where their lines, circles or ellipses cross.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct TrimExtend

pub struct TrimExtend

Trim or extend a linear element to the line of a reference element (the circle of an arc wall); the pick point marks the part to keep. Arc walls trim and extend along their circle. A detail line trims or extends to another detail line (also a circle or an ellipse) or to the line of a wall, beam or grid.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ElementSplit

pub struct ElementSplit

Split a linear element (wall, beam, grid) or a detail line at a point; returns the new element. A detail circle or whole ellipse splits into halves, from the point and from the one opposite.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ElementOffset

pub struct ElementOffset

Copy a linear element parallel at distance (positive: to the left of its direction). Detail lines too: an arc’s or a circle’s copy is concentric (positive: towards the center of a circle); ellipses have no offset.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ElementAlign

pub struct ElementAlign

Align an element onto a line of a reference element, in plan: the edge picked on the element (a wall’s face, a column’s side) moves onto the line picked on the reference (a face or side, or the location line of a grid or of an element picked without a point). When the two are not parallel the element first turns about the picked point of its edge. An arc wall moves onto the circle of a concentric arc wall (its radius changes). Alignment is in plan, so the elements may be on different levels (a column above onto the face of the column below).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

fn align_line

pub fn align_line(project: &cc_core::Project, geom: &cc_geom::ModelGeometry, id: ElementId, pick: Option<DVec2>) -> Option<cc_core::wall_ops::Path>

The line of element id that Align uses: the edge of its plan outline nearest to pick (a wall face, a column side), else its location line (grids have only that). An arc wall gives its arc.

struct ElementMoveEnd

pub struct ElementMoveEnd

Move one end of a wall, beam or grid (joined wall ends follow).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct GridsAlignEnds

pub struct GridsAlignEnds

Give grids the extents of a reference grid, so their bubbles line up: each grid parallel to the reference (within 1°) has its ends moved along its own line onto the lines through the reference’s ends perpendicular to it (each end to the reference end on its side). Grids that are not parallel and pinned grids are left alone.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ElementsTurn

pub struct ElementsTurn

Turn elements a quarter: components and columns rotate 90° about their insertion point; doors and windows flip to the other side of their wall (the Space key on a selection). Others and pinned elements are left alone.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ElementsExport

pub struct ElementsExport

The elements as a portable set for elements_paste: doors and windows of the given walls come along. The set keeps type, level and view ids, so it pastes into this project or one sharing them.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ElementsPaste

pub struct ElementsPaste

Paste a set from elements_export moved by delta, on level when given (else on their own levels). Elements whose type, level, view or wall does not exist here are skipped. Returns the new ids.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

fn retarget

pub(crate) fn retarget(p: &Project, set: &mut [cc_core::Element], view: cc_core::ViewId) -> Result<()>

Move the view-owned elements of a copied set (see cc_core::Element::owner_view) into view, onto its level (or the lowest). Refused unless the view takes every one of them, as the commands that create them would. A dimension moved between views that do not share a drawing frame (two plans) stops measuring elements and stays where it is drawn.

struct WallAttach

pub struct WallAttach

Attach the tops of walls to a roof, ceiling or floor (top), or take them off it (detach). Under the element a wall rises or drops to its underside, following its slope (a gable wall ends in a triangle); elsewhere it keeps its own top. The walls follow the element when it changes.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

cc_engine::commands::niche

crates/cc_engine/src/commands/niche.rs

Niches (issue #304): recesses in one face of a wall, hosted like doors and windows. A niche type is a component of ComponentKind::Niche whose opening has a depth (cc_core::openings::niche_def); the wall’s geometry recesses its face there (cc_geom::Recess).

Items: NicheTypeCreate · NicheCreate

struct NicheTypeCreate

pub struct NicheTypeCreate

Create a niche type: a recess width wide, height tall and depth deep in one face of a wall, its bottom sill above the wall’s base by default. In a wall thinner than the depth plus 1 cm the niche stops 1 cm short of the other face (an opening through a wall is a door or a window). Place niches with niche_create.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct NicheCreate

pub struct NicheCreate

Place a niche in a wall: a recess in one of its faces, centered on the wall unless offset or point is given. It is in the wall’s left face (seen from its start to its end), in the right one with flip_facing, and with point in the face on the point’s side. A project with no niche type gets a default one (see niche_type_create) in the same undo step. The wall keeps standing behind the niche: it is not split, and rooms, joins and framing ignore it. A niche that would overlap a door, a window or another niche of its wall cuts nothing; element_get then shows no volume.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

cc_engine::commands::pad

crates/cc_engine/src/commands/pad.rs

Building pads: flat areas graded into a terrain, with cut and fill slopes out to the existing ground (see cc_core::pad).

Items: new_pad_type · default_host · PadCreate · PadTypeCreate · derived

fn new_pad_type

pub fn new_pad_type(id: ElementTypeId) -> ElementType

A pad type for a project that has none: slopes of 1:1 in cut and 1:1.5 in fill.

fn default_host

pub fn default_host(p: &Project, level: Option<cc_core::LevelId>, outline: &[DVec2]) -> Option<ElementId>

The terrain a pad with outline grades by default: the first (in id order) on level (any level when None) whose boundary holds the outline’s center, else the first it overlaps.

struct PadCreate

pub struct PadCreate

Create a building pad: a flat area at elevation (meters above the terrain’s level) inside a closed outline (or one drawn with curves), graded into a terrain (host) with cut and fill slopes out to the existing ground. Slopes are the horizontal run per unit of rise (cut_slope 1 is 1:1); without them the pad uses its type’s. Pads of one terrain apply in creation order. A project without a pad type gets one.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct PadTypeCreate

pub struct PadTypeCreate

Create a building pad type: the run per unit of rise of its cut and fill slopes.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

fn derived

pub(crate) fn derived(g: &cc_geom::pad::PadGeom, derived: &mut serde_json::Map<String, Value>)

The figures element_get shows for a pad, as pad.

cc_engine::commands::paint

crates/cc_engine/src/commands/paint.rs

Painted faces: a material on one surface of an element (see cc_core::paint for how a paint finds its face after the model changes).

Items: PICK_TOLERANCE · Paint · PaintRemove · PaintsList

const PICK_TOLERANCE

pub const PICK_TOLERANCE: f64

How far from a face a point given to paint or paint_remove may be, meters.

struct Paint

pub struct Paint

Paint a face of an element with a material: the face at point (and those touching it in its plane, or the rest of a curved surface). It shows the material’s colors, surface pattern and texture over the type’s material; painting a painted surface again replaces its paint. The paint follows the face when the element changes (the face turned like it that passes nearest its point).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct PaintRemove

pub struct PaintRemove

Take the paint off a face of an element (the one at point), or every paint of the element when no point is given.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct PaintsList

pub struct PaintsList

The painted faces of an element (or of every element): each paint’s material, point and normal, and the faces and area it covers now (none when no face is turned like it any more).

Traits: Debug, Default, Deserialize, Serialize, JsonSchema, Command

Fields

cc_engine::commands::phases

crates/cc_engine/src/commands/phases.rs

Construction phases: the project’s phases, the phases of elements (built, demolished), phase filters and the graphics of each status (see cc_core::phase).

Items: element_phases_json · view_phase_json · PhasesList · PhaseCreate · PhaseSet · PhaseDelete · ElementsPhaseSet · ElementsDemolish · PhaseCreationSet · display_name · status_name · phase_filter_json · PhaseFiltersList · PhaseFilterCreate · PhaseFilterSet · PhaseFilterDelete · PhaseGraphicsGet · PhaseGraphicsSet

fn element_phases_json

pub(crate) fn element_phases_json(p: &Project, e: &cc_core::Element) -> (Value, Value)

The phases of an element as element_get shows them.

fn view_phase_json

pub(crate) fn view_phase_json(p: &Project, v: &cc_core::View) -> (Value, Value)

A view’s phase and phase filter as view_get shows them.

struct PhasesList

pub struct PhasesList

The project’s construction phases in time order, with how many elements each builds and demolishes and how many views show it.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

struct PhaseCreate

pub struct PhaseCreate

Add a construction phase, at the end (the latest) or before another. Elements and views keep their phases.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct PhaseSet

pub struct PhaseSet

Rename a phase, change its description, or move it to another place in time (index, 0 = earliest). A move that would put an element’s demolition before its construction is refused.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct PhaseDelete

pub struct PhaseDelete

Delete a phase. A phase that elements are built or demolished in, or that views show, needs merge_into: they move to that phase (an element then built and demolished in the same phase is temporary). The last remaining phase cannot be deleted.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct ElementsPhaseSet

pub struct ElementsPhaseSet

Set the phase elements are built in and/or demolished in (null: not demolished). A demolition cannot come before the construction. Doors, windows and rebar follow their hosts: they are never built before them and are demolished with them (unless demolished earlier).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct ElementsDemolish

pub struct ElementsDemolish

Demolish elements in a phase: phase when given, else the phase of view, else the phase new elements are built in (the last by default). Their doors, windows and rebar go with them (unless demolished earlier). Elements not built by then, or already demolished earlier, are refused.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct PhaseCreationSet

pub struct PhaseCreationSet

Set the phase new elements are built in by this session (the active view’s phase in the application): display state, not saved, not undone. phase (id or name), or the phase of view; neither resets it to the last phase.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

fn display_name

pub fn display_name(d: PhaseDisplay) -> &'static str

fn status_name

pub fn status_name(st: PhaseStatus) -> &'static str

fn phase_filter_json

pub(crate) fn phase_filter_json(p: &Project, f: &PhaseFilter) -> Value

struct PhaseFiltersList

pub struct PhaseFiltersList

The phase filters: for each status (existing, demolished, new, temporary) whether views using the filter show it by_category, overridden (with the status graphics, see phase_graphics_get) or not_displayed.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

struct PhaseFilterCreate

pub struct PhaseFilterCreate

Create a phase filter; statuses not given show by_category.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct PhaseFilterSet

pub struct PhaseFilterSet

Change a phase filter: its name or how it shows each status. Views using it follow.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct PhaseFilterDelete

pub struct PhaseFilterDelete

Delete a phase filter; views and view templates using it are left without one (showing every status by category).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct PhaseGraphicsGet

pub struct PhaseGraphicsGet

The graphics of each phase status (existing, demolished, new, temporary), used by phase filters that show a status overridden. Overrides are shaped as in view_graphics_get.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

struct PhaseGraphicsSet

pub struct PhaseGraphicsSet

Change the graphics of a phase status: overrides is merged into the current ones (null resets an attribute; see view_graphics_get), reset clears them first.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

cc_engine::commands::piles

crates/cc_engine/src/commands/piles.rs

Piles and pile caps (see cc_core::pile): free piles, pile and pile cap types, caps placed one by one or under columns (their piles made with them), and tie beams between caps.

Items: toe_arg · PileTypeCreate · PileCreate · PileCapTypeCreate · PileCapCreate · CapRotation · PileCapsUnderColumns · TieBeamsCreate · derived · normalize_patch · check · owned_piles

fn toe_arg

pub(crate) fn toe_arg(cut_off: f64, toe: Option<f64>, length: Option<f64>) -> Result<f64>

A pile’s toe from a toe or a length below cut_off (default: the default length).

struct PileTypeCreate

pub struct PileTypeCreate

Create a pile type: round (diameter) or square (side), made as kind says.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct PileCreate

pub struct PileCreate

Create a free pile at position: its head (cut_off) above the level and its toe given by toe or by a length below the head. A project without a pile type gets one (round, 40 cm, in concrete).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct PileCapTypeCreate

pub struct PileCapTypeCreate

Create a pile cap type: the layout of its piles (single, pair, triangle, square, line of count, circle of count on a radius, a ring cap with ring_width), their spacing and edge distance, the cap’s thickness, and the type, length and embedment of its piles. The cap’s outline follows: a rectangle around one, two, four and a line of piles; for three, a triangle with its corners cut square; on a circle, a round cap or a ring. A project without a pile type gets one.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct PileCapCreate

pub struct PileCapCreate

Place a pile cap centered at position, turned by rotation (its layout’s u axis along it), its top top_offset above the level. Its piles are made with it, in the same undo step, and follow it: they move, turn and are copied and deleted with it, and change with its type. A project without a pile cap type gets one (two piles).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

enum CapRotation

pub enum CapRotation

How caps under columns are turned: as their column, by a fixed angle, or pointing away from a center.

Traits: Debug, Clone, PartialEq, Deserialize, Serialize, JsonSchema

Variants

struct PileCapsUnderColumns

pub struct PileCapsUnderColumns

Place a pile cap under each column (default: every column of the level), centered on it, its top at the column’s base; its piles are made with it, all in one undo step. rotation turns each cap: column (default) as its column, an angle in degrees, or radial: its layout’s u axis pointing away from center, so caps under columns on a circle point outward (a three-pile cap’s first pile outside). Columns that already stand on a pad footing or a pile cap are skipped.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct TieBeamsCreate

pub struct TieBeamsCreate

Create tie beams between consecutive pile caps of caps (and from the last back to the first when closed): straight, or arcs around center (each between two caps at the same distance from it, the shorter way), or of a signed radius (positive: counter-clockwise). Each beam runs between the caps’ centers and stops at their outlines where it frames into their depth; its top is flush with the lower of its two caps’ tops unless top_offset is given. Tie beams are ordinary beams.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

fn derived

pub(crate) fn derived(p: &Project, e: &cc_core::Element, out: &mut serde_json::Map<String, Value>)

The derived values element_get shows for a pile or a pile cap.

fn normalize_patch

pub(crate) fn normalize_patch(e: &cc_core::Element, patch: &Value) -> Result<Value>

element_set params for a pile: length stands for the toe that far below the head; a pile cap’s piles follow their cap and take no params.

fn check

pub(crate) fn check(pile: &Pile) -> Result<()>

Check a pile changed by element_set: a length within the limits.

fn owned_piles

pub(crate) fn owned_piles(p: &Project, ids: &[ElementId]) -> Vec<ElementId>

Element ids of piles in ids that belong to a cap not in ids (they go with their cap only).

cc_engine::commands::profiles

crates/cc_engine/src/commands/profiles.rs

Structural profiles (see cc_core::structural_profile): the named cross-sections column and beam types are drawn and built with. A profile is a standard parametric shape (i, channel, rect_tube, rect…) of a material (steel, cold_formed, timber, concrete) or a sketch whose points are expressions over its own parameters. Profiles are project settings: each command changes them in one undo step, and the types using a changed profile follow it (their width and height become its bounding box).

Items: TypeSectionInfo · section · ProfilesList · ProfileGet · SketchParamArg · ProfileCreate · ProfileSet · ProfileDuplicate · ProfileDelete · ProfileCatalog · ProfileImport · ProfileTypeCreate

struct TypeSectionInfo

pub(crate) struct TypeSectionInfo

The section of a column or beam type as element and analytical queries show it.

Fields

fn section

pub(crate) fn section(p: &Project, data: &TypeData) -> Option<TypeSectionInfo>

The section of a column or beam type: its profile’s (turned and mirrored), or its own legacy section’s when it has none.

struct ProfilesList

pub struct ProfilesList

The project’s structural profiles, optionally of one material or shape: id, name, material, shape, area (m²), mass per meter in steel (kg/m) and the number of column and beam types using each.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct ProfileGet

pub struct ProfileGet

One structural profile: its material, shape and parameters (and the sketch of a sketched one), the outline (outer loop counter-clockwise, holes clockwise, meters, centered on its bounding box), its section properties (SI units; mass per length with the usual density of its material), its catalog entry and the names of the types using it.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct SketchParamArg

pub struct SketchParamArg

A numeric parameter of a sketched profile.

Traits: Debug, Clone, Deserialize, Serialize, JsonSchema

Fields

struct ProfileCreate

pub struct ProfileCreate

Create a structural profile: a standard shape of a material (its default dimensions, changed by params), or a sketch drawn with curves (and openings), whose points keep the drawn coordinates and which declares sketch_params. Without a name it gets one from its shape and size.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct ProfileSet

pub struct ProfileSet

Change a structural profile: its name, material, parameter values or, for a sketched one, its sketch (a merge patch over the sketch that profile_get shows: params, outline and openings). A change that leaves no valid outline is refused. The column and beam types using it follow; a profile whose size or material changes is no longer its catalog entry.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct ProfileDuplicate

pub struct ProfileDuplicate

Copy a structural profile under a new name (default: the name with a number).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct ProfileDelete

pub struct ProfileDelete

Delete a structural profile. Refused while column or beam types use it, unless replace_with names the profile they take instead, in the same undo step.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct ProfileCatalog

pub struct ProfileCatalog

The built-in profile catalogs (standard steel, cold-formed, timber and hollow sections). Without series: each series’ code, name, material, shape and row count. With it: the series’ code, name and rows, each a designation, the name an imported profile gets and its params (meters; degrees for angle). Catalogs are not part of the project; profile_import copies rows in.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct ProfileImport

pub struct ProfileImport

Copy rows of a built-in catalog series into the project as profiles that remember their catalog entry, in one undo step (none when nothing is imported). A row whose profile name is taken keeps the existing profile (on_clash: "keep", the default) or comes in under a free name ("rename"). Returns the imported profiles (id, name), the names kept and the designations the series does not have (unknown).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct ProfileTypeCreate

pub struct ProfileTypeCreate

Make a column or beam type of a structural profile: a copy of the category’s first type given the profile, its width and height becoming the profile’s bounding box. Returns its id and name.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

cc_engine::commands::project

crates/cc_engine/src/commands/project.rs

The session’s project: new, open, save, information, undo, units, language.

Items: ProjectNew · ProjectOpen · ProjectSave · ProjectInfoGet · ProjectInfoSet · Undo · Redo · UnitsGet · UnitsSet · LanguageSet

struct ProjectNew

pub struct ProjectNew

Start a new project from a template (unsaved changes are discarded).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ProjectOpen

pub struct ProjectOpen

Open a ConstructCraft project (.ccad), replacing the session’s project. Damaged files are repaired and the number of repairs reported.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ProjectSave

pub struct ProjectSave

Save the project to its file, or to path (which becomes its file).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ProjectInfoGet

pub struct ProjectInfoGet

Project information, file, unsaved state and counts.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

struct ProjectInfoSet

pub struct ProjectInfoSet

Change the project information (title block fields).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct Undo

pub struct Undo

Undo the last edit.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

struct Redo

pub struct Redo

Redo the last undone edit.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

struct UnitsGet

pub struct UnitsGet

The project units (length, area, volume, angle, slope, currency, number format).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

struct UnitsSet

pub struct UnitsSet

Change the project units: values is merged into the object units_get returns (only the fields given change), after preset when given. Length units are Millimeter, Centimeter, Meter, Foot, Inch, FeetInches (12'-6 1/2") and FractionalInch; for the last two, decimals is the precision, 1/2^decimals of an inch.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct LanguageSet

pub struct LanguageSet

Language of default names, messages and sheet labels (en, pt-BR, es, fr, de, it, lo, pl, uk-UA, zh-TW, zh-CN or ja).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

cc_engine::commands::query

crates/cc_engine/src/commands/query.rs

Reading the model: categories, levels, types, elements, views, materials, schedules.

Items: snake · view_category · CategoriesList · LevelsList · TypesList · type_json · TypeGet · ElementsList · element_json · ElementGet · view_json · ViewsList · ViewGet · MaterialsList · MaterialGet · ScheduleTable · GroupsList · Measure

fn snake

pub(crate) fn snake(name: &str) -> String

FloorPlan → floor_plan.

fn view_category

pub(crate) fn view_category(name: &str) -> Result<ViewCategory>

struct CategoriesList

pub struct CategoriesList

Element categories with their display names and how many elements and types each has.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

struct LevelsList

pub struct LevelsList

Levels from the lowest, with their elevations (meters).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

struct TypesList

pub struct TypesList

Types, optionally of one category.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

fn type_json

pub(crate) fn type_json(s: &Session, id: cc_core::ElementTypeId) -> Option<Value>

struct TypeGet

pub struct TypeGet

A type with all its parameters (params, editable with type_set) and identity data (info). A title block’s pictures show as format, width, height (pixels) and bytes, not their bytes; component_sheet_piece_set replaces them.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ElementsList

pub struct ElementsList

Elements, optionally of one category, level and/or type, or only those shown in a view (all the instances of a type visible in it, for example), with a short summary each.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

fn element_json

pub(crate) fn element_json(s: &mut Session, id: ElementId) -> Option<Value>

Full description of an element: everything element_set can change, plus derived values.

struct ElementGet

pub struct ElementGet

An element with all its parameters (params, editable with element_set) and derived values (length, height, thickness, volume, room area and perimeter; for beams the length after joins and what each end is framed into; for columns and beams the section: profile name, area, mass per length with the material’s density (null without one), ix, iy, wx, wy).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

fn view_json

pub(crate) fn view_json(s: &Session, id: ViewId) -> Option<Value>

struct ViewsList

pub struct ViewsList

Views (plans, ceiling plans, elevations, sections, 3D, legends, drafting views, schedules, sheets), optionally of one category.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ViewGet

pub struct ViewGet

A view with all its parameters (params, editable with view_set), its scale denominator and scale_text, the scale as the project writes it (1:50, or 1/4" = 1'-0" in imperial projects), and its sun: null, or the settings view_set takes plus derived (azimuth and altitude, above_horizon, the current frame’s date and time, sunrise and sunset, the number of frames, site_known and whether it is the conventional sun), and its shading (ambient and shadow, null for views that take no sun).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct MaterialsList

pub struct MaterialsList

Materials with their colors and how many types use each.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

struct MaterialGet

pub struct MaterialGet

A material with all its fields (editable with material_set).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ScheduleTable

pub struct ScheduleTable

The table of a schedule view: headers, one row per element (with its id) and totals, formatted with the project units.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct GroupsList

pub struct GroupsList

The project’s groups with their members.

Traits: Debug, Default, Deserialize, Serialize, JsonSchema, Command

struct Measure

pub struct Measure

Measure between two points of a view (meters on its plane: plan coordinates in plans): the distance, its horizontal and vertical parts and its angle. When both points lie on lines (line_a, line_b, each two points) that are parallel, the distance between the lines is given too. Nothing is created.

Traits: Debug, Default, Deserialize, Serialize, JsonSchema, Command

Fields

cc_engine::commands::ramp

crates/cc_engine/src/commands/ramp.rs

Ramps: creating them in any shape and checking them against the accessibility rules of their type.

Items: SHAPES · RampCreate · new_ramp_type · RampCheck · issue_text · RampTypeCreate

const SHAPES

pub const SHAPES: [(&str, RampShape); 4]

Names of the ramp shapes in commands.

struct RampCreate

pub struct RampCreate

Create a ramp starting at start (the middle of its foot) and rising along direction up to the level above (or height). Flights follow the type’s rules: at most its steepest slope and its highest rise per flight, with landings between them; shape lays them out in line, L- or U-shaped (switchback), or as a helix. A project without a ramp type gets one.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

Methods

fn new_ramp_type

pub fn new_ramp_type(p: &Project, id: ElementTypeId) -> ElementType

A ramp type for a project that has none: 1.20 m wide, a 15 cm slab of the stairs’ material, the default rules (4’-0”, a 6” slab and the customary rules in imperial projects; see cc_core::Defaults::ramp).

struct RampCheck

pub struct RampCheck

Check a ramp: its slope, flights (count, rise and run of each) and the rules of its type it breaks (too steep, a flight rising too high, a short landing).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

fn issue_text

pub fn issue_text(issue: &cc_core::RampIssue) -> String

A broken ramp rule in words.

struct RampTypeCreate

pub struct RampTypeCreate

Create a ramp type: a slab thickness thick and width wide, within the accessibility rules given (by default 8.33 % slope, 0.80 m rise per flight and 1.20 m landings).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

cc_engine::commands::rebar

crates/cc_engine/src/commands/rebar.rs

Reinforcement: sets of bars in beams and columns, and copying a host’s sets to others.

Items: bar_type · partition_arg · splice · RebarCreate · RebarTypical · RebarCopy

fn bar_type

pub(crate) fn bar_type(p: &Project, diameter: f64) -> Result<ElementTypeId>

The bar type nearest diameter.

fn partition_arg

pub(crate) fn partition_arg(text: Option<&str>) -> Result<String>

The lap splices of bars of type_id running along a beam: max_length (default: the stock length; 0 for whole bars) and lap (default: 40 bar diameters). A partition as it is kept: trimmed, at most cc_core::bar_marks::MAX_MARK_TEXT characters.

fn splice

pub(crate) fn splice(p: &Project, type_id: ElementTypeId, max_length: Option<f64>, lap: Option<f64>) -> Result<Option<Splice>>

struct RebarCreate

pub struct RebarCreate

Add a set of bars to a beam or column: layout is top or bottom (beams), perimeter (columns) with count bars, sides (beams: count side bars on each side face, or as many as keep them spacing apart over the height), or stirrups every spacing. The bars are cover inside the faces (default 2.5 cm) and follow the host: along an arc beam they follow the arc, each at its own radius, and the stirrups are radial. Top and bottom bars that do not fit side by side (a clear distance of the bar diameter, at least 2 cm) go in a second layer. Bars along a beam longer than max_length are made of pieces overlapping by lap, the splices of neighbouring bars staggered. A column’s perimeter bars are count spread around its section, or given face by face with faces (a bar count for each face of the section, its two corner bars included, the corner bars shared between faces; the column’s derived.faces lists the faces in order) or face_spacing; on a curved face they stand at even angles. Its stirrups follow the section’s outline, and ties adds cross-ties every spacing: a hooked bar from each bar between the corners to the bar opposite. With max_length a column’s vertical bars are cut in lifts that lap by lap. same_type gives the set to every column (or beam) of the host’s type.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct RebarTypical

pub struct RebarTypical

Give beams and columns without reinforcement a typical one: beams two (three when 20 cm wide or more) 10 mm bars at the bottom, two 8 mm at the top (both lap spliced past the stock length) and 5 mm stirrups every 15 cm; columns four 10 mm bars (six in round ones) and 5 mm ties every 15 cm. Default: every beam and column of level (or of the project).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct RebarCopy

pub struct RebarCopy

Copy the reinforcement sets of one host (all, or those of sets) to other hosts of the same kind and section in one step: columns and beams of the same type or of types with the same section, walls and strip footings of the same type. Each copy keeps its bar type, layout, cover, splices, partition and hand-given mark. Floors and slab foundations, whose sets keep plan points, are not copied. With replace, each target’s own sets go first. Nothing is changed when a target does not match. Returns the created set ids and those replaced.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

cc_engine::commands::region

crates/cc_engine/src/commands/region.rs

Filled and masking regions: 2D areas drawn in one view (see cc_core::region), sketched like floors (curves: an outline and the loops inside it as openings). They are moved, copied, rotated, mirrored and deleted with the generic commands; sketch_get/sketch_set read and redraw the boundary; element_set changes the boundary style ("boundary": "<style>" or "none") and element_set’s type (or type_set on the type) the fill.

Items: FilledRegionCreate · MaskingRegionCreate · FilledRegionTypeCreate · normalize_patch · check · redraw

struct FilledRegionCreate

pub struct FilledRegionCreate

Draw a filled region in a 2D view (plan, ceiling plan, elevation, section, legend or drafting view): the closed loops of curves in the view’s drawing coordinates (meters), the largest the outline and those inside it openings, filled as its type says (a pattern over a background, or a solid color) and edged in a line style. It is drawn only in that view, over the model and under the view’s annotations. A project without a filled region type gets one (diagonal lines over white).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct MaskingRegionCreate

pub struct MaskingRegionCreate

Draw a masking region in a 2D view: an opaque white area (the closed loops of curves, openings inside the outline) that hides the model’s linework of the view under it, while the view’s annotations (detail lines, dimensions, texts, tags) stay on top. Drawn only in that view.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct FilledRegionTypeCreate

pub struct FilledRegionTypeCreate

Create a filled region type: a foreground pattern over a background pattern, each with its color (a solid pattern fills with its color; a none background leaves the model visible between the pattern lines). Change it later with type_set ({"fill": {...}}).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

fn normalize_patch

pub(crate) fn normalize_patch(p: &Project, patch: &Value) -> Result<Value>

A params patch for a region with its boundary given by code ("boundary": "wide", or "none") turned into the model’s form.

fn check

pub(crate) fn check(old: &Region, new: &Region) -> Result<()>

Check a patched region: the view stays, the outline is valid, the openings lie inside it apart.

fn redraw

pub(crate) fn redraw(r: &mut Region, sketch: cc_core::sketch::Sketch) -> Result<()>

Redraw a region’s outline and openings from a sketch (sketch_set).

cc_engine::commands::render

crates/cc_engine/src/commands/render.rs

Photorealistic rendering of 3D views (path tracing, cc_raytracing).

Items: ViewRender

struct ViewRender

pub struct ViewRender

Render a 3D view photorealistically (path tracing on the processor, no GPU) and write the image: .png, .jpg/.jpeg exposed, tone mapped and sRGB encoded, .exr and .hdr in linear light. The view’s render settings are used (the defaults when it has none), patched by settings for this render only; its camera is the one kept in the view, fitted to the model when it was never moved, as the 3D view does. The view is rendered as printed, without temporary hiding. Changes nothing in the model. Returns the path, the image size, the samples per pixel, the seconds spent and the triangles rendered.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

cc_engine::commands::roofing

crates/cc_engine/src/commands/roofing.rs

Roof coverings and framing: checking a roof against its tiles.

Items: RoofCheck · roof_json

struct RoofCheck

pub struct RoofCheck

Check a roof against its covering: the least slope its tiles take and the roof’s slopes, the area covered, the number of tiles and their weight, and its framing (purlins, rafters, battens and truss members: lengths, the number of trusses and the volume). The covering and framing are set on the roof’s type (type_set with covering and framing).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

fn roof_json

pub fn roof_json(covering: Option<TileKind>, system: FramingSystem, g: &RoofFramingGeom) -> Value

A roof’s covering and framing figures as JSON, with the rules it breaks.

cc_engine::commands::schedule

crates/cc_engine/src/commands/schedule.rs

Schedule definitions (see cc_core::schedule): the fields a schedule shows, its filters, its sorting and grouping, how each column is written and how the table looks on paper.

Items: ScheduleGet · ScheduleSet

struct ScheduleGet

pub struct ScheduleGet

A schedule’s definition: the fields it shows in order, its filters (field, op, value), its sorting levels (field, descending, header, footer, blank_line), whether every element has its own row (itemize), whether the totals row shows (totals), each column’s format (columns: heading, align, hidden, total) and the table’s appearance on paper; and the fields available to schedules of its category. schedule_set changes any of them.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ScheduleSet

pub struct ScheduleSet

Change a schedule’s definition; every part is optional and replaces the part it names, the others staying as they are. fields are the columns in order. filters keep the rows that pass every one: each compares a field with a value by op (equals, not_equals, contains, not_contains, begins_with, not_begins_with, greater, greater_or_equal, less, less_or_equal, has_value, has_no_value); numbers compare as numbers in SI units (lengths in meters), texts without case. sorting orders the rows by up to four levels, the first outermost; a level with header, footer or blank_line groups the rows alike in it under a heading, over a footer (the group’s count and totals) or apart by a blank line. With itemize false, the elements alike in every sorting level share one row: values that differ among them read as varying and totaled columns add up (the Count field says how many). columns formats the columns of the fields named (heading, align: Auto, Left, Center, Right; hidden: a hidden field still sorts and filters; total: add the column up in footers and totals), totals shows or hides the totals row, and appearance is how the table is drawn on sheets and exports (grid_lines, outline, show_title, show_headers, and the title_size, header_size and text_size in millimeters). One undo step; returns the definition as schedule_get does.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

cc_engine::commands::shaft

crates/cc_engine/src/commands/shaft.rs

Shaft openings: vertical openings through the floors, ceilings and roofs between their base and top (see cc_core::shaft).

Items: new_shaft_type · ShaftCreate · ShaftTypeCreate

fn new_shaft_type

pub fn new_shaft_type(id: ElementTypeId) -> ElementType

The shaft type a project gets with its first shaft.

struct ShaftCreate

pub struct ShaftCreate

Create a shaft: a vertical opening with outline in plan (or drawn with curves), from its level plus base_offset up to top_level (plus top_offset) or height. Every floor, ceiling and roof it passes through is cut where the outline lies inside it, clear of its own openings; the cuts follow the shaft when it moves, changes or is deleted. A project without a shaft type gets one.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct ShaftTypeCreate

pub struct ShaftTypeCreate

Create a shaft type (shafts have no properties of their own; types name them).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

cc_engine::commands::sheets

crates/cc_engine/src/commands/sheets.rs

Sheets and their title blocks: paper, title block, fields and issue date of a sheet; title block components and their 2D pieces.

Items: SizeArg · rename_sheet_fields · SheetSet · SheetFields · TitleBlockCreate · SheetPieceArg · pattern_arg · def_json · push_pieces · ComponentSheetPieceAdd · check_nested · check_nested_in · ComponentSheetPieceSet · ComponentSheetPieceDelete

enum SizeArg

pub enum SizeArg

A paper size by name ("A0"…"A4", "ANSI A"…"ANSI E", "ARCH A"…"ARCH E1", "ARCH E"), or {width, height} in millimeters.

Traits: Debug, Clone, Deserialize, Serialize, JsonSchema

Variants

fn rename_sheet_fields

pub(crate) fn rename_sheet_fields(e: &mut EditCtx, types: &[ElementTypeId], renames: &[(String, String)])

Sheets on any of the title block types keep their per-sheet values under the parameters’ new names (renames, [old, new] in order).

struct SheetSet

pub struct SheetSet

Change a sheet: its number, paper (size, portrait), title block, per-sheet field values and issue date.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct SheetFields

pub struct SheetFields

A sheet’s title block fields: every field key (fields, as {key} in title block texts reads it) with its value on this sheet, the title block’s per-sheet parameters (params: name, label, the sheet’s value and the type’s default), and the title block’s pieces that do not resolve on this paper (errors).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct TitleBlockCreate

pub struct TitleBlockCreate

Create a title block component: a copy of the standard one, or empty with empty. Sheets use it through sheet_set title_block.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

enum SheetPieceArg

pub enum SheetPieceArg

A 2D piece of a title block or a detail component. A title block’s coordinates are millimeters from the paper’s bottom-left corner (numbers or expressions over the parameters, SheetWidth and SheetHeight); a detail component’s are meters in its own frame, text heights too (numbers or expressions over its parameters).

Traits: Debug, Clone, Deserialize, Serialize, JsonSchema

Variants

Methods

fn pattern_arg

pub(crate) fn pattern_arg(code: &str) -> Result<cc_core::LinePattern>

A dash pattern by its code.

fn def_json

pub(crate) fn def_json(def: &ComponentDef) -> Value

A definition as queries show it: each title block picture as its format, size in pixels and bytes, not the bytes themselves.

fn push_pieces

pub(crate) fn push_pieces(def: &mut ComponentDef, shapes: Vec<SheetShape>, name: Option<&str>) -> Result<Vec<usize>>

Push shapes onto a title block’s or detail component’s pieces, the first named name (the others Piece1, Piece2…), and return their indices; refused whole when they would pass the most pieces it holds.

struct ComponentSheetPieceAdd

pub struct ComponentSheetPieceAdd

Add 2D pieces to a title block or detail component (every type of it), in one step.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

fn check_nested

pub(crate) fn check_nested(p: &Project, type_ref: &Ref, shapes: &[SheetShape]) -> Result<()>

Nested pieces must name detail components that do not hold the component of type_ref (a cycle).

fn check_nested_in

pub(crate) fn check_nested_in(p: &Project, component: &str, shapes: &[SheetShape]) -> Result<()>

Nested pieces of shapes must name detail components that do not hold component.

struct ComponentSheetPieceSet

pub struct ComponentSheetPieceSet

Change a 2D piece of a title block or detail component: piece is a merge patch over its form in component_get def.sheet (e.g. {"Text": {"size": "4"}}); an image piece’s picture is replaced with image_path or image, not by the patch.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ComponentSheetPieceDelete

pub struct ComponentSheetPieceDelete

Delete 2D pieces of a title block or detail component, in one step.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

cc_engine::commands::site

crates/cc_engine/src/commands/site.rs

The site location (latitude, longitude, elevation, true north and the postal address) and the map data brought in around it (a site drawing and context masses from OpenStreetMap).

Items: site_json · SiteGet · SiteSet · SiteContextImport

fn site_json

pub fn site_json(s: &Session) -> Value

The site as commands show it (null when the project has no location).

struct SiteGet

pub struct SiteGet

The project’s site location: latitude and longitude of the project origin (degrees, WGS 84), its elevation above sea level (meters), the angle from project north to true north (degrees counter-clockwise), the place name, the parts of the postal address, and local time’s offset from UTC in hours (utc_offset, null when not set, and utc_offset_used: the one set, else the longitude’s nominal time zone, which the sun uses); site is null when no location is set. address is the project address line.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

struct SiteSet

pub struct SiteSet

Set the project’s site location, in one undo step: the latitude and longitude of the project origin (both needed when the project has no location yet), its elevation above sea level, true north and the place and address found by a map search, and the offset from UTC. Fields left out keep their values. When address parts are given the project address (title blocks, IFC) is rewritten from them unless project_address is false. clear removes the location.

Traits: Debug, Default, Deserialize, Serialize, JsonSchema, Command

Fields

struct SiteContextImport

pub struct SiteContextImport

Bring OpenStreetMap data around the site into a floor plan, in one undo step: a site drawing (an imported drawing in meters, pinned, under the model: layers for buildings, streets, paths, railways, water, green areas, trees and street names) and, unless masses is false, a context mass per building footprint (height from the map’s height or building:levels, else default_levels storeys; no mass floors) of the “Context” mass type. data is the JSON an Overpass query answers ([out:json], out geom or ways with their nodes; the program builds the query for the square it shows); points are placed with the site location, which must be set. Map data © OpenStreetMap contributors (ODbL).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

cc_engine::commands::sketch

crates/cc_engine/src/commands/sketch.rs

Sketched outlines: the curves of floors, ceilings, roofs and masses (see cc_core::sketch), given to the commands that create them as curves, read with sketch_get and drawn again with sketch_set.

Items: CurveArg · sketch_of · sketch_error · profile · outline · SketchGet · SketchSet

enum CurveArg

pub enum CurveArg

A curve of a sketch. Rectangles and polygons become their sides (lines).

Traits: Debug, Clone, Deserialize, Serialize, JsonSchema

Variants

Methods

fn sketch_of

pub fn sketch_of(args: &[CurveArg]) -> Result<Sketch>

The sketch the arguments draw.

fn sketch_error

pub fn sketch_error(e: SketchError) -> EngineError

A sketch’s error as a command error.

fn profile

pub fn profile(sketch: &Sketch) -> Result<Profile>

The outline and openings of a sketch.

fn outline

pub fn outline(sketch: &Sketch) -> Result<Vec<DVec2>>

The outline of a sketch that takes no openings.

struct SketchGet

pub struct SketchGet

The curves an element’s outline is drawn with: its sketch, or lines along its outline and openings when it has none (floors, ceilings, roofs, masses and the other sketched elements, regions among them).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct SketchSet

pub struct SketchSet

Draw an element’s outline again from curves (edit its boundary): floors, roofs and regions take the loops inside the outline as their openings; ceilings and masses take one loop. The element keeps the curves, so sketch_get gives them back. A terrain’s measured points can change in the same step (points).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

cc_engine::commands::slab_rebar

crates/cc_engine/src/commands/slab_rebar.rs

Slab reinforcement: a mesh, or ring and radial bars, in the top and bottom layers of floors and foundation slabs, and trimming bars around their openings.

Items: TrimBars · SlabRebarCreate

struct TrimBars

pub struct TrimBars

Trimming bars around the openings of a slab.

Traits: Debug, Clone, Deserialize, Serialize, JsonSchema, Default

Fields

struct SlabRebarCreate

pub struct SlabRebarCreate

Reinforce slabs: floors and foundation slabs of any boundary. layout is mesh (default): straight bars in two directions, angle and square to it, spacing (and cross_spacing) apart; or radial: ring bars spacing apart around center and radial_count radial bars, with shorter bars from intermediate between them. The bars go in the top and bottom layers (layers), cover inside the faces of the slab’s structure, its edge and its openings: each bar is clipped to the true boundary (arcs and circles as drawn), so every bar has its own length (element_get lists a set’s derived.bars by length). hook bends the ends of mesh bars at the slab’s edge. Bars longer than max_length are lap spliced, neighbouring splices staggered. A slab with openings gets trimming bars around them (trim; false for none). One set per layer and direction, in one undo step; the bars follow the slab. Without slabs, the structural floors (floor_create structural) and the foundation slabs are reinforced.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

cc_engine::commands::stair

crates/cc_engine/src/commands/stair.rs

Stairs: creating them in any shape, checking their steps and adding the railings that follow them.

Items: SHAPES · StairCreate · StairCheck · issue_text · StairRailingsAdd · RailingHostSet

const SHAPES

pub const SHAPES: [(&str, StairShape); 6]

Names of the stair shapes in commands.

struct StairCreate

pub struct StairCreate

Create a stair starting at start (the middle of its first riser) and rising along direction up to the level above (or height). Risers and treads follow the type (the fewest risers within its maximum, and a fixed tread or one from Blondel’s formula 2 × riser + tread) unless risers or tread set them: the riser height is then the height over the risers. shape lays it out straight, with a landing, L- or U-shaped, in three flights round two landings, or around a center. The top floor is the last step: a stair ends with a riser, not a tread.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

Methods

struct StairCheck

pub struct StairCheck

Check a stair’s steps: riser count and height, tread on the walking line, Blondel’s step 2 × riser + tread and the rules of its type they break (riser out of range, short tread, step out of the Blondel range, short landing). landings lists each landing’s elevation and the places round its edge where a post can stand under an assembled stair (where its beams reach the edge), with their plan points and whether one stands there.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

fn issue_text

pub fn issue_text(issue: &cc_core::StairIssue) -> String

A broken stair rule in words.

struct StairRailingsAdd

pub struct StairRailingsAdd

Add railings along the sides of a stair or a ramp: they follow its flights, landings and turns (at the pitch of the nosings on stairs), and go with it when it changes, moves or is deleted.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct RailingHostSet

pub struct RailingHostSet

Put a railing on a stair or ramp (host), or take it off (detach). On a host it follows the host’s side (default: the side its path runs nearest), inset in from the edge, and moves, turns and goes with it; taken off, it keeps the path it had in plan, at its level plus base_offset. A hosted railing can also change only its side or inset.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

cc_engine::commands::steel_building

crates/cc_engine/src/commands/steel_building.rs

Parametric steel buildings (see cc_core::steel_building): the host element and the catalog types its members get by default.

Items: FRAME_DEFAULT · SECONDARY_DEFAULT · new_steel_building_type · SecondaryMembers · SteelBuildingCreate · derived

const FRAME_DEFAULT

pub const FRAME_DEFAULT: (&str, &str)

Columns and rafters by default: (series, designation).

const SECONDARY_DEFAULT

pub const SECONDARY_DEFAULT: (&str, &str)

Purlins and girts by default.

fn new_steel_building_type

pub fn new_steel_building_type(id: ElementTypeId) -> ElementType

The type a project gets with its first steel building.

struct SecondaryMembers

pub struct SecondaryMembers

Purlins or girts.

Traits: Debug, Clone, Deserialize, Serialize, JsonSchema, Default

Fields

struct SteelBuildingCreate

pub struct SteelBuildingCreate

Create a parametric steel building: portal frames (two columns and the rafters of a gable or mono-pitch roof) every bay_spacing along it, purlins on the roof and girts on both long sides, as ordinary columns and beams the building keeps in step with its parameters (element_set regenerates them, keeping their ids). A member edited or deleted by hand is detached and left alone. Default types come from the profile catalog (W310x38,7 for columns and rafters, Ue 150x60x20x2,00 for purlins and girts), made when missing. Out-of-range values are refused. One undo step; returns the building’s id and its members.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

fn derived

pub(crate) fn derived(p: &cc_core::Project, b: &SteelBuilding, out: &mut serde_json::Map<String, Value>)

element_get’s derived values of a building: its member ids by role kind, how many roles are detached and whether the layout reached the member limit (at_limit).

cc_engine::commands::strip_rebar

crates/cc_engine/src/commands/strip_rebar.rs

Strip footing reinforcement: bars across and along the footing slab, and stirrups, side bars and longitudinal bars for the beam on top.

Items: StripBeamBars · StripRebarCreate

struct StripBeamBars

pub struct StripBeamBars

The bars of the beam on top of a strip footing (or of the whole section of a strip without one).

Traits: Debug, Clone, Deserialize, Serialize, JsonSchema, Default

Fields

struct StripRebarCreate

pub struct StripRebarCreate

Reinforce strip footings, straight or arc: bars across the footing (transverse_spacing apart along it; radial in an arc strip) and bars along it (longitudinal_spacing apart across it; ring bars in an arc strip, each as long as the arc at its own radius), in the bottom and top layers. A top bar across the footing follows its top, up the slopes of a haunched section and flat between the faces of its beam, and its ends turn down to the bottom layer, closing the edges. The bars along a haunched footing follow the slopes, and leave the beam to its own: beam gives it stirrups over the full height of the section, top, bottom and side bars (a haunched strip gets stirrups and two top bars by default; false for none). Bars along the strip longer than max_length are lap spliced, neighbouring splices staggered. One set per layer and direction, in one undo step; the bars follow the strip.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

cc_engine::commands::structure

crates/cc_engine/src/commands/structure.rs

Structural layout from grids: columns at grid intersections and beams between the columns along grid lines or in a given order.

Items: SAME · grids_with_ids · crossing · intersections · columns_on · beam_exists · ColumnsAtGrids · BeamsOnGrids · BeamsBetweenColumns · SlabJoinSupports · StructureNumber

const SAME

pub(crate) const SAME: f64

Points closer than this are the same place (1 cm).

fn grids_with_ids

pub(crate) fn grids_with_ids(p: &Project, ids: &[u64]) -> Result<Vec<(ElementId, (DVec2, DVec2))>>

The grids named by ids with their lines, or every grid when none are given.

fn crossing

pub(crate) fn crossing((a0, a1): (DVec2, DVec2), (b0, b1): (DVec2, DVec2)) -> Option<DVec2>

Where segments a and b cross (ends included), if they are not parallel.

fn intersections

pub(crate) fn intersections(lines: &[(DVec2, DVec2)]) -> Vec<DVec2>

Every intersection of the lines, each place once.

fn columns_on

pub(crate) fn columns_on(p: &Project, level: LevelId) -> Vec<(ElementId, DVec2)>

Columns of level with their centers.

fn beam_exists

pub(crate) fn beam_exists(p: &Project, level: LevelId, a: DVec2, b: DVec2) -> bool

Whether a beam of level already runs between a and b (either way).

struct ColumnsAtGrids

pub struct ColumnsAtGrids

Place a column at every intersection of grid lines on a level, skipping places that already have a column. Returns the new ids (created) and how many intersections were skipped.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct BeamsOnGrids

pub struct BeamsOnGrids

Place beams along grid lines: on each grid, a beam between each pair of neighboring columns of the level whose centers lie on it. Spans that already have a beam are skipped.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct BeamsBetweenColumns

pub struct BeamsBetweenColumns

Place beams from column to column in the order given (a chain), on the level of the first column. Spans that already have a beam are skipped.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct SlabJoinSupports

pub struct SlabJoinSupports

Join each slab with the structure that carries it: beams, structural columns and structural walls whose bodies overlap it (default: every floor, or every floor of level). Beams and columns cut the slab, the slab cuts walls, and the shared volume counts once. Pairs already joined are left as they are.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct StructureNumber

pub struct StructureNumber

Number the marks of beams, columns and pad footings (default: all three) in reading order: horizontal beams top to bottom then left to right, the other beams left to right then top to bottom, columns and footings top to bottom then left to right. Marks are a prefix per category (V, P, S in Portuguese; B, C, F in English) and a number.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

cc_engine::commands::structure_material

crates/cc_engine/src/commands/structure_material.rs

Column and beam types by structural material (concrete, steel, timber): the first type of a material, else a default made from the profile catalog (steel W200x26,6, timber MLC 9x32) or a 20 x 40 concrete rectangle, in one undo step.

Items: material_arg · member_category · structural_type · catalog_type · catalog_type_turned · catalog_type_placed · StructuralTypeFor · type_or_row · type_or_turned_row

fn material_arg

pub(crate) fn material_arg(code: &str) -> Result<StructuralMaterial>

fn member_category

pub(crate) fn member_category(code: &str) -> Result<Category>

fn structural_type

pub(crate) fn structural_type(s: &mut Session, category: Category, material: StructuralMaterial) -> Result<(ElementTypeId, bool)>

The type of category new material members get: the first one of the material, else a default made in one undo step. Returns it and whether it was made.

fn catalog_type

pub(crate) fn catalog_type(s: &mut Session, category: Category, series: &str, designation: &str) -> Result<ElementTypeId>

The first category type whose profile is catalog row designation of series, its profile not turned, else one made from the row (the profile imported when the project lacks it). What it makes takes undo steps of its own: callers squash them into theirs.

fn catalog_type_turned

pub(crate) fn catalog_type_turned(s: &mut Session, category: Category, row: (&str, &str), rotation_deg: f64) -> Result<ElementTypeId>

catalog_type with the profile turned rotation_deg (90 lays a beam’s section on its side: its depth runs across, its width up).

fn catalog_type_placed

pub(crate) fn catalog_type_placed(s: &mut Session, category: Category, (series, designation): (&str, &str), rotation_deg: f64, mirror: bool) -> Result<ElementTypeId>

catalog_type_turned with the profile also mirrored when mirror (before it is turned: a channel laid on its side with 90 opens upward, and downward when mirrored).

struct StructuralTypeFor

pub struct StructuralTypeFor

The column or beam type new members of a structural material get: the first type of that material, else a default made in one undo step (steel W200x26,6, timber MLC 9x32 from the profile catalog, concrete a 0.20 x 0.40 rectangle named 20x40). Returns its id, name and whether it was created.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

fn type_or_row

pub(crate) fn type_or_row(s: &mut Session, given: Option<ElementTypeId>, category: Category, (series, row): (&str, &str)) -> Result<ElementTypeId>

The given type, else the catalog row’s (made when missing).

fn type_or_turned_row

pub(crate) fn type_or_turned_row(s: &mut Session, given: Option<ElementTypeId>, category: Category, row: (&str, &str), rotation_deg: f64) -> Result<ElementTypeId>

type_or_row with the row’s type turned rotation_deg (see catalog_type_turned).

cc_engine::commands::sun

crates/cc_engine/src/commands/sun.rs

The sun of a view (see cc_core::sun): its settings as commands show and take them (view_get, view_set), where it stands, the frames of a study, and the project’s named presets.

Items: SunArg · apply_sun · mode_json · sun_json · sun_arg · view_sun_json · SunPosition · utc_offset · SunFrames · SunPresetsList · SunPresetSave · SunPresetRename · SunPresetDelete

struct SunArg

pub struct SunArg

A view’s sun as commands take it (view_set sun, sun_preset_save): every field is optional and changes only what it names. The fields a mode has: still date and time; single_day date, from, to, sunrise_to_sunset and interval; multi_day from_date, to_date, from, to, sunrise_to_sunset and interval; lighting azimuth, altitude and relative_to_view. frame, show_path, shadows and ground belong to every mode. Dates and times are local to the site.

Traits: Debug, Clone, Default, PartialEq, Deserialize, Serialize, JsonSchema

Fields

fn apply_sun

pub(crate) fn apply_sun(p: &Project, current: Option<&SunSettings>, arg: &SunArg) -> Result<SunSettings>

current (or the default sun) changed by arg, checked: unknown names, unreadable dates and times, fields the mode does not have and values out of range are refused, never repaired.

fn mode_json

pub fn mode_json(mode: &SunMode) -> Map<String, Value>

A mode in the friendly form: mode and the fields it has.

fn sun_json

pub fn sun_json(project: &Project, sun: &SunSettings) -> Value

A view’s sun in the friendly form (what view_get shows and view_set takes).

fn sun_arg

pub fn sun_arg(project: &Project, sun: &SunSettings) -> SunArg

The argument that makes sun from any settings: every field of its mode and the common ones (the inverse of applying a SunArg).

fn view_sun_json

pub(crate) fn view_sun_json(p: &Project, v: &View) -> Value

A view’s sun as view_get shows it: null, or the friendly form plus derived (where it stands for the current frame).

struct SunPosition

pub struct SunPosition

Where the sun stands: for a view with a sun, at its current frame (or its lighting direction); else on date at time (local) at the project’s site, or at latitude, longitude and utc_offset given here (a longitude given without an offset takes its nominal time zone). Returns the azimuth (degrees clockwise from true north), the altitude (degrees above the horizon, no refraction), above_horizon, the unit direction towards the sun in project coordinates (true north applied), sunrise and sunset that day (HH:MM, or null with polar day or night), and site_known (false: the equator at Greenwich).

Traits: Debug, Default, Deserialize, Serialize, JsonSchema, Command

Fields

fn utc_offset

pub(crate) fn utc_offset(v: f64) -> Result<f64>

An offset from UTC within range.

struct SunFrames

pub struct SunFrames

The frames of a view’s sun study, in time order: count (all of them, at most 5000; 0 for lighting, 1 for a still sun) and the first limit as {index, date, time, azimuth, altitude}.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct SunPresetsList

pub struct SunPresetsList

The project’s sun presets: each name with its mode in the form view_set sun takes (a view takes one with "sun": {"preset": name}).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

struct SunPresetSave

pub struct SunPresetSave

Save a sun preset, in one undo step: the mode and its values (dates, times, step or light direction; not the frame, path, shadows or ground) of a view’s sun, or of sun applied to the default sun. A preset of the same name is replaced only with replace; a project keeps at most 200.

Traits: Debug, Default, Deserialize, Serialize, JsonSchema, Command

Fields

struct SunPresetRename

pub struct SunPresetRename

Rename a sun preset, in one undo step.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct SunPresetDelete

pub struct SunPresetDelete

Delete a sun preset, in one undo step (views that took it keep their sun).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

cc_engine::commands::sweep

crates/cc_engine/src/commands/sweep.rs

Swept profiles: a profile (a closed outline held by the type) carried along a path in plan, for baseboards, crown moldings, fascias, gutters and copings. Creating them, creating their types and redrawing a type’s profile.

Items: new_sweep_type · SweepCreate · SweepTypeCreate · SweepProfileSet

fn new_sweep_type

pub fn new_sweep_type(p: &Project, id: ElementTypeId) -> ElementType

The sweep type a project gets with its first sweep: a baseboard (10 cm tall, 4” in imperial projects; see cc_core::Defaults::baseboard).

struct SweepCreate

pub struct SweepCreate

Create a swept profile: the profile of its type carried along path in plan, base_offset above the level, on the left of the path walking along it (flip puts it on the right); closed runs the path back to its first point (around a room). A project without a sweep type gets one (a baseboard).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct SweepTypeCreate

pub struct SweepTypeCreate

Create a sweep type: its profile drawn as points [x, y] (x across, to the left of the path; y up from it, meters) or as curves (lines, arcs, circles, rectangles… making one closed outline), shown in material. Without a profile it is a baseboard 1.5 cm × 10 cm.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct SweepProfileSet

pub struct SweepProfileSet

Redraw the profile of a sweep type, as points [x, y] or curves; every sweep of the type follows. The type keeps the curves (type_get shows them as its sketch), so arcs stay arcs when the profile is edited again.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

cc_engine::commands::topography

crates/cc_engine/src/commands/topography.rs

Terrain: topography surfaces from measured points inside a boundary (see cc_core::topography).

Items: Point3 · checked_points · new_topography_type · TopographyCreate · PointElevation · TopographyPointsSet · TopographyTypeCreate · derived

type alias Point3

pub type Point3 = [f64; 3]

A measured point [x, y, z]: plan position and elevation above the level, meters.

fn checked_points

pub(crate) fn checked_points(list: &[Point3]) -> Result<Vec<DVec3>>

A terrain’s new points: at most MAX_POINTS, finite, and those that repeat another in plan dropped.

fn new_topography_type

pub fn new_topography_type(id: ElementTypeId, material: String, system: cc_core::MeasurementSystem) -> ElementType

A terrain type for a project of system that has none, in material (contours every meter, every foot in imperial projects).

struct TopographyCreate

pub struct TopographyCreate

Create a terrain surface (topography): measured points [x, y, z] inside a closed boundary (or one drawn with curves; with neither, the convex hull of the points). The points are triangulated with the boundary, whose vertices take the elevations the points give them; the earth closes down to a flat base base_depth below the lowest point. Points outside the boundary are kept: they give the boundary its elevations but are not vertices of the surface. A project without a terrain type gets one (and an earth material).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct PointElevation

pub struct PointElevation

A new elevation for one point.

Traits: Debug, Deserialize, Serialize, JsonSchema, Clone, Copy

Fields

struct TopographyPointsSet

pub struct TopographyPointsSet

Edit the measured points of a terrain surface: replace them all (points), or change elevations (set), remove points (remove, by index) and add new ones (add), in that order. Indices refer to the points before remove and add: the current ones, or points when it is given. Points that repeat another in plan are dropped (the first is kept); the answer says how many.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct TopographyTypeCreate

pub struct TopographyTypeCreate

Create a terrain type: the earth material sections cut it in, and its contour lines every contour_interval meters, every major_every-th a major (heavier) one.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

fn derived

pub(crate) fn derived(g: &cc_geom::topography::TopoGeom, derived: &mut serde_json::Map<String, Value>)

The figures element_get shows for a terrain surface, as topography.

cc_engine::commands::types

crates/cc_engine/src/commands/types.rs

Types and components: change, duplicate, delete, create components.

Items: validate · type_out · TypeSet · TypeDuplicate · TypeDelete · ComponentCreate · starter_def

fn validate

pub(crate) fn validate(def: &ComponentDef) -> Result<()>

Parameter names valid and unique, sound reference planes, lines and dimensions, the right kind of pieces (a title block: sheet pieces only, within their limits; a detail component at least one), every piece resolves. A component may have no pieces while it is shaped: it starts empty, and component_place refuses it until it has one.

fn type_out

pub(crate) fn type_out(s: &Session, id: ElementTypeId) -> Value

struct TypeSet

pub struct TypeSet

Change a type: its name, its parameters (params, merged into what type_get shows: layers, sizes, materials, a component’s def…) and its identity data (info: type mark, description, manufacturer, cost…). A column or beam type takes profile (a structural profile’s name or id; null is refused: these types always point to a profile), profile_rotation_deg and profile_mirror. width/height are the box of the turned profile; changing them alone re-points the type to a profile of that section, unturned and unmirrored. Changing a component’s definition updates every type of that component, each keeping its own parameter values.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct TypeDuplicate

pub struct TypeDuplicate

Copy a type under a new name (default “ (copy)"); the given elements of the type switch to the copy.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct TypeDelete

pub struct TypeDelete

Delete a type that no element uses (the last type of a category is kept, except a title block: sheets on a deleted title block move to the first other one, or to none).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ComponentCreate

pub struct ComponentCreate

Create a component type: def holds its parameters and pieces, shaped like a component type’s params.def in type_get. A piece’s shape is a Box {x, y, z, width, depth, height}, a Cylinder {x, y, z, radius, height}, an Extrusion {points: [[x, y], …], z, height} (a plan outline extruded up), a Profile {plane: Plan, Front or Side, points: [{u, v, radius}, …], offset, depth} (lines and arcs drawn on a plane: u, v are x, y in plan, x, z from the front and y, z from the side; the plane stands at offset on the remaining axis and extrudes depth along it; a point’s optional radius makes the segment to the next point an arc, positive bulging outwards) or a Revolution {plane, points, offset, axis, angle} (the profile turned about the line u = axis of its plane). Every field is an expression over the parameters (meters, degrees). A piece with void: true is cut out of the solid pieces it overlaps; one with plan_only: true is a plan symbol (a door’s swing), drawn in plans and not a solid. A kind of Door or Window with an opening {width, height, sill, own_symbol, operation, door_operation} (expressions, then a window’s operation: Fixed, SideHungLeft, SideHungRight or DoubleSideHung, drawn as swings in plans and written as IFC panel properties, and a door’s door_operation: SingleSwingLeft (default), SingleSwingRight or DoubleDoor, one swing per leaf in plans and the IFC operation type; door_type_create makes the built-in ones) makes a door or window type, placed with door_create or window_create: it cuts that opening in its wall; its frame has x along the wall from the opening’s center, y across it (towards the side a door or window opens to), z up from the sill, and WallThickness is the wall’s thickness. connectors [{name, system: ColdWater, HotWater, Sanitary, Vent, Rainwater, Power or Lighting, x, y, z, direction: Down, Up, Front (-y), Back (+y), Left (-x) or Right (+x), diameter}] are where mep_connect joins pipes and conduits (a toilet’s inlet and outlet). With a kind in place of def the component starts from that kind’s own parameters and pieces, to be shaped in the component environment or with the component_* commands.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

fn starter_def

pub fn starter_def(kind: ComponentKind) -> Option<ComponentDef>

The definition a new component of kind starts from: the kind’s own parameters, named in the current language, and pieces sized by them. A generic component has no parameters (they are the user’s to add) and one fixed box, since a component needs a piece. None for the 2D kinds, which are made by title_block_create and detail_component_create.

cc_engine::commands::valve

crates/cc_engine/src/commands/valve.rs

Valves on pipes: inline accessories hosted by a pipe at a distance along its run (see cc_core::mep::Valve). A valve takes its pipe’s diameter and system, is a node of its network, and moves, is copied and is deleted with the pipe.

Items: parse_kind · new_valve_type · ValvePlace · ValveTypeCreate

fn parse_kind

pub(crate) fn parse_kind(name: &str) -> Result<ValveKind>

fn new_valve_type

pub fn new_valve_type(id: ElementTypeId, kind: ValveKind, material: String) -> ElementType

A valve type of kind, named after it.

struct ValvePlace

pub struct ValvePlace

Place a valve on a pipe, at point (the nearest point of the pipe in plan, within 0.5 m) or distance meters along the pipe from its start (default: its middle). type picks a valve type; else kind (gate, ball, check or globe) picks the first type of that kind, created when the project has none; else the first valve type (a gate valve type is created when there is none). The valve takes the pipe’s diameter and system and splits its network there; it moves, is copied and is deleted with the pipe.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct ValveTypeCreate

pub struct ValveTypeCreate

Create valve types, one per kind in kinds (gate, ball, check, globe; default: a gate valve), named after their kind (or name, for one kind), in material (default: the project’s first metal).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

cc_engine::commands::views

crates/cc_engine/src/commands/views.rs

Views and sheets: create, change, duplicate, delete, place on sheets.

Items: view_out · ViewCreate · ViewSet · apply_render · apply_shading · ViewDuplicate · ViewDelete · sheet_of · sheet · SheetPlaceView · SheetRemoveViewport

fn view_out

pub(crate) fn view_out(s: &Session, id: ViewId) -> Value

struct ViewCreate

pub struct ViewCreate

Create a view. kind is floor_plan or ceiling_plan (with level), section (with start, end and optional depth), elevation (with direction: north, south, east or west), structural_plan (with level: a formwork plan of the structure, tagged), plumbing_plan, electrical_plan, communications_plan and lightning_plan (with level: the pipes, the conduits and devices, the structured cabling, or the lightning protection, over the architecture, tagged), three_d, analytical (a 3D view of the analytical model), rebar (a 3D view of the reinforcement), legend (all types), drafting (a 2D view independent of the model, showing only the text, dimensions and imported drawings placed in it; 1:10 by default), schedule (with category), panel_diagram (with panel: the single-line diagram and load schedule of a distribution board; default the only board) or sheet (A3, ANSI B in imperial projects, numbered after the others, with the first title block type).

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

struct ViewSet

pub struct ViewSet

Change a view: name, scale, phase and phase filter, and its params as view_get shows them (merged: cut height, section depth, legend types, schedule fields, sort, filter and totals, sheet number and size, viewport positions…), the crop, the sun, the render settings and the shading.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

fn apply_render

pub(crate) fn apply_render(current: Option<&RenderSettings>, patch: &Value) -> Result<RenderSettings>

The render settings patch makes of current (the defaults when none): a merge patch over their serde form, refused when it names an unknown field or leaves a value out of range.

fn apply_shading

pub(crate) fn apply_shading(current: &ShadingSettings, patch: &Value) -> Result<ShadingSettings>

The shading patch makes of current: a merge patch over its serde form, refused when it names an unknown field or leaves a value out of range.

struct ViewDuplicate

pub struct ViewDuplicate

Copy a view (a copied sheet starts without viewports), in one undo step. With detailing, what is drawn in it comes along: detail lines, filled and masking regions, text notes, dimensions (still measuring the same elements), level marks, detail components and imported drawings; the result lists them in copied.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct ViewDelete

pub struct ViewDelete

Delete a view (and its viewports on sheets; dimensions drawn in it go too).

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

fn sheet_of

pub fn sheet_of(project: &Project, view: ViewId) -> Option<ViewId>

The sheet that shows view, if any.

fn sheet

pub(crate) fn sheet(p: &Project, r: &Ref) -> Result<ViewId>

struct SheetPlaceView

pub struct SheetPlaceView

Place a view on a sheet at center (paper millimeters; default left of center). A view can be on only one sheet; sheets cannot be placed.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

struct SheetRemoveViewport

pub struct SheetRemoveViewport

Remove a view from a sheet.

Traits: Debug, Deserialize, Serialize, JsonSchema, Command

Fields

cc_engine::commands::wall_framing

crates/cc_engine/src/commands/wall_framing.rs

Light steel and wood framing of walls (see cc_core::wall_framing): the host element and the catalog types its members get by default.

Items: FramingRows · framing_rows · new_wall_framing_type · WallFramingCreate · derived

struct FramingRows

pub struct FramingRows

The catalog rows a system’s members get by default: (series, designation).

Traits: Debug, Clone, Copy

Fields

fn framing_rows

pub fn framing_rows(system: FramingSystem) -> FramingRows

fn new_wall_framing_type

pub fn new_wall_framing_type(id: ElementTypeId) -> ElementType

The type a project gets with its first wall framing.

struct WallFramingCreate

pub struct WallFramingCreate

Frame straight walls in light steel or wood, one framing per wall. Studs stand every spacing from the wall start (plus one flush with each end) between a bottom track or plate and one top track (two plates for wood). Each door or window gets king and jack studs, a header, a sill (windows) and cripples. Blocking at mid-height is optional. The studs are columns and the rest are beams, all ordinary elements that the framing keeps in step with its parameters, its wall and the wall’s doors and windows (element_set on the framing regenerates them, keeping their ids). A member edited or deleted by hand is detached and left alone, and deleting the wall deletes its framing and members. The framing and its members follow the wall’s phases, design option and level. Default types come from the profile catalog, made when missing:

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

fn derived

pub(crate) fn derived(p: &cc_core::Project, f: &WallFraming, out: &mut serde_json::Map<String, Value>)

element_get’s derived values of a framing: its member ids by role kind, how many roles are detached, its wall’s length and whether the layout would pass the member limit, so it has no members (at_limit).

cc_engine::commands::wall_rebar

crates/cc_engine/src/commands/wall_rebar.rs

Wall reinforcement: horizontal (ring) and vertical bars near each face of a wall, and ties between the faces.

Items: ZoneArg · HorizontalBars · EndArg · VerticalBars · TieBars · WallRebarCreate

struct ZoneArg

pub struct ZoneArg

The spacing of horizontal bars up to a height.

Traits: Debug, Clone, Copy, Deserialize, Serialize, JsonSchema

Fields

struct HorizontalBars

pub struct HorizontalBars

A wall’s horizontal bars (ring bars in an arc wall).

Traits: Debug, Clone, Deserialize, Serialize, JsonSchema, Default

Fields

struct EndArg

pub struct EndArg

How an end of a vertical bar is bent.

Traits: Debug, Clone, Copy, Deserialize, Serialize, JsonSchema, Default

Fields

struct VerticalBars

pub struct VerticalBars

A wall’s vertical bars.

Traits: Debug, Clone, Deserialize, Serialize, JsonSchema, Default

Fields

struct TieBars

pub struct TieBars

Ties between the two faces of a wall.

Traits: Debug, Clone, Deserialize, Serialize, JsonSchema, Default

Fields

struct WallRebarCreate

pub struct WallRebarCreate

Reinforce walls, straight or arc: horizontal bars up the wall (ring bars in an arc wall, each as long as the arc at its own radius) and vertical bars along it near each face, and ties between the faces. With none of the three given, horizontal and vertical bars every 15 cm on both faces. Bars lie cover inside the faces of the wall’s structure (its core layers), stop at its ends and around its doors and windows, and those longer than max_length are lap spliced, neighbouring splices staggered. Horizontal bars may close up towards the base (zones); vertical bars may cover part of the height, start between those of another set (offset) and have bent ends. Each call adds sets, so a second call makes the additional bars of a zone. One set per family and face, in one undo step; the bars follow the wall.

Traits: Debug, Deserialize, Serialize, JsonSchema, Default, Command

Fields

cc_engine::defaults

crates/cc_engine/src/defaults.rs

Defaults applied when elements are created (shared by the drawing tools).

Items: default_top · default_roof_base · pipe_offset · drain_slope · conduit_offset · tray_offset · device_height · next_number · walls_loop · walls_loop_at · default_wall_face

fn default_top

pub fn default_top(project: &Project, level: LevelId) -> WallTop

Top constraint for new columns and stairs: the level above, if any.

fn default_roof_base

pub fn default_roof_base(project: &Project, level: LevelId) -> f64

Default roof base: the top of the tallest wall on the level (else a story: 3 m, 10’-0” in imperial projects).

fn pipe_offset

pub fn pipe_offset(project: &Project, kind: Option<cc_core::SystemKind>) -> f64

Elevation of a new pipe’s center line above its level: supply pipes run in the walls (0.6 m up, 2’-0” in imperial projects), drains under the floor (0.3 m down, 1’-0”).

fn drain_slope

pub fn drain_slope(project: &Project, diameter: f64) -> f64

Minimum fall of a horizontal drain of outside diameter, as in common drainage practice: 2 % up to 75 mm, 1 % from 100 mm (in imperial projects 1/4” per foot up to 3”, 1/8” per foot from 4”).

fn conduit_offset

pub fn conduit_offset(project: &Project, level: LevelId) -> f64

Elevation of a new conduit above its level: in the slab above (the level height, else 2.80 m; 9’-0” in imperial projects).

fn tray_offset

pub fn tray_offset(project: &Project, level: LevelId) -> f64

Elevation of a new cable tray’s center line above its level: under the slab above, clear of it by 0.3 m (1’-0” in imperial projects).

fn device_height

pub fn device_height(project: &Project, level: LevelId, device: cc_core::DeviceKind) -> f64

Usual mounting height of an electrical device above its level (lights: the ceiling, at the level height); round inches in imperial projects (see cc_core::Defaults::devices).

fn next_number

pub fn next_number<'a>(existing: impl Iterator<Item = &'a str>) -> String

Next free number among existing names (1 when none is numeric).

fn walls_loop

pub fn walls_loop(project: &Project, level: LevelId, outward: f64) -> Option<Vec<DVec2>>

Closed loop around the walls of level, offset to the exterior faces (outward > 0) or interior faces (outward < 0): the outer boundary of their location lines, so interior walls (even those meeting its corners) and walls hanging off it are left out; with several separate loops, the largest. The offset is half the thickest wall on the boundary.

fn walls_loop_at

pub fn walls_loop_at(project: &Project, level: LevelId, face: LocationLine) -> Option<Vec<DVec2>>

Closed loop around the walls of level along one face of each wall on it (issue #311): the outer boundary of their location lines, as walls_loop finds it, with every side moved to that face of its own wall, whatever its thickness, layers and location line. Exterior is the side of a wall outside the loop and interior the side inside it (not the wall’s own exterior side, which depends on how it was drawn): the finish faces are the wall’s two faces, the core faces those of its structure layers (the finish faces of a wall with no other layer). Where walls in a line differ, the loop steps from one face to the next.

fn default_wall_face

pub fn default_wall_face(category: cc_core::Category) -> LocationLine

The face a loop of walls follows when none is asked for: the outside faces, or the inside ones for ceilings.

cc_engine::dimensions

crates/cc_engine/src/dimensions.rs

Dimensions that follow and drive the model. Placing: each end of a new dimension follows the element (or, in elevations and sections, the level line) whose linework in the view passes through it. Editing the value: the moving end’s element moves — elements crossing the measured direction translate; walls, beams and grids along it stretch their nearest end. In elevations and sections a dimension between level lines raises or lowers the upper level.

Items: point_on_segment · associate · set_value

fn point_on_segment

pub fn point_on_segment(a: DVec2, b: DVec2, p: DVec2, tol: f64) -> bool

fn associate

pub fn associate(project: &Project, drawing: &Drawing2D, dim: &Dimension) -> Dimension

References for the ends of a dimension being placed: each end follows the element whose linework passes through it, preferring lines across the measured direction (the faces being measured) and, among those, walls, columns and grids. Radial and diameter dimensions follow the element of their arc; angular ones the elements along each measured line.

fn set_value

pub fn set_value(s: &mut Session, id: ElementId, value: f64) -> Result<()>

Give dimension id the measured value (meters, or radians for angles), moving what its moving end touches (see the module docs). One undo step.

cc_engine::error

crates/cc_engine/src/error.rs

Items: ErrorCode · EngineError · Result

enum ErrorCode

pub enum ErrorCode

What kind of failure a command met.

Traits: Debug, Clone, Copy, PartialEq, Eq, Serialize

Variants

struct EngineError

pub struct EngineError

A command failure: a code for programs and a message for people.

Traits: Debug, Clone, PartialEq, Eq, Serialize, fmt::Display, std::error::Error, From<cc_core::PersistError>, From<cc_core::component_file::ComponentFileError>, From<cc_ifc::ImportError>, From<std::io::Error>, From<cc_core::wall_ops::EditError>

Fields

Methods

type alias Result

pub type Result<T> = std::result::Result<T, EngineError>

cc_engine::extension

crates/cc_engine/src/extension.rs

Commands added at run time (plugins). An Extension set on a Session lists its commands next to the built-in catalog and runs them when Session::execute is asked for one of their names, so plugin commands reach the GUI, the command line and the MCP server like the built-in ones. A command of an extension is one undo step however many commands it runs, and a failed one leaves nothing behind.

Items: SEPARATOR · Extension · is_extension_name

const SEPARATOR

pub const SEPARATOR: &str

Separates an extension’s id from its command’s name in the full name (<id>__<name>). Built-in names never contain it.

trait Extension

pub trait Extension

A source of commands beyond the built-in catalog.

Implemented by (1): cc_plugins::plugin::PluginHost

Required and provided items

fn is_extension_name

pub fn is_extension_name(name: &str) -> bool

Whether name could be the full name of an extension command.

cc_engine::gltf

crates/cc_engine/src/gltf.rs

glTF 2.0 models (.glb, or .gltf with its buffers embedded as data URIs or in files next to it) as component types: each node of the scene’s root, with everything below it, becomes a type of fixed mesh pieces, one per material, placed by an element at the center of its footprint and the bottom of its extent. glTF lengths are meters and its Y axis points up, so nothing needs asking. Materials take their base color and its texture (a picture in a buffer, a data URI or a file next to the model), repeating as the texture coordinates say (see crate::import_material), and their opacity when blended. Files are hostile input: every index, offset and count is checked, the node graph is walked with a depth limit and a visited set, and the sizes read are bounded. Compressed meshes (Draco, meshopt) are not read.

Items: MAX_BYTES · GltfError · convert

const MAX_BYTES

pub const MAX_BYTES: u64

Largest file read, in bytes (also each external buffer).

enum GltfError

pub enum GltfError

Traits: Debug, Clone, PartialEq

Variants

fn convert

pub fn convert(bytes: &[u8], dir: Option<&Path>, name: &str, merge: bool) -> Result<Converted, GltfError>

Convert the glTF file bytes (external buffers looked for in dir) to types and placements; merge makes the whole scene one type at the file’s origin, named name.

cc_engine::graph

crates/cc_engine/src/graph/mod.rs

Visual programming graphs: nodes joined by wires, evaluated as a dataflow over the engine’s commands. Every command of the catalog is a node (its parameters are the inputs, its result the outputs), next to built-in nodes (inputs, math, lists, geometry as JSON values) and Lua nodes (pure functions run in the sandbox). A node given lists where it takes single values runs once per item (lace). Elements an edit node creates are bound to its call (cc_core::graph_binding), so running the graph again changes them in place, makes the new ones and deletes the ones no longer made (eval). A graph is a .ccgraph file (JSON, Graph); files are hostile input: Graph::from_json bounds sizes, drops dangling wires and refuses cycles.

Re-exports

Items: GRAPH_FORMAT · MAX_NODES · MAX_WIRES · MAX_TEXT · MAX_FILE · MAX_LIST · MAX_CALLS · RunMode · NodeKind · Node · Wire · Note · Group · Graph · Repairs

const GRAPH_FORMAT

pub const GRAPH_FORMAT: u32

Current .ccgraph format version.

const MAX_NODES

pub const MAX_NODES: usize

Most nodes in a graph.

const MAX_WIRES

pub const MAX_WIRES: usize

Most wires in a graph.

const MAX_TEXT

pub const MAX_TEXT: usize

Largest text in a node (Lua code, notes), in bytes.

const MAX_FILE

pub const MAX_FILE: usize

Largest .ccgraph file, in bytes.

const MAX_LIST

pub const MAX_LIST: usize

Most items a list value may hold.

const MAX_CALLS

pub const MAX_CALLS: usize

Most node calls in one run.

enum RunMode

pub enum RunMode

When a graph runs.

Traits: Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize

Variants

enum NodeKind

pub enum NodeKind

What a node is.

Traits: Debug, Clone, PartialEq, Serialize, Deserialize

Variants

struct Node

pub struct Node

A box of the graph.

Traits: Debug, Clone, PartialEq, Serialize, Deserialize

Fields

Methods

struct Wire

pub struct Wire

An output of one node joined to an input of another.

Traits: Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize

Fields

struct Note

pub struct Note

A text on the canvas.

Traits: Debug, Clone, PartialEq, Serialize, Deserialize

Fields

struct Group

pub struct Group

Nodes framed together under a title.

Traits: Debug, Clone, PartialEq, Serialize, Deserialize

Fields

struct Graph

pub struct Graph

A visual programming graph (.ccgraph).

Traits: Debug, Clone, PartialEq, Serialize, Deserialize, Default

Fields

Methods

struct Repairs

pub struct Repairs

What reading a graph file fixed.

Traits: Debug, Clone, Default, PartialEq, Eq

Fields

Methods

cc_engine::graph::builtin

crates/cc_engine/src/graph/builtin.rs

The built-in nodes: input values, math, lists, geometry (as the JSON values commands take: points [x, y] and curves) and element parameters.

Items: Outputs · PureFn · SessionFn · Eval · Builtin · GROUPS · catalog · find · number · point · at_path

type alias Outputs

pub type Outputs = Result<Vec<Value>, String>

The outputs of one call, or why it failed.

type alias PureFn

pub type PureFn = fn(&[Option<Value>], &Node) -> Outputs

A node that reads only its inputs.

type alias SessionFn

pub type SessionFn = fn(&mut Session, &[Option<Value>], &Node) -> Outputs

A node that reads or changes the model.

enum Eval

pub enum Eval

What running a built-in node needs.

Traits: Clone, Copy

Variants

struct Builtin

pub struct Builtin

A built-in node’s definition.

Traits: Clone

Fields

const GROUPS

pub const GROUPS: [&str; 7]

Groups of built-in nodes, in the order the node search shows them.

fn catalog

pub fn catalog() -> Vec<Builtin>

Every built-in node.

fn find

pub fn find(name: &str) -> Option<Builtin>

One built-in node by name.

fn number

pub(crate) fn number(v: &Option<Value>) -> Result<f64, String>

fn point

pub(crate) fn point(v: &Option<Value>) -> Result<[f64; 2], String>

fn at_path

pub(crate) fn at_path<'a>(mut v: &'a Value, path: &str) -> Option<&'a Value>

The value at a dotted path (params.height, ids.0).

cc_engine::graph::eval

crates/cc_engine/src/graph/eval.rs

Running a graph: nodes in dataflow order, lists mapped over, the elements edit nodes create bound to their calls. A run is one undo step. For each call of a command that creates elements, the elements made by the same call in an earlier run (the same node and lacing path) take the new content and keep their ids, persistent ids, marks, comments and phases, so what refers to them stays; new calls make new elements, and after the run the elements of calls no longer made are deleted. Running again with nothing changed changes nothing.

Items: DefKind · NodeDef · command_def · node_def · NodeResult · RunReport · Evaluator · is_identifier

enum DefKind

pub enum DefKind

What a node is, resolved against the session’s catalog.

Traits: Clone

Variants

struct NodeDef

pub struct NodeDef

A node’s ports and what running it does.

Traits: Clone

Fields

Methods

fn command_def

pub fn command_def(info: &crate::CommandInfo) -> NodeDef

The ports of a command, from its catalog entry.

fn node_def

pub fn node_def(session: &Session, graph: &Graph, node: &Node) -> NodeDef

The definition of node in graph, against session’s commands.

struct NodeResult

pub struct NodeResult

How one node fared in a run.

Traits: Debug, Clone, Default, Serialize

Fields

struct RunReport

pub struct RunReport

What a run did.

Traits: Debug, Clone, Default, Serialize

Fields

struct Evaluator

pub struct Evaluator

Runs graphs; keeps each node’s last outputs, so a run after a change of the graph alone re-runs only the nodes it affects.

Traits: Default

Some fields are private.

Methods

fn is_identifier

pub fn is_identifier(name: &str) -> bool

Whether name can be a Lua local’s name.

cc_engine::graph::lace

crates/cc_engine/src/graph/lace.rs

Lacing: a node given lists where it takes single values runs once per item, and its outputs become lists of the same shape.

Items: MAX_LEVELS · Lacing · Arg · map

const MAX_LEVELS

pub const MAX_LEVELS: usize

Deepest list nesting a node maps over.

enum Lacing

pub enum Lacing

How the items of several lists pair up.

Traits: Debug, Clone, Copy, Default, PartialEq, Eq, Serialize, Deserialize, JsonSchema

Variants

struct Arg

pub struct Arg

An input of one mapping: its value and how many list levels it runs past what its port takes.

Traits: Debug, Clone

Fields

fn map

pub fn map(args: Vec<Arg>, lacing: Lacing, outputs: usize, budget: &mut usize, call: &mut Call) -> Result<Vec<Value>, String>

Run call once per combination of items and gather its outputs (outputs of them per call) into lists. call gets the values and the path of indices of the call; budget counts calls down.

cc_engine::graph::ports

crates/cc_engine/src/graph/ports.rs

Ports of graph nodes: their types, read from command schemas, and how deep a value runs past what a port takes (the lists a node maps over).

Items: PortType · Port · type_of_schema · depth

enum PortType

pub enum PortType

What a port carries. Values are JSON; the type says how they read.

Traits: Debug, Clone, PartialEq, Eq, Serialize

Variants

Methods

struct Port

pub struct Port

An input or output of a node.

Traits: Debug, Clone, PartialEq, Serialize

Fields

Methods

fn type_of_schema

pub fn type_of_schema(name: &str, schema: &Value) -> PortType

The type of a parameter from its JSON schema (draft 7, inlined).

fn depth

pub fn depth(value: &Value) -> usize

How deep value runs in lists (an empty list counts one level).

cc_engine::i18n

crates/cc_engine/src/i18n.rs

Localization: a Fluent-compatible subset (key = value messages with { $var } placeholders). All languages are embedded at build time and the active one can be switched at runtime.

Items: Language · language · set_language · parse_messages · try_tr · tr · tr_args · format_date · today · civil_from_days · t

enum Language

pub enum Language

Traits: Debug, Clone, Copy, PartialEq, Eq

Variants

Methods

fn language

pub fn language() -> Language

fn set_language

pub fn set_language(lang: Language)

Switch the active language (also sets the number format).

fn parse_messages

pub fn parse_messages(source: &str) -> HashMap<String, String>

Parse key = value lines; # starts a comment line.

fn try_tr

pub fn try_tr(key: &str) -> Option<String>

Translate key if the active language defines it.

fn tr

pub fn tr(key: &str) -> String

Translate key; falls back to Portuguese, then to the key itself so gaps are visible.

fn tr_args

pub fn tr_args(key: &str, args: &[(&str, String)]) -> String

Translate key, substituting { $name } placeholders.

fn format_date

pub fn format_date(y: i32, m: u32, d: u32) -> String

A date written the way the current language writes it.

fn today

pub fn today() -> (i32, u32, u32)

Today’s date (UTC), from the system clock.

fn civil_from_days

pub fn civil_from_days(z: i64) -> (i32, u32, u32)

Year, month, day of a count of days since 1970-01-01 (proleptic Gregorian).

macro t

macro_rules! t

t!("key") or t!("key", "name" => value, ...).

cc_engine::import_material

crates/cc_engine/src/import_material.rs

Materials of imported models (SketchUp, OBJ, glTF): name, color, opacity and texture. A texture’s picture becomes the material’s appearance texture, repeating every so many meters: the model’s own texture coordinates cannot be kept (textures are laid on each face’s plane), so the repeat comes from them — the meters one unit of the coordinates spans on the faces, see UvScale. The material’s color is its color times the picture’s average, so it looks right where textures are not drawn.

Items: ImportedMaterial · texture_image · to_linear · to_srgb · average_color · textured · UvScale

struct ImportedMaterial

pub struct ImportedMaterial

A material a model uses.

Traits: Debug, Clone, PartialEq

Fields

Methods

fn texture_image

pub fn texture_image(bytes: Vec<u8>) -> Option<RasterImage>

An image file usable as a texture (a picture format this reads, within the texture limits).

fn to_linear

pub fn to_linear(c: u8) -> f64

sRGB byte to linear 0..1.

fn to_srgb

pub fn to_srgb(v: f64) -> u8

Linear 0..1 to an sRGB byte (200 when not a number).

fn average_color

pub fn average_color(image: &RasterImage) -> Option<[f64; 3]>

The average color of a picture (linear, weighted by alpha), or None when it cannot be decoded or is wholly clear.

fn textured

pub fn textured(name: String, factor: [f64; 3], opacity: f64, image: Option<RasterImage>, repeat: Option<(f64, f64)>) -> ImportedMaterial

A material with color factor (linear) times the average of image, which becomes its texture repeating every repeat meters (1 m when the model gives no texture coordinates).

struct UvScale

pub struct UvScale

The meters a unit of texture coordinates spans on the faces, along u and v, averaged over triangles by their area.

Traits: Debug, Clone, Copy, Default

Some fields are private.

Methods

cc_engine::obj

crates/cc_engine/src/obj.rs

Wavefront OBJ models as component types: each object (o, or g in a file without objects) becomes a type of fixed mesh pieces, one per material of its .mtl library, placed by an element at the center of its footprint and the bottom of its extent. OBJ has no units nor a fixed up axis, so the caller gives both. Materials take Kd, d/Tr and the picture of map_Kd (by file name next to the model), its repeat from the faces’ texture coordinates (vt, see crate::import_material). Files are hostile input: unknown statements are skipped, faces with a bad index are dropped, and the sizes read are bounded.

Items: MAX_BYTES · Frame · ObjError · Mtl · read_mtl · convert

const MAX_BYTES

pub const MAX_BYTES: u64

Largest .obj file read, in bytes.

struct Frame

pub struct Frame

How the file’s coordinates map to the model’s.

Traits: Debug, Clone, Copy

Fields

enum ObjError

pub enum ObjError

Traits: Debug

Variants

struct Mtl

pub struct Mtl

A material of a library: diffuse color (Kd, kept linear 0 to 1), opacity (d, or Tr = 1 - d) and diffuse picture (map_Kd, a file name).

Traits: Debug, Clone, PartialEq, Default

Fields

fn read_mtl

pub fn read_mtl(text: &str) -> HashMap<String, Mtl>

The materials of a material library.

fn convert

pub fn convert(text: &str, dir: Option<&Path>, frame: Frame, name: &str, merge: bool) -> Result<Converted, ObjError>

Convert the OBJ text (its material libraries looked for in dir) to types and placements; merge makes the whole file one type at the origin of the file, named name.

cc_engine::osm

crates/cc_engine/src/osm.rs

OpenStreetMap data around the project site: the JSON an Overpass query returns, turned into a site drawing (buildings, streets, paths, railways, water, green areas, trees and street names, in project coordinates) and building footprints with heights for context masses; plus the answers of the address search (Nominatim) and of an elevation service. Everything here is pure: the program downloads, the engine reads. Map data is © OpenStreetMap contributors, under the ODbL.

Items: MAX_JSON · MAX_ELEMENTS · ATTRIBUTION · Layer · Building · Options · Site · read · overpass_query · Place · read_places · read_reverse · read_elevation

const MAX_JSON

pub const MAX_JSON: usize

Largest Overpass answer read, bytes.

const MAX_ELEMENTS

pub const MAX_ELEMENTS: usize

Most OSM elements read from one answer.

const ATTRIBUTION

pub const ATTRIBUTION: &str

Attribution required with any use of OpenStreetMap data.

enum Layer

pub enum Layer

The layers of a site drawing, in the order they are listed.

Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord

Variants

Methods

struct Building

pub struct Building

A building footprint for a context mass.

Traits: Debug, Clone, PartialEq

Fields

struct Options

pub struct Options

How map data becomes a site drawing and masses.

Traits: Debug, Clone, Copy, PartialEq, Default

Fields

struct Site

pub struct Site

A site drawing and the buildings for masses.

Traits: Debug, Clone, Default

Fields

fn read

pub fn read(json: &str, site: &SiteLocation, opts: &Options) -> Result<Site, String>

Read an Overpass answer ([out:json], with out geom or with the ways’ nodes) into a site drawing in project coordinates around site.

fn overpass_query

pub fn overpass_query(site: &SiteLocation, extent: f64) -> String

The Overpass QL query for the map data of the square of half side extent meters around site (its bounding box in latitude and longitude, widened to hold the square under any north angle).

struct Place

pub struct Place

A place the address search found.

Traits: Debug, Clone, PartialEq

Fields

fn read_places

pub fn read_places(json: &str) -> Result<Vec<Place>, String>

The places of a Nominatim search answer (format=jsonv2, addressdetails=1).

fn read_reverse

pub fn read_reverse(json: &str) -> Result<Option<Place>, String>

The place of a Nominatim reverse answer (format=jsonv2), if any.

fn read_elevation

pub fn read_elevation(json: &str) -> Result<f64, String>

The first elevation of an elevation answer ({"elevation": [12.0]}), meters.

cc_engine::reference

crates/cc_engine/src/reference.rs

The command reference (docs/commands.md), generated from the catalog so it always matches the engine: ccad reference > docs/commands.md.

Items: markdown

fn markdown

pub fn markdown() -> String

The Markdown reference of every command.

cc_engine::refs

crates/cc_engine/src/refs.rs

Naming model objects in commands: levels, types, views, materials and systems by numeric id or by name; elements by id.

Items: Ref · ScaleArg · Point · point · points · finite · positive · level · browser_scheme · level_or_first · element_type · type_of · view · material · system · element · elements · category · view_category · category_name · filter · template · phase · option_set · design_option · line_style · fill_pattern · profile · phase_filter · nullable · detail_level · visual_style

enum Ref

pub enum Ref

A level, type, view or material: its numeric id or its name.

Traits: Debug, Clone, PartialEq, Deserialize, Serialize, JsonSchema, Default

Variants

enum ScaleArg

pub enum ScaleArg

A drawing scale: the denominator N of 1:N (48), or text read by cc_core::scale::parse ("1:48", "1/4\" = 1'-0\"").

Traits: Debug, Clone, PartialEq, Deserialize, Serialize, JsonSchema, From<u32>

Variants

Methods

type alias Point

pub type Point = [f64; 2]

A point in plan, [x, y] in meters.

fn point

pub fn point(p: Point) -> Result<DVec2>

fn points

pub fn points(ps: &[Point]) -> Result<Vec<DVec2>>

fn finite

pub fn finite(v: f64, what: &str) -> Result<f64>

A finite number.

fn positive

pub fn positive(v: f64, what: &str) -> Result<f64>

A positive finite number.

fn level

pub fn level(p: &Project, r: &Ref) -> Result<LevelId>

fn browser_scheme

pub fn browser_scheme(p: &Project, r: &Ref) -> Result<cc_core::BrowserSchemeId>

A project browser organization scheme.

fn level_or_first

pub fn level_or_first(p: &Project, r: Option<&Ref>) -> Result<LevelId>

The given level, else the lowest one.

fn element_type

pub fn element_type(p: &Project, r: &Ref) -> Result<ElementTypeId>

fn type_of

pub fn type_of(p: &Project, category: Category, r: Option<&Ref>) -> Result<ElementTypeId>

A type of category: the given one (checked), else the category’s default.

fn view

pub fn view(p: &Project, r: &Ref) -> Result<ViewId>

fn material

pub fn material(p: &Project, r: &Ref) -> Result<String>

A material’s name (materials are keyed by name; an index also works).

fn system

pub fn system(p: &Project, r: &Ref) -> Result<cc_core::SystemId>

A plumbing system or electrical circuit by id, name, code or, when it is the only one of its kind, kind (cold_water, sanitary…).

fn element

pub fn element(p: &Project, id: u64) -> Result<ElementId>

fn elements

pub fn elements(p: &Project, ids: &[u64]) -> Result<Vec<ElementId>>

fn category

pub fn category(name: &str) -> Result<Category>

A category by its English name (wall, door…, titleblock), case-insensitive.

fn view_category

pub fn view_category(name: &str) -> Result<Category>

A category that views draw and filter (not title blocks), by name.

fn category_name

pub fn category_name(c: Category) -> String

fn filter

pub fn filter(p: &Project, r: &Ref) -> Result<cc_core::FilterId>

A view filter by id or name.

fn template

pub fn template(p: &Project, r: &Ref) -> Result<cc_core::TemplateId>

A view template by id or name.

fn phase

pub fn phase(p: &Project, r: &Ref) -> Result<cc_core::PhaseId>

A construction phase by id or name.

fn option_set

pub fn option_set(p: &Project, r: &Ref) -> Result<cc_core::OptionSetId>

A design option set by id or name.

fn design_option

pub fn design_option(p: &Project, r: &Ref) -> Result<cc_core::OptionId>

A design option by id, by name (unique in the project), or as "Set: Option".

fn line_style

pub fn line_style(p: &Project, r: &Ref) -> Result<cc_core::LineStyleId>

One of the project’s line styles by id or name.

fn fill_pattern

pub fn fill_pattern(p: &Project, r: &Ref) -> Result<cc_core::FillPatternId>

A custom fill pattern by id or name.

fn profile

pub fn profile(p: &Project, r: &Ref) -> Result<cc_core::ProfileId>

A structural profile by id or name.

fn phase_filter

pub fn phase_filter(p: &Project, r: &Ref) -> Result<cc_core::PhaseFilterId>

A phase filter by id or name.

fn nullable

pub fn nullable<'de, D, T>(d: D) -> std::result::Result<Option<Option<T>>, D::Error> where D: serde::Deserializer<'de>, T: Deserialize<'de>

Deserialize an optional field that may also be null: absent gives None, null gives Some(None) (use with #[serde(default)]).

fn detail_level

pub fn detail_level(name: &str) -> Result<cc_core::DetailLevel>

A detail level by name: coarse, medium or fine.

fn visual_style

pub fn visual_style(name: &str) -> Result<Option<cc_core::VisualStyle>>

A visual style by name (wireframe, hidden_line, shaded, consistent_colors, textures), or default for the usual style of the view’s kind (None).

cc_engine::registry

crates/cc_engine/src/registry.rs

Items: CommandKind · Command · CommandInfo · describe

enum CommandKind

pub enum CommandKind

What a command does to the session.

Traits: Debug, Clone, Copy, PartialEq, Eq, Serialize

Variants

trait Command

pub trait Command: DeserializeOwned + JsonSchema

A command: typed parameters and what running it does. The type’s doc comment is its description; its fields’ doc comments describe the parameters in the generated schema.

Implemented by (344): cc_engine::commands::analytical::AnalyticalExport, cc_engine::commands::analytical::AnalyticalModelGet, cc_engine::commands::annotate::DimensionChainCreate, cc_engine::commands::annotate::DimensionCreate, cc_engine::commands::annotate::DimensionOrdinateCreate, cc_engine::commands::annotate::DimensionSetValue, cc_engine::commands::annotate::TagMove, cc_engine::commands::annotate::TextAddLeader, cc_engine::commands::annotate::TextCreate, cc_engine::commands::annotate::TextRemoveLeader, cc_engine::commands::bar_marks::BarLengthCheck, cc_engine::commands::bar_marks::BarMarkingSet, cc_engine::commands::bar_marks::BarMarksList, cc_engine::commands::bar_marks::BarMarksRenumber, cc_engine::commands::bar_marks::BarMarksUpdate, cc_engine::commands::bar_marks::BarTagCreate, cc_engine::commands::bar_marks::BendingScheduleCreate, cc_engine::commands::bracing::BracingCreate, cc_engine::commands::browser::BrowserSchemeCreate, cc_engine::commands::browser::BrowserSchemeDelete, cc_engine::commands::browser::BrowserSchemeSet, cc_engine::commands::browser::BrowserSchemeUse, cc_engine::commands::browser::BrowserSchemesList, cc_engine::commands::browser::BrowserTree, cc_engine::commands::cable_tray::CableTrayCreate, cc_engine::commands::cable_tray::CableTrayTypeCreate, cc_engine::commands::cabling::CablingList, cc_engine::commands::cabling::DataOutletPlace, cc_engine::commands::cabling::RackPlace, cc_engine::commands::cad::CadImportFile, cc_engine::commands::cad::CadLayersSet, cc_engine::commands::cad::CadLayers, cc_engine::commands::cad::ImageImport, cc_engine::commands::cad_explode::CadExplode, cc_engine::commands::callout::CalloutCreate, cc_engine::commands::callout::CalloutRemove, cc_engine::commands::callout::CalloutsList, cc_engine::commands::component::ComponentDimensionAdd, cc_engine::commands::component::ComponentDimensionDelete, cc_engine::commands::component::ComponentDimensionSet, cc_engine::commands::component::ComponentEqualAdd, cc_engine::commands::component::ComponentEqualDelete, cc_engine::commands::component::ComponentGet, cc_engine::commands::component::ComponentParamAdd, cc_engine::commands::component::ComponentParamDelete, cc_engine::commands::component::ComponentParamSet, cc_engine::commands::component::ComponentRefLineAdd, cc_engine::commands::component::ComponentRefLineDelete, cc_engine::commands::component::ComponentRefPlaneAdd, cc_engine::commands::component::ComponentRefPlaneDelete, cc_engine::commands::component::ComponentRefPlaneSet, cc_engine::commands::component_connector::ComponentConnectorAdd, cc_engine::commands::component_connector::ComponentConnectorDelete, cc_engine::commands::component_connector::ComponentConnectorSet, cc_engine::commands::component_piece::ComponentPieceAdd, cc_engine::commands::component_piece::ComponentPieceDelete, cc_engine::commands::component_piece::ComponentPieceSet, cc_engine::commands::component_script::ComponentHotspotMove, cc_engine::commands::component_script::ComponentParamsGet, cc_engine::commands::component_script::ComponentParamsSet, cc_engine::commands::component_script::ComponentScriptSet, cc_engine::commands::connection::ConnectionsCreate, cc_engine::commands::create::BeamCreate, cc_engine::commands::create::CeilingCreate, cc_engine::commands::create::ColumnCreate, cc_engine::commands::create::ComponentPlace, cc_engine::commands::create::DoorCreate, cc_engine::commands::create::FloorCreate, cc_engine::commands::create::FloorOpeningAdd, cc_engine::commands::create::FloorOpeningRemove, cc_engine::commands::create::GridCreate, cc_engine::commands::create::RailingCreate, cc_engine::commands::create::RoofCreate, cc_engine::commands::create::RoofEdgeSet, cc_engine::commands::create::RoofOpeningRemove, cc_engine::commands::create::RoomCreate, cc_engine::commands::create::WallCreate, cc_engine::commands::create::WindowCreate, cc_engine::commands::curtain::CurtainGet, cc_engine::commands::curtain::CurtainGridSet, cc_engine::commands::curtain::CurtainPanelSet, cc_engine::commands::curtain::CurtainTypeCreate, cc_engine::commands::design_options::ElementsOptionSet, cc_engine::commands::design_options::OptionAcceptPrimary, cc_engine::commands::design_options::OptionActiveSet, cc_engine::commands::design_options::OptionCreate, cc_engine::commands::design_options::OptionDelete, cc_engine::commands::design_options::OptionSetCreate, cc_engine::commands::design_options::OptionSetDelete, cc_engine::commands::design_options::OptionSetProps, cc_engine::commands::design_options::OptionSetRename, cc_engine::commands::design_options::OptionsList, cc_engine::commands::design_options::ViewOptionsSet, cc_engine::commands::detail::DetailLineCreate, cc_engine::commands::detail_component::DetailComponentCreate, cc_engine::commands::detail_component::DetailComponentPlace, cc_engine::commands::devices::DeviceTypeCreate, cc_engine::commands::doors::DoorTypeCreate, cc_engine::commands::edit::ElementSet, cc_engine::commands::edit::ElementsSetType, cc_engine::commands::edit::ElementsSet, cc_engine::commands::fill_patterns::FillPatternCreate, cc_engine::commands::fill_patterns::FillPatternDelete, cc_engine::commands::fill_patterns::FillPatternDuplicate, cc_engine::commands::fill_patterns::FillPatternExport, cc_engine::commands::fill_patterns::FillPatternGet, cc_engine::commands::fill_patterns::FillPatternImport, cc_engine::commands::fill_patterns::FillPatternSet, cc_engine::commands::fill_patterns::FillPatternsList, cc_engine::commands::foundation::FootingCreate, cc_engine::commands::foundation::FootingsUnderColumns, cc_engine::commands::foundation::FoundationSlabCreate, cc_engine::commands::foundation::StripFootingCreate, cc_engine::commands::foundation::StripFootingsUnderWalls, cc_engine::commands::framing::BraceCreate, cc_engine::commands::framing::BracesBetweenColumns, cc_engine::commands::framing::TrussCreate, cc_engine::commands::graph::GraphCheck, cc_engine::commands::graph::GraphElements, cc_engine::commands::graph::GraphNodes, cc_engine::commands::graph::GraphRelease, cc_engine::commands::graph::GraphRun, cc_engine::commands::graphics::ElementHideInView, cc_engine::commands::graphics::ElementOverrideSet, cc_engine::commands::graphics::FilterCreate, cc_engine::commands::graphics::FilterDelete, cc_engine::commands::graphics::FilterElements, cc_engine::commands::graphics::FilterSet, cc_engine::commands::graphics::FiltersList, cc_engine::commands::graphics::TemplateCreate, cc_engine::commands::graphics::TemplateDelete, cc_engine::commands::graphics::TemplateSet, cc_engine::commands::graphics::TemplatesList, cc_engine::commands::graphics::ViewFilterAdd, cc_engine::commands::graphics::ViewFilterMove, cc_engine::commands::graphics::ViewFilterRemove, cc_engine::commands::graphics::ViewFilterSet, cc_engine::commands::graphics::ViewGraphicsGet, cc_engine::commands::graphics::ViewGraphicsSet, cc_engine::commands::graphics::ViewTemplateApply, cc_engine::commands::graphics::ViewTemplateAssign, cc_engine::commands::graphics::ViewTemporaryApply, cc_engine::commands::graphics::ViewTemporary, cc_engine::commands::grid_frame::GridFrameCreate, cc_engine::commands::io::ComponentLibraryList, cc_engine::commands::io::ComponentLoad, cc_engine::commands::io::ComponentSave, cc_engine::commands::io::GltfImport, cc_engine::commands::io::IfcExport, cc_engine::commands::io::IfcImport, cc_engine::commands::io::ObjImport, cc_engine::commands::io::ScheduleExportCsv, cc_engine::commands::io::SheetExport, cc_engine::commands::io::SkpComponentLoad, cc_engine::commands::io::SkpImport, cc_engine::commands::io::ViewExport, cc_engine::commands::level_mark::LevelMarkCreate, cc_engine::commands::level_mark::LevelMarkTypeCreate, cc_engine::commands::levels::LevelCreate, cc_engine::commands::levels::LevelDelete, cc_engine::commands::levels::LevelSet, cc_engine::commands::lightning::AirTerminalPlace, cc_engine::commands::lightning::EarthElectrodePlace, cc_engine::commands::lightning::EarthRingCreate, cc_engine::commands::lightning::LpsCheck, cc_engine::commands::lightning::LpsConductorCreate, cc_engine::commands::lightning::LpsConductorTypeCreate, cc_engine::commands::line_style::LineStyleCreate, cc_engine::commands::line_style::LineStyleDelete, cc_engine::commands::line_style::LineStyleSet, cc_engine::commands::line_style::LineStylesList, cc_engine::commands::mass::MassCreate, cc_engine::commands::mass::MassFaceMove, cc_engine::commands::mass::MassFloorsSet, cc_engine::commands::mass::MassFloors, cc_engine::commands::mass::MassRoofCreate, cc_engine::commands::mass::MassSlabsCreate, cc_engine::commands::mass::MassTypeCreate, cc_engine::commands::mass::MassWallsCreate, cc_engine::commands::materials::MaterialCreate, cc_engine::commands::materials::MaterialDelete, cc_engine::commands::materials::MaterialDuplicate, cc_engine::commands::materials::MaterialRename, cc_engine::commands::materials::MaterialSet, cc_engine::commands::materials::MaterialTextureClear, cc_engine::commands::materials::MaterialTextureSet, cc_engine::commands::mep::CircuitLoads, cc_engine::commands::mep::ConduitCreate, cc_engine::commands::mep::MepConnect, cc_engine::commands::mep::MepFittings, cc_engine::commands::mep::MepSizeApply, cc_engine::commands::mep::MepSizing, cc_engine::commands::mep::PipeCreate, cc_engine::commands::mep::SystemAssign, cc_engine::commands::mep::SystemCreate, cc_engine::commands::mep::SystemDelete, cc_engine::commands::mep::SystemSet, cc_engine::commands::mep::SystemsList, cc_engine::commands::modify::ElementAlign, cc_engine::commands::modify::ElementFlip, cc_engine::commands::modify::ElementMoveEnd, cc_engine::commands::modify::ElementOffset, cc_engine::commands::modify::ElementSplit, cc_engine::commands::modify::ElementsCopy, cc_engine::commands::modify::ElementsDelete, cc_engine::commands::modify::ElementsExport, cc_engine::commands::modify::ElementsMirror, cc_engine::commands::modify::ElementsMove, cc_engine::commands::modify::ElementsPaste, cc_engine::commands::modify::ElementsPin, cc_engine::commands::modify::ElementsRotate, cc_engine::commands::modify::ElementsTurn, cc_engine::commands::modify::GeometryJoin, cc_engine::commands::modify::GeometryUnjoin, cc_engine::commands::modify::GridsAlignEnds, cc_engine::commands::modify::GroupCreate, cc_engine::commands::modify::GroupUngroup, cc_engine::commands::modify::TrimCorner, cc_engine::commands::modify::TrimExtend, cc_engine::commands::modify::WallAttach, cc_engine::commands::modify::WallJoin, cc_engine::commands::niche::NicheCreate, cc_engine::commands::niche::NicheTypeCreate, cc_engine::commands::pad::PadCreate, cc_engine::commands::pad::PadTypeCreate, cc_engine::commands::paint::PaintRemove, cc_engine::commands::paint::Paint, cc_engine::commands::paint::PaintsList, cc_engine::commands::phases::ElementsDemolish, cc_engine::commands::phases::ElementsPhaseSet, cc_engine::commands::phases::PhaseCreate, cc_engine::commands::phases::PhaseCreationSet, cc_engine::commands::phases::PhaseDelete, cc_engine::commands::phases::PhaseFilterCreate, cc_engine::commands::phases::PhaseFilterDelete, cc_engine::commands::phases::PhaseFilterSet, cc_engine::commands::phases::PhaseFiltersList, cc_engine::commands::phases::PhaseGraphicsGet, cc_engine::commands::phases::PhaseGraphicsSet, cc_engine::commands::phases::PhaseSet, cc_engine::commands::phases::PhasesList, cc_engine::commands::piles::PileCapCreate, cc_engine::commands::piles::PileCapTypeCreate, cc_engine::commands::piles::PileCapsUnderColumns, cc_engine::commands::piles::PileCreate, cc_engine::commands::piles::PileTypeCreate, cc_engine::commands::piles::TieBeamsCreate, cc_engine::commands::profiles::ProfileCatalog, cc_engine::commands::profiles::ProfileCreate, cc_engine::commands::profiles::ProfileDelete, cc_engine::commands::profiles::ProfileDuplicate, cc_engine::commands::profiles::ProfileGet, cc_engine::commands::profiles::ProfileImport, cc_engine::commands::profiles::ProfileSet, cc_engine::commands::profiles::ProfileTypeCreate, cc_engine::commands::profiles::ProfilesList, cc_engine::commands::project::LanguageSet, cc_engine::commands::project::ProjectInfoGet, cc_engine::commands::project::ProjectInfoSet, cc_engine::commands::project::ProjectNew, cc_engine::commands::project::ProjectOpen, cc_engine::commands::project::ProjectSave, cc_engine::commands::project::Redo, cc_engine::commands::project::Undo, cc_engine::commands::project::UnitsGet, cc_engine::commands::project::UnitsSet, cc_engine::commands::query::CategoriesList, cc_engine::commands::query::ElementGet, cc_engine::commands::query::ElementsList, cc_engine::commands::query::GroupsList, cc_engine::commands::query::LevelsList, cc_engine::commands::query::MaterialGet, cc_engine::commands::query::MaterialsList, cc_engine::commands::query::Measure, cc_engine::commands::query::ScheduleTable, cc_engine::commands::query::TypeGet, cc_engine::commands::query::TypesList, cc_engine::commands::query::ViewGet, cc_engine::commands::query::ViewsList, cc_engine::commands::ramp::RampCheck, cc_engine::commands::ramp::RampCreate, cc_engine::commands::ramp::RampTypeCreate, cc_engine::commands::rebar::RebarCopy, cc_engine::commands::rebar::RebarCreate, cc_engine::commands::rebar::RebarTypical, cc_engine::commands::region::FilledRegionCreate, cc_engine::commands::region::FilledRegionTypeCreate, cc_engine::commands::region::MaskingRegionCreate, cc_engine::commands::render::ViewRender, cc_engine::commands::roofing::RoofCheck, cc_engine::commands::schedule::ScheduleGet, cc_engine::commands::schedule::ScheduleSet, cc_engine::commands::shaft::ShaftCreate, cc_engine::commands::shaft::ShaftTypeCreate, cc_engine::commands::sheets::ComponentSheetPieceAdd, cc_engine::commands::sheets::ComponentSheetPieceDelete, cc_engine::commands::sheets::ComponentSheetPieceSet, cc_engine::commands::sheets::SheetFields, cc_engine::commands::sheets::SheetSet, cc_engine::commands::sheets::TitleBlockCreate, cc_engine::commands::site::SiteContextImport, cc_engine::commands::site::SiteGet, cc_engine::commands::site::SiteSet, cc_engine::commands::sketch::SketchGet, cc_engine::commands::sketch::SketchSet, cc_engine::commands::slab_rebar::SlabRebarCreate, cc_engine::commands::stair::RailingHostSet, cc_engine::commands::stair::StairCheck, cc_engine::commands::stair::StairCreate, cc_engine::commands::stair::StairRailingsAdd, cc_engine::commands::steel_building::SteelBuildingCreate, cc_engine::commands::strip_rebar::StripRebarCreate, cc_engine::commands::structure::BeamsBetweenColumns, cc_engine::commands::structure::BeamsOnGrids, cc_engine::commands::structure::ColumnsAtGrids, cc_engine::commands::structure::SlabJoinSupports, cc_engine::commands::structure::StructureNumber, cc_engine::commands::structure_material::StructuralTypeFor, cc_engine::commands::sun::SunFrames, cc_engine::commands::sun::SunPosition, cc_engine::commands::sun::SunPresetDelete, cc_engine::commands::sun::SunPresetRename, cc_engine::commands::sun::SunPresetSave, cc_engine::commands::sun::SunPresetsList, cc_engine::commands::sweep::SweepCreate, cc_engine::commands::sweep::SweepProfileSet, cc_engine::commands::sweep::SweepTypeCreate, cc_engine::commands::topography::TopographyCreate, cc_engine::commands::topography::TopographyPointsSet, cc_engine::commands::topography::TopographyTypeCreate, cc_engine::commands::types::ComponentCreate, cc_engine::commands::types::TypeDelete, cc_engine::commands::types::TypeDuplicate, cc_engine::commands::types::TypeSet, cc_engine::commands::valve::ValvePlace, cc_engine::commands::valve::ValveTypeCreate, cc_engine::commands::views::SheetPlaceView, cc_engine::commands::views::SheetRemoveViewport, cc_engine::commands::views::ViewCreate, cc_engine::commands::views::ViewDelete, cc_engine::commands::views::ViewDuplicate, cc_engine::commands::views::ViewSet, cc_engine::commands::wall_framing::WallFramingCreate, cc_engine::commands::wall_rebar::WallRebarCreate

Required and provided items

struct CommandInfo

pub struct CommandInfo

A command as listed by the catalog.

Traits: Debug, Clone, Serialize

Fields

fn describe

pub fn describe(name: &str) -> Option<CommandInfo>

The catalog entry of one command.

cc_engine::script

crates/cc_engine/src/script.rs

Scripts (macros): a list of commands with their arguments, as a JSON array of {"command": ..., "args": {...}} objects or one such object per line (// lines are comments). ccad script runs them, the app records and plays them as macros. Arguments may hold two kinds of placeholders, resolved just before their step runs: {"$step": n} (or {"$step": n, "path": "/created/0"}) is a value of the result of the earlier step n (counted from 1; path is a JSON pointer, /id by default), so a step can use what an earlier one created; {"$level": "active"} is the active level (see Session::set_active_level; without one, the lowest level). Recording writes both (see link and mark_level).

Items: STEP_KEY · LEVEL_KEY · Step · parse · to_text · StepError · run · Made · link · mark_level

const STEP_KEY

pub const STEP_KEY: &str

Key of a reference to an earlier step’s result.

const LEVEL_KEY

pub const LEVEL_KEY: &str

Key of the active level placeholder (its value is "active").

struct Step

pub struct Step

One step of a script.

Traits: Debug, Clone, PartialEq

Fields

Methods

fn parse

pub fn parse(text: &str) -> Result<Vec<Step>>

Read a script.

fn to_text

pub fn to_text(steps: &[Step]) -> String

A script with one step per line (the format macros are saved in).

struct StepError

pub struct StepError

A failed step: its index (from 0) and the error.

Traits: Debug, Clone, PartialEq

Fields

fn run

pub fn run(session: &mut Session, steps: &[Step]) -> std::result::Result<Vec<Value>, (Vec<Value>, StepError)>

Run the steps in order, stopping at the first error; returns each completed step’s result. Placeholders in the arguments are resolved first (see the module documentation).

struct Made

pub(crate) struct Made

What a recorded step made: the ids allocated while it ran (ids are shared by every kind of object, so none of them names an older object) and its result.

Traits: Debug, Clone

Fields

pub(crate) fn link(steps: &mut [Step], made: &[Option<Made>])

Replace the ids that earlier steps created by references to their results (made[i] is what steps[i] made). Integers at keys of counts and indices, and ids no earlier result holds, stay as they are.

fn mark_level

pub(crate) fn mark_level(v: &mut Value, level: LevelId, name: &str, depth: usize)

Replace the references to level (by id or name) at level keys by the active level placeholder, so the step plays on the level active then.

cc_engine::session

crates/cc_engine/src/session.rs

Items: Session · new_project · new_project_with · guard

struct Session

pub struct Session

An open project with its derived geometry and drawings, rebuilt lazily when the document changes.

Traits: Default

Fields

Some fields are private.

Methods

fn new_project

pub fn new_project() -> Project

A new project from the metric template, named in the active language.

fn new_project_with

pub fn new_project_with(system: cc_core::MeasurementSystem) -> Project

A new project from the template of system, named in the active language.

fn guard

pub(crate) fn guard<T>(f: impl FnOnce() -> T) -> Result<T>

Last-resort guard: a panic becomes an internal error.

cc_engine::skp

crates/cc_engine/src/skp.rs

SketchUp (.skp) models as component types: the geometry of each placed component or group becomes a type of fixed mesh pieces (one per material), placed by an element at the instance’s position and plan rotation. Whatever else the instance’s transform holds (tilt, scale, mirror) is baked into the type, so placements that differ only by a move or a plan rotation share one type.

Items: MAX_FACES · SkpType · SkpPlacement · Converted · SkpError · MeshBuild · mesh_definition · convert · convert_single

const MAX_FACES

pub const MAX_FACES: usize

Faces written over the whole import.

struct SkpType

pub struct SkpType

A component type to add: its name and definition.

Traits: Debug, Clone

Fields

struct SkpPlacement

pub struct SkpPlacement

An element placing types[ty], in meters and degrees, before the import’s own move and rotation.

Traits: Debug, Clone, Copy

Fields

struct Converted

pub struct Converted

What a file becomes: types, placements and the materials they use.

Traits: Debug, Clone, Default

Fields

enum SkpError

pub enum SkpError

Traits: Debug

Variants

struct MeshBuild

pub(crate) struct MeshBuild

Faces of one piece, with vertices shared by position.

Traits: Default

Some fields are private.

Methods

fn mesh_definition

pub(crate) fn mesh_definition(name: &str, pieces: BTreeMap<Option<usize>, MeshBuild>, materials: &[crate::import_material::ImportedMaterial]) -> Option<ComponentDef>

A component definition of fixed mesh pieces, one per entry of pieces (keyed by the index in materials; None takes no material and is named name); none when nothing was drawn.

fn convert

pub fn convert(model: &SkpModel, loose_name: &str) -> Result<Converted, SkpError>

Every placed component and group of model as an element of a component type; the root’s loose faces make one more type, loose_name.

fn convert_single

pub fn convert_single(model: &SkpModel, name: &str) -> Result<Converted, SkpError>

The whole of model as one component type named name.