ConstructCraft

cc_app API

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

ConstructCraft — open source BIM authoring.

Modules

Module Items Summary
cc_app 0 ConstructCraft — open source BIM authoring.
cc_app::actions 73 Document-level commands shared by the ribbon, browser and shortcuts.
cc_app::app 4 Top-level eframe application: layout, dock and keyboard shortcuts.
cc_app::bracing_ui 5 Bracing in the app: the Bracing command (the bay between two selected columns, else the two-click tool), the tool’s options bar and the properties of a selected bracing (every parameter through element_set, which regenerates its braces in the same undo step).
cc_app::browser 3 Project Browser: the tree of views, schedules and sheets, grouped as the project’s browser organization says (cc_core::browser): by view type alone, or by the criteria of the scheme in use.
cc_app::browser_org_dialog 3 The Browser Organization dialog (View → Browser Organization, also in the menu of the project browser’s groups): the schemes that group the browser’s views.
cc_app::cad_ui 10 Imported CAD drawings in the app: the Import CAD and Import Image commands (file dialog or files dropped on the window), and their properties and layers, and Explode.
cc_app::callout_ui 6 Callouts in the app: the Callout tool draws a rectangle in a plan, ceiling plan, section or elevation and makes a detail view of that region (callout_create); the Select tool picks a callout’s mark, moves it and resizes it by its corners (the detail view’s crop, view_set) and opens its view on a double-click; the view’s properties show the callout’s parent and open the view.
cc_app::canvas 7 2D view canvas: plans, ceilings, elevations, sections, legends and drafting views.
cc_app::clipboard 8 Clipboard: cut, copy and paste of elements within the open project, and match type (pick an element, then click others to give them its type).
cc_app::commands 8 Interface commands: every ribbon, quick access and palette entry is a UiCommand, so its label, shortcut, description, the engine command it runs and whether it is available now (and why not) are defined once and read by every place that shows it.
cc_app::component_env 31 The component modeling environment: a workspace of its own where one component is shaped.
cc_app::component_sketch 14 Sketching pieces in the component modeling environment.
cc_app::connection_ui 3 Connections in the app: the Structure tab’s Connections buttons, which run connections_create on the selected members (else the active level’s), and the rows of a selected connection, whose sizes change through element_set.
cc_app::curtain_ui 10 Curtain walls in the app: the Curtain Grid tool (add and remove grid lines, merge cells across a segment, swap panels by clicking a curtain wall in a plan, elevation or section), its options bar, the grid rows of the properties palette and the curtain sections of the Type Properties dialog.
cc_app::design_options_ui 8 Design options in the application: the Design Options dialog (sets, their options and primary option, accepting the primary), the menu of the option being edited, and the option rows of view, template and element properties.
cc_app::detail_component_ui 6 Detail components in the app: the Detail Component tool (Annotate tab), which places a type in the active 2D view with the rotation, scale and mirror of its options (detail_component_place); Create Detail Component, which makes a type from the selected detail lines, regions, texts and detail components of the view and puts it in their place (detail_component_create); and the rows of a placed one in the properties palette.
cc_app::detail_ui 17 Detail lines in the app: the Detail Line tool (Annotate tab) with its line, polyline, arc, circle, ellipse and rectangle modes and the line style in the options bar, the grips of selected detail lines (ends, centers, an arc’s middle, axis points), their properties, and their previews in the Split and Offset tools.
cc_app::dialog 8 Standard dialog frame shared by every modal window: a header with the title and a close button, a padded body (with an icon for alerts) and a footer with the buttons.
cc_app::dialog::session 3 Edits made while a data dialog is open can be cancelled as a whole: the dialog remembers the undo depth when it opens and undoes back to it.
cc_app::dialogs 6 Application dialogs, all built on crate::dialog::Dialog.
cc_app::dim_edit 9 Editing measured values in place.
cc_app::dim_type_ui 1 The Type Properties rows of a dimension type: the marks, witness and dimension lines and pens (Graphics) and the text (Text).
cc_app::engine_edit 12 Property edits through the engine.
cc_app::fill_patterns_dialog 9 The Fill Patterns dialog (Manage → Fill Patterns, also opened from the material browser and a filled region type’s fill): the built-in patterns, read only, and the project’s own with a drawn swatch each; the selected one’s name, description, kind (drafting or model), scale and line families, edited in place over a live preview.
cc_app::gestures 3 Scroll and pinch gestures over the views (issue #174).
cc_app::gpu 11 Graphics start-up: which wgpu backends the window tries, in what order, and what its device asks of the adapter.
cc_app::graph_ui 6 Visual programming: the graph editor, a panel under the views.
cc_app::graphics_dialog 19 View graphics dialogs: Visibility/Graphics of a view or view template (categories and filters), graphic overrides of selected elements, the view filter editor and the view template manager.
cc_app::grid_frame_ui 4 Structure → Grid Frame: the levels, the types (of the tab’s material) and optional secondary beams for grid_frame_create.
cc_app::home 3 Home screen: open or create a project, recent projects and samples.
cc_app::i18n 1 Localization lives in the engine (cc_engine::i18n), so the GUI, the command line and the MCP server name things alike; this module re-exports it and defines the app’s t! macro.
cc_app::icons 5 Interface icons: SVG drawings in assets/icons/ui (24 x 24 grid, white strokes and fills), rasterized with resvg at the exact pixel size they are shown at and tinted with theme colors: strokes in one tone, soft fills in a second (see Tones), and an optional Badge marks what kind of action a command is.
cc_app::jobs 9 Long commands (opening a project, importing IFC, DWG/DXF, SketchUp, pictures, component files) run on a worker thread over a copy of the document, while a modal dialog shows what is being read and for how long.
cc_app::level_mark_ui 4 Level marks in the app: the tool that places them in plans, elevations and sections (through level_mark_create), their rows in the properties palette and the rows of their type.
cc_app::library 4 Component library: browse the component files (.ccomp) of the folders the user adds (such as a copy of the ConstructCraft Components library), search them, see a component’s types, parameters, connectors and plan, load it into the project, and save the project’s components into a library folder.
cc_app::line_styles_dialog 3 The Line Styles dialog (Annotate → Line Styles): the built-in line styles, read only, and the project’s own, whose name, weight, color and dash pattern are edited in place; New adds one and Delete removes the selected one (what uses it moves to the thin style).
cc_app::lps_cabling_ui 4 Lightning protection and structured cabling in the app: the tools that place air terminals, earth electrodes, racks and data outlets (their built-in types made on first use by device_type_create), the earth ring around the walls, the coverage check (lps_check) and the cabling per rack (cabling_list).
cc_app::material_browser 4 Material browser: the project’s materials in a searchable list and the selected one’s identity, graphics, appearance and physical properties in tabs.
cc_app::mcp_bridge 2 constructcraft mcp (or --mcp): MCP clients pointed at the app instead of ccad get the MCP server of the ccad next to it, on the same standard input and output, instead of a window that never answers (issue #265).
cc_app::member_host_ui 3 Rows shared by the properties of member hosts (steel buildings, trusses): the member counts and Reset Members, and length rows that report when an edit ends.
cc_app::modify 21 Transform tools on the selection: move, copy, rotate, mirror (picking a line or drawing the axis) and linear array.
cc_app::modify3d 9 The modify tools in the 3D view: move, copy, array, rotate and mirror the selection, align and join geometry.
cc_app::new_component_dialog 6 The New Component dialog: a name and the kind the component is, picked from a list that shows the parameters each kind starts with (a generic component starts with none: they are the user’s to add).
cc_app::new_project_dialog 2 The New Project dialog: the template a new project starts from, metric or imperial, picked on one of two cards.
cc_app::obj_ui 4 Import OBJ and glTF (Insert → Import OBJ…, Import glTF…): after the file is picked, a dialog asks what the format does not say (for OBJ the units and which axis is up; for both one element or one per object), then obj_import or gltf_import runs as a background job.
cc_app::opening_place 6 Placing a door or window on a wall in a plan: where its center goes along the wall, from the cursor, a snap of its center or one of its edges to an imported drawing or the underlay (issue #251), or a distance typed from either end of the wall (issue #250), and the temporary dimensions from its center to both ends.
cc_app::paint 16 Painting Drawing2Ds with egui.
cc_app::paint_cache 1 Painted drawings kept between frames.
cc_app::paint_ui 3 The Paint and Remove Paint tools: click a face of an element in a 3D view to paint it with the material chosen in the options bar (paint), or to take its paint off (paint_remove).
cc_app::palette 4 Command palette (Ctrl+Shift+P): search every interface command, the project’s views and the engine’s command catalog by name, description or shortcut, and run the chosen one.
cc_app::phases_dialog 9 Construction phases in the application: the Phases dialog (phases, phase filters and the graphics of each status), the phase rows of view and element properties, and the Demolish tool.
cc_app::plugins_ui 7 Plugins in the app: loading the plugins of the plugins folder into the session (their commands join the engine’s catalog, the palette and the ribbon’s Plugin Commands menu) and the Plugins window, which turns them on and off, grants the files permission, removes them, and installs and updates them from the community index.
cc_app::preferences 16 App preferences (not model data): what they hold, how they are kept in eframe’s storage (every key lives here), how the interface follows them, and the Preferences window (File tab, Ctrl+,, home screen).
cc_app::profile_sketch 10 Edit Profile: the profile of a sweep type drawn in a sketch, in the profile’s own plane (x across the path, to its left; y up from the path’s height), which takes the place of the views while it is open.
cc_app::profiles_dialog 9 The Profile Manager (Structure → Profiles, also Manage → Profiles): the project’s structural profiles grouped by material, with a search; the selected one’s outline drawn to fit, its name, material and dimensions (millimeters on screen, meters to the engine) and its section properties.
cc_app::properties 16 Properties palette: instance parameters of the selection, or of the active view.
cc_app::recovery 7 Autosave and crash recovery of the open project (the files are written by cc_core::recovery): a copy of a project with unsaved changes is written in the background an interval (a preference: a minute by default, or off) after its last copy; a clean save, close or exit removes it; a panic writes a final copy and appends to a crash log; at start-up, copies left by earlier sessions are offered for restoring.
cc_app::region_ui 5 Filled and masking regions in the app: Annotate → Filled Region and Masking Region open the sketch mode in the active view (a plan, ceiling plan, elevation, section, legend or drafting view; curves in the view’s drawing coordinates), and Finish runs filled_region_create or masking_region_create with the curves.
cc_app::render_ui 5 The render window (View → Render): the active 3D view path traced progressively (cc_raytracing), the picture on the left (fitted; the wheel zooms about the pointer, a drag pans, a double click fits again) and the view’s render settings on the right (quality, output, environment), with Save Image…, Region, Render, Stop and Close.
cc_app::ribbon 10 Ribbon, options bar and status bar.
cc_app::schedule_ui 5 Schedule (table) view, its definition dialog (fields, filter, sorting and grouping, formatting, appearance) and CSV export.
cc_app::section_mark 4 Section marks in plans: picked with the Select tool, moved by dragging, their ends and the pieces of a split line dragged by their handles, flipped with Space.
cc_app::sheet 1 Sheet composer: paper, title block and placed viewports.
cc_app::sheet_props 4 A sheet’s rows in the properties palette: its number, title block, paper and issue date, and the title block’s per-sheet fields.
cc_app::side_panels 7 The side panels, Project Browser and Properties: docked on either side of the window, stacked in one column or each in a column of its own.
cc_app::site_ui 3 Site Location (Manage → Project): a window with an OpenStreetMap map, an address search, a marker fixed at the center and the square of map data to bring in.
cc_app::sketch_mode 21 Sketch mode: the outline of a floor, ceiling, roof, foundation slab or mass drawn with lines, rectangles, polygons, circles, arcs and ellipses (see cc_core::sketch), in the active plan.
cc_app::snap_geom 3 Snap points that come from two pieces of geometry, or from the point a segment is drawn from (issue #159): where lines and arcs cross, the foot of the perpendicular from the anchor, and the points where a line from the anchor touches an arc or circle.
cc_app::snaps 3 Object snaps (issue #317): which points the tools snap to (a preference), and the snap points of the elements a view draws, so that every element shown has them, not only those the tools know by their geometry.
cc_app::stair_ui 13 Stair and ramp controls: the plan layout (options bar and properties), the construction and step rules of stair types, the rules of ramp types, and their checks.
cc_app::state 4 Application state shared by all panels and views.
cc_app::steel_building_ui 5 Structure → Steel Building: the dialog that runs steel_building_create on the active level, and the properties of a selected building (every parameter, through element_set, which regenerates its members in the same undo step).
cc_app::sun_overlay 1 A 3D view’s sun: the light the renderer draws it with (cc_render::Light) and its sun path diagram painted over the image (cc_views::sun_path::diagram, projected through the live camera).
cc_app::sun_ui 5 The Sun Settings dialog (View → Sun Settings, and the Sun row of a view’s properties): how a view places its sun (one moment, a study over one or several days, or a light from a direction given by hand), the project’s sun presets, the site’s time zone and what is drawn (the sun path, shadows, a ground plane).
cc_app::systems_dialog 5 Plumbing systems, electrical circuits, the structured cabling of racks and lightning protection systems: names, codes, colors, the board (or rack) feeding each circuit (or cabling) and its voltage, with the circuits’ loads.
cc_app::table 16 Property table primitives shared by the properties palette and dialogs: collapsible sections of two-column rows, header blocks and padded content.
cc_app::text_tool 10 Text notes in 2D views: the Text tool (single-line or multiline text, optionally with a leader of one or two segments), the Add Leader tool and the text editor shown over the view.
cc_app::theme 22 Visual theme: color tokens, typography and spacing applied to egui.
cc_app::thumbnails 5 Project thumbnails: a small render of the model, stored in the application data folder and shown on the home screen.
cc_app::title_block_env 38 The title block editor: the component environment for a title block (ComponentKind::TitleBlock).
cc_app::tools 61 Modeling tools: selection, walls, hosted openings, sketches, sections, rooms, grids and dimensions.
cc_app::truss_ui 4 Trusses in the app: the Truss tool’s options bar and the properties of a selected truss (every parameter through element_set, which regenerates its members in the same undo step).
cc_app::type_dialog 1 Type Properties dialog: switch, duplicate and rename types, edit the compound structure (layers) and the type parameters in sections.
cc_app::units_dialog 1 Project Units dialog: unit, decimals and symbol of each quantity, the currency and the number style, with a live sample of each format.
cc_app::update 16 Update notice: at startup (at most once a day) and on request, the app asks GitHub for the latest release of ConstructCraft in a background thread and, when it is newer than this build, shows a notice with a link to the release page.
cc_app::update_install 19 One-click updates: download the package of a newer release that fits how this copy was installed, verify it, and put it in place.
cc_app::view3d 3 Interactive 3D view backed by cc_render::Renderer3D.
cc_app::view_cube 4 Navigation cube for 3D views: a cube aligned with the world axes and a compass ring, drawn in the view’s corner.
cc_app::wall_framing_ui 8 Structure → Light Steel Frame / Wood Frame: the dialog that runs wall_framing_create on the selected walls (or the active level’s), the properties of a selected framing (through element_set, which regenerates its members in the same undo step), and the Framing row of its members.

cc_app

crates/cc_app/src/main.rs

cc_app::actions

crates/cc_app/src/actions.rs

Document-level commands shared by the ribbon, browser and shortcuts.

Items: material_type_ref · structure_place · run_command · new_plan · new_3d · new_legend · new_drafting_view · new_schedule · new_sheet · t_category · duplicate_view · delete_view · rename_view · sheet_of · place_on_sheet · place_on_sheet_at · remove_viewport · add_level_beside · delete_level · open_default_3d · activate_category_tool · new_project · set_language · guarded · run_pending · open · open_path · save_component · load_component · load_component_path · import_skp · export_ifc · SheetFormat · active_sheet · export_sheet · IMAGE_DPI · image_view · export_image · export_dxf · toggle_macro_recording · run_macro · run_macro_file · save · select_instances · group_selection · ungroup_selection · grids_for · reference_grid · align_grid_ends · selected_columns · columns_at_grids · beams_on_grids · footings_under_columns · strip_footings_under_walls · slab_join_supports · open_analytical_view · export_analytical · typical_rebar · open_rebar_view · open_structural_plan · mep_connect · open_panel_diagram · open_mep_plan · number_structure · active_floor_plan · toggle_structure_tags · beams_between_columns · hide_in_view · temporary · temporary_permanent · selected_masses · from_masses · terrain_on_level

fn material_type_ref

pub fn material_type_ref(state: &mut AppState, category: Category) -> Option<cc_engine::Ref>

The type of category in the Structure tab’s material (made when the project has none, as an undo step).

fn structure_place

pub fn structure_place(state: &mut AppState, category: Category, material: cc_core::StructuralMaterial)

Start the column or beam tool of the Structure tab on a type of material.

fn run_command

pub fn run_command<C: cc_engine::Command + serde::Serialize>(state: &mut AppState, command: C) -> Option<serde_json::Value>

Run an engine command; failures go to the status bar.

fn new_plan

pub fn new_plan(state: &mut AppState, level: LevelId, ceiling: bool) -> Option<ViewId>

fn new_3d

pub fn new_3d(state: &mut AppState) -> Option<ViewId>

fn new_legend

pub fn new_legend(state: &mut AppState) -> Option<ViewId>

fn new_drafting_view

pub fn new_drafting_view(state: &mut AppState) -> Option<ViewId>

fn new_schedule

pub fn new_schedule(state: &mut AppState, category: Category) -> Option<ViewId>

fn new_sheet

pub fn new_sheet(state: &mut AppState) -> Option<ViewId>

fn t_category

pub fn t_category(category: Category) -> String

fn duplicate_view

pub fn duplicate_view(state: &mut AppState, id: ViewId, detailing: bool)

Copy a view and open the copy; with detailing, what is drawn in it too.

fn delete_view

pub fn delete_view(state: &mut AppState, id: ViewId)

fn rename_view

pub fn rename_view(state: &mut AppState, id: ViewId, name: String)

fn sheet_of

pub fn sheet_of(project: &Project, view: ViewId) -> Option<ViewId>

Sheet that already shows view, if any.

fn place_on_sheet

pub fn place_on_sheet(state: &mut AppState, sheet: ViewId, view: ViewId)

fn place_on_sheet_at

pub fn place_on_sheet_at(state: &mut AppState, sheet: ViewId, view: ViewId, center: glam::DVec2)

Place view on sheet centered at center (paper millimeters) and select the new viewport; errors (already on a sheet…) go to the status bar.

fn remove_viewport

pub fn remove_viewport(state: &mut AppState, sheet: ViewId, index: usize)

fn add_level_beside

pub fn add_level_beside(state: &mut AppState, level: LevelId, above: bool) -> Option<LevelId>

Add a level as a new storey above (or below) level, with its plans; the levels beyond it move away, so the order of the levels stays.

fn delete_level

pub fn delete_level(state: &mut AppState, level: LevelId)

Delete a level and its plan views; refused while elements use it.

fn open_default_3d

pub fn open_default_3d(state: &mut AppState)

Open the project’s first 3D view, creating one when there is none.

fn activate_category_tool

pub fn activate_category_tool(state: &mut AppState, category: Category)

fn new_project

pub fn new_project() -> Project

A new project from the template, named in the active UI language.

fn set_language

pub fn set_language(state: &mut AppState, lang: crate::i18n::Language)

Switch the UI language and refresh text baked into cached drawings.

fn guarded

pub fn guarded(state: &mut AppState, action: PendingAction)

Run action now, or ask for confirmation first if there are unsaved changes.

fn run_pending

pub fn run_pending(state: &mut AppState, action: PendingAction)

fn open

pub fn open(state: &mut AppState)

fn open_path

pub fn open_path(state: &mut AppState, path: std::path::PathBuf)

Open the project at path, read on a worker thread behind the progress dialog.

fn save_component

pub fn save_component(state: &mut AppState, name: &str)

Save the component name (all its types) to a .ccomp file.

fn load_component

pub fn load_component(state: &mut AppState)

Load a .ccomp file: its types (and missing materials) join the project in one undo step, and the component tool picks the first type.

fn load_component_path

pub fn load_component_path(state: &mut AppState, path: std::path::PathBuf)

Load the component file at path (see load_component).

fn import_skp

pub fn import_skp(state: &mut AppState)

Insert a SketchUp model into the project, on the active view’s level.

fn export_ifc

pub fn export_ifc(state: &mut AppState)

enum SheetFormat

pub enum SheetFormat

Vector formats a sheet can be exported to.

Traits: Debug, Clone, Copy, PartialEq, Eq

Variants

fn active_sheet

pub fn active_sheet(state: &AppState) -> Option<ViewId>

The active view when it is a sheet.

fn export_sheet

pub fn export_sheet(state: &mut AppState, format: SheetFormat)

Export the active sheet as PDF or SVG.

const IMAGE_DPI

pub const IMAGE_DPI: f64

Resolution of exported images, dots per inch.

fn image_view

pub fn image_view(state: &AppState) -> Option<ViewId>

The active view, to export as an image or DXF: every view has a drawing (a schedule draws as its table).

fn export_image

pub fn export_image(state: &mut AppState)

Export the active view as a PNG image, as printed (no temporary hiding).

fn export_dxf

pub fn export_dxf(state: &mut AppState)

Export the active view as DXF, for other CAD programs: at full size in millimeters (a sheet in paper millimeters), as printed.

fn toggle_macro_recording

pub fn toggle_macro_recording(state: &mut AppState)

Start recording a macro, or stop and save it as a script of commands (the format ccad script runs).

fn run_macro

pub fn run_macro(state: &mut AppState)

Run a macro (a script of commands) on the open project; each step is one undo step.

fn run_macro_file

pub fn run_macro_file(state: &mut AppState, path: &std::path::Path)

Run the macro at path (see run_macro).

fn save

pub fn save(state: &mut AppState, save_as: bool) -> bool

fn select_instances

pub fn select_instances(state: &mut AppState)

Select every instance of the selected elements’ types shown in the active view (the engine’s elements_list by type and view).

fn group_selection

pub fn group_selection(state: &mut AppState)

Group the selection (the engine’s group_create).

fn ungroup_selection

pub fn ungroup_selection(state: &mut AppState)

Ungroup every group the selection touches (the engine’s group_ungroup).

fn grids_for

pub fn grids_for(state: &AppState) -> Vec<u64>

Ids of the selected grids, or of every grid when none is selected.

fn reference_grid

pub fn reference_grid(state: &AppState) -> Option<u64>

The single selected grid, the reference of align_grid_ends.

fn align_grid_ends

pub fn align_grid_ends(state: &mut AppState)

Give every grid parallel to the selected one its extents, so their bubbles line up (the engine’s grids_align_ends).

fn selected_columns

pub fn selected_columns(state: &AppState) -> Vec<u64>

The selected columns as a chain: from the lowest-left one, each followed by the nearest left.

fn columns_at_grids

pub fn columns_at_grids(state: &mut AppState)

Columns at the intersections of the selected grids (the engine’s columns_at_grids).

fn beams_on_grids

pub fn beams_on_grids(state: &mut AppState)

Beams between the columns along the selected grids (the engine’s beams_on_grids).

fn footings_under_columns

pub fn footings_under_columns(state: &mut AppState)

Pad footings under the selected columns, or every column of the active level.

fn strip_footings_under_walls

pub fn strip_footings_under_walls(state: &mut AppState)

Strip footings under the selected walls, or every wall of the active level.

fn slab_join_supports

pub fn slab_join_supports(state: &mut AppState)

Join the selected floors (or those of the active level) with the beams, columns and walls carrying them.

fn open_analytical_view

pub fn open_analytical_view(state: &mut AppState)

Open the analytical model view, creating it the first time.

fn export_analytical

pub fn export_analytical(state: &mut AppState)

Export the analytical model as JSON.

fn typical_rebar

pub fn typical_rebar(state: &mut AppState)

X bracing between the two selected columns. Typical reinforcement for the selected beams and columns, or all of the active level.

fn open_rebar_view

pub fn open_rebar_view(state: &mut AppState)

Open the first 3D view showing reinforcement, creating one the first time.

fn open_structural_plan

pub fn open_structural_plan(state: &mut AppState)

Open the structural plan of the active level (or the lowest), creating it the first time.

fn mep_connect

pub fn mep_connect(state: &mut AppState)

Connect the selected fixtures and devices to the nearest pipes and conduits (mep_connect).

fn open_panel_diagram

pub fn open_panel_diagram(state: &mut AppState)

Open the diagram of the selected distribution board (or the first), creating it the first time.

fn open_mep_plan

pub fn open_mep_plan(state: &mut AppState, discipline: cc_core::MepDiscipline)

Open the plumbing, electrical, communications or lightning protection plan of the active level (or the lowest), creating it the first time.

fn number_structure

pub fn number_structure(state: &mut AppState)

Number the beams, columns and footings of the active level (or the whole project).

fn active_floor_plan

pub fn active_floor_plan(state: &AppState) -> Option<(ViewId, bool)>

The active view when it is a floor plan, with whether it shows structure tags.

fn toggle_structure_tags

pub fn toggle_structure_tags(state: &mut AppState)

Show or hide the beam and column tags of the active floor plan.

fn beams_between_columns

pub fn beams_between_columns(state: &mut AppState)

Beams through the selected columns (the engine’s beams_between_columns).

fn hide_in_view

pub fn hide_in_view(state: &mut AppState)

Hide the selection in the active view (permanently; Visibility/Graphics shows it again).

fn temporary

pub fn temporary(state: &mut AppState, action: &str)

Temporarily hide or isolate the selection (or its categories) in the active view, or reset.

fn temporary_permanent

pub fn temporary_permanent(state: &mut AppState)

Make the active view’s temporary hide/isolate permanent.

fn selected_masses

pub fn selected_masses(state: &AppState) -> Vec<ElementId>

The masses in the selection.

fn from_masses

pub fn from_masses(state: &mut AppState, what: &str)

Walls (walls), floors (slabs) or roofs (roof) from each selected mass; what they make is selected.

fn terrain_on_level

pub fn terrain_on_level(state: &AppState) -> bool

Whether the active plan’s level has a terrain (for building pads to grade).

cc_app::app

crates/cc_app/src/app.rs

Top-level eframe application: layout, dock and keyboard shortcuts.

Items: Args · ConstructApp · zoom_fit · shortcuts

struct Args

pub struct Args

Command-line options.

Traits: Debug, Default, Clone

Fields

struct ConstructApp

pub struct ConstructApp

Traits: eframe::App

Some fields are private.

Methods

fn zoom_fit

pub fn zoom_fit(state: &mut AppState)

Zoom the active view to fit its contents.

fn shortcuts

pub(crate) fn shortcuts(ctx: &egui::Context, state: &mut AppState)

The keyboard shortcuts of the app: Ctrl ones, plain keys and two-letter tool keys.

cc_app::bracing_ui

crates/cc_app/src/bracing_ui.rs

Bracing in the app: the Bracing command (the bay between two selected columns, else the two-click tool), the tool’s options bar and the properties of a selected bracing (every parameter through element_set, which regenerates its braces in the same undo step).

Items: between_columns · start · tool_options · edit · props

fn between_columns

pub fn between_columns(state: &AppState, columns: Vec<u64>, material: StructuralMaterial) -> BracingCreate

The command for the bay between two columns, with the tool’s options (the storey height comes from the columns).

fn start

pub fn start(state: &mut AppState)

The Bracing command: with two columns selected it braces their bay, otherwise it starts the tool (two clicks: the bay’s column axes).

fn tool_options

pub fn tool_options(ui: &mut Ui, state: &mut AppState)

The options bar of the Bracing tool.

fn edit

pub fn edit(state: &mut AppState, id: ElementId, field: &str, f: impl FnOnce(&mut Bracing))

Change bracing id as f changes a copy of it (element_set, which regenerates its braces); edits under one field merge while dragging.

fn props

pub fn props(ui: &mut Ui, state: &mut AppState, id: ElementId, bracing: &Bracing)

The rows of a selected bracing.

cc_app::browser

crates/cc_app/src/browser.rs

Project Browser: the tree of views, schedules and sheets, grouped as the project’s browser organization says (cc_core::browser): by view type alone, or by the criteria of the scheme in use.

Items: ViewDrag · category_icon · body

struct ViewDrag

pub struct ViewDrag(pub ViewId)

A view dragged from the browser (dropped on a sheet, it is placed there).

Traits: Debug, Clone, Copy, PartialEq, Eq

fn category_icon

pub fn category_icon(category: ViewCategory) -> Icon

fn body

pub fn body(ui: &mut Ui, state: &mut AppState)

The browser’s tree, under a header drawn by the caller.

cc_app::browser_org_dialog

crates/cc_app/src/browser_org_dialog.rs

The Browser Organization dialog (View → Browser Organization, also in the menu of the project browser’s groups): the schemes that group the browser’s views. The marked scheme is the one in use, and the browser follows it at once; Default lists the views by type alone. A project scheme has a name and the criteria it nests, outermost first. Every change runs a browser_scheme_* command; OK keeps them, Cancel undoes them all (dialog::session, through crate::graphics_dialog::Edits).

Items: BrowserOrgDialog · open · show

struct BrowserOrgDialog

pub struct BrowserOrgDialog

The open Browser Organization dialog.

Some fields are private.

Methods

fn open

pub fn open(state: &mut AppState)

fn show

pub fn show(ctx: &Context, state: &mut AppState)

cc_app::cad_ui

crates/cc_app/src/cad_ui.rs

Imported CAD drawings in the app: the Import CAD and Import Image commands (file dialog or files dropped on the window), and their properties and layers, and Explode. Every change runs an engine command (cad_import, image_import, element_set, cad_layers_set, cad_explode).

Items: EXTENSIONS · cad_view · selected_import · explode_selected · import_cad · import_cad_path · import_image · import_image_path · dropped_files · props

const EXTENSIONS

pub const EXTENSIONS: [&str; 2]

File extensions read as CAD drawings.

fn cad_view

pub fn cad_view(state: &AppState) -> Option<ViewId>

The active view when it can hold an imported drawing.

fn selected_import

pub fn selected_import(state: &AppState) -> Option<ElementId>

The imported drawing selected alone, if any.

fn explode_selected

pub fn explode_selected(state: &mut AppState)

Explode the selected imported drawing into detail lines, filled regions and text notes of its view (cad_explode), selecting what it made.

fn import_cad

pub fn import_cad(state: &mut AppState)

Pick a DWG or DXF file and import it into the active view.

fn import_cad_path

pub fn import_cad_path(state: &mut AppState, path: PathBuf)

Import the drawing at path into the active view, select it and report what was read.

fn import_image

pub fn import_image(state: &mut AppState)

Pick a picture or an SVG file and import it into the active view.

fn import_image_path

pub fn import_image_path(state: &mut AppState, path: PathBuf)

Import the picture or SVG at path into the active view, centered on what it shows, and select it.

fn dropped_files

pub fn dropped_files(ctx: &egui::Context, state: &mut AppState)

DWG and DXF drawings, pictures and SVG files dropped on the window go into the active view.

fn props

pub fn props(ui: &mut Ui, state: &mut AppState, id: ElementId, c: &CadImport)

Properties of an imported drawing: file, placement, colors and layers.

cc_app::callout_ui

crates/cc_app/src/callout_ui.rs

Callouts in the app: the Callout tool draws a rectangle in a plan, ceiling plan, section or elevation and makes a detail view of that region (callout_create); the Select tool picks a callout’s mark, moves it and resizes it by its corners (the detail view’s crop, view_set) and opens its view on a double-click; the view’s properties show the callout’s parent and open the view.

Items: CalloutOptions · Part · tool · options · select · view_rows

struct CalloutOptions

pub struct CalloutOptions

Options of the Callout tool.

Traits: Debug, Clone, Copy, PartialEq, Default

Fields

enum Part

pub enum Part

What a drag of a callout mark holds.

Traits: Debug, Clone, Copy, PartialEq

Variants

fn tool

pub fn tool(_ui: &Ui, resp: &Response, painter: &Painter, state: &mut AppState, view: &View, xf: &Xf)

The Callout tool: two clicks give opposite corners of the rectangle.

fn options

pub fn options(ui: &mut Ui, state: &mut AppState)

The Callout tool’s options: the detail view’s scale, or a drafting view to point to.

fn select

pub fn select(ui: &Ui, resp: &Response, painter: &Painter, state: &mut AppState, xf: &Xf, drawing: &Drawing2D) -> bool

Callout marks under the Select tool. Returns true when they took the pointer this frame (the element selection is left alone).

fn view_rows

pub fn view_rows(ui: &mut Ui, state: &mut AppState, id: ViewId)

The callout and crop rows of a view’s properties: the view its callout is drawn in, opening the view, removing the callout or the crop.

cc_app::canvas

crates/cc_app/src/canvas.rs

2D view canvas: plans, ceilings, elevations, sections, legends and drafting views.

Items: ZoomCommand · ZoomNav · View2DState · zoom · show · temporary_frame · view_toolbar

enum ZoomCommand

pub enum ZoomCommand

Zoom commands of the view toolbar menu.

Traits: Debug, Clone, Copy, PartialEq, Eq, Default

Variants

Methods

struct ZoomNav

pub struct ZoomNav

What the zoom menu can offer in a view.

Traits: Debug, Clone, Copy, Default

Fields

struct View2DState

pub struct View2DState

Pan/zoom state of a 2D view.

Traits: Debug, Clone, Default

Fields

Some fields are private.

Methods

fn zoom

pub fn zoom(state: &mut AppState, view: ViewId, cmd: ZoomCommand, mm_scale: f64)

Run a toolbar zoom command on view (or, for “fit all”, on every view).

fn show

pub fn show(ui: &mut Ui, state: &mut AppState, view_id: ViewId)

Show a graphical 2D view and run the active tool on it.

fn temporary_frame

pub fn temporary_frame(ui: &mut Ui, state: &mut AppState, rect: Rect, view_id: ViewId)

While something is temporarily hidden or isolated in the view: a colored border and a chip naming the state, with Reset and Make Permanent.

fn view_toolbar

pub fn view_toolbar(ui: &mut Ui, default: ZoomCommand, rect: Rect, view_id: ViewId, scale: Option<u32>, nav: ZoomNav) -> Option<ZoomCommand>

Floating chip in the view corner with the scale (when given) and the zoom button: a click runs the default zoom command, the arrow opens the menu of all of them. Returns the command to run.

cc_app::clipboard

crates/cc_app/src/clipboard.rs

Clipboard: cut, copy and paste of elements within the open project, and match type (pick an element, then click others to give them its type). The clipboard holds a snapshot of the copied elements (with the doors and windows of copied walls), so a cut can be pasted after its originals are gone. It lives in the app state and is dropped with the document, since its type and level ids only mean something in that project.

Items: Clipboard · copy · cut · paste · paste_aligned · paste_tool · start_match_type · match_type_tool

struct Clipboard

pub struct Clipboard

Copied elements and, while pasting, their preview in the active view.

Traits: Default

Some fields are private.

Methods

fn copy

pub fn copy(ctx: &egui::Context, state: &mut AppState) -> bool

Copy the selection to the clipboard. The system clipboard gets a short note, which also makes Ctrl+V reach the app (egui only reports a paste when the system clipboard holds text).

fn cut

pub fn cut(ctx: &egui::Context, state: &mut AppState)

Copy the selection to the clipboard and delete it (pinned elements stay).

fn paste

pub fn paste(state: &mut AppState)

Ctrl+V: place the clipboard with a click in a plan view; elsewhere paste it where it was copied. What was drawn in a view (detail lines, regions, notes, dimensions…) goes into the active view when it is a 2D view that holds such elements, else back into its own view.

fn paste_aligned

pub fn paste_aligned(state: &mut AppState, current_level: bool)

Paste where the elements were copied, on their own levels or (with current_level) on the active plan’s level.

fn paste_tool

pub fn paste_tool(ui: &Ui, resp: &Response, painter: &Painter, state: &mut AppState, view: ViewId, level: LevelId, xf: &Xf)

Paste tool: the clipboard follows the cursor (its center on the snapped point) and a click places it on the view’s level.

fn start_match_type

pub fn start_match_type(state: &mut AppState)

Start match type: with one element selected it is the source, otherwise the first click picks it.

fn match_type_tool

pub fn match_type_tool(resp: &Response, painter: &Painter, state: &mut AppState, xf: &Xf, drawing: &Drawing2D)

Match type tool: the first click picks the source, later clicks give its type to elements of the same category (a click on empty space picks again).

cc_app::commands

crates/cc_app/src/commands.rs

Interface commands: every ribbon, quick access and palette entry is a UiCommand, so its label, shortcut, description, the engine command it runs and whether it is available now (and why not) are defined once and read by every place that shows it.

Items: set_key_overrides · is_letter_keys · UiCommand · DEVICE_TOOLS · phase_view · graphics_view · invoke · run

fn set_key_overrides

pub fn set_key_overrides(keys: &std::collections::BTreeMap<String, String>)

Use keys (command id → two letters, or empty) as the custom shortcuts.

fn is_letter_keys

pub fn is_letter_keys(keys: &str) -> bool

Two ASCII capital letters, the form of the keys typed in a view.

enum UiCommand

pub enum UiCommand

Traits: Debug, Clone, Copy, PartialEq, Eq, Hash

Variants

Methods

const DEVICE_TOOLS

pub const DEVICE_TOOLS: [cc_core::DeviceKind; 4]

Communications and lightning protection devices placed by a tool of their own.

fn phase_view

pub fn phase_view(state: &AppState) -> Option<cc_core::ViewId>

The active view when it is a 2D view with a phase (plans, elevations, sections).

fn graphics_view

pub fn graphics_view(state: &AppState) -> Option<cc_core::ViewId>

The active view when it has visibility/graphics (plans, elevations, sections, 3D, drafting views).

fn invoke

pub fn invoke(state: &mut AppState, ctx: &egui::Context, command: UiCommand)

Run command if it is available; otherwise say why in the status bar.

fn run

pub fn run(state: &mut AppState, ctx: &egui::Context, command: UiCommand)

cc_app::component_env

crates/cc_app/src/component_env.rs

The component modeling environment: a workspace of its own where one component is shaped. It replaces the project’s views with the component’s plan, front, side and 3D views, the ribbon with the Create tab and the left panel with the component’s parameters, types and the selected reference plane or dimension. Every change is an engine command on the component (component_*), so it applies to every type of the component and undoes like any edit. Finish keeps the changes; Cancel undoes everything done since the environment opened.

Items: VIEW_SCALE · Pick · EnvTool · Env · open · open_on · open_new · target_type · save_file · finish · cancel · component · type_ref · plane_from_line · plane_at · piece_at · connector_at · connector_from_click · dimension_at · ribbon · options · central · set_tool · escape · delete_pick · draft_field · panel · ref_problems · types_row · params · piece_props

const VIEW_SCALE

pub(crate) const VIEW_SCALE: u32

Scale the views are drawn at (text and dimension sizes).

enum Pick

pub enum Pick

What is selected in the environment.

Traits: Debug, Clone, PartialEq

Variants

enum EnvTool

pub enum EnvTool

The tool of the environment.

Traits: Debug, Clone, PartialEq, Default

Variants

struct Env

pub struct Env

Fields

Some fields are private.

fn open

pub fn open(state: &mut AppState, type_id: ElementTypeId)

Open the environment on the component of type type_id (a title block previews the active sheet).

fn open_on

pub fn open_on(state: &mut AppState, type_id: ElementTypeId, sheet: Option<cc_core::ViewId>)

Open the environment on component type type_id; a title block previews sheet (its paper and fields), or sample values on A3 paper when there is none.

fn open_new

pub fn open_new(state: &mut AppState, type_id: ElementTypeId, start_depth: usize)

Open the environment on the component type type_id just made, at undo depth start_depth before it was: Cancel Editing removes it.

fn target_type

pub fn target_type(state: &AppState) -> Option<ElementTypeId>

The type of the selected component element, or the one the component tool places.

fn save_file

pub fn save_file(state: &mut AppState)

Save the component as a .ccomp file.

fn finish

pub fn finish(state: &mut AppState)

Leave the environment keeping the changes.

fn cancel

pub fn cancel(state: &mut AppState)

Leave the environment undoing every change made in it.

fn component

pub(crate) fn component(state: &AppState) -> Option<(String, cc_core::ComponentDef)>

The component’s definition, name and parameter values of the shown type.

fn type_ref

pub(crate) fn type_ref(state: &AppState) -> Ref

fn plane_from_line

pub fn plane_from_line(kind: ComponentViewKind, a: DVec2, b: DVec2) -> Option<(PlaneAxis, f64)>

The plane a two-click line in view kind makes: the axis it is square to and its position. Mostly vertical lines make planes of constant u.

fn plane_at

pub fn plane_at(view: &ComponentView, p: DVec2, tol: f64) -> Option<String>

The plane of view whose line passes within tol (model units) of p.

fn piece_at

pub fn piece_at(view: &ComponentView, p: DVec2, tol: f64) -> Option<usize>

The piece with an edge within tol of p.

fn connector_at

pub fn connector_at(view: &ComponentView, p: DVec2, tol: f64) -> Option<usize>

The connector whose marker is within tol of p.

fn connector_from_click

pub fn connector_from_click(view: &ComponentView, kind: ComponentViewKind, p: DVec2, tol: f64) -> Option<([String; 3], cc_core::component::ConnectorDirection)>

Where a click at p in view kind places a connector: x, y and z as expressions, each coordinate of the view locked to a plane seen edge-on within tol (else to the millimeter), the depth at 0; and the way runs leave it (down in plan, back elsewhere).

fn dimension_at

pub fn dimension_at(view: &ComponentView, p: DVec2, tol: f64) -> Option<usize>

The dimension whose text is within tol of p.

fn ribbon

pub fn ribbon(ui: &mut Ui, state: &mut AppState)

The Create tab of the ribbon.

fn options

pub fn options(ui: &mut Ui, state: &mut AppState)

The hint of the active tool, for the options bar.

fn central

pub fn central(ui: &mut Ui, state: &mut AppState)

The central area: the component’s views in tabs.

fn set_tool

pub fn set_tool(state: &mut AppState, tool: EnvTool)

fn escape

pub fn escape(state: &mut AppState)

Esc steps back: the tool’s first pick, the tool, the selection.

fn delete_pick

pub fn delete_pick(state: &mut AppState)

Delete removes the selected plane or dimension.

fn draft_field

pub(crate) fn draft_field(ui: &mut Ui, state: &mut AppState, key: &str, current: &str, width: f32) -> Option<String>

Text field that commits on Enter or when it loses focus; None until then.

fn panel

pub fn panel(ui: &mut Ui, state: &mut AppState)

The component’s types, parameters and the selection’s properties.

fn ref_problems

pub(crate) fn ref_problems(ui: &mut Ui, def: &cc_core::ComponentDef)

The planes and dimensions that do not resolve, in the danger color.

fn types_row

pub(crate) fn types_row(ui: &mut Ui, state: &mut AppState)

The type whose values the views show.

fn params

pub(crate) fn params(ui: &mut Ui, state: &mut AppState, def: &cc_core::ComponentDef, title_block: bool)

The parameters: name, value, instance and delete per row, then Add. A title block’s (title_block) numbers are plain millimeters, its texts are typed in, and a new parameter is a number starting at 0.

fn piece_props

pub fn piece_props(ui: &mut Ui, state: &mut AppState, def: &cc_core::ComponentDef, index: usize)

A piece: name, solid or void, material, shown in plans, and where a sketched one starts and ends (or its axis and angle).

cc_app::component_sketch

crates/cc_app/src/component_sketch.rs

Sketching pieces in the component modeling environment. Extrusion, Revolution, Sweep and Blend open the same sketch as outlines in plans (crate::sketch_mode), in the plan, front or side view: its drawing and modify tools, picked curves and their grips, its own undo. Finish turns the curves into the piece’s profile points: an extrusion is made at once, a revolution then asks for its axis, a sweep’s curves are its open path (the section comes from the options bar), and a blend takes a bottom outline, then a top one. Edit Sketch opens a piece’s profile again. A coordinate that lies on a reference plane seen edge-on is written as the plane’s name, so the piece follows the plane when a parameter moves it; a point on a circle or an ellipse is written from its center. Other numbers are rounded to the micrometer. Editing keeps the expressions of the points that did not move.

Items: PieceKind · PieceSketch · section_points · um · offset · snap · same · written · piece · start · edit · finish · canvas · options

enum PieceKind

pub enum PieceKind

What the sketch becomes.

Traits: Debug, Clone, Copy, PartialEq, Eq, Default

Variants

struct PieceSketch

pub struct PieceSketch

A piece being sketched: what it becomes and where it stands.

Traits: Debug, Clone, PartialEq

Fields

Methods

fn section_points

pub fn section_points(w: f64, h: f64, round: bool) -> Vec<SketchPointArg>

A sweep’s section about the path: a w by h rectangle, or a circle of diameter w, centered on it (u to the left of the path, v along the normal).

fn um

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

A number rounded to the micrometer, as an expression.

fn offset

pub fn offset(e: &str, d: f64) -> String

e + d, folded into a number when e is one.

fn snap

pub fn snap(view: &ComponentView, p: DVec2, tol: f64) -> (DVec2, bool)

The point at p in view: on the planes whose lines pass within tol (a vertical line fixes u, a horizontal one v), elsewhere rounded to the millimeter; and whether it lies on a plane.

fn same

pub(crate) fn same(a: Segment, b: Segment) -> bool

Whether two segments are the same (an arc of the same radius, the same ellipse).

fn written

pub(crate) fn written(def: &cc_core::ComponentDef, view: &ComponentView, curves: &[SketchCurve], closed: bool, old: &[ProfilePoint], extra: &[(&str, f64)]) -> Result<Vec<SketchPointArg>, String>

The profile points that draw curves (closed, or an open path), or why not; extra are names the old points’ expressions may read (a title block’s paper).

fn piece

pub fn piece(state: &AppState) -> Option<&PieceSketch>

The open sketch’s piece, if it is one.

fn start

pub fn start(state: &mut AppState, kind: PieceKind)

Start sketching a new piece of kind.

fn edit

pub fn edit(state: &mut AppState, index: usize)

Open the sketch of piece index (Edit Sketch).

fn finish

pub fn finish(state: &mut AppState)

Finish: the piece from the curves, or the next step (a revolution’s axis, a blend’s top); a sketch that does not make a profile stays open.

fn canvas

pub fn canvas(ui: &Ui, resp: &Response, painter: &Painter, state: &mut AppState, view: &ComponentView, kind: ComponentViewKind, xf: &Xf, tol: f64)

The piece sketch in one of the environment’s views: drawn in the view it started in, snapping to the sketch’s points and the reference planes.

fn options

pub fn options(ui: &mut Ui, state: &mut AppState)

The piece’s options in the options bar: solid or void, a sweep’s section, and what the sketch is waiting for.

cc_app::connection_ui

crates/cc_app/src/connection_ui.rs

Connections in the app: the Structure tab’s Connections buttons, which run connections_create on the selected members (else the active level’s), and the rows of a selected connection, whose sizes change through element_set.

Items: place · edit · props

fn place

pub fn place(state: &mut AppState, kind: ConnectionKind)

Place connections of kind with their default sizes: on the selected columns (base plates) or beams, else on the active level’s; the result goes to the status bar.

fn edit

pub fn edit(state: &mut AppState, id: ElementId, field: &str, f: impl FnOnce(&mut Connection))

Change connection id as f changes a copy of it (element_set); edits under one field merge while dragging.

fn props

pub fn props(ui: &mut Ui, state: &mut AppState, id: ElementId, connection: &Connection)

The rows of a selected connection.

cc_app::curtain_ui

crates/cc_app/src/curtain_ui.rs

Curtain walls in the app: the Curtain Grid tool (add and remove grid lines, merge cells across a segment, swap panels by clicking a curtain wall in a plan, elevation or section), its options bar, the grid rows of the properties palette and the curtain sections of the Type Properties dialog. Every change runs an engine command (curtain_grid_set, curtain_panel_set, type_set).

Items: GridMode · PanelChoice · CurtainOptions · grid_tool · has_curtain_type · new_type_label · new_curtain_type · options_bar · palette_rows · type_sections

enum GridMode

pub enum GridMode

What a click of the Curtain Grid tool does.

Traits: Debug, Clone, Copy, PartialEq, Eq, Default

Variants

Methods

enum PanelChoice

pub enum PanelChoice

The panel the tool puts in.

Traits: Debug, Clone, Copy, PartialEq, Eq, Default

Variants

struct CurtainOptions

pub struct CurtainOptions

Options of the Curtain Grid tool.

Traits: Debug, Clone, Copy, PartialEq, Default

Fields

fn grid_tool

pub fn grid_tool(resp: &egui::Response, painter: &egui::Painter, state: &mut AppState, view: &View, xf: &Xf)

The Curtain Grid tool: hovering a curtain wall shows what a click does (the line to add or remove, the segment, the panel); clicking does it.

fn has_curtain_type

pub fn has_curtain_type(state: &AppState) -> bool

Whether the project has a curtain wall type.

fn new_type_label

pub fn new_type_label() -> String

The wall tool’s list entry that makes a curtain type.

fn new_curtain_type

pub fn new_curtain_type(state: &mut AppState) -> Option<ElementTypeId>

The project’s first curtain wall type, made (glass between steel mullions) when it has none.

fn options_bar

pub fn options_bar(ui: &mut Ui, state: &mut AppState)

The options bar of the Curtain Grid tool.

fn palette_rows

pub fn palette_rows(ui: &mut Ui, state: &mut AppState, el: &Element, w: &cc_core::Wall)

The grid of a selected curtain wall: its columns and rows, panel count, glazed area and mullion length, and resetting a direction to the type’s lines.

fn type_sections

pub fn type_sections(ui: &mut Ui, state: &mut AppState, ty: &ElementType)

The curtain sections of the Type Properties dialog: both grids, the panel and the three kinds of mullions.

cc_app::design_options_ui

crates/cc_app/src/design_options_ui.rs

Design options in the application: the Design Options dialog (sets, their options and primary option, accepting the primary), the menu of the option being edited, and the option rows of view, template and element properties. Every change goes through the engine’s commands; OK keeps the dialog’s changes, Cancel undoes them.

Items: OptionsDialog · open · show · active_label · active_menu · view_section · template_rows · element_rows

struct OptionsDialog

pub struct OptionsDialog

The open Design Options dialog.

Some fields are private.

fn open

pub fn open(state: &mut AppState)

fn show

pub fn show(ctx: &Context, state: &mut AppState)

fn active_label

pub fn active_label(state: &AppState) -> String

The name of the option being edited, or of the main model.

fn active_menu

pub fn active_menu(ui: &mut Ui, state: &mut AppState)

The menu of the option being edited: the main model, then every option.

fn view_section

pub fn view_section(ui: &mut Ui, state: &mut AppState, view: ViewId)

The Design Options section of a view’s properties (plans, elevations, sections, 3D views and schedules): the option shown of each set, read-only when the view’s template controls it.

fn template_rows

pub fn template_rows(ui: &mut Ui, state: &mut AppState, template: cc_core::TemplateId)

A view template’s choices (in the template manager’s grid).

fn element_rows

pub fn element_rows(ui: &mut Ui, state: &mut AppState, el: &Element)

The design option an element belongs to (hosted elements show their host’s, read-only).

cc_app::detail_component_ui

crates/cc_app/src/detail_component_ui.rs

Detail components in the app: the Detail Component tool (Annotate tab), which places a type in the active 2D view with the rotation, scale and mirror of its options (detail_component_place); Create Detail Component, which makes a type from the selected detail lines, regions, texts and detail components of the view and puts it in their place (detail_component_create); and the rows of a placed one in the properties palette. Pieces are edited with the component_sheet_piece_* commands (the command palette).

Items: PlaceOptions · options · tool · selection · create_from_selection · props

struct PlaceOptions

pub struct PlaceOptions

Options of the Detail Component tool.

Traits: Debug, Clone, Copy, PartialEq, Default

Fields

fn options

pub fn options(ui: &mut Ui, state: &mut AppState)

The options bar of the tool: rotation, scale and mirror.

fn tool

pub fn tool(ui: &Ui, resp: &Response, painter: &Painter, state: &mut AppState, view: &View, type_id: ElementTypeId, xf: &Xf)

The Detail Component tool: the type follows the cursor; a click places it.

fn selection

pub fn selection(state: &AppState) -> Option<(cc_core::ViewId, Vec<ElementId>)>

The view and the selected elements a detail component can be made of: detail lines, regions, text notes and detail components, all of the active view (one that holds drawings).

fn create_from_selection

pub fn create_from_selection(state: &mut AppState)

Create Detail Component: the selection becomes a new detail component type (named Detail 1, Detail 2…, renamed in its type’s properties), placed where the elements were; the new element is selected.

fn props

pub fn props(ui: &mut Ui, state: &mut AppState, id: ElementId, c: &DetailComponent)

A placed detail component in the properties palette: its component and view, and its rotation, scale and mirror.

cc_app::detail_ui

crates/cc_app/src/detail_ui.rs

Detail lines in the app: the Detail Line tool (Annotate tab) with its line, polyline, arc, circle, ellipse and rectangle modes and the line style in the options bar, the grips of selected detail lines (ends, centers, an arc’s middle, axis points), their properties, and their previews in the Split and Offset tools. The tool draws with the sketch mode’s curve tools (see crate::sketch_mode::draw) and makes each curve an element through detail_line_create as soon as it is drawn; a polyline goes on from the last end until it closes or Esc.

Items: DetailMode · DetailOptions · DetailDraw · tool · create · typing · typed_target · escape · view_owned · near · grips · split_pick · offset_pick · options · style_label · style_picker · props

enum DetailMode

pub enum DetailMode

How the Detail Line tool draws.

Traits: Debug, Clone, Copy, PartialEq, Eq, Default

Variants

Methods

struct DetailOptions

pub struct DetailOptions

Options of the Detail Line tool (kept between uses, in the options bar).

Traits: Debug, Clone, Copy, PartialEq, Eq, Default

Fields

struct DetailDraw

pub struct DetailDraw

The curve being drawn in a view.

Traits: Debug, Clone

Some fields are private.

fn tool

pub fn tool(ui: &Ui, resp: &Response, painter: &Painter, state: &mut AppState, view: &cc_core::View, xf: &Xf)

The Detail Line tool in a 2D view: snaps, previews the curve and makes each finished curve a detail line of the view.

fn create

pub(crate) fn create(state: &mut AppState, view: ViewId, style: LineStyleRef, curves: &[SketchCurve])

Make curves detail lines of view (one undo step); they are selected.

fn typing

pub fn typing(state: &AppState) -> bool

The Detail Line tool takes typed values now: it has the first point of a line, arc, circle, ellipse or rectangle.

fn typed_target

pub fn typed_target(state: &mut AppState) -> &mut TypedInput

Where typed values go: the detail line being drawn (see typing), else the other tools’ lengths.

fn escape

pub fn escape(state: &mut AppState) -> bool

Esc while a curve is being drawn: drop the typed value, else its picks. Returns whether it did.

fn view_owned

pub fn view_owned(state: &AppState, tool: &Tool) -> bool

Whether a modify tool may run outside a plan: the elements it moves are all owned by a view (detail lines, texts, dimensions), whose coordinates are the view’s own. Tools that pick their element take only detail lines there (see crate::modify).

fn near

pub fn near(line: &DetailLine, p: DVec2, r: f64) -> bool

Whether a detail line passes within r of p (a quick bounds check for snapping).

fn grips

pub fn grips(ui: &Ui, resp: &Response, painter: &Painter, state: &mut AppState, xf: &Xf) -> bool

The grips of the selected detail lines of the active view: dragging one reshapes the line (element_set). Returns whether it took the pointer.

fn split_pick

pub fn split_pick(painter: &Painter, xf: &Xf, state: &mut AppState, id: ElementId, raw: DVec2, click: bool) -> bool

The Split tool over a detail line: a tick where it splits; a click splits it. Returns whether id is a detail line.

fn offset_pick

pub fn offset_pick(painter: &Painter, xf: &Xf, state: &mut AppState, id: ElementId, raw: DVec2, distance: f64, click: bool) -> bool

The Offset tool over a detail line: the copy on the cursor’s side at the distance of the options bar; a click makes it. Returns whether id is a detail line.

fn options

pub fn options(ui: &mut Ui, state: &mut AppState)

The options bar of the Detail Line tool: the mode and the line style.

fn style_label

pub fn style_label(style: Option<LineStyleRef>, styles: &LineStyles) -> String

The name of a line style as shown: a built-in style’s translated name, a project style’s own name; None (no line) when allowed.

fn style_picker

pub fn style_picker(ui: &mut Ui, id: impl std::hash::Hash + std::fmt::Debug, styles: &LineStyles, style: &mut Option<LineStyleRef>, allow_none: bool) -> bool

A combo box of the built-in line styles and the project’s (and “none” with allow_none); returns whether it changed.

fn props

pub fn props(ui: &mut Ui, state: &mut AppState, id: ElementId, line: &DetailLine)

The properties of a selected detail line: its style, view and size.

cc_app::dialog

crates/cc_app/src/dialog.rs

Standard dialog frame shared by every modal window: a header with the title and a close button, a padded body (with an icon for alerts) and a footer with the buttons. Footer conventions: action buttons are right-aligned in the usual desktop order (main action first, Cancel last), auxiliary buttons sit on the left, the main action is highlighted and destructive actions are red. Esc and the close button dismiss the dialog, like Cancel; clicks outside are ignored.

Items: BUTTON_SIZE · Kind · Style · styled_button · Footer · DialogResponse · Dialog · two_columns

const BUTTON_SIZE

pub const BUTTON_SIZE: egui::Vec2

Minimum size of footer buttons.

enum Kind

pub enum Kind

Icon shown next to the message of an alert.

Traits: Debug, Clone, Copy, PartialEq, Eq

Variants

enum Style

pub enum Style

Visual weight of a footer button.

Traits: Debug, Clone, Copy, PartialEq, Eq

Variants

fn styled_button

pub fn styled_button(ui: &mut Ui, label: &str, style: Style) -> egui::Response

A highlighted button with the standard footer size.

pub struct Footer

Footer buttons, declared in display order; Dialog::show reports which was clicked.

Traits: Default

Some fields are private.

Methods

struct DialogResponse

pub struct DialogResponse

Fields

struct Dialog

pub struct Dialog

Some fields are private.

Methods

fn two_columns

pub fn two_columns(ui: &mut Ui, widths: [f32; 2], mut column: impl FnMut(&mut Ui, usize))

Two top-down columns side by side (a list and its details), with a divider as tall as the taller column; column draws column 0 (left) and 1 (right). ui.separator() in a row takes the available height instead, and in a modal that grows with the modal every frame until the dialog runs off the window.

cc_app::dialog::session

crates/cc_app/src/dialog.rs

Edits made while a data dialog is open can be cancelled as a whole: the dialog remembers the undo depth when it opens and undoes back to it.

Items: begin · commit · cancel

fn begin

pub fn begin(state: &mut AppState)

Mark the start of the dialog’s edits (no-op if already marked).

fn commit

pub fn commit(state: &mut AppState)

Keep the edits.

fn cancel

pub fn cancel(state: &mut AppState)

Undo every edit made since begin.

cc_app::dialogs

crates/cc_app/src/dialogs.rs

Application dialogs, all built on crate::dialog::Dialog.

Items: show · ok_cancel · add_project_field · rename_project_field · remove_project_field · material_combo

fn show

pub fn show(ctx: &Context, state: &mut AppState)

fn ok_cancel

pub(crate) fn ok_cancel(state: &mut AppState, response: &crate::dialog::DialogResponse, ok: usize) -> bool

Footer of a data dialog: OK keeps the edits, Cancel (or Esc / close) undoes them. Returns true when the dialog closes.

fn add_project_field

pub(crate) fn add_project_field(state: &mut AppState) -> bool

Add a project field with an unused name (Field 1, Field 2…) and no value.

fn rename_project_field

pub(crate) fn rename_project_field(state: &mut AppState, old: &str, new: &str) -> bool

Rename project field old (refused when the new name is empty or taken).

fn remove_project_field

pub(crate) fn remove_project_field(state: &mut AppState, name: &str) -> bool

Remove project field name.

fn material_combo

pub(crate) fn material_combo(ui: &mut Ui, state: &AppState, id: impl Hash + std::fmt::Debug, current: &mut String) -> bool

cc_app::dim_edit

crates/cc_app/src/dim_edit.rs

Editing measured values in place. Clicking the text of a selected dimension (or double-clicking a dimension) opens a small field over the view; Enter applies the value, Esc or a click elsewhere cancels. Dimensions store points, not references, so a new value moves what the dimension touches: the elements whose linework passes through its moving end (b, or a when only that end touches something). Elements crossing the move direction translate; walls, beams and grids along it stretch their nearest end. This works in plans, where drawing coordinates are model coordinates; elsewhere only free dimensions change.

Items: Target · ValueEdit · open · canvas · show · apply_text · set_dimension_value · Temp · temps

enum Target

pub enum Target

What an edited value drives.

Traits: Debug, Clone, PartialEq

Variants

struct ValueEdit

pub struct ValueEdit

The open value field.

Traits: Debug, Clone

Some fields are private.

fn open

pub fn open(state: &mut AppState, view: ViewId, target: Target, at: Pos2)

Open the value field for target at the screen point at.

fn canvas

pub fn canvas(ui: &Ui, resp: &Response, painter: &Painter, state: &mut AppState, view: ViewId, xf: &Xf, px_per_mm: f64, drawing: &Drawing2D) -> bool

Clicks on dimension text with the Select tool open the value field. Returns true when the pointer was used (the tools skip the frame).

fn show

pub fn show(ui: &Ui, state: &mut AppState, view: ViewId)

The value field over view, when open there.

fn apply_text

pub fn apply_text(state: &mut AppState, target: &Target, text: &str) -> Result<(), String>

Parse text for target and apply it.

fn set_dimension_value

pub fn set_dimension_value(state: &mut AppState, id: ElementId, value: f64) -> Result<(), String>

Give dimension id the measured value (meters, or radians for angles) through the engine’s dimension_set_value.

struct Temp

pub struct Temp

A temporary dimension of the selected element: from a point of it to the nearest reference linework, editable to move the element.

Traits: Debug, Clone, PartialEq

Fields

fn temps

pub fn temps(state: &AppState, drawing: &Drawing2D) -> Vec<Temp>

Temporary dimensions of the single selected element in a plan: walls, beams and grids to the nearest parallel linework on each side; columns and components along X and Y; doors and windows along their wall.

cc_app::dim_type_ui

crates/cc_app/src/dim_type_ui.rs

The Type Properties rows of a dimension type: the marks, witness and dimension lines and pens (Graphics) and the text (Text).

Items: type_sections

fn type_sections

pub fn type_sections(ui: &mut Ui, state: &mut AppState, ty: &ElementType)

The dimension type’s sections; nothing for other types.

cc_app::engine_edit

crates/cc_app/src/engine_edit.rs

Property edits through the engine. Panels and dialogs describe a change as a function on a copy of the object; these helpers send the result to the engine’s *_set command, merged into one undo step per key while a value is dragged. Refusals (invalid values) go to the status bar.

Items: elements · elements_identity · element · element_type · view · sheet · material · units · info · system · level · level_height

fn elements

pub fn elements(state: &mut AppState, ids: &[ElementId], key: Option<u64>, level: Option<LevelId>, params: Option<serde_json::Value>) -> bool

Change elements ids at once (elements_set): a new level and the same params merged into each, in one undo step per key.

fn elements_identity

pub fn elements_identity(state: &mut AppState, ids: &[ElementId], key: Option<u64>, mark: Option<String>, comments: Option<String>) -> bool

Give elements ids the same mark or comments (elements_set), in one undo step per key.

fn element

pub fn element(state: &mut AppState, id: ElementId, key: Option<u64>, f: impl FnOnce(&mut Element)) -> bool

Change element id as f changes a copy of it (element_set).

fn element_type

pub fn element_type(state: &mut AppState, id: ElementTypeId, key: Option<u64>, f: impl FnOnce(&mut ElementType)) -> bool

Change type id as f changes a copy of it (type_set).

fn view

pub fn view(state: &mut AppState, id: ViewId, key: Option<u64>, f: impl FnOnce(&mut View)) -> bool

Change view id as f changes a copy of it (view_set).

fn sheet

pub fn sheet(state: &mut AppState, id: ViewId, key: Option<u64>, f: impl FnOnce(&mut View)) -> bool

Change sheet id as f changes a copy of it (sheet_set): its number, paper, title block, per-sheet field values and issue date, in one undo step per key.

fn material

pub fn material(state: &mut AppState, name: &str, key: Option<u64>, f: impl FnOnce(&mut Material)) -> bool

Change material name as f changes a copy of it (material_set; renaming has its own command).

fn units

pub fn units(state: &mut AppState, key: Option<u64>, f: impl FnOnce(&mut cc_core::Units)) -> bool

Change the project units as f changes a copy of them (units_set).

fn info

pub fn info(state: &mut AppState, key: Option<u64>, f: impl FnOnce(&mut cc_core::ProjectInfo)) -> bool

Change the project information as f changes a copy of it (project_info_set).

fn system

pub fn system(state: &mut AppState, id: cc_core::SystemId, key: Option<u64>, f: impl FnOnce(&mut cc_core::MepSystem)) -> bool

Change plumbing system or circuit id as f changes a copy (system_set).

fn level

pub fn level(state: &mut AppState, id: LevelId, key: Option<u64>, f: impl FnOnce(&mut Level)) -> bool

Rename a level or change its elevation as f changes a copy (level_set).

fn level_height

pub fn level_height(state: &mut AppState, id: LevelId, key: Option<u64>, height: f64) -> bool

Set the height from a level up to the next one; the levels above move along (level_set).

cc_app::fill_patterns_dialog

crates/cc_app/src/fill_patterns_dialog.rs

The Fill Patterns dialog (Manage → Fill Patterns, also opened from the material browser and a filled region type’s fill): the built-in patterns, read only, and the project’s own with a drawn swatch each; the selected one’s name, description, kind (drafting or model), scale and line families, edited in place over a live preview. Import .pat… reads a file and lets the user pick which of its patterns come in; New, Duplicate and Delete (with the pattern that takes its place where it is used) complete it. Every change runs a fill_pattern_* command; OK keeps them, Cancel undoes them all (dialog::session, through crate::graphics_dialog::Edits). The module also holds what the pattern pickers share: labels, swatches and the picker itself, listing custom patterns after the built-ins.

Items: label · choices · paint · swatch · picker · FillPatternsDialog · open · show · open_import

fn label

pub fn label(project: &Project, p: Pattern) -> String

A pattern’s name: the built-in’s, translated, or the project pattern’s.

fn choices

pub fn choices(project: &Project) -> Vec<(Pattern, String)>

The patterns a picker offers: the built-in ones, then the project’s.

fn paint

pub fn paint(painter: &egui::Painter, rect: Rect, project: &Project, pattern: Pattern, color: [u8; 3], spacing: f64)

Paint pattern in color over rect (built-ins with lines spacing points apart); Solid fills it.

fn swatch

pub fn swatch(ui: &mut Ui, project: &Project, pattern: Pattern, size: egui::Vec2) -> egui::Response

A small framed swatch of pattern in black on white.

fn picker

pub fn picker(ui: &mut Ui, id: impl std::hash::Hash + std::fmt::Debug, project: &Project, value: &mut Pattern, width: f32) -> bool

A drop-down of every pattern (custom ones after the built-ins, each with its swatch); returns whether the choice changed.

struct FillPatternsDialog

pub struct FillPatternsDialog

The open Fill Patterns dialog.

Some fields are private.

fn open

pub fn open(state: &mut AppState)

fn show

pub fn show(ctx: &Context, state: &mut AppState)

fn open_import

pub fn open_import(state: &mut AppState, path: PathBuf)

Read the patterns of the .pat file at path and offer them.

cc_app::gestures

crates/cc_app/src/gestures.rs

Scroll and pinch gestures over the views (issue #174). egui adds the mouse wheel and a trackpad’s two-finger scroll into one scroll delta. The views tell them apart by the wheel events of the frame: a wheel reports lines (or pages), a trackpad reports points. A wheel zooms, as in CAD programs; with the Trackpad scrolling pans preference (on by default) two fingers move the view and a pinch zooms. The kind of the last wheel event is remembered, since egui spreads a wheel notch over a few frames that have no events of their own.

Items: set_trackpad_pans · Gesture · read

fn set_trackpad_pans

pub fn set_trackpad_pans(on: bool)

Follow the Trackpad scrolling pans preference.

struct Gesture

pub struct Gesture

What the scroll and pinch of this frame ask a view to do.

Traits: Debug, Clone, Copy, PartialEq

Fields

Methods

fn read

pub fn read(ui: &Ui) -> Gesture

The gesture of this frame (call it only while the view is hovered).

cc_app::gpu

crates/cc_app/src/gpu.rs

Graphics start-up: which wgpu backends the window tries, in what order, and what its device asks of the adapter. The native APIs (Vulkan, DirectX 12, Metal) are tried first and OpenGL after them, unless WGPU_BACKEND names the backends to use. A start-up that fails with an error moves on to the next API in the same process; one that panics before the first frame restarts the app once; one that kills the process (a driver crash) leaves a marker file behind, so the next start tries the other API first. Once OpenGL has been needed it stays first (gpu-backend in the data folder; delete it to try the native APIs again). Every failure is written to the crash log.

Items: Api · plan · required_limits · wgpu_options · startup_plan · begin · started · note_frame · failed · restart · report_failure

enum Api

pub enum Api

A family of graphics backends to start the window with.

Traits: Clone, Copy, Debug, PartialEq, Eq

Variants

Methods

fn plan

pub fn plan(env: Option<wgpu::Backends>, saved: Option<Api>, interrupted: Option<Api>) -> Vec<Api>

The APIs to try, in order: only those of WGPU_BACKEND when it names any (env); otherwise the native APIs and OpenGL, the other API first when the last start-up died with one (interrupted), else OpenGL first once it was needed (saved).

fn required_limits

pub fn required_limits(backend: wgpu::Backend, adapter: &wgpu::Limits) -> wgpu::Limits

The limits the device asks for: wgpu’s defaults (WebGL 2’s on OpenGL) with textures up to 8192 px (a depth buffer as large as a 4K+ window), lowered to what the adapter supports, since asking for more than it has fails the start.

fn wgpu_options

pub fn wgpu_options(api: Api) -> egui_wgpu::WgpuConfiguration

eframe’s wgpu options for a start-up with api.

fn startup_plan

pub fn startup_plan() -> Vec<Api>

The APIs to try at this start, from WGPU_BACKEND and the files of earlier start-ups (a marker left behind by one that died is logged).

fn begin

pub fn begin(api: Api)

A start-up with api begins: write its marker.

fn started

pub fn started() -> bool

Whether the start-up under way has shown its first frame.

fn note_frame

pub fn note_frame()

Called at the start of every frame: at the second, the first has been shown, so the start-up worked; remove its marker and keep OpenGL first if it took OpenGL.

fn failed

pub fn failed(api: Api, error: &str)

A start-up with api failed with an error: log it and remove its marker.

fn restart

pub fn restart(api: Api) -> bool

After a panic before the first frame: start the app again (once), which then tries the other API first (the marker is still there). Returns whether it was started.

fn report_failure

pub fn report_failure(error: &str)

Every API failed: log it and tell the user (the app has no window).

cc_app::graph_ui

crates/cc_app/src/graph_ui.rs

Visual programming: the graph editor, a panel under the views. The graph (cc_engine::graph::Graph) is edited here and run through the engine’s graph_run command, like every model change of the app; the nodes come from graph_nodes (built-in nodes, the Lua node and a node per engine command). The canvas is drawn with egui’s painter: nodes, ports colored by type, wires as curves, the value or error of each node under it; an inspector on the right edits the selected node’s inputs, Lua code and lacing.

Items: GraphEditor · toggle · run · open_path · keys · show

struct GraphEditor

pub struct GraphEditor

The graph editor’s state (AppState::graph).

Traits: Default

Fields

Some fields are private.

fn toggle

pub fn toggle(state: &mut AppState)

Open or close the panel.

fn run

pub fn run(state: &mut AppState)

Run the graph through the engine (one undo step).

fn open_path

pub fn open_path(state: &mut AppState, path: PathBuf)

Open the graph file at path in the editor.

fn keys

pub fn keys(ctx: &egui::Context, state: &mut AppState, undo: bool, redo: bool, save: bool, save_as: bool) -> bool

Keys while the pointer is over the panel; returns whether the graph took them.

fn show

pub fn show(ui: &mut Ui, state: &mut AppState)

The panel: toolbar, canvas and inspector.

cc_app::graphics_dialog

crates/cc_app/src/graphics_dialog.rs

View graphics dialogs: Visibility/Graphics of a view or view template (categories and filters), graphic overrides of selected elements, the view filter editor and the view template manager. Every change goes through the engine’s commands; OK keeps the changes, Cancel undoes them.

Items: Target · Edits · GraphicsDialog · OverrideDialog · FilterEditor · TemplateManager · key · run · overrides_json · open · open_overrides · open_filters · open_templates · show · override_cells · header · override_headers · view_rows · controlled

enum Target

pub enum Target

Whose graphics are edited.

Traits: Debug, Clone, Copy, PartialEq, Eq, Hash

Variants

struct Edits

pub struct Edits

Edits made while a dialog is open, cancelled as a whole. A dialog opened over another one undoes back to its own start (the outer one owns the shared session).

Traits: Debug, Clone, Copy

Some fields are private.

Methods

struct GraphicsDialog

pub struct GraphicsDialog

The open Visibility/Graphics dialog.

Fields

Some fields are private.

struct OverrideDialog

pub struct OverrideDialog

The open element override dialog.

Some fields are private.

struct FilterEditor

pub struct FilterEditor

The open filter editor.

Some fields are private.

struct TemplateManager

pub struct TemplateManager

The open view template manager.

Some fields are private.

fn key

pub(crate) fn key(v: impl Hash) -> u64

fn run

pub(crate) fn run<C: cc_engine::Command + serde::Serialize>(state: &mut AppState, merge: Option<u64>, command: C) -> bool

fn overrides_json

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

fn open

pub fn open(state: &mut AppState, target: Target)

Open Visibility/Graphics for a view or template.

fn open_overrides

pub fn open_overrides(state: &mut AppState)

Open the override dialog for the selected elements in the active view.

fn open_filters

pub fn open_filters(state: &mut AppState)

fn open_templates

pub fn open_templates(state: &mut AppState)

fn show

pub fn show(ctx: &Context, state: &mut AppState)

fn override_cells

pub(crate) fn override_cells(ui: &mut Ui, ov: &mut GraphicOverride, enabled: bool, choices: &[(Pattern, String)]) -> bool

The override cells of one row, in the column order of override_headers.

fn header

pub(crate) fn header(ui: &mut Ui, text: String)

fn override_headers

pub(crate) fn override_headers(ui: &mut Ui)

fn view_rows

pub fn view_rows(ui: &mut Ui, state: &mut AppState, view: ViewId)

The view’s template and Visibility/Graphics in its properties.

fn controlled

pub fn controlled(state: &AppState, view: ViewId, what: &str) -> bool

Whether the view’s template controls what (scale, detail, visual_style, cut_height, discipline, structural), for read-only rows.

cc_app::grid_frame_ui

crates/cc_app/src/grid_frame_ui.rs

Structure → Grid Frame: the levels, the types (of the tab’s material) and optional secondary beams for grid_frame_create.

Items: GridFrameDialog · open · combo · show

struct GridFrameDialog

pub struct GridFrameDialog

Traits: Debug, Clone

Fields

fn open

pub fn open(state: &mut AppState)

Open the dialog: from the active level (else the lowest) to the next one.

fn combo

pub(crate) fn combo<T: PartialEq + Copy>(ui: &mut egui::Ui, id: &str, value: &mut T, items: &[(T, String)])

fn show

pub fn show(ctx: &Context, state: &mut AppState)

cc_app::home

crates/cc_app/src/home.rs

Home screen: open or create a project, recent projects and samples.

Items: sample_project · show · push_recent

fn sample_project

pub fn sample_project(name: &str) -> Option<Project>

fn show

pub fn show(ui: &mut Ui, state: &mut AppState)

fn push_recent

pub fn push_recent(recent: &mut Vec<PathBuf>, path: &Path, max: usize)

Remember path at the top of the recent projects list, which keeps at most max (at least one).

cc_app::i18n

crates/cc_app/src/i18n.rs

Localization lives in the engine (cc_engine::i18n), so the GUI, the command line and the MCP server name things alike; this module re-exports it and defines the app’s t! macro.

Re-exports

Items: t

macro t

macro_rules! t

t!("key") or t!("key", "name" => value, ...).

cc_app::icons

crates/cc_app/src/icons.rs

Interface icons: SVG drawings in assets/icons/ui (24 x 24 grid, white strokes and fills), rasterized with resvg at the exact pixel size they are shown at and tinted with theme colors: strokes in one tone, soft fills in a second (see Tones), and an optional Badge marks what kind of action a command is. Textures are cached per icon, layer and size, so each one is rasterized once.

Items: Icon · Badge · Tones · paint · paint_toned

enum Icon

pub enum Icon

Traits: Debug, Clone, Copy, PartialEq, Eq, Hash

Variants

Methods

enum Badge

pub enum Badge

A small mark in the bottom-right corner of an icon telling what kind of action it is.

Traits: Debug, Clone, Copy, PartialEq, Eq, Hash

Variants

struct Tones

pub struct Tones

Colors of a two-tone icon and its badge.

Traits: Debug, Clone, Copy

Fields

Methods

fn paint

pub fn paint(painter: &Painter, rect: Rect, icon: Icon, color: Color32)

Paint icon centered in rect (the largest square that fits), in one color.

fn paint_toned

pub fn paint_toned(painter: &Painter, rect: Rect, icon: Icon, tones: Tones, badge: Option<Badge>)

Paint icon in two tones, with an optional badge.

cc_app::jobs

crates/cc_app/src/jobs.rs

Long commands (opening a project, importing IFC, DWG/DXF, SketchUp, pictures, component files) run on a worker thread over a copy of the document, while a modal dialog shows what is being read and for how long. The app keeps drawing the document as it was; when the command ends, its document comes back to the UI thread, which installs it and reports. Only one job runs at a time, and while it runs the dialog blocks the interface and busy keeps keyboard shortcuts and dropped files out, so nothing edits the document the job’s copy will replace.

Items: Base · Finish · Job · busy · start · poll · wait · cancel · show

enum Base

pub enum Base

What the command runs on.

Traits: Debug, Clone, Copy, PartialEq, Eq

Variants

type alias Finish

pub type Finish = Box<dyn FnOnce(&mut AppState, Result<Value, EngineError>, Option<Document>)>

The step that runs on the UI thread when the command ends: the answer, and for a Base::Fresh job that succeeded, the new document.

struct Job

pub struct Job

A running job.

Some fields are private.

fn busy

pub fn busy(state: &AppState) -> bool

A job is running: shortcuts, dropped files and new jobs wait.

fn start

pub fn start(state: &mut AppState, title: String, path: PathBuf, base: Base, run: impl FnOnce(&mut Session) -> Result<Value, EngineError> + Send + 'static, finish: Finish)

Run run on a worker thread over the document base names, showing the progress dialog titled title for path; finish reports the result.

fn poll

pub fn poll(state: &mut AppState)

Install the result of a job that ended; call it once per frame.

fn wait

pub fn wait(state: &mut AppState)

Wait for the running job and install its result (at startup, before the window shows, and in tests).

fn cancel

pub fn cancel(state: &mut AppState)

Stop waiting for the running job: its result is dropped and the document stays as it was.

fn show

pub fn show(ctx: &Context, state: &mut AppState)

The progress dialog of the running job.

cc_app::level_mark_ui

crates/cc_app/src/level_mark_ui.rs

Level marks in the app: the tool that places them in plans, elevations and sections (through level_mark_create), their rows in the properties palette and the rows of their type.

Items: hosts · tool · props · type_rows

fn hosts

pub fn hosts(view: &View) -> bool

Whether level marks go in view: plans, elevations and sections.

fn tool

pub fn tool(ui: &Ui, resp: &Response, painter: &Painter, state: &mut AppState, view: &View, type_id: ElementTypeId, xf: &Xf, drawing: &Drawing2D)

The Level Mark tool: the levels a mark would write follow the cursor; a click places one.

fn props

pub fn props(ui: &mut Ui, state: &mut AppState, id: ElementId, mark: &LevelMark)

A level mark in the properties palette: its view, the side of its values, the levels it writes (measured, or set) and whether the raw one shows.

fn type_rows

pub fn type_rows(ui: &mut Ui, state: &mut AppState, tid: ElementTypeId, data: &TypeData)

The rows of a level mark type: text size, datum and the suffixes.

cc_app::library

crates/cc_app/src/library.rs

Component library: browse the component files (.ccomp) of the folders the user adds (such as a copy of the ConstructCraft Components library), search them, see a component’s types, parameters, connectors and plan, load it into the project, and save the project’s components into a library folder. Listing, loading and saving are engine commands.

Items: Entry · Library · open · show

struct Entry

pub struct Entry

A component file found in a library folder (from component_library_list).

Traits: Debug, Clone, Default

Fields

struct Library

pub struct Library

State of the open library window.

Traits: Debug, Clone, Default

Fields

Some fields are private.

fn open

pub fn open(state: &mut AppState)

Open the library window, reading the folders.

fn show

pub fn show(ctx: &Context, state: &mut AppState)

cc_app::line_styles_dialog

crates/cc_app/src/line_styles_dialog.rs

The Line Styles dialog (Annotate → Line Styles): the built-in line styles, read only, and the project’s own, whose name, weight, color and dash pattern are edited in place; New adds one and Delete removes the selected one (what uses it moves to the thin style). Every change runs a line_style_* command; OK keeps them, Cancel undoes them all (dialog::session, through crate::graphics_dialog::Edits).

Items: LineStylesDialog · open · show

struct LineStylesDialog

pub struct LineStylesDialog

The open Line Styles dialog.

Some fields are private.

Methods

fn open

pub fn open(state: &mut AppState)

fn show

pub fn show(ctx: &Context, state: &mut AppState)

cc_app::lps_cabling_ui

crates/cc_app/src/lps_cabling_ui.rs

Lightning protection and structured cabling in the app: the tools that place air terminals, earth electrodes, racks and data outlets (their built-in types made on first use by device_type_create), the earth ring around the walls, the coverage check (lps_check) and the cabling per rack (cabling_list). Every change is an engine command.

Items: device_tool · earth_ring · show · meters_text

fn device_tool

pub fn device_tool(state: &mut AppState, device: DeviceKind)

Start placing devices of device: its type (made when the project has none) in the component tool, in the services plan that shows it.

fn earth_ring

pub fn earth_ring(state: &mut AppState)

An earth ring around the walls of the active level (or the lowest).

fn show

pub fn show(ctx: &Context, state: &mut AppState)

fn meters_text

pub fn meters_text(v: &Value, decimals: usize) -> String

A length in meters from a command’s output: 12,5 m in metric projects (as always), feet and inches in imperial ones.

cc_app::material_browser

crates/cc_app/src/material_browser.rs

Material browser: the project’s materials in a searchable list and the selected one’s identity, graphics, appearance and physical properties in tabs. Edits are undoable and the dialog’s Cancel reverts them all.

Items: Tab · Browser · show · KEYS

enum Tab

pub enum Tab

Traits: Debug, Clone, Copy, PartialEq, Eq, Default

Variants

struct Browser

pub struct Browser

Browser state kept between frames.

Traits: Debug, Clone, Default

Fields

fn show

pub fn show(ctx: &Context, state: &mut AppState)

const KEYS

pub const KEYS: [&str; 12]

Keys used at runtime (checked by the i18n tests).

cc_app::mcp_bridge

crates/cc_app/src/mcp_bridge.rs

constructcraft mcp (or --mcp): MCP clients pointed at the app instead of ccad get the MCP server of the ccad next to it, on the same standard input and output, instead of a window that never answers (issue #265).

Items: mcp_args · run

fn mcp_args

pub fn mcp_args(args: &[String]) -> Option<Vec<String>>

The ccad arguments for the app’s arguments, when they ask for the MCP server.

fn run

pub fn run(args: Vec<String>) -> i32

Runs ccad mcp with the app’s standard streams and returns its exit code.

cc_app::member_host_ui

crates/cc_app/src/member_host_ui.rs

Rows shared by the properties of member hosts (steel buildings, trusses): the member counts and Reset Members, and length rows that report when an edit ends.

Items: finished · length · member_rows

fn finished

pub(crate) fn finished(r: &egui::Response) -> bool

Whether a drag or a typed value ended.

fn length

pub(crate) fn length(ui: &mut Ui, label: &str, v: &mut f64, range: RangeInclusive<f64>) -> bool

A length row; true when the edit ended.

fn member_rows

pub(crate) fn member_rows(ui: &mut Ui, host: &dyn MemberHost) -> bool

The members and detached counts and Reset Members (enabled when a role is detached); true when it was clicked: the caller clears the host’s detached roles in its own edit.

cc_app::modify

crates/cc_app/src/modify.rs

Transform tools on the selection: move, copy, rotate, mirror (picking a line or drawing the axis) and linear array. Each works in plan views, previews the result as a ghost of the selection’s linework and applies in one undo step.

Items: ModifyOptions · start · start_pick · paint_ghost · handle · apply_base_target · apply_rotation · axis_of · apply_mirror · alignable · align_edge · align_command · join_tool · start_attach · attach_target · attach_tool · attach_pick · attach_to · detach_tops · join_pick · set_pinned

struct ModifyOptions

pub struct ModifyOptions

Options of the transform tools, kept between uses.

Traits: Debug, Clone, Default

Fields

fn start

pub fn start(state: &mut AppState, tool: Tool)

Start a transform tool on the current selection; without one, explain.

fn start_pick

pub fn start_pick(state: &mut AppState, tool: Tool)

Start a pick tool (trim, split, offset, align): it acts on clicked elements.

fn paint_ghost

pub(crate) fn paint_ghost(painter: &Painter, xf: &Xf, drawing: &Drawing2D, ids: &BTreeSet<ElementId>, t: &PlanTransform)

fn handle

pub fn handle(ui: &Ui, resp: &Response, painter: &Painter, state: &mut AppState, level: LevelId, xf: &Xf, drawing: &Drawing2D, tool: &Tool)

fn apply_base_target

pub(crate) fn apply_base_target(state: &mut AppState, tool: &Tool, targets: &BTreeSet<ElementId>, delta: DVec2)

Move, copy or array the targets by delta (the target point less the base point), as plans and the 3D view pick them.

fn apply_rotation

pub fn apply_rotation(state: &mut AppState, targets: &BTreeSet<ElementId>, center: DVec2, angle: f64)

Rotate (or copy rotated) by angle radians about center, and finish.

fn axis_of

pub(crate) fn axis_of(state: &AppState, id: ElementId) -> Option<(DVec2, DVec2)>

The line of a model element usable as a mirror axis (walls, grids, beams).

fn apply_mirror

pub(crate) fn apply_mirror(state: &mut AppState, targets: &BTreeSet<ElementId>, a: DVec2, b: DVec2)

Mirror (or copy mirrored) across the line through a and b, and finish.

fn alignable

pub(crate) fn alignable(state: &AppState, id: ElementId) -> bool

Whether an element can be aligned or aligned to: it has a location line (wall, beam, grid) or vertical faces to align by (column, component).

fn align_edge

pub(crate) fn align_edge(state: &AppState, id: ElementId, at: DVec2) -> Option<(DVec2, DVec2)>

The plan line Align uses when element id is picked at at, as the engine does: the face or side nearest to the pick, else its location line.

fn align_command

pub(crate) fn align_command(id: ElementId, pick: DVec2, reference: ElementId, reference_pick: DVec2) -> cmd::ElementAlign

Align id (picked at pick) onto reference (picked at reference_pick), in plan.

fn join_tool

pub fn join_tool(resp: &Response, painter: &Painter, state: &mut AppState, xf: &Xf, drawing: &Drawing2D, unjoin: bool)

Join or unjoin geometry: the first pick stays, and each further pick is joined with it (or unjoined from it) until Esc.

fn start_attach

pub fn start_attach(state: &mut AppState)

Attach Top: the selected walls wait for a click on the roof, ceiling or floor their tops attach to.

fn attach_target

pub fn attach_target(state: &AppState, id: ElementId) -> bool

Whether id is something a wall’s top attaches to.

fn attach_tool

pub fn attach_tool(resp: &Response, painter: &Painter, state: &mut AppState, xf: &Xf, drawing: &Drawing2D)

The Attach Top tool: the roof, ceiling or floor under the pointer is highlighted, and a click attaches the walls’ tops to it.

fn attach_pick

pub(crate) fn attach_pick(state: &mut AppState, picked: Option<ElementId>)

A click of the Attach Top tool in a 3D view on picked: a roof, ceiling or floor takes the walls’ tops; anything else repeats the hint.

fn attach_to

pub(crate) fn attach_to(state: &mut AppState, target: ElementId)

Attach the walls the tool holds to target, then go back to selecting them.

fn detach_tops

pub fn detach_tops(state: &mut AppState)

Detach Top: the selected walls keep their own tops again.

fn join_pick

pub(crate) fn join_pick(state: &mut AppState, hovered: Option<ElementId>, unjoin: bool)

A click of the join tool on hovered (a joinable element or nothing): the first pick stays, each further one is joined with it (or unjoined).

fn set_pinned

pub fn set_pinned(state: &mut AppState, pinned: bool)

Pin or unpin the selection (one undo step).

cc_app::modify3d

crates/cc_app/src/modify3d.rs

The modify tools in the 3D view: move, copy, array, rotate and mirror the selection, align and join geometry. Points are picked on a horizontal working plane (the level of the elements changed, then the height of the first point picked) or snapped to model points near the pointer on screen: corners of solids, column and component insertion points, wall ends and grid crossings. Every result is a plan transform run through the same engine commands as in plans, so elements keep their levels: a level 2 column can be moved or aligned onto a ground-floor one.

Items: PickCache · works_in_3d · active_3d · Frame · ray_plane_z · nearest_on_screen · snap_points · ortho · handle

struct PickCache

pub struct PickCache

Cached pick data of one 3D view.

Traits: Default

Some fields are private.

fn works_in_3d

pub fn works_in_3d(tool: &Tool) -> bool

Whether tool works in the 3D view (it then takes the clicks there).

fn active_3d

pub fn active_3d(state: &AppState) -> bool

Whether the active view is a 3D view.

struct Frame

pub struct Frame

The camera of a 3D view as drawn in rect.

Traits: Debug, Clone, Copy

Fields

Some fields are private.

Methods

fn ray_plane_z

pub fn ray_plane_z(ray: Ray, z: f64) -> Option<DVec3>

Where ray meets the horizontal plane at height z (in front of its origin).

fn nearest_on_screen

pub fn nearest_on_screen(frame: &Frame, points: impl IntoIterator<Item = DVec3>, cursor: Pos2, radius: f32) -> Option<DVec3>

The point that shows nearest to cursor, within radius points; of points showing (about) as near, the one closest to the eye.

fn snap_points

pub fn snap_points(project: &Project, geom: &ModelGeometry, shown: &mut dyn FnMut(ElementId) -> bool) -> Vec<DVec3>

Model points to snap to: corners of the solids shown, the insertion points of columns and components and the ends of walls, at the bottom and top of each.

fn ortho

pub fn ortho(a: DVec2, p: DVec2) -> DVec2

Keep the plan offset from a to p along its main axis (Shift).

fn handle

pub fn handle(ui: &Ui, resp: &Response, painter: &Painter, state: &mut AppState, view_id: ViewId, frame: Frame)

Run the active tool in a 3D view (after the scene is painted).

cc_app::new_component_dialog

crates/cc_app/src/new_component_dialog.rs

The New Component dialog: a name and the kind the component is, picked from a list that shows the parameters each kind starts with (a generic component starts with none: they are the user’s to add). Create makes the component through component_create and opens it in the component environment, where it is shaped; cancelling the environment removes it.

Items: NewComponent · kinds · open · show · create · place

struct NewComponent

pub struct NewComponent

The dialog’s state: the name typed and the kind picked.

Traits: Debug, Clone

Fields

fn kinds

pub(crate) fn kinds() -> Vec<ComponentKind>

The kinds a new component may be: title blocks and detail components are 2D and made in their own places.

fn open

pub fn open(state: &mut AppState)

Open the dialog (kept as it is when already open).

fn show

pub fn show(ctx: &Context, state: &mut AppState)

fn create

pub fn create(state: &mut AppState, name: &str, kind: ComponentKind)

Create the component of kind and open it in the component environment. Cancel Editing there removes it, and Finish picks the tool that places it.

fn place

pub fn place(state: &mut AppState, type_id: ElementTypeId)

Pick the tool that places the component type type_id: doors and windows go in walls.

cc_app::new_project_dialog

crates/cc_app/src/new_project_dialog.rs

The New Project dialog: the template a new project starts from, metric or imperial, picked on one of two cards. Create goes on to actions::guarded, so the question about unsaved changes comes after the choice, and cancelling either leaves the open project as it is.

Items: open · show

fn open

pub fn open(state: &mut AppState)

Open the dialog with the template picked last (kept when it is already open).

fn show

pub fn show(ctx: &Context, state: &mut AppState)

cc_app::obj_ui

crates/cc_app/src/obj_ui.rs

Import OBJ and glTF (Insert → Import OBJ…, Import glTF…): after the file is picked, a dialog asks what the format does not say (for OBJ the units and which axis is up; for both one element or one per object), then obj_import or gltf_import runs as a background job.

Items: ObjOptions · import_obj · import_gltf · show

struct ObjOptions

pub struct ObjOptions

The choices of the import dialog, kept for the next import.

Traits: Debug, Clone, Copy, Default

Fields

fn import_obj

pub fn import_obj(state: &mut AppState)

Pick an .obj file and open the options dialog for it.

fn import_gltf

pub fn import_gltf(state: &mut AppState)

Pick a .glb or .gltf file and open the options dialog for it.

fn show

pub fn show(ctx: &Context, state: &mut AppState)

The options dialog of a picked file; OK starts the import.

cc_app::opening_place

crates/cc_app/src/opening_place.rs

Placing a door or window on a wall in a plan: where its center goes along the wall, from the cursor, a snap of its center or one of its edges to an imported drawing or the underlay (issue #251), or a distance typed from either end of the wall (issue #250), and the temporary dimensions from its center to both ends.

Items: Part · Snapped · Placement · center_range · place · paint_dimensions

enum Part

pub enum Part

Which part of the opening a snap lines up.

Traits: Debug, Clone, Copy, PartialEq, Eq

Variants

struct Snapped

pub struct Snapped

A feature of a drawing the opening was lined up with: the point snapped to and the part of the opening on it.

Traits: Debug, Clone, Copy, PartialEq

Fields

struct Placement

pub struct Placement

Where the opening goes: its center along the wall, or why it cannot.

Traits: Debug, Clone, PartialEq

Fields

fn center_range

pub fn center_range(g: &WallGeom, width: f64) -> Option<(f64, f64)>

The range of centers an opening width wide may take on g, or None when the wall is too short for it.

fn place

pub fn place(g: &WallGeom, width: f64, (u, v): (f64, f64), features: &CadSnap, r: f64, typed: &TypedInput) -> Option<Placement>

The center of an opening width wide on g for the cursor at wall-local (u, v): a typed distance first (the first field from the wall’s start, the second, after Tab, from its end; the active one wins when both are typed), else a snap of its center or an edge to features within r, else the cursor; always kept inside the wall. None when the wall is too short.

fn paint_dimensions

pub fn paint_dimensions(painter: &Painter, xf: &crate::paint::Xf, g: &WallGeom, offset: f64, side: f64, typed: &TypedInput)

Draw the temporary dimensions from the opening’s center at offset to both ends of the wall, beside its face on side side (1 left, -1 right), with the typed values in place of the measures being typed.

cc_app::paint

crates/cc_app/src/paint.rs

Painting Drawing2Ds with egui.

Items: HIGHLIGHT · PREVIEW · Xf · stroke_for · fill_polygon · PaintOptions · Budget · frame_left · frame_use · Gate · Drawn · paint_drawing · prim_shapes · text_culled · image_texture · paint_text

const HIGHLIGHT

pub const HIGHLIGHT: Color32

Highlight on the drawing paper, white in both themes.

const PREVIEW

pub const PREVIEW: Color32

struct Xf

pub struct Xf

Maps drawing coordinates to the screen.

Traits: Clone, Copy

Fields

Methods

fn stroke_for

pub fn stroke_for(style: LineStyle, highlighted: bool) -> Stroke

fn fill_polygon

pub fn fill_polygon(painter: &Painter, pts: Vec<Pos2>, color: Color32)

struct PaintOptions

pub struct PaintOptions<'a>

Fields

struct Budget

pub(crate) struct Budget

The vertices a drawing still may add, and the pixels its tiny lines took.

Fields

Some fields are private.

Methods

fn frame_left

pub(crate) fn frame_left(ctx: &egui::Context) -> usize

The vertices the drawings painted so far in this frame left.

fn frame_use

pub(crate) fn frame_use(ctx: &egui::Context, n: usize)

Count n vertices as used in this frame.

enum Gate

pub(crate) enum Gate<'a>

How a primitive is let in: by the budget (painting, or building a cached drawing), or as an earlier build decided (redrawing part of one).

Variants

enum Drawn

pub(crate) enum Drawn

What a primitive draws.

Variants

fn paint_drawing

pub fn paint_drawing(painter: &Painter, d: &Drawing2D, xf: &Xf, opts: &PaintOptions)

fn prim_shapes

pub(crate) fn prim_shapes(ctx: &egui::Context, d: &Drawing2D, prim: &Prim, xf: &Xf, opts: &PaintOptions, clip: egui::Rect, gate: &mut Gate, out: &mut Vec<Shape>) -> Drawn

The shapes of one primitive of d on screen (into out), unless it lies outside clip, is left out by opts or gate refuses it. Texts are left to the caller.

fn text_culled

pub(crate) fn text_culled(text: &str, px: f32, at: Pos2, clip: egui::Rect) -> bool

Whether a text of px points at at is too small to read or too far outside clip to reach into it.

fn image_texture

pub(crate) fn image_texture(ctx: &egui::Context, image: &std::sync::Arc<RasterImage>, faded: bool) -> Option<egui::TextureHandle>

The texture of image, decoded the first time it is shown; None when it cannot be decoded.

fn paint_text

pub(crate) fn paint_text(painter: &Painter, pos: Pos2, text: &str, px: f32, anchor: cc_views::Anchor, angle: f32)

Text anchored at pos and rotated by angle (radians, counter-clockwise on the drawing).

cc_app::paint_cache

crates/cc_app/src/paint_cache.rs

Painted drawings kept between frames. A large drawing (an imported DXF holds 100 000 primitives) is slow to turn into shapes and tessellate, and a 2D view repaints on every pointer move. PaintCache keeps each view’s drawing tessellated at the view’s zoom, in screen points relative to where it was built: a frame only moves the meshes by the pan since. It is built again when the drawing (its shared allocation), the zoom, the text scale or the pixel density changes, when the view pans past the area it was built for (the drawing is built for the view and a view’s size around it, or all of it when it fits there), or when the frame’s vertex budget changes what fits. A change of selection redraws only the chunks holding the elements whose highlight changed. Texts are laid out every frame (egui keeps the layouts), since their glyphs live in a font atlas that may be rebuilt.

Items: PaintCache

struct PaintCache

pub struct PaintCache

Painted drawings by view.

Traits: Default

Some fields are private.

Methods

cc_app::paint_ui

crates/cc_app/src/paint_ui.rs

The Paint and Remove Paint tools: click a face of an element in a 3D view to paint it with the material chosen in the options bar (paint), or to take its paint off (paint_remove).

Items: start · options_bar · pick

fn start

pub fn start(state: &mut AppState, remove: bool)

Start painting (or removing paint): the material defaults to the last one used, else the project’s first.

fn options_bar

pub fn options_bar(ui: &mut Ui, state: &mut AppState, remove: bool)

The options bar: the material to paint with, and what to do.

fn pick

pub fn pick(state: &mut AppState, view: ViewId, remove: bool, picked: Option<ElementId>, ray: cc_geom::Ray)

A click in 3D view view with the tool: picked is the element under the pointer, ray the pointer’s ray.

cc_app::palette

crates/cc_app/src/palette.rs

Command palette (Ctrl+Shift+P): search every interface command, the project’s views and the engine’s command catalog by name, description or shortcut, and run the chosen one. Engine commands open a small form with their JSON arguments, the same ones scripts and the MCP server use.

Items: Palette · open_command · toggle · show

struct Palette

pub struct Palette

The open palette.

Traits: Default

Some fields are private.

Methods

fn open_command

pub fn open_command(state: &mut AppState, name: &str)

Open the palette on the form of the engine command name (a plugin’s command from the ribbon); nothing happens for an unknown name.

fn toggle

pub fn toggle(state: &mut AppState)

Open or close the palette.

fn show

pub fn show(ctx: &egui::Context, state: &mut AppState)

cc_app::phases_dialog

crates/cc_app/src/phases_dialog.rs

Construction phases in the application: the Phases dialog (phases, phase filters and the graphics of each status), the phase rows of view and element properties, and the Demolish tool. Every change goes through the engine’s commands; OK keeps the dialog’s changes, Cancel undoes them.

Items: PhasesDialog · open · show · view_section · element_rows · demolishable · demolish · start_demolish · demolish_tool

struct PhasesDialog

pub struct PhasesDialog

The open Phases dialog.

Some fields are private.

fn open

pub fn open(state: &mut AppState)

fn show

pub fn show(ctx: &Context, state: &mut AppState)

fn view_section

pub fn view_section(ui: &mut Ui, state: &mut AppState, view: ViewId)

The Phasing section of a view’s properties (plans, elevations, sections, 3D views and schedules).

fn element_rows

pub fn element_rows(ui: &mut Ui, state: &mut AppState, el: &Element)

The phases an element is built and demolished in.

fn demolishable

pub fn demolishable(state: &AppState, view: ViewId, ids: impl IntoIterator<Item = ElementId>) -> Vec<ElementId>

The elements of ids standing in the view’s phase (existing or new there), which the view can demolish.

fn demolish

pub fn demolish(state: &mut AppState, view: ViewId, ids: &[ElementId]) -> bool

Demolish ids in the view’s phase; returns whether it was done.

fn start_demolish

pub fn start_demolish(state: &mut AppState)

Starting the Demolish command: a selection standing in the active view’s phase is demolished at once; otherwise the tool waits for clicks or a window.

fn demolish_tool

pub fn demolish_tool(resp: &egui::Response, painter: &egui::Painter, state: &mut AppState, view: &cc_core::View, xf: &crate::paint::Xf, drawing: &cc_views::Drawing2D)

Click elements, or drag a window around them (left to right: inside it; right to left: touching it), to demolish them in the active view’s phase.

cc_app::plugins_ui

crates/cc_app/src/plugins_ui.rs

Plugins in the app: loading the plugins of the plugins folder into the session (their commands join the engine’s catalog, the palette and the ribbon’s Plugin Commands menu) and the Plugins window, which turns them on and off, grants the files permission, removes them, and installs and updates them from the community index. Plugins run sandboxed in cc_plugins; installing is cc_plugins::store (checked archives), and the only network use is here: the index and the archives it lists, downloaded over HTTPS in background threads with bounded sizes, only when the user opens the Available tab or installs.

Items: Tab · Listed · Plugins · load · drain_messages · open · show

enum Tab

pub enum Tab

Which list the window shows.

Traits: Debug, Clone, Copy, PartialEq, Eq, Default

Variants

struct Listed

pub struct Listed

A plugin of the plugins folder, as listed.

Traits: Debug, Clone

Fields

struct Plugins

pub struct Plugins

Plugins state of the app (kept when the document changes).

Traits: Debug, Default

Fields

Some fields are private.

Methods

fn load

pub fn load(state: &mut AppState)

Load the plugins of the plugins folder into the session, as the preferences say (turned off ones are left out and run no code; files only where the user allowed it), and list them for the window.

fn drain_messages

pub fn drain_messages(state: &mut AppState)

Every frame: load the plugins again when the plugins folder changed, and show what plugins printed while their commands ran (logged, the last one in the status bar).

fn open

pub fn open(state: &mut AppState)

Open the Plugins window.

fn show

pub fn show(ctx: &Context, state: &mut AppState)

cc_app::preferences

crates/cc_app/src/preferences.rs

App preferences (not model data): what they hold, how they are kept in eframe’s storage (every key lives here), how the interface follows them, and the Preferences window (File tab, Ctrl+,, home screen). Stored values are hostile input: numbers are parsed and clamped, lists are bounded, and folders that no longer exist are kept but skipped where they are used. Missing values take defaults that match the behavior before the window existed.

Items: UI_SCALES · AUTOSAVE_MINUTES · RECENT_COUNTS · MAX_MACROS · Preferences · load_language · load · save · Look · sync_look · trim_recent · macro_files · Section · PreferencesDialog · open · show

const UI_SCALES

pub const UI_SCALES: [u32; 8]

Interface scales offered (percent).

const AUTOSAVE_MINUTES

pub const AUTOSAVE_MINUTES: [u32; 6]

Autosave intervals offered (minutes; 0 turns autosave off).

const RECENT_COUNTS

pub const RECENT_COUNTS: [usize; 6]

Numbers of recent projects offered.

const MAX_MACROS

pub const MAX_MACROS: usize

The macro menu lists at most this many files.

struct Preferences

pub struct Preferences

The app preferences. Language and the update check’s bookkeeping are kept elsewhere (i18n, Updates), but stored and restored here too.

Traits: Debug, Clone, PartialEq, Default

Fields

Methods

fn load_language

pub fn load_language(get: impl Fn(&str) -> Option<String>, language: Option<Language>)

Set the UI language at startup: language (from the command line), else the stored one, else the operating system’s.

fn load

pub fn load(state: &mut AppState, get: impl Fn(&str) -> Option<String>, zoom: f32)

Restore every other stored preference into state at startup (zoom: see Preferences::read).

fn save

pub fn save(state: &AppState, mut set: impl FnMut(&str, String))

Store every preference of state (and the language).

struct Look

pub struct Look

What the interface last applied of the preferences (theme, zoom, font size).

Traits: Debug, Clone, Copy

Some fields are private.

Methods

fn sync_look

pub fn sync_look(ctx: &Context, prefs: &mut Preferences, look: &mut Look)

Make the interface follow the preferences; call it once at the start of every frame. A zoom changed with Ctrl+Plus/Minus since the last frame becomes the scale preference.

fn trim_recent

pub fn trim_recent(state: &mut AppState)

Keep at most prefs.recent_count recent projects.

fn macro_files

pub fn macro_files(folder: &Path) -> Vec<PathBuf>

The macro files (.ccmacro) of folder, sorted by name: not recursive, at most MAX_MACROS; a missing or unreadable folder has none.

enum Section

pub enum Section

A page of the Preferences window.

Traits: Debug, Clone, Copy, PartialEq, Eq, Default

Variants

Methods

struct PreferencesDialog

pub struct PreferencesDialog

State of the open Preferences window. Changes show at once; Cancel restores the values the window opened with.

Traits: Debug, Clone

Fields

Some fields are private.

fn open

pub fn open(state: &mut AppState, section: Section)

Open the Preferences window on section (or show that section if it is open).

fn show

pub fn show(ctx: &Context, state: &mut AppState)

cc_app::profile_sketch

crates/cc_app/src/profile_sketch.rs

Edit Profile: the profile of a sweep type drawn in a sketch, in the profile’s own plane (x across the path, to its left; y up from the path’s height), which takes the place of the views while it is open. The sketch is the same as for outlines in plans (its ribbon, tools, grips, properties and undo); Finish runs sweep_profile_set with its curves, so every sweep of the type follows in one undo step. Edit sketch in the Profile Manager opens a sketched structural profile the same way, around the axes x = 0 and y = 0 of its sketch, with no level: Finish writes its outline and openings with profile_set, keeping the expressions of the points that did not move, and both Finish and Cancel go back to the manager.

Items: target · curves_of · open · edit_selected · is_open · section_curves · open_section · finish_section · leave_section · central

fn target

pub fn target(state: &AppState) -> Option<ElementTypeId>

The sweep type Edit Profile would open: that of the one selected sweep.

fn curves_of

pub fn curves_of(state: &AppState, type_id: ElementTypeId) -> Option<Vec<SketchCurve>>

The curves of a sweep type’s profile: those it was drawn with, or lines along its points.

fn open

pub fn open(state: &mut AppState, type_id: ElementTypeId)

Open the profile of sweep type type_id in a sketch.

fn edit_selected

pub fn edit_selected(state: &mut AppState)

Edit Profile from the ribbon: the selected sweep’s type.

fn is_open

pub fn is_open(state: &AppState) -> bool

Whether the open sketch is a sweep’s or a structural profile (which then takes the central area).

fn section_curves

pub fn section_curves(project: &Project, id: ProfileId) -> Option<Vec<SketchCurve>>

The curves that draw a sketched structural profile: its outline’s, then each opening’s.

fn open_section

pub fn open_section(state: &mut AppState, id: ProfileId) -> bool

Open a sketched structural profile in a sketch (Edit sketch); Whether it opened (a profile whose points do not evaluate does not).

fn finish_section

pub fn finish_section(state: &mut AppState)

Finish on a structural profile’s sketch: its outline and openings written with profile_set (nothing when they draw the same loops, from any start and either way round), then back to the Profile Manager; a sketch that makes no profile stays open with the reason.

fn leave_section

pub fn leave_section(state: &mut AppState, id: ProfileId)

Close a structural profile’s sketch and go back to the Profile Manager on it, with the manager’s edits from before the sketch.

fn central

pub fn central(ui: &mut Ui, state: &mut AppState)

The profile’s plane in the central area: the path’s point and the axes, the sketch and its tools; middle or right drag pans, the wheel zooms, a middle double click fits.

cc_app::profiles_dialog

crates/cc_app/src/profiles_dialog.rs

The Profile Manager (Structure → Profiles, also Manage → Profiles): the project’s structural profiles grouped by material, with a search; the selected one’s outline drawn to fit, its name, material and dimensions (millimeters on screen, meters to the engine) and its section properties. New makes a profile of a standard shape, Duplicate copies one, Delete removes one (with the profile that takes its place in the types using it) and Import from catalog copies rows of the built-in series in. Every change is a profile_* command; OK keeps them, Cancel undoes them all (dialog::session, through crate::graphics_dialog::Edits). What is shown is read back with profiles_list and profile_get.

Items: shape_key · param_key · ProfilesDialog · Catalog · open · section_sketch_open · settle_abandoned · resume · show

fn shape_key

pub fn shape_key(code: &str) -> String

The i18n key of a shape code’s name (profile-shape-cold-lipped-u).

fn param_key

pub fn param_key(name: &str) -> String

The i18n key of what a shape parameter measures (profile-param-bf-top).

struct ProfilesDialog

pub struct ProfilesDialog

The open Profile Manager.

Fields

Some fields are private.

struct Catalog

pub struct Catalog

Import from catalog: a series, a filter and the designations picked.

Fields

Some fields are private.

fn open

pub fn open(state: &mut AppState)

Open the Profile Manager; not while one of its profile sketches is open (the manager comes back when that sketch closes).

fn section_sketch_open

pub fn section_sketch_open(state: &AppState) -> bool

Whether a structural profile’s sketch is open (the manager waits for it).

fn settle_abandoned

pub fn settle_abandoned(state: &mut AppState)

Keep the manager’s edits when its profile sketch closed without going back to it (another tool, a palette command…), so the shared dialog session ends and a later dialog’s Cancel undoes only its own edits. The one place that settles them, run when the tool changes and every frame.

fn resume

pub fn resume(state: &mut AppState, id: ProfileId, edits: Option<Edits>)

Open the manager again on profile id after its sketch closes, with edits, the ones it had when the sketch opened (a fresh start if none).

fn show

pub fn show(ctx: &Context, state: &mut AppState)

cc_app::properties

crates/cc_app/src/properties.rs

Properties palette: instance parameters of the selection, or of the active view. A header block names what is shown (and its type, with “Edit Type”); below it, parameters are listed in collapsible sections of a two-column table.

Items: key · body · MultiSummary · underlay_rows · underlay_patch · length_drag · size_drag · field_label · slope_drag · paper_drag · weight_drag · decimal_paper_drag · ParamEdit · param_editor · number_drag · param_value

fn key

pub(crate) fn key(parts: impl Hash) -> u64

fn body

pub fn body(ui: &mut Ui, state: &mut AppState)

The properties of the selection (or the active view), under a header drawn by the caller.

struct MultiSummary

pub struct MultiSummary

The selected elements and their parameters as the multi-selection rows read them, kept while the document and the selection stay the same (copying and serializing every selected element each frame is costly for large selections).

Some fields are private.

fn underlay_rows

pub fn underlay_rows(ui: &mut Ui, state: &AppState, salt: u64, own: Option<cc_core::LevelId>, enabled: bool, u: &mut cc_core::Underlay) -> bool

The rows of an underlay (cc_core::Underlay): the plan below and the plan above (none, the next level, or a level), each looking down or up, and whether it is printed. own is the view’s level (left out of the choices), None for a template. Returns whether the user changed it.

fn underlay_patch

pub fn underlay_patch(old: &cc_core::Underlay, new: &cc_core::Underlay) -> serde_json::Value

The patch of view_set or template_set that turns a view’s or template’s underlay old into new. Plans set back to none are cleared (issue #235): the plain JSON of new leaves them out, and a merge would keep the old ones.

fn length_drag

pub fn length_drag(value: &mut f64) -> DragValue<'_>

Number, name, height and computed area of a room. Drag value for a length stored in meters, shown and typed in the project’s length unit (a typed unit symbol overrides it).

fn size_drag

pub fn size_drag(value: &mut f64) -> DragValue<'_>

Drag value for a small size stored in meters (a layer, a section’s side, a diameter, a riser): a length in metric projects (see length_drag), inches with a fraction in imperial ones (3/4"; a bare number typed is inches, see format::parse_size).

fn field_label

pub fn field_label(field: cc_core::ScheduleField) -> String

The header of a schedule field as a label in the current units: Area (m²) in metric projects, Area in imperial ones, whose values carry their own symbols (see cc_core::ScheduleField::key_in).

fn slope_drag

pub fn slope_drag(value: &mut f64) -> DragValue<'_>

Drag value for a slope stored as rise over run, shown and typed in the project’s slope unit (8,3 %, 4,76°, 6:12; a typed unit or ratio overrides it, see format::parse_slope).

fn paper_drag

pub fn paper_drag(value: &mut f64) -> DragValue<'_>

Drag value for a size on paper stored in millimeters (text heights, bubbles, gaps, sheet sides): ` mm after the number in metric projects; in imperial ones inches with a fraction (3/32”), typed in inches unless a unit says otherwise (see format::parse_paper`).

fn weight_drag

pub fn weight_drag(value: &mut f64) -> DragValue<'_>

Drag value for a pen weight stored in millimeters: ` mm after the number in metric projects, decimal inches in imperial ones (0.010”`).

fn decimal_paper_drag

pub fn decimal_paper_drag(value: &mut f64) -> DragValue<'_>

Drag value for a paper length shown as decimal inches in imperial projects (0.125", drafting fill patterns), ` mm` after the number in metric ones.

enum ParamEdit

pub enum ParamEdit

A new value typed in a param_editor.

Variants

fn param_editor

pub fn param_editor(ui: &mut Ui, p: &cc_core::ComponentParam, number: f64, text: &str, materials: &[String]) -> (Response, Option<ParamEdit>)

The widget of a component parameter of any kind: a drag value, a checkbox, a text box, or a list of its choices or of the project’s materials. Returns its response and the new value when it changed.

fn number_drag

pub fn number_drag(value: &mut f64) -> DragValue<'_>

A number field whose typed text is taken when the field is left (Enter, Tab or a click elsewhere), not at every key. A value written at every key goes through the model, which clamps or refuses half-typed numbers, and the field then shows the model’s value in place of the text being typed (issue 319: 1 read 5, 0.9 over 0.80 gave 0.9.80). Dragging still changes the value as it moves.

fn param_value

pub fn param_value(value: &mut f64, kind: cc_core::ParamKind) -> DragValue<'_>

Drag value for a component parameter, with the unit of its kind.

cc_app::recovery

crates/cc_app/src/recovery.rs

Autosave and crash recovery of the open project (the files are written by cc_core::recovery): a copy of a project with unsaved changes is written in the background an interval (a preference: a minute by default, or off) after its last copy; a clean save, close or exit removes it; a panic writes a final copy and appends to a crash log; at start-up, copies left by earlier sessions are offered for restoring.

Items: data_dir · folder · crash_log · Recovery · log_panic · log_event · install_panic_hook

fn data_dir

pub fn data_dir() -> Option<PathBuf>

The app’s data folder (where eframe keeps its preferences).

fn folder

pub fn folder() -> Option<PathBuf>

The folder of the recovery copies.

fn crash_log

pub fn crash_log() -> Option<PathBuf>

The crash log: one entry per panic, with its message, place and backtrace, and per failed graphics start-up or lost GPU device.

struct Recovery

pub struct Recovery

Recovery state of the running session.

Some fields are private.

Methods

fn log_panic

pub fn log_panic(info: &std::panic::PanicHookInfo<'_>)

Append a panic to the crash log (no recursion, no panics: errors are ignored).

fn log_event

pub fn log_event(what: &str)

Append an event that is not a panic (a failed graphics start-up, a lost GPU device) to the crash log, without a backtrace; errors are ignored.

fn install_panic_hook

pub fn install_panic_hook()

Install the panic hook: every panic is logged to the crash log, then reported as before (on the console, in debug builds).

cc_app::region_ui

crates/cc_app/src/region_ui.rs

Filled and masking regions in the app: Annotate → Filled Region and Masking Region open the sketch mode in the active view (a plan, ceiling plan, elevation, section, legend or drafting view; curves in the view’s drawing coordinates), and Finish runs filled_region_create or masking_region_create with the curves. Edit Boundary on a selected region redraws it (sketch_set). The properties palette shows the boundary’s line style, the view and the area; Type Properties the fill of a filled region type.

Items: takes_openings · start · create · props · type_section

fn takes_openings

pub fn takes_openings(category: Category) -> bool

Whether a sketch of category takes loops inside its outline as openings.

fn start

pub fn start(state: &mut AppState, category: Category)

Start sketching a region of category in the active view. A project without a type of it gets one when the first region is made.

fn create

pub fn create(state: &mut AppState, category: Category, type_id: ElementTypeId, curves: Vec<CurveArg>) -> Option<ElementId>

Make the region the curves draw in the active view; returns its id.

fn props

pub fn props(ui: &mut Ui, state: &mut AppState, id: ElementId, region: &Region)

The properties of a selected region: its boundary style, view and size.

fn type_section

pub fn type_section(ui: &mut Ui, state: &mut AppState, ty: &ElementType)

The fill of a filled region type in Type Properties: the foreground and background patterns and their colors.

cc_app::render_ui

crates/cc_app/src/render_ui.rs

The render window (View → Render): the active 3D view path traced progressively (cc_raytracing), the picture on the left (fitted; the wheel zooms about the pointer, a drag pans, a double click fits again) and the view’s render settings on the right (quality, output, environment), with Save Image…, Region, Render, Stop and Close. The window is a tool, like a viewer, not a data dialog: it has no Cancel. A setting is written to the view (view_set, through crate::engine_edit::view) only when the user changes one, all of them under one merge key, so whatever is changed in a session of the window is one undo step; Close keeps it. It is modal, so the model cannot change under a running render. The camera is the one the viewport shows when the window opens (its live camera, not the one last written to the model). A camera still fitted to the model, or the default camera of a view never shown, is fitted again for the render’s field of view and aspect, as the viewport fits it to its own. Rendering runs on two threads of its own, handed copies of the project, the view’s geometry, the view and its temporary visibility: the render thread builds the scene and traces it, sending a copy of the linear image at most four times a second (and the last one); the display thread exposes and tone maps the newest of those (composited over the previous image for a region) and hands the picture to the window, so neither the tracing nor the window waits for that. A stop flag ends the render between steps: Stop, closing the window, a new render and dropping the window (the app closing, the document replaced) all set it, and nothing waits for the threads. Each render has its own channels and number, so a late picture of an earlier render never shows in a later one. Exposure and tone mapping only change how the linear image is shown: changing them maps the image again (on a thread) without tracing it again. Sun Settings… hides the window and opens the Sun Settings dialog on the view; when that closes (OK or Cancel) the window opens again on the same view and camera, without the picture (the light changed).

Items: Resume · RenderWindow · open · open_for · show

struct Resume

pub struct Resume

What the window keeps of how it was opened (also while Sun Settings, opened from it, are open).

Traits: Debug, Clone, Copy

Some fields are private.

struct RenderWindow

pub struct RenderWindow

The open render window.

Some fields are private.

fn open

pub fn open(state: &mut AppState)

Open the window on the active view (when it is a 3D view).

fn open_for

pub fn open_for(state: &mut AppState, view: ViewId)

Open the window on view, with the camera its viewport shows now.

fn show

pub fn show(ctx: &Context, state: &mut AppState)

cc_app::ribbon

crates/cc_app/src/ribbon.rs

Ribbon, options bar and status bar.

Items: category_icon · env_group · command_tooltip · key_cap · ribbon · dimension_icon · selected_text · env_stacks · options_bar · status_bar

fn category_icon

pub fn category_icon(category: Category) -> Icon

Icon of a model category, shared by the ribbon, options bar and browser.

fn env_group

pub fn env_group(ui: &mut Ui, state: &mut AppState, caption: String, commands: &[UiCommand])

A group of the component environment’s ribbon.

fn command_tooltip

pub fn command_tooltip(response: Response, state: &AppState, command: UiCommand, why: Option<String>) -> Response

The rich tooltip of a command: title and shortcut, what it does, why it is unavailable, and the engine command that scripts call for the same change. With detailed tooltips off (a preference), only the title, shortcut and why it is unavailable.

fn key_cap

pub(crate) fn key_cap(ui: &mut Ui, keys: &str) -> egui::Response

A keyboard shortcut drawn as a key cap.

fn ribbon

pub fn ribbon(ui: &mut Ui, state: &mut AppState)

fn dimension_icon

pub fn dimension_icon(mode: DimensionMode) -> Icon

fn selected_text

pub fn selected_text(state: &AppState) -> Option<cc_core::ElementId>

The text note selected alone, if any.

fn env_stacks

pub fn env_stacks(ui: &mut Ui, state: &mut AppState, caption: String, families: &[&[UiCommand]])

Families of small buttons, each starting its own column. A captioned group of small buttons in columns (a contextual ribbon’s).

fn options_bar

pub fn options_bar(ui: &mut Ui, state: &mut AppState)

fn status_bar

pub fn status_bar(ui: &mut Ui, state: &mut AppState)

cc_app::schedule_ui

crates/cc_app/src/schedule_ui.rs

Schedule (table) view, its definition dialog (fields, filter, sorting and grouping, formatting, appearance) and CSV export.

Items: Tab · open · props · show · dialog

enum Tab

pub enum Tab

The pages of the schedule definition dialog.

Traits: Debug, Clone, Copy, PartialEq, Eq, Default

Variants

Methods

fn open

pub fn open(state: &mut AppState, view: ViewId, tab: Tab)

Open the definition dialog of schedule view on tab.

fn props

pub fn props(ui: &mut Ui, state: &mut AppState, view: ViewId)

The rows of a schedule’s properties: one per page of its definition, each with its Edit button.

fn show

pub fn show(ui: &mut Ui, state: &mut AppState, view_id: ViewId)

fn dialog

pub fn dialog(ctx: &Context, state: &mut AppState)

The definition of the schedule being edited: fields, filter, sorting and grouping, formatting and appearance, a page each.

cc_app::section_mark

crates/cc_app/src/section_mark.rs

Section marks in plans: picked with the Select tool, moved by dragging, their ends and the pieces of a split line dragged by their handles, flipped with Space. Every change goes through view_set.

Items: select · Part · flip · set_split

fn select

pub fn select(ui: &Ui, resp: &Response, painter: &Painter, state: &mut AppState, xf: &Xf, drawing: &Drawing2D) -> bool

Section marks under the Select tool in a plan. Returns true when they took the pointer this frame (the element selection is left alone).

enum Part

pub enum Part

What a drag of a section mark holds.

Traits: Debug, Clone, Copy, PartialEq

Variants

fn flip

pub fn flip(state: &mut AppState) -> bool

Turn the selected section to look the other way (Space).

fn set_split

pub fn set_split(state: &mut AppState, view: ViewId, split: bool)

Split the section’s line (a piece next to each head, a quarter of it long), or draw it whole again.

cc_app::sheet

crates/cc_app/src/sheet.rs

Sheet composer: paper, title block and placed viewports.

Items: show

fn show

pub fn show(ui: &mut Ui, state: &mut AppState, sheet_id: ViewId)

cc_app::sheet_props

crates/cc_app/src/sheet_props.rs

A sheet’s rows in the properties palette: its number, title block, paper and issue date, and the title block’s per-sheet fields. Each change runs sheet_set (through crate::engine_edit::sheet).

Items: today_iso · rows · fields_section · title_block_error

fn today_iso

pub fn today_iso() -> String

Today as YYYY-MM-DD.

fn rows

pub fn rows(ui: &mut Ui, state: &mut AppState, id: ViewId)

The sheet’s own rows (inside its properties section).

fn fields_section

pub fn fields_section(ui: &mut Ui, state: &mut AppState, id: ViewId)

One row per per-sheet field: empty shows (and uses) the type’s text.

fn title_block_error

pub fn title_block_error(state: &AppState) -> Option<String>

The first piece of the active sheet’s title block that does not draw, as a status bar message.

cc_app::side_panels

crates/cc_app/src/side_panels.rs

The side panels, Project Browser and Properties: docked on either side of the window, stacked in one column or each in a column of its own. A panel moves by dragging its header onto a side or another panel, or from the header’s context menu; the layout is a preference (PanelLayout).

Items: Pane · Side · PanelLayout · Target · show · menu · target_at

enum Pane

pub enum Pane

A side panel.

Traits: Debug, Clone, Copy, PartialEq, Eq, Hash

Variants

Methods

enum Side

pub enum Side

A side of the window.

Traits: Debug, Clone, Copy, PartialEq, Eq, Hash

Variants

struct PanelLayout

pub struct PanelLayout

Where the panels are: the columns on each side, from the window’s edge inward, each stacking its panels top to bottom. Every panel is in exactly one column and no column is empty.

Traits: Debug, Clone, PartialEq, Eq, Default

Fields

Methods

enum Target

pub enum Target

Where a moved panel goes.

Traits: Debug, Clone, Copy, PartialEq, Eq

Variants

fn show

pub fn show(ui: &mut Ui, state: &mut AppState)

Show the side panels; call it after the top and bottom bars and before the central area.

fn menu

pub fn menu(ui: &mut Ui, state: &mut AppState, pane: Pane) -> bool

The docking choices for pane; true when one was taken.

fn target_at

pub fn target_at(pos: Pos2, pane: Pane, area: Rect, rects: &[(Pane, Rect)]) -> Option<(Target, Rect)>

Where a panel dragged to pos would go, and the area that shows it: the strips along the window’s sides dock it there, and over another panel the nearest edge picks above, below, left or right of it.

cc_app::site_ui

crates/cc_app/src/site_ui.rs

Site Location (Manage → Project): a window with an OpenStreetMap map, an address search, a marker fixed at the center and the square of map data to bring in. The map moves under the marker; OK stores the location, elevation, true north and address (site_set); Import Context also downloads the map data of the square (Overpass) and runs site_context_import. Map tiles, the search and the elevation come from public services in background threads (never in tests); tiles are kept in memory while the window is open. Usage policies followed: an identifying User-Agent, at most two tile connections, one search per second and only on request (no autocomplete), and the OpenStreetMap attribution on the map.

Items: SiteDialog · open · show

struct SiteDialog

pub struct SiteDialog

The open Site Location window.

Some fields are private.

fn open

pub fn open(state: &mut AppState)

Open the window on the project’s location (else a view of the whole country map).

fn show

pub fn show(ctx: &Context, state: &mut AppState)

cc_app::sketch_mode

crates/cc_app/src/sketch_mode.rs

Sketch mode: the outline of a floor, ceiling, roof, foundation slab or mass drawn with lines, rectangles, polygons, circles, arcs and ellipses (see cc_core::sketch), in the active plan. The ribbon shows the drawing tools and Finish/Cancel while the sketch is open; in its Select mode a click picks a curve, whose grips stretch it and whose values the properties palette edits; a window picks the curves inside it (or, dragged to the left, those it touches) and a double click the chain of joined curves. The modify tools move, copy, rotate and mirror the picked curves, and offset, trim, extend and split curves (see cc_core::sketch_edit). Finish creates the element (or draws the edited element’s outline again, Edit Boundary) through the engine’s curves; the sketch’s own changes undo inside it. A terrain’s sketch also takes its measured points (Point, at the elevation in the options bar), which undo with the curves.

Items: Target · Draw · Session · curve_grips · moved · boundary_target · edit_boundary · takes_points · cancel · finish · error_text · escape · set_draw · pick_walls · canvas · interact · draw · finish_spline · ribbon · options · properties

enum Target

pub enum Target

What finishing the sketch makes.

Traits: Debug, Clone, Copy, PartialEq, Eq

Variants

enum Draw

pub enum Draw

How clicks draw.

Traits: Debug, Clone, Copy, PartialEq, Eq, Default

Variants

Methods

struct Session

pub struct Session

An open sketch.

Traits: Debug, Clone

Fields

Some fields are private.

Methods

fn curve_grips

pub(crate) fn curve_grips(c: &SketchCurve) -> Vec<(u8, DVec2)>

The grips of a curve, each with its handle number (see moved).

fn moved

pub(crate) fn moved(c: &SketchCurve, which: u8, p: DVec2) -> SketchCurve

Curve c with its grip which moved to p.

fn boundary_target

pub fn boundary_target(state: &AppState) -> Option<ElementId>

The element whose boundary Edit Boundary would open: one selected floor, ceiling, roof or mass.

fn edit_boundary

pub fn edit_boundary(state: &mut AppState)

Open the sketch of the selected element’s outline (Edit Boundary).

fn takes_points

pub fn takes_points(state: &AppState) -> bool

The open sketch makes (or edits) a terrain, which takes measured points.

fn cancel

pub fn cancel(state: &mut AppState)

Leave the sketch without changing the model.

fn finish

pub fn finish(state: &mut AppState)

Make the element (or its new outline) from the sketch; a sketch that does not close shows where and stays open.

fn error_text

pub fn error_text(e: &SketchError) -> String

A sketch error as a message.

fn escape

pub fn escape(state: &mut AppState)

Escape: drop the curve being drawn, then leave the drawing tool, then the selection.

fn set_draw

pub fn set_draw(state: &mut AppState, draw: Draw)

Pick a drawing or modify tool; those acting on the picked curves need some.

fn pick_walls

pub fn pick_walls(state: &mut AppState)

Add lines along the loop of the level’s walls, on the face of each wall chosen in the options bar (issue #311).

fn canvas

pub fn canvas(ui: &Ui, resp: &Response, painter: &Painter, state: &mut AppState, level: Option<LevelId>, xf: &Xf)

The sketch in a plan (or, for regions, any view that holds drawings, with no level): its curves, the tool’s preview, snapping, picks and grips.

fn interact

pub fn interact(ui: &Ui, resp: &Response, painter: &Painter, s: &mut Session, opts: &crate::modify::ModifyOptions, raw: Option<DVec2>, snapped: Option<Snap>, xf: &Xf) -> Option<String>

The sketch in a canvas (a plan, or a view of the component environment): its curves, where it does not close, and the active tool at the cursor (raw, and snapped where it snaps). Returns a message for the status bar.

fn draw

pub(crate) fn draw(click: bool, painter: &Painter, s: &mut Session, p: DVec2, xf: &Xf, tol: f64)

The drawing tools: preview at p, and a click adds a point or the curve.

fn finish_spline

pub(crate) fn finish_spline(s: &mut Session, closed: bool)

Add the spline through the picks (closed back to the first when closed) and start a new one.

fn ribbon

pub fn ribbon(ui: &mut Ui, state: &mut AppState)

The sketch’s ribbon: mode, drawing tools and tools.

fn options

pub fn options(ui: &mut Ui, state: &mut AppState)

The options bar: chaining, polygon sides, the modify tools’ options and the hint.

fn properties

pub fn properties(ui: &mut Ui, state: &mut AppState)

The selected curve’s values in the properties palette.

cc_app::snap_geom

crates/cc_app/src/snap_geom.rs

Snap points that come from two pieces of geometry, or from the point a segment is drawn from (issue #159): where lines and arcs cross, the foot of the perpendicular from the anchor, and the points where a line from the anchor touches an arc or circle. Lines are segments, arcs are cc_core::arc::Arcs (a whole circle sweeps a full turn).

Items: crossing · perpendicular · tangent

fn crossing

pub fn crossing(lines: &[(DVec2, DVec2)], arcs: &[Arc], raw: DVec2, r: f64) -> Option<DVec2>

The crossing of two of the lines and arcs nearest raw, within r.

fn perpendicular

pub fn perpendicular(anchor: DVec2, lines: &[(DVec2, DVec2)], arcs: &[Arc], raw: DVec2, r: f64) -> Option<DVec2>

The foot of the perpendicular from anchor to one of the lines (on the segment) or arcs (towards or away from the center, on the arc) nearest raw, within r.

fn tangent

pub fn tangent(anchor: DVec2, arcs: &[Arc], raw: DVec2, r: f64) -> Option<DVec2>

A point where a line from anchor touches one of the arcs, nearest raw, within r (none from inside a circle).

cc_app::snaps

crates/cc_app/src/snaps.rs

Object snaps (issue #317): which points the tools snap to (a preference), and the snap points of the elements a view draws, so that every element shown has them, not only those the tools know by their geometry.

Items: SnapSettings · SnapOption · drawing_snap

struct SnapSettings

pub struct SnapSettings

Which object snaps are on. Rounding free points to the zoom’s increment and the angle increments from the point a segment starts at stay.

Traits: Debug, Clone, Copy, PartialEq, Eq, Default

Fields

Methods

enum SnapOption

pub enum SnapOption

A snap setting: its storage code and the key of its name.

Traits: Debug, Clone, Copy, PartialEq, Eq

Variants

Methods

fn drawing_snap

pub fn drawing_snap(drawing: &Drawing2D, raw: DVec2, r: f64, out: &mut CadSnap)

Snap features of the elements drawing shows near raw: the lines passing within r, their ends where they are corners and their midpoints. See Drawing2D::lines_near for what is left out.

cc_app::stair_ui

crates/cc_app/src/stair_ui.rs

Stair and ramp controls: the plan layout (options bar and properties), the construction and step rules of stair types, the rules of ramp types, and their checks.

Items: Edited · layout_controls · build_rows · posts_rows · rules_rows · check_rows · create_command · tool_options · ramp_layout_controls · ramp_rules_rows · ramp_check_rows · ramp_command · ramp_tool_options

struct Edited

pub struct Edited

What a set of controls did this frame.

Traits: Default

Fields

fn layout_controls

pub fn layout_controls(ui: &mut Ui, salt: u64, layout: &mut StairLayout, table: bool) -> Edited

Shape, turn, riser count, tread and the sizes the shape uses.

fn build_rows

pub fn build_rows(ui: &mut Ui, salt: u64, build: &mut StairBuild) -> Edited

Construction of a stair type: solid, cast in place (waist) or assembled (stringers and treads).

fn posts_rows

pub fn posts_rows(ui: &mut Ui, layout: &mut StairLayout, g: &cc_geom::StairGeom, build: &StairBuild) -> Edited

The posts under each landing of an assembled stair: a checkbox for each place round its edge its beams reach.

fn rules_rows

pub fn rules_rows(ui: &mut Ui, salt: u64, rules: &mut StairRules, max_riser: f64, tread: f64) -> Edited

Step rules of a stair type: how the tread is set and the comfort limits.

fn check_rows

pub fn check_rows(ui: &mut Ui, g: &cc_geom::StairGeom)

Riser, tread, Blondel’s step and the broken rules of a laid-out stair.

fn create_command

pub fn create_command(layout: StairLayout, start: [f64; 2], direction: f64, level: cc_core::LevelId, type_id: cc_core::ElementTypeId) -> cc_engine::commands::stair::StairCreate

The engine command creating a stair with layout.

fn tool_options

pub fn tool_options(ui: &mut Ui, state: &mut AppState)

Options bar of the stair tool.

fn ramp_layout_controls

pub fn ramp_layout_controls(ui: &mut Ui, salt: u64, layout: &mut cc_core::RampLayout, table: bool) -> Edited

Shape, turn, slope and the sizes a ramp’s shape uses.

fn ramp_rules_rows

pub fn ramp_rules_rows(ui: &mut Ui, rules: &mut cc_core::RampRules) -> Edited

Accessibility rules of a ramp type.

fn ramp_check_rows

pub fn ramp_check_rows(ui: &mut Ui, g: &cc_geom::RampGeom)

Slope, flights and the broken rules of a laid-out ramp.

fn ramp_command

pub fn ramp_command(layout: cc_core::RampLayout, start: [f64; 2], direction: f64, level: cc_core::LevelId, type_id: cc_core::ElementTypeId) -> cc_engine::commands::ramp::RampCreate

The engine command creating a ramp with layout.

fn ramp_tool_options

pub fn ramp_tool_options(ui: &mut Ui, state: &mut AppState)

Options bar of the ramp tool.

cc_app::state

crates/cc_app/src/state.rs

Application state shared by all panels and views.

Items: RibbonTab · PendingAction · Dialogs · AppState

enum RibbonTab

pub enum RibbonTab

Traits: Debug, Clone, Copy, PartialEq, Eq, Default

Variants

enum PendingAction

pub enum PendingAction

An action that discards unsaved changes, waiting for confirmation.

Traits: Debug, Clone, PartialEq

Variants

struct Dialogs

pub struct Dialogs

Traits: Default

Fields

struct AppState

pub struct AppState

Fields

Some fields are private.

Methods

cc_app::steel_building_ui

crates/cc_app/src/steel_building_ui.rs

Structure → Steel Building: the dialog that runs steel_building_create on the active level, and the properties of a selected building (every parameter, through element_set, which regenerates its members in the same undo step).

Items: SteelBuildingDialog · open · show · edit · props

struct SteelBuildingDialog

pub struct SteelBuildingDialog

Traits: Debug, Clone, Default

Fields

fn open

pub fn open(state: &mut AppState)

fn show

pub fn show(ctx: &Context, state: &mut AppState)

fn edit

pub fn edit(state: &mut AppState, id: ElementId, field: &str, f: impl FnOnce(&mut SteelBuilding))

Change building id as f changes a copy of it (element_set, which regenerates its members); edits under one field merge while dragging.

fn props

pub fn props(ui: &mut Ui, state: &mut AppState, id: ElementId, building: &SteelBuilding)

The rows of a selected steel building.

cc_app::sun_overlay

crates/cc_app/src/sun_overlay.rs

A 3D view’s sun: the light the renderer draws it with (cc_render::Light) and its sun path diagram painted over the image (cc_views::sun_path::diagram, projected through the live camera). Both are resolved once per document revision and kept: a sun placed relative to the view (lighting relative_to_view) is resolved again when the live camera turns, so it follows the viewer while orbiting; every other sun stays put. The diagram’s ring and paths do not depend on the camera; only the sun’s disc of a view-relative sun moves with it. The diagram is drawn over the model (never hidden by it) and is not picked.

Items: SunView

struct SunView

pub struct SunView

A 3D view’s resolved sun.

Traits: Default

Some fields are private.

Methods

cc_app::sun_ui

crates/cc_app/src/sun_ui.rs

The Sun Settings dialog (View → Sun Settings, and the Sun row of a view’s properties): how a view places its sun (one moment, a study over one or several days, or a light from a direction given by hand), the project’s sun presets, the site’s time zone and what is drawn (the sun path, shadows, a ground plane). Every change runs a command as it is made (view_set, sun_preset_*, site_set), so the view behind shows it at once; OK keeps them all as one undo step, Cancel undoes them (dialog::session, through crate::graphics_dialog::Edits). The Site Location window is not opened from here: it keeps its own dialog session, which would end this one’s. A hint names where it is.

Items: SunDialog · open · open_for · show · view_rows

struct SunDialog

pub struct SunDialog

The open Sun Settings dialog.

Some fields are private.

fn open

pub fn open(state: &mut AppState)

Open the dialog on the active view (when it takes a sun).

fn open_for

pub fn open_for(state: &mut AppState, view: ViewId)

Open the dialog on view. A view without a sun gets the default one, inside the dialog’s edits (Cancel takes it away again).

fn show

pub fn show(ctx: &Context, state: &mut AppState)

fn view_rows

pub fn view_rows(ui: &mut Ui, state: &mut AppState, id: ViewId)

The sun rows of a view’s graphics section: the Sun button (it opens the dialog), when the view has a sun the sun path and shadows, and the view’s shading (ambient light and shadow intensity).

cc_app::systems_dialog

crates/cc_app/src/systems_dialog.rs

Plumbing systems, electrical circuits, the structured cabling of racks and lightning protection systems: names, codes, colors, the board (or rack) feeding each circuit (or cabling) and its voltage, with the circuits’ loads. Every change is an engine command (system_*); Cancel undoes them all.

Items: panels · boards · system_combo · show · sizing

fn panels

pub fn panels(state: &AppState) -> Vec<(ElementId, String)>

The distribution boards of the project: (element, label).

fn boards

pub fn boards(state: &AppState, board: DeviceKind) -> Vec<(ElementId, String)>

The boards (or racks) of the project: (element, label).

fn system_combo

pub fn system_combo(ui: &mut Ui, state: &AppState, id: impl std::hash::Hash + std::fmt::Debug, classes: &[SystemClass], current: &mut Option<SystemId>) -> bool

A choice of the systems of the families classes (any, when empty), with “none”.

fn show

pub fn show(ctx: &Context, state: &mut AppState)

fn sizing

pub fn sizing(ctx: &Context, state: &mut AppState)

The sizing of the pipes and circuits (mep_sizing), with a button that gives undersized pipes the required diameters (mep_size_apply).

cc_app::table

crates/cc_app/src/table.rs

Property table primitives shared by the properties palette and dialogs: collapsible sections of two-column rows, header blocks and padded content.

Items: ROW_H · LABEL_SHARE · FONT_SIZE · font_size · section · row · row_tip · boxed · checkbox · labeled_checkbox · button_row · readonly_row · header_block · padded · live_text · commit_text

const ROW_H

pub const ROW_H: f32

Height of a table row and of a section header.

const LABEL_SHARE

pub const LABEL_SHARE: f32

Share of the table width taken by the label column.

const FONT_SIZE

pub const FONT_SIZE: f32

fn font_size

pub fn font_size() -> f32

Text size of the tables, following the font size preference.

fn section

pub fn section(ui: &mut Ui, id: &str, title: String, add: impl FnOnce(&mut Ui))

Collapsible section header; add draws the rows while it is open.

fn row

pub fn row<R>(ui: &mut Ui, label: &str, add: impl FnOnce(&mut Ui) -> R) -> R

One table row: a label cell and a value cell filled by add.

fn row_tip

pub fn row_tip<R>(ui: &mut Ui, label: &str, tip: Option<&str>, add: impl FnOnce(&mut Ui) -> R) -> R

row whose label shows tip when hovered (else the label itself).

fn boxed

pub fn boxed<'a>(checkbox: egui::Checkbox<'a>) -> impl egui::Widget + 'a

A checkbox that shows its box wherever it stands. Table cells are flat (no border or fill until hovered), which would leave an unticked box the color of the background.

fn checkbox

pub fn checkbox(ui: &mut Ui, checked: &mut bool) -> egui::Response

A checkbox without text, as boxed.

fn labeled_checkbox

pub fn labeled_checkbox(ui: &mut Ui, checked: &mut bool, text: impl Into<egui::WidgetText>) -> egui::Response

A checkbox with a text beside it, as boxed.

fn button_row

pub fn button_row<R>(ui: &mut Ui, add: impl FnOnce(&mut Ui) -> R) -> R

A row of buttons across the whole table, wrapping when they do not fit; add draws them.

fn readonly_row

pub fn readonly_row(ui: &mut Ui, label: &str, value: String)

A row whose value cannot be edited (shown dimmed).

fn header_block

pub fn header_block(ui: &mut Ui, icon: Icon, title: &str, subtitle: &str)

Header with a large icon tile, a title and a subtitle.

fn padded

pub fn padded<R>(ui: &mut Ui, add: impl FnOnce(&mut Ui) -> R) -> R

Content with the panel’s side padding (headers, buttons, lists).

fn live_text

pub fn live_text(ui: &mut Ui, salt: impl std::hash::Hash + std::fmt::Debug, text: &mut String, add: impl FnOnce(&mut Ui, &mut String) -> egui::Response) -> egui::Response

A single-line text field over a value read from the model every frame. While it has the focus it shows what was typed, not the value read back, so a command that trims or refuses the text mid-typing (a trailing space, an emptied name) or a value only kept when the field is left never undoes the typing. text holds what was typed this frame; salt names the field (unique among those shown), add draws it.

fn commit_text

pub fn commit_text(ui: &mut Ui, salt: impl std::hash::Hash + std::fmt::Debug, current: &str, width: f32, hint: &str) -> Option<String>

A one-line field that hands back its text, trimmed, when Enter is pressed or it loses the focus, and only if it changed. While focused it keeps what is typed; otherwise it shows current. hint shows when empty.

cc_app::text_tool

crates/cc_app/src/text_tool.rs

Text notes in 2D views: the Text tool (single-line or multiline text, optionally with a leader of one or two segments), the Add Leader tool and the text editor shown over the view. Notes are created and changed through the engine’s commands.

Items: LeaderShape · TextOptions · TextTarget · TextEditor · text_tool · add_leader_tool · canvas · show · options · symbol_combo

enum LeaderShape

pub enum LeaderShape

The leader a new text gets.

Traits: Debug, Clone, Copy, PartialEq, Eq, Default

Variants

Methods

struct TextOptions

pub struct TextOptions

Options of the text tools (kept between uses, shown in the options bar).

Traits: Debug, Clone, Copy, PartialEq, Default

Fields

enum TextTarget

pub enum TextTarget

What the editor’s text goes to.

Traits: Debug, Clone, PartialEq

Variants

struct TextEditor

pub struct TextEditor

The text editor open over a view.

Traits: Debug, Clone

Some fields are private.

fn text_tool

pub fn text_tool(ui: &Ui, resp: &Response, painter: &Painter, state: &mut AppState, view: &cc_core::View, type_id: ElementTypeId, xf: &Xf, px_per_mm: f64)

The Text tool: click the leader’s end and elbow (when the options ask for a leader), then where the text goes, and type it.

fn add_leader_tool

pub fn add_leader_tool(ui: &Ui, resp: &Response, painter: &Painter, state: &mut AppState, view: &cc_core::View, id: ElementId, xf: &Xf, px_per_mm: f64)

The Add Leader tool: click the end (and elbow) of a new leader of note id.

fn canvas

pub fn canvas(resp: &Response, state: &mut AppState, view: ViewId, xf: &Xf, drawing: &Drawing2D) -> bool

A double click on a note with the Select tool opens it in the editor. Returns true when the pointer was used.

fn show

pub fn show(ui: &Ui, state: &mut AppState, view: ViewId)

The text editor over view, when open there: Enter (single-line) or Ctrl+Enter (multiline) or OK applies, Esc or Cancel closes it.

fn options

pub fn options(ui: &mut Ui, state: &mut AppState, adding_leader: bool)

Options bar of the text tools.

fn symbol_combo

pub fn symbol_combo(ui: &mut Ui, id: impl std::hash::Hash + std::fmt::Debug, symbol: &mut LeaderSymbol) -> bool

A combo box of leader symbols; returns whether it changed.

cc_app::theme

crates/cc_app/src/theme.rs

Visual theme: color tokens, typography and spacing applied to egui. Colors are defined once in Palette and every panel reads them from PALETTE instead of hard-coding values, so the look stays consistent. LIGHT and DARK hold the tokens of the two themes; PALETTE reads the one the interface shows (sync follows the egui theme each frame), and ThemeChoice is the user’s preference: light, dark or the system’s.

Items: Palette · LIGHT · DARK · palette · FONT_SCALE_RANGE · font_scale · set_font_scale · ShownPalette · PALETTE · sync · ThemeChoice · set_theme · APP_ICON_PNG · logo · RADIUS · semibold · title · panel_header · caption · muted · apply · dock_style

struct Palette

pub struct Palette

Color tokens of a theme.

Traits: Debug, Clone, Copy

Fields

const LIGHT

pub const LIGHT: Palette

Color tokens of the light theme.

const DARK

pub const DARK: Palette

Color tokens of the dark theme.

fn palette

pub fn palette(ctx: &egui::Context) -> &'static Palette

The palette of the theme ctx shows.

const FONT_SCALE_RANGE

pub const FONT_SCALE_RANGE: std::ops::RangeInclusive<f32>

Smallest and largest font size multipliers.

fn font_scale

pub fn font_scale() -> f32

The multiplier of the interface text sizes (see set_font_scale).

fn set_font_scale

pub fn set_font_scale(ctx: &egui::Context, scale: f32)

Make the interface text scale times its normal size (independent of the interface zoom): the text styles of both themes and the property tables follow it. Out-of-range values are clamped.

struct ShownPalette

pub struct ShownPalette

The palette of the theme shown: read like a constant (PALETTE.text).

Traits: Debug, Clone, Copy, std::ops::Deref

static PALETTE

pub static PALETTE: ShownPalette

The colors of the theme the interface shows (see sync).

fn sync

pub fn sync(ctx: &egui::Context)

Make PALETTE follow the theme ctx shows; call it at the start of every frame (the system theme may change at any time).

enum ThemeChoice

pub enum ThemeChoice

The user’s theme preference.

Traits: Debug, Clone, Copy, PartialEq, Eq, Default

Variants

Methods

fn set_theme

pub fn set_theme(ctx: &egui::Context, choice: ThemeChoice)

Show the theme choice asks for.

const APP_ICON_PNG

pub const APP_ICON_PNG: &[u8]

The application icon (256 px PNG).

pub fn logo(ctx: &egui::Context) -> Option<egui::TextureHandle>

Texture of the application icon, loaded by apply for the ribbon.

const RADIUS

pub const RADIUS: u8

Corner radius of buttons, fields and popups.

fn semibold

pub fn semibold() -> FontFamily

Font family of the semibold weight, for titles and emphasis.

fn title

pub fn title(text: impl Into<String>) -> RichText

Section or panel title text.

fn panel_header

pub fn panel_header(ui: &mut egui::Ui, title_text: &str, subtitle: Option<&str>) -> egui::Response

Full-width header strip at the top of a side panel; its response covers the strip.

fn caption

pub fn caption(text: impl Into<String>) -> RichText

Small uppercase-free caption, used for group labels.

fn muted

pub fn muted(text: impl Into<String>) -> RichText

Secondary text.

fn apply

pub fn apply(ctx: &egui::Context)

Install fonts, text styles, spacing and colors.

fn dock_style

pub fn dock_style(style: &egui::Style) -> egui_dock::Style

Dock (view tabs) style matching the theme.

cc_app::thumbnails

crates/cc_app/src/thumbnails.rs

Project thumbnails: a small render of the model, stored in the application data folder and shown on the home screen.

Items: SIZE · Job · project_file · sample_file · process

const SIZE

pub const SIZE: [u32; 2]

Thumbnail size in pixels (3:2).

enum Job

pub enum Job

A thumbnail waiting to be rendered (rendering needs the GPU, which only the app loop has).

Traits: Debug, Clone, PartialEq

Variants

fn project_file

pub fn project_file(path: &Path) -> Option<PathBuf>

fn sample_file

pub fn sample_file(name: &str) -> Option<PathBuf>

fn process

pub fn process(state: &mut AppState, rs: &egui_wgpu::RenderState)

Render pending thumbnails.

cc_app::title_block_env

crates/cc_app/src/title_block_env.rs

The title block editor: the component environment for a title block (ComponentKind::TitleBlock). One Sheet view takes the place of the plan, front, side and 3D views: the paper at a preview size (the sheet the editor opened from, or A0–A4 portrait or landscape), its four edges as locked reference planes, the component’s own reference planes, and the title block’s pieces with their fields filled in (from that sheet, else sample values) or shown as typed. The canvas works in paper meters (millimeters / MM), so the sketch’s snapping to the millimeter, its pick distances and typed lengths measure the printed paper; pieces are written in millimeters, the unit of title block expressions. A coordinate on an edge is written 0, SheetWidth or SheetHeight, one on a reference plane as its name, so the piece follows the paper. Every change is a component_* command.

Items: MM · Preview · SheetEditor · is_open · sheet_title_block_of · sheet_title_block · edit_sheet · new_title_block · iso_paper · paper · scope_extra · SheetPlane · planes · plane_view · field_value · central · text_box · piece_at · pieces_in · Picture · picture · picture_file · image_rect · pick_image · coordinate · place_text · field_menu · insert_field · sheet_plane_from_line · is_sheet_sketch · start_lines · chains · finish_stroke · edit_stroke · delete_pieces · ribbon · options · panel_content

const MM

pub const MM: f64

Millimeters per canvas unit (the canvas is in paper meters).

enum Preview

pub enum Preview

The paper the Sheet view shows.

Traits: Debug, Clone, Copy, PartialEq

Variants

struct SheetEditor

pub struct SheetEditor

The Sheet view’s state.

Traits: Debug, Clone, PartialEq

Fields

Some fields are private.

Methods

fn is_open

pub fn is_open(state: &AppState) -> bool

Whether the component environment shows a title block.

fn sheet_title_block_of

pub fn sheet_title_block_of(state: &AppState, id: ViewId) -> Option<ElementTypeId>

The title block type of sheet id.

fn sheet_title_block

pub fn sheet_title_block(state: &AppState) -> Option<ElementTypeId>

The active sheet’s title block type.

fn edit_sheet

pub fn edit_sheet(state: &mut AppState, id: ViewId)

Edit Title Block on sheet id: make it the active view, then open its title block on it. open_view only queues the tab, so the active view is set here for the editor to read the sheet.

fn new_title_block

pub fn new_title_block(state: &mut AppState)

New Title Block: a copy of the standard layout under a name no type and no component uses (title_block_create refuses both), opened.

fn iso_paper

pub fn iso_paper(size: SheetSize, portrait: bool) -> DVec2

An ISO paper in millimeters, portrait (long side up) or landscape.

fn paper

pub fn paper(state: &AppState, preview: Preview) -> DVec2

The paper shown, millimeters.

fn scope_extra

pub fn scope_extra(paper: DVec2) -> [(&'static str, f64); 2]

The names expressions read for the paper, millimeters.

struct SheetPlane

pub struct SheetPlane

A line pieces snap to and are written against.

Traits: Debug, Clone, PartialEq

Fields

fn planes

pub fn planes(def: &ComponentDef, paper: DVec2) -> Vec<SheetPlane>

The four paper edges, then the component’s planes square to x or y that resolve on this paper.

fn plane_view

pub fn plane_view(planes: &[SheetPlane], k: f64) -> ComponentView

The planes as the lines of a ComponentView, k canvas units per millimeter: the sketch snaps to them (crate::component_sketch::snap) and writes coordinates on them as their names.

fn field_value

pub fn field_value(state: &AppState, ed: &SheetEditor, def: &ComponentDef, key: &str) -> Option<String>

The value of field key in the preview: from the sheet the editor opened from, else a sample; paper is always the preview’s.

fn central

pub fn central(ui: &mut Ui, state: &mut AppState)

The Sheet view: the paper, the planes, the title block, and the tools.

fn text_box

pub fn text_box(t: &SheetText) -> (DVec2, DVec2)

A text’s extents (millimeters), estimated: 0.6 × its height per character and 1.5 × its height per line, from its anchor, turned.

fn piece_at

pub fn piece_at(pieces: &SheetPieces, p: DVec2, tol: f64) -> Option<usize>

The piece at p (millimeters): a text whose box holds it, else the nearest stroke within tol, else a picture under it.

fn pieces_in

pub fn pieces_in(pieces: &SheetPieces, a: DVec2, b: DVec2) -> Vec<usize>

The pieces wholly inside the window from a to b (millimeters), in order.

struct Picture

pub struct Picture

A picture for the Image tool: PNG, JPEG, GIF, BMP or WebP bytes (an SVG drawn into a PNG), and its width / height.

Traits: Debug, Clone, PartialEq

Fields

fn picture

pub fn picture(bytes: Vec<u8>) -> Option<Picture>

The picture in a file’s bytes; an SVG is drawn into a PNG. None for anything else, a file over the picture size limit, or a reader that fails (a panic in a decoder is caught: files are hostile input). usvg parses and renders nested elements recursively, and a deeply nested file could overflow the caller’s stack, which aborts the process; so the file is read on a thread of its own with a large stack.

fn picture_file

pub fn picture_file(path: &std::path::Path) -> Result<Picture, String>

The picture in file path; a file over the picture size limit is refused before it is read.

fn image_rect

pub fn image_rect(a: DVec2, b: DVec2, aspect: f64, free: bool) -> (DVec2, DVec2)

The rectangle a picture dragged from a to b fills (millimeters): its bottom-left corner and size; the size keeps aspect (width / height) unless free, following the longer dragged side.

fn pick_image

pub fn pick_image(state: &mut AppState)

Image: pick a picture file, then drag its rectangle.

fn coordinate

pub fn coordinate(planes: &[SheetPlane], value: f64, vertical: bool) -> String

The expression of a coordinate value (millimeters): the name of an edge or plane standing there, else the number to a hundredth.

fn place_text

pub fn place_text(state: &mut AppState, planes: &[SheetPlane], at: DVec2)

Place a text at at (millimeters) and pick it.

fn field_menu

pub fn field_menu(p: &cc_core::Project, def: &ComponentDef) -> Vec<(String, Vec<(String, String)>)>

The Insert field menu: groups of (name shown, key). The fixed fields, with issue_date right after date, then a project: key per project field and a param: key per text parameter of the title block.

fn insert_field

pub fn insert_field(text: &str, key: &str, at: Option<usize>) -> (String, usize)

text with {key} inserted at character at (the end when None or past it), and the character the cursor goes to after it.

fn sheet_plane_from_line

pub fn sheet_plane_from_line(a: DVec2, b: DVec2) -> Option<(&'static str, f64)>

The plane two clicks (millimeters) make: x (a vertical line) or y, and its position to a tenth of a millimeter.

fn is_sheet_sketch

pub fn is_sheet_sketch(state: &AppState) -> bool

Whether the open sketch draws a title block’s lines.

fn start_lines

pub fn start_lines(state: &mut AppState)

Lines: a new sketch on the Sheet view.

fn chains

pub fn chains(curves: &[SketchCurve]) -> Vec<(Vec<SketchCurve>, bool)>

The curves in chains joined end to end (a chain stops where more than two curves meet), each with whether it closes.

fn finish_stroke

pub fn finish_stroke(state: &mut AppState)

Finish of a lines sketch: each chain becomes a stroke, closed when its ends meet; an edited stroke takes the first chain. A chain that does not make a stroke keeps the sketch open with the reason.

fn edit_stroke

pub fn edit_stroke(state: &mut AppState, index: usize)

Edit Sketch of stroke index: its lines and arcs on the Sheet view.

fn delete_pieces

pub fn delete_pieces(state: &mut AppState, list: &[usize])

Delete pieces list, in one step.

fn ribbon

pub fn ribbon(ui: &mut Ui, state: &mut AppState)

The Create tab of the title block editor.

fn options

pub fn options(ui: &mut Ui, state: &mut AppState)

The options bar: the preview paper, raw keys, and the tool’s hint.

fn panel_content

pub fn panel_content(ui: &mut Ui, state: &mut AppState, name: &str, def: &ComponentDef)

The left panel: name, type, parameters (and the paper’s size), and the picked piece or plane.

cc_app::tools

crates/cc_app/src/tools.rs

Modeling tools: selection, walls, hosted openings, sketches, sections, rooms, grids and dimensions.

Items: Tool · DimensionMode · Drag · Interaction · ChainAt · ChainStep · chain_back · chain_forward · DimChain · Snap · snap_at · cad_snap · CadIndexEntry · underlay_snap · round_step · round_fine · select_box · ModelSnaps · draw_snap · label · TEMP_DIM · dim_text · temp_measure · temp_dimension · dimension_line · TypedInput · handle · run_create · MepOptions · device_type · ComponentGroup · component_group · tool_types · mep_component_type · Run · TrussOptions · truss_command · BracingOptions · bracing_command · foundation_type · is_strip · grid_crossings · beam_command · RailingHostOptions · railing_host · SweepOptions · finish_sweep · finish_railing · linear_direction · line_at · point_on_segment · arc_at · arc_preview · place_opening_3d · add_opening · move_elements · copy_elements · duplicate · rotate_elements · mirror_elements · rotate_selection

enum Tool

pub enum Tool

Traits: Debug, Clone, PartialEq

Variants

Methods

enum DimensionMode

pub enum DimensionMode

What the dimension tool places.

Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default

Variants

Methods

enum Drag

pub enum Drag

Traits: Debug, Clone

Variants

struct Interaction

pub struct Interaction

Transient state of the active tool.

Traits: Debug, Clone, Default

Fields

Methods

struct ChainAt

pub struct ChainAt

Where a chain stands: its anchor, the direction angles are measured from, and the elevation a pipe or conduit run goes on at.

Traits: Debug, Clone, Copy, PartialEq, Default

Some fields are private.

struct ChainStep

pub struct ChainStep

A segment a chain tool placed: the chain before and after it, its undo steps (a pipe’s rise and run are two), and the document revision it left (or, taken back, the revision the undo left), so a step is only taken back or redone when nothing else changed the model meanwhile.

Traits: Debug, Clone, Copy, PartialEq

Some fields are private.

fn chain_back

pub fn chain_back(state: &mut AppState) -> bool

Backspace or Ctrl+Z while a chain tool is drawing: take back the last segment (undoing it) and go on from where it started, without leaving the tool; with no segment left, drop the start point. A railing’s last point and an arc wall’s picked end go first. Returns whether it did anything.

fn chain_forward

pub fn chain_forward(state: &mut AppState) -> bool

Ctrl+Y after chain_back: place the segment again and go on from its end.

struct DimChain

pub struct DimChain

A chain of dimensions being placed: the next one measures from last (the origin of ordinate dimensions, which stays) along dir and sits on the line through line.

Traits: Debug, Clone, Copy, PartialEq

Fields

struct Snap

pub(crate) struct Snap

Traits: Debug, Clone, Copy

Fields

Some fields are private.

Methods

fn snap_at

pub(crate) fn snap_at(state: &mut AppState, level: Option<LevelId>, raw: DVec2, anchor: Option<DVec2>, extra: &[DVec2], scale: f64, ortho: bool) -> Snap

Snap through snap with the interaction’s acquired points, and acquire the point when it is a model point.

fn cad_snap

pub(crate) fn cad_snap(state: &mut AppState, raw: DVec2, r: f64) -> cc_core::cad::CadSnap

Snap features of the imported drawings and detail lines shown in the active view near raw, and of the lines of its underlay (the other levels’ plans drawn under it).

type alias CadIndexEntry

pub type CadIndexEntry = (std::sync::Arc<cc_core::CadDrawing>, std::sync::Arc<cc_core::cad::CadSnapIndex>)

An imported drawing and the snap index built from it.

fn underlay_snap

pub(crate) fn underlay_snap(drawing: &Drawing2D, raw: DVec2, r: f64, out: &mut cc_core::cad::CadSnap)

Lines of drawing’s underlay passing within r of raw, with their ends and midpoints (the underlay has no arcs: plans draw them as chords).

fn round_step

pub(crate) fn round_step(scale: f64) -> f64

Increment for rounding free coordinates at the current zoom: 1 cm to 10 m in metric projects, 1/2” to 20’-0” in imperial ones, so drawn lengths land on round values of the project’s system.

fn round_fine

pub(crate) fn round_fine(meters: f64) -> f64

meters rounded to a millimeter, or to 1/16” in imperial projects (component reference planes and sketches), to 1e-7 m so it writes short.

fn select_box

pub(crate) fn select_box(painter: &egui::Painter, start: egui::Pos2, cur: egui::Pos2)

Snap raw to model points, wall lines, alignments and angle/length increments. tracked are points acquired by hovering them earlier: with the anchor and extra they cast horizontal, vertical and wall-line guides; a crossing of two guides, or of a guide with the current direction from the anchor, is a snap point. The selection rectangle from start to cur: a window (solid outline) dragged to the right, a crossing (dashed, green) dragged to the left.

struct ModelSnaps

pub(crate) struct ModelSnaps

The model’s snap candidates on a level: element ends, midpoints, lines and arcs, outlines, grid lines and crossings, risers. They depend only on the model, so they are gathered once per revision and level (see model_snaps_cached), not on every pointer move.

Traits: Debug, Default

Some fields are private.

fn draw_snap

pub(crate) fn draw_snap(painter: &Painter, xf: &Xf, s: Snap)

fn label

pub(crate) fn label(painter: &Painter, pos: Pos2, text: String)

const TEMP_DIM

pub(crate) const TEMP_DIM: Color32

Color of temporary dimensions.

fn dim_text

pub(crate) fn dim_text(painter: &Painter, pos: Pos2, text: String, angle: f32, strong: bool)

Text on a light background, centered at pos and rotated by angle (radians, screen orientation), kept upright.

fn temp_measure

pub(crate) fn temp_measure(painter: &Painter, xf: &Xf, a: DVec2, b: DVec2) -> (Pos2, egui::Vec2, f32)

Temporary dimension measuring from a to b (both drawn as small ticks on the measuring line). Returns the screen center, size and rotation of its value, for clicking.

fn temp_dimension

pub(crate) fn temp_dimension(painter: &Painter, xf: &Xf, a: DVec2, p: DVec2, reference: Option<DVec2>, typed: Option<&TypedInput>, side: f64)

Temporary dimension of a segment being drawn from a to p: a dimension line beside it with its length (or the typed value) and an arc with the angle to reference (the previous segment, or the X axis).

fn dimension_line

pub(crate) fn dimension_line(painter: &Painter, xf: &Xf, a: DVec2, p: DVec2, typed: &str, active: bool, side: f64)

A temporary dimension line beside the segment from a to p (to its left, side further out) with its length, or the typed value; active marks the field typing goes to.

struct TypedInput

pub struct TypedInput

Values typed while drawing a segment: digits go to the active field (length, or angle after Tab), in the project’s length unit and degrees.

Traits: Debug, Clone, Default, PartialEq

Fields

Methods

fn handle

pub fn handle(ui: &Ui, resp: &Response, painter: &Painter, state: &mut AppState, view: &View, xf: &Xf, drawing: &Drawing2D)

fn run_create

pub(crate) fn run_create<C: cc_engine::Command + serde::Serialize>(state: &mut AppState, command: C) -> Option<ElementId>

Run a creating command: the new element is selected; a refusal goes to the status bar.

struct MepOptions

pub struct MepOptions

Options of the pipe and conduit tools and of placing devices, kept between uses.

Traits: Debug, Clone, PartialEq, Default

Fields

fn device_type

pub fn device_type(project: &Project, type_id: ElementTypeId) -> Option<cc_core::DeviceKind>

The device kind of a component type, if it is an electrical device.

enum ComponentGroup

pub enum ComponentGroup

The ribbon tool that places a component type: the generic component tool, plumbing fixtures, electrical devices, or a device with a tool of its own (commands::DEVICE_TOOLS). The options bar lists the types of one of these.

Traits: Debug, Clone, Copy, PartialEq, Eq

Variants

fn component_group

pub fn component_group(project: &Project, type_id: ElementTypeId) -> ComponentGroup

Which tool places type_id (Generic for any type that is no fixture or device).

fn tool_types

pub fn tool_types(project: &Project, category: Category, type_id: ElementTypeId, material: Option<cc_core::StructuralMaterial>) -> Vec<(ElementTypeId, String)>

The types the options bar offers to a tool of category placing type_id: all of the category, but for components only those placed by the same tool (fixtures, electrical devices, a device with its own tool, the rest).

fn mep_component_type

pub fn mep_component_type(project: &Project, device: bool) -> Option<ElementTypeId>

The first component type that is an electrical device (device) or a plumbing fixture.

enum Run

pub enum Run

What a run tool draws.

Traits: Debug, Clone, Copy, PartialEq, Eq, Drop

Variants

struct TrussOptions

pub struct TrussOptions

Truss tool options, kept between uses.

Traits: Debug, Clone, PartialEq, Default

Fields

fn truss_command

pub fn truss_command(o: &TrussOptions, material: cc_core::StructuralMaterial, level: LevelId, a: DVec2, b: DVec2) -> cc_engine::commands::framing::TrussCreate

The command the tool runs for a truss from a to b.

struct BracingOptions

pub struct BracingOptions

Bracing tool options, kept between uses.

Traits: Debug, Clone, PartialEq, Default

Fields

fn bracing_command

pub fn bracing_command(o: &BracingOptions, material: cc_core::StructuralMaterial, level: LevelId, a: DVec2, b: DVec2) -> cc_engine::commands::bracing::BracingCreate

The command the tool runs for a braced bay from a to b.

fn foundation_type

pub fn foundation_type(project: &Project, kind: cc_core::FoundationKind) -> Option<ElementTypeId>

The first foundation type of kind.

fn is_strip

pub fn is_strip(project: &Project, type_id: ElementTypeId) -> bool

fn grid_crossings

pub(crate) fn grid_crossings(project: &Project) -> Vec<DVec2>

Intersections of grid lines, offered as snap points.

fn beam_command

pub fn beam_command(level: LevelId, type_id: ElementTypeId, a: DVec2, b: DVec2, bulge: f64) -> create::BeamCreate

Two clicks: start and end of a beam. Its top is at the level above by default. The command the beam tool runs for a beam from a to b (an arc with a bulge).

struct RailingHostOptions

pub struct RailingHostOptions

Options of the railing tool: put railings on a stair or ramp picked in the view instead of drawing a path.

Traits: Debug, Clone, Copy, Default, PartialEq

Fields

fn railing_host

pub fn railing_host(state: &AppState, id: ElementId) -> bool

Whether id is a stair or a ramp (an element railings can follow).

struct SweepOptions

pub struct SweepOptions

Options of the swept profile tool.

Traits: Debug, Clone, Copy, Default, PartialEq

Fields

fn finish_sweep

pub fn finish_sweep(state: &mut AppState, level: LevelId, type_id: ElementTypeId)

Create the swept profile from the points clicked so far.

fn finish_railing

pub fn finish_railing(state: &mut AppState, level: LevelId, type_id: ElementTypeId)

Create the railing from the points clicked so far.

fn linear_direction

pub(crate) fn linear_direction(a: DVec2, b: DVec2, cursor: DVec2) -> DVec2

Horizontal or vertical measuring direction for a linear dimension from a to b, by where the cursor places the line: above or below the points’ box measures horizontally, beside it vertically.

fn line_at

pub(crate) fn line_at(drawing: &Drawing2D, p: DVec2, tol: f64) -> Option<(DVec2, DVec2)>

The linework segment (of an element) nearest to p within tol.

fn point_on_segment

pub(crate) fn point_on_segment(a: DVec2, b: DVec2, p: DVec2, tol: f64) -> bool

Whether p lies on the segment a-b within tol.

fn arc_at

pub(crate) fn arc_at(drawing: &Drawing2D, p: DVec2, tol: f64) -> Option<(DVec2, f64)>

An arc or circle drawn as a chain of short segments near p: its center and radius. Needs four consecutive points of one element on a common circle (corners of straight linework do not qualify).

fn arc_preview

pub(crate) fn arc_preview(painter: &Painter, xf: &Xf, a: DVec2, b: DVec2, bulge: f64, center: f64, half: f64)

Preview of an arc wall drawn from a to b with bulge: its location line and faces, as in paint_wall_preview.

fn place_opening_3d

pub(crate) fn place_opening_3d(state: &mut AppState, tool: &Tool, host: ElementId, point: DVec2)

A door or window tool clicked on point of wall host in a 3D view: the opening is centered there (at the type’s sill), facing the side clicked.

fn add_opening

pub fn add_opening(state: &mut AppState, host: ElementId, pts: Vec<DVec2>)

Add the sketched outline pts as an opening of roof (refused, with a message, when it is not inside the roof or overlaps another opening). Add the sketched opening pts to the roof or floor host.

fn move_elements

pub fn move_elements(state: &mut AppState, ids: &[ElementId], delta: DVec2)

Translate elements; hosted elements slide along their host unless it moves too.

fn copy_elements

pub fn copy_elements(state: &mut AppState, ids: &[ElementId], delta: DVec2, count: u32) -> Vec<ElementId>

Copy elements by delta, count times (an array); the copies are selected and returned.

fn duplicate

pub fn duplicate(state: &mut AppState, ids: &[ElementId], delta: DVec2)

Copy elements by delta; hosted elements follow copied hosts.

fn rotate_elements

pub fn rotate_elements(state: &mut AppState, ids: &[ElementId], center: DVec2, angle: f64, copy: bool) -> Vec<ElementId>

Rotate (or copy rotated) by angle radians about center; returns the elements rotated or created (copies are selected).

fn mirror_elements

pub fn mirror_elements(state: &mut AppState, ids: &[ElementId], a: DVec2, b: DVec2, copy: bool) -> Vec<ElementId>

Mirror (or copy mirrored) across the line through a and b; returns the elements mirrored or created (copies are selected).

fn rotate_selection

pub fn rotate_selection(state: &mut AppState) -> bool

Space on a selection: components and columns turn 90° about their insertion point, doors and windows flip to the other side of the wall. Returns whether anything changed (one undo step).

cc_app::truss_ui

crates/cc_app/src/truss_ui.rs

Trusses in the app: the Truss tool’s options bar and the properties of a selected truss (every parameter through element_set, which regenerates its members in the same undo step).

Items: patterns_for · tool_options · edit · props

fn patterns_for

pub fn patterns_for(shape: TrussShape) -> Vec<TrussPattern>

The patterns offered for a shape (gable-only ones on gables).

fn tool_options

pub fn tool_options(ui: &mut Ui, state: &mut AppState)

The options bar of the Truss tool.

fn edit

pub fn edit(state: &mut AppState, id: ElementId, field: &str, f: impl FnOnce(&mut Truss))

Change truss id as f changes a copy of it (element_set, which regenerates its members); edits under one field merge while dragging.

fn props

pub fn props(ui: &mut Ui, state: &mut AppState, id: ElementId, truss: &Truss)

The rows of a selected truss.

cc_app::type_dialog

crates/cc_app/src/type_dialog.rs

Type Properties dialog: switch, duplicate and rename types, edit the compound structure (layers) and the type parameters in sections.

Items: show

fn show

pub fn show(ctx: &Context, state: &mut AppState)

cc_app::units_dialog

crates/cc_app/src/units_dialog.rs

Project Units dialog: unit, decimals and symbol of each quantity, the currency and the number style, with a live sample of each format.

Items: show

fn show

pub fn show(ctx: &Context, state: &mut AppState)

cc_app::update

crates/cc_app/src/update.rs

Update notice: at startup (at most once a day) and on request, the app asks GitHub for the latest release of ConstructCraft in a background thread and, when it is newer than this build, shows a notice with a link to the release page. Checks only notify; Update Now (see crate::update_install) downloads, verifies and installs a release, and only when the user asks. The one request is an HTTPS GET of RELEASES_API with a short timeout and a bounded response; every failure is silent (logged) and reported as “could not check” only when the user asked. Automatic checks can be turned off in the About dialog, and the environment variable NO_CHECK_ENV turns every check off (CI and tests). Version comparison and the response parsing are pure functions, tested without a network.

Items: RELEASES_API · NO_CHECK_ENV · CHECK_INTERVAL · Version · Release · Outcome · current · evaluate · disabled_by_env · auto_check_due · now · Updates · Install · Plan · plan · notice

const RELEASES_API

pub const RELEASES_API: &str

The GitHub API endpoint of the latest (non-draft, non-prerelease) release.

const NO_CHECK_ENV

pub const NO_CHECK_ENV: &str

Set (to anything but 0 or nothing) to turn every update check off.

const CHECK_INTERVAL

pub const CHECK_INTERVAL: Duration

Time between automatic checks.

struct Version

pub struct Version

A release version major.minor.patch (build metadata ignored).

Traits: Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, std::fmt::Display

Fields

Methods

struct Release

pub struct Release

A published release.

Traits: Debug, Clone, PartialEq, Eq

Fields

enum Outcome

pub enum Outcome

The result of a check.

Traits: Debug, Clone, PartialEq, Eq

Variants

fn current

pub fn current() -> Option<Version>

The version of this build.

fn evaluate

pub fn evaluate(current: Version, json: &str) -> Outcome

Compare the latest-release JSON of the GitHub API with current. Drafts and pre-releases are ignored (reported as up to date).

fn disabled_by_env

pub fn disabled_by_env() -> bool

Whether NO_CHECK_ENV turns checks off.

fn auto_check_due

pub fn auto_check_due(enabled: bool, last_check: Option<u64>, now: u64) -> bool

Whether an automatic check is due: turned on, and none in the last CHECK_INTERVAL (or the clock went back). Times are seconds since the Unix epoch.

fn now

pub fn now() -> u64

Seconds since the Unix epoch (0 if the clock is before it).

struct Updates

pub struct Updates

Update checks of the app: when the last ran, the check in progress and what to show.

Traits: Debug, Default

Fields

Some fields are private.

Methods

enum Install

pub enum Install

Update Now, as the dialog shows it.

Traits: Debug

Variants

enum Plan

pub enum Plan

How Update Now would update to release here, if it can.

Variants

fn plan

pub fn plan(release: &Release) -> Option<Plan>

What Update Now does for release on this installation, or None (Download only).

fn notice

pub fn notice(ui: &mut egui::Ui, updates: &mut Updates)

The notice of a newer release, in one row: message, Download, Skip, dismiss. Shows nothing without one.

cc_app::update_install

crates/cc_app/src/update_install.rs

One-click updates: download the package of a newer release that fits how this copy was installed, verify it, and put it in place. Verification is never skipped: the package’s SHA-256 must match the release’s SHA256SUMS.txt, both fetched over HTTPS from the release’s own download links on GitHub. A package that does not match is deleted and nothing is replaced. What “put in place” means:

Items: DOWNLOAD_PREFIX · SUMS · Asset · assets_of · InstallKind · detect · this_install · package_for · installs_itself · deb_command · expected_sha256 · Progress · Next · install · swap_executable · remove_old_executables · installer_command · finish · Running

const DOWNLOAD_PREFIX

pub const DOWNLOAD_PREFIX: &str

Packages and the checksum list must come from this repository’s releases.

const SUMS

pub const SUMS: &str

The checksum list every release carries.

struct Asset

pub struct Asset

A file attached to a release.

Traits: Debug, Clone, PartialEq, Eq

Fields

fn assets_of

pub fn assets_of(release: &serde_json::Value) -> Vec<Asset>

The assets of a release response that can be downloaded safely: plain file names, links under DOWNLOAD_PREFIX.

enum InstallKind

pub enum InstallKind

How this copy of ConstructCraft was installed.

Traits: Debug, Clone, PartialEq, Eq

Variants

fn detect

pub fn detect(os: &str, exe: Option<&Path>, env: impl Fn(&str) -> Option<String>) -> InstallKind

Tell how a copy was installed from the OS (std::env::consts::OS), its executable and the environment (env).

fn this_install

pub fn this_install() -> InstallKind

This copy’s installation.

fn package_for

pub fn package_for<'a>(kind: &InstallKind, arch: &str, assets: &'a [Asset]) -> Option<&'a Asset>

The release package for kind on arch (std::env::consts::ARCH), by the end of its name (release names carry the version).

fn installs_itself

pub fn installs_itself(kind: &InstallKind) -> bool

Whether Update Now can install for kind (the others get Download, or a command).

fn deb_command

pub fn deb_command(asset: &Asset) -> String

The command that installs a downloaded .deb.

fn expected_sha256

pub fn expected_sha256(sums: &str, name: &str) -> Option<String>

The lowercase hex SHA-256 that SHA256SUMS.txt (<hex> <name> or <hex> *<name> lines) gives for name.

struct Progress

pub struct Progress

Progress of an update, shared with the window that shows it.

Traits: Debug, Default

Fields

enum Next

pub enum Next

What to do once the package is in place.

Traits: Debug, Clone, PartialEq, Eq

Variants

fn install

pub fn install(kind: &InstallKind, package: &Asset, sums_url: &str, progress: &Progress) -> Result<Next, String>

Download, verify and put in place package of the release whose checksum list is sums_url, for this installation. Runs on a background thread.

fn swap_executable

pub fn swap_executable(current: &Path, new: &Path) -> Result<(), String>

Replace the (possibly running) executable current with new: current is renamed to <name>.old first, and put back if the new one can’t take its place.

fn remove_old_executables

pub fn remove_old_executables(exe: &Path)

Remove the .old executables a previous update left beside exe.

fn installer_command

pub fn installer_command(msi: &Path, exe: &Path) -> (String, Vec<String>)

The command that runs the installer msi, waits for it and then starts exe (the installed program). If the user cancels the installer, the old version is still there to start.

fn finish

pub fn finish(next: &Next)

Start what an update left to do, as the app closes.

struct Running

pub struct Running

A running update: its progress, and the result when it is done.

Traits: std::fmt::Debug

Fields

Some fields are private.

Methods

cc_app::view3d

crates/cc_app/src/view3d.rs

Interactive 3D view backed by cc_render::Renderer3D.

Items: View3DState · fit_camera · show

struct View3DState

pub struct View3DState

Fields

Some fields are private.

Methods

fn fit_camera

pub fn fit_camera(camera: &mut CameraState, geom: &cc_geom::ModelGeometry, aspect: f32)

Zoom the camera to frame the whole model.

fn show

pub fn show(ui: &mut Ui, state: &mut AppState, view_id: ViewId, render_state: Option<&egui_wgpu::RenderState>)

cc_app::view_cube

crates/cc_app/src/view_cube.rs

Navigation cube for 3D views: a cube aligned with the world axes and a compass ring, drawn in the view’s corner. Each cube face is split into a 3 x 3 grid: the center cell looks at the face, edge cells look along the edge and corner cells give the isometric views (26 directions). Dragging the cube orbits, dragging the ring turns around the vertical axis, and the home button returns to the default view.

Items: KEYS · CubeAction · angles_from · show

const KEYS

pub const KEYS: [&str; 10]

Translation keys used at runtime (checked by the i18n tests).

struct CubeAction

pub struct CubeAction

What the user asked of the cube this frame.

Traits: Debug, Default

Fields

fn angles_from

pub fn angles_from(dir: DVec3, yaw: f64) -> (f64, f64)

Yaw and pitch that look at the target from dir (keeping yaw when looking straight down or up).

fn show

pub fn show(ui: &mut Ui, view: Rect, cam: &CameraState, north: glam::DVec2) -> CubeAction

Show the cube in the top-right corner of view, its compass turned to north (true north in plan, a unit vector; project +Y without a site).

cc_app::wall_framing_ui

crates/cc_app/src/wall_framing_ui.rs

Structure → Light Steel Frame / Wood Frame: the dialog that runs wall_framing_create on the selected walls (or the active level’s), the properties of a selected framing (through element_set, which regenerates its members in the same undo step), and the Framing row of its members.

Items: WallFramingDialog · open · walls_to_frame · command · show · edit · props · member_row

struct WallFramingDialog

pub struct WallFramingDialog

Traits: Debug, Clone

Fields

Methods

fn open

pub fn open(state: &mut AppState, system: FramingSystem)

fn walls_to_frame

pub fn walls_to_frame(state: &AppState) -> Vec<ElementId>

The walls OK frames: the selected walls, or every wall of the active level when nothing is selected (a selection without walls frames nothing); only straight walls not framed yet.

fn command

pub fn command(d: &WallFramingDialog, walls: &[ElementId]) -> WallFramingCreate

The command OK runs for walls.

fn show

pub fn show(ctx: &Context, state: &mut AppState)

fn edit

pub fn edit(state: &mut AppState, id: ElementId, field: &str, f: impl FnOnce(&mut WallFraming))

Change framing id as f changes a copy of it (element_set, which regenerates its members); edits under one field merge while dragging.

fn props

pub fn props(ui: &mut Ui, state: &mut AppState, id: ElementId, framing: &WallFraming)

The rows of a selected framing.

fn member_row

pub fn member_row(ui: &mut Ui, state: &mut AppState, member: ElementId)

The Framing row of a member of a wall framing: its button selects the framing.