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.
| 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_appcrates/cc_app/src/main.rs
cc_app::actionscrates/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
material_type_refpub 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).
structure_placepub 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.
run_commandpub 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.
new_planpub fn new_plan(state: &mut AppState, level: LevelId, ceiling: bool) -> Option<ViewId>
new_3dpub fn new_3d(state: &mut AppState) -> Option<ViewId>
new_legendpub fn new_legend(state: &mut AppState) -> Option<ViewId>
new_drafting_viewpub fn new_drafting_view(state: &mut AppState) -> Option<ViewId>
new_schedulepub fn new_schedule(state: &mut AppState, category: Category) -> Option<ViewId>
new_sheetpub fn new_sheet(state: &mut AppState) -> Option<ViewId>
t_categorypub fn t_category(category: Category) -> String
duplicate_viewpub 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.
delete_viewpub fn delete_view(state: &mut AppState, id: ViewId)
rename_viewpub fn rename_view(state: &mut AppState, id: ViewId, name: String)
sheet_ofpub fn sheet_of(project: &Project, view: ViewId) -> Option<ViewId>
Sheet that already shows view, if any.
place_on_sheetpub fn place_on_sheet(state: &mut AppState, sheet: ViewId, view: ViewId)
place_on_sheet_atpub 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.
remove_viewportpub fn remove_viewport(state: &mut AppState, sheet: ViewId, index: usize)
add_level_besidepub 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.
delete_levelpub fn delete_level(state: &mut AppState, level: LevelId)
Delete a level and its plan views; refused while elements use it.
open_default_3dpub fn open_default_3d(state: &mut AppState)
Open the project’s first 3D view, creating one when there is none.
activate_category_toolpub fn activate_category_tool(state: &mut AppState, category: Category)
new_projectpub fn new_project() -> Project
A new project from the template, named in the active UI language.
set_languagepub fn set_language(state: &mut AppState, lang: crate::i18n::Language)
Switch the UI language and refresh text baked into cached drawings.
guardedpub fn guarded(state: &mut AppState, action: PendingAction)
Run action now, or ask for confirmation first if there are unsaved changes.
run_pendingpub fn run_pending(state: &mut AppState, action: PendingAction)
openpub fn open(state: &mut AppState)
open_pathpub fn open_path(state: &mut AppState, path: std::path::PathBuf)
Open the project at path, read on a worker thread behind the progress dialog.
save_componentpub fn save_component(state: &mut AppState, name: &str)
Save the component name (all its types) to a .ccomp file.
load_componentpub 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.
load_component_pathpub fn load_component_path(state: &mut AppState, path: std::path::PathBuf)
Load the component file at path (see load_component).
import_skppub fn import_skp(state: &mut AppState)
Insert a SketchUp model into the project, on the active view’s level.
export_ifcpub fn export_ifc(state: &mut AppState)
SheetFormatpub enum SheetFormat
Vector formats a sheet can be exported to.
Traits: Debug, Clone, Copy, PartialEq, Eq
Variants
PdfSvgactive_sheetpub fn active_sheet(state: &AppState) -> Option<ViewId>
The active view when it is a sheet.
export_sheetpub fn export_sheet(state: &mut AppState, format: SheetFormat)
Export the active sheet as PDF or SVG.
IMAGE_DPIpub const IMAGE_DPI: f64
Resolution of exported images, dots per inch.
image_viewpub 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).
export_imagepub fn export_image(state: &mut AppState)
Export the active view as a PNG image, as printed (no temporary hiding).
export_dxfpub 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.
toggle_macro_recordingpub 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).
run_macropub fn run_macro(state: &mut AppState)
Run a macro (a script of commands) on the open project; each step is one undo step.
run_macro_filepub fn run_macro_file(state: &mut AppState, path: &std::path::Path)
Run the macro at path (see run_macro).
savepub fn save(state: &mut AppState, save_as: bool) -> bool
select_instancespub 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).
group_selectionpub fn group_selection(state: &mut AppState)
Group the selection (the engine’s group_create).
ungroup_selectionpub fn ungroup_selection(state: &mut AppState)
Ungroup every group the selection touches (the engine’s group_ungroup).
grids_forpub fn grids_for(state: &AppState) -> Vec<u64>
Ids of the selected grids, or of every grid when none is selected.
reference_gridpub fn reference_grid(state: &AppState) -> Option<u64>
The single selected grid, the reference of align_grid_ends.
align_grid_endspub 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).
selected_columnspub fn selected_columns(state: &AppState) -> Vec<u64>
The selected columns as a chain: from the lowest-left one, each followed by the nearest left.
columns_at_gridspub fn columns_at_grids(state: &mut AppState)
Columns at the intersections of the selected grids (the engine’s columns_at_grids).
beams_on_gridspub fn beams_on_grids(state: &mut AppState)
Beams between the columns along the selected grids (the engine’s beams_on_grids).
footings_under_columnspub fn footings_under_columns(state: &mut AppState)
Pad footings under the selected columns, or every column of the active level.
strip_footings_under_wallspub fn strip_footings_under_walls(state: &mut AppState)
Strip footings under the selected walls, or every wall of the active level.
slab_join_supportspub 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.
open_analytical_viewpub fn open_analytical_view(state: &mut AppState)
Open the analytical model view, creating it the first time.
export_analyticalpub fn export_analytical(state: &mut AppState)
Export the analytical model as JSON.
typical_rebarpub 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.
open_rebar_viewpub fn open_rebar_view(state: &mut AppState)
Open the first 3D view showing reinforcement, creating one the first time.
open_structural_planpub fn open_structural_plan(state: &mut AppState)
Open the structural plan of the active level (or the lowest), creating it the first time.
mep_connectpub fn mep_connect(state: &mut AppState)
Connect the selected fixtures and devices to the nearest pipes and conduits (mep_connect).
open_panel_diagrampub fn open_panel_diagram(state: &mut AppState)
Open the diagram of the selected distribution board (or the first), creating it the first time.
open_mep_planpub 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.
number_structurepub fn number_structure(state: &mut AppState)
Number the beams, columns and footings of the active level (or the whole project).
active_floor_planpub fn active_floor_plan(state: &AppState) -> Option<(ViewId, bool)>
The active view when it is a floor plan, with whether it shows structure tags.
toggle_structure_tagspub fn toggle_structure_tags(state: &mut AppState)
Show or hide the beam and column tags of the active floor plan.
beams_between_columnspub fn beams_between_columns(state: &mut AppState)
Beams through the selected columns (the engine’s beams_between_columns).
hide_in_viewpub fn hide_in_view(state: &mut AppState)
Hide the selection in the active view (permanently; Visibility/Graphics shows it again).
temporarypub fn temporary(state: &mut AppState, action: &str)
Temporarily hide or isolate the selection (or its categories) in the active view, or reset.
temporary_permanentpub fn temporary_permanent(state: &mut AppState)
Make the active view’s temporary hide/isolate permanent.
selected_massespub fn selected_masses(state: &AppState) -> Vec<ElementId>
The masses in the selection.
from_massespub fn from_masses(state: &mut AppState, what: &str)
Walls (walls), floors (slabs) or roofs (roof) from each selected
mass; what they make is selected.
terrain_on_levelpub fn terrain_on_level(state: &AppState) -> bool
Whether the active plan’s level has a terrain (for building pads to grade).
cc_app::appcrates/cc_app/src/app.rs
Top-level eframe application: layout, dock and keyboard shortcuts.
Items: Args · ConstructApp · zoom_fit · shortcuts
Argspub struct Args
Command-line options.
Traits: Debug, Default, Clone
Fields
path: Option<std::path::PathBuf>views: Vec<String>
Views (by name or tab title) to open at startup.
language: Option<Language>graph: Option<std::path::PathBuf>
A visual programming graph to open in the graph editor.
ConstructApppub struct ConstructApp
Traits: eframe::App
Some fields are private.
Methods
pub fn new(cc: &eframe::CreationContext<'_>, args: Args) -> Self
Create the app; see Args for the startup options.
zoom_fitpub fn zoom_fit(state: &mut AppState)
Zoom the active view to fit its contents.
shortcutspub(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_uicrates/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
between_columnspub 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).
startpub 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).
tool_optionspub fn tool_options(ui: &mut Ui, state: &mut AppState)
The options bar of the Bracing tool.
editpub 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.
propspub fn props(ui: &mut Ui, state: &mut AppState, id: ElementId, bracing: &Bracing)
The rows of a selected bracing.
cc_app::browsercrates/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
ViewDragpub struct ViewDrag(pub ViewId)
A view dragged from the browser (dropped on a sheet, it is placed there).
Traits: Debug, Clone, Copy, PartialEq, Eq
category_iconpub fn category_icon(category: ViewCategory) -> Icon
bodypub fn body(ui: &mut Ui, state: &mut AppState)
The browser’s tree, under a header drawn by the caller.
cc_app::browser_org_dialogcrates/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
BrowserOrgDialogpub struct BrowserOrgDialog
The open Browser Organization dialog.
Some fields are private.
Methods
pub fn edits_finish(self, state: &mut AppState, keep: bool)
Close the dialog’s edits: keep them (OK) or undo them (Cancel).
openpub fn open(state: &mut AppState)
showpub fn show(ctx: &Context, state: &mut AppState)
cc_app::cad_uicrates/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
EXTENSIONSpub const EXTENSIONS: [&str; 2]
File extensions read as CAD drawings.
cad_viewpub fn cad_view(state: &AppState) -> Option<ViewId>
The active view when it can hold an imported drawing.
selected_importpub fn selected_import(state: &AppState) -> Option<ElementId>
The imported drawing selected alone, if any.
explode_selectedpub 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.
import_cadpub fn import_cad(state: &mut AppState)
Pick a DWG or DXF file and import it into the active view.
import_cad_pathpub 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.
import_imagepub fn import_image(state: &mut AppState)
Pick a picture or an SVG file and import it into the active view.
import_image_pathpub 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.
dropped_filespub 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.
propspub 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_uicrates/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
CalloutOptionspub struct CalloutOptions
Options of the Callout tool.
Traits: Debug, Clone, Copy, PartialEq, Default
Fields
scale: u32
Scale denominator of the new detail view (0: about five times the parent’s).
drafting: Option<ViewId>
A drafting view the callout points to instead of a new detail view.
Partpub enum Part
What a drag of a callout mark holds.
Traits: Debug, Clone, Copy, PartialEq
Variants
Body
The whole mark, moved.
Corner(usize)
A corner of the rectangle (as CropBox::corners counts them).
toolpub 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.
optionspub 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.
selectpub 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).
view_rowspub 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::canvascrates/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
ZoomCommandpub enum ZoomCommand
Zoom commands of the view toolbar menu.
Traits: Debug, Clone, Copy, PartialEq, Eq, Default
Variants
Region
Drag a window to zoom into.
OutTwo
Zoom out by half around the view center.
FitFitAll
Zoom every open view to fit.
SheetSize
One paper millimeter shows as one screen millimeter.
PreviousNextMethods
pub const ALL: [ZoomCommand; 7]pub fn key(self) -> &'static strZoomNavpub struct ZoomNav
What the zoom menu can offer in a view.
Traits: Debug, Clone, Copy, Default
Fields
back: boolforward: boolsheet_size: bool
The view has a paper scale (“zoom sheet size”).
View2DStatepub struct View2DState
Pan/zoom state of a 2D view.
Traits: Debug, Clone, Default
Fields
center: DVec2
Drawing coordinates shown at the canvas center.
ppm: f64
Screen points per drawing unit.
fitted: bool
Whether the view has been zoomed to fit at least once (or after “zoom extents”).
zoom_region: bool
“Zoom in region” waits for a window; the drag’s start once it began.
Some fields are private.
Methods
pub fn xf(&self, rect: Rect) -> Xfpub fn nav(&self) -> ZoomNavpub fn apply(&mut self, cmd: ZoomCommand, mm_scale: f64)
Run a zoom command; mm_scale is the drawing’s paper millimeters
per drawing unit (sheets: 1; plans at 1:100: 10).
pub fn request_fit(&mut self)
Zoom to fit on the next frame (fitting needs the drawing’s bounds), remembering the current pan/zoom.
pub fn start_empty(&mut self, scale: u32, drafting: bool)
Where a view with nothing to fit starts. A view of the model shows the first meters of a building; a drafting view, drawn at its own scale, shows as much paper as a 1:100 plan does at that zoom, so what is annotated in it can be read (issue #318: at the zoom of a building the text of a 1:10 detail is a pixel tall).
pub fn fit(&mut self, (lo, hi): (DVec2, DVec2), rect: Rect)pub fn needs_fit(&self, rect: Rect) -> bool
Whether to zoom to fit now: the view was never fitted, or it was left as fitted and its canvas changed size.
pub fn navigate(&mut self, ui: &Ui, resp: &Response, rect: Rect)
Wheel or pinch zoom around the cursor, two-finger (trackpad) and
middle-button pan (see crate::gestures).
pub fn region(&mut self, ui: &Ui, resp: &Response, painter: &egui::Painter, rect: Rect) -> bool
“Zoom in region”: drag a window and zoom to it; a click or Esc cancels. Returns true while it takes the pointer (tools wait meanwhile).
zoompub 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).
showpub fn show(ui: &mut Ui, state: &mut AppState, view_id: ViewId)
Show a graphical 2D view and run the active tool on it.
temporary_framepub 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.
view_toolbarpub 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::clipboardcrates/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
Clipboardpub struct Clipboard
Copied elements and, while pasting, their preview in the active view.
Traits: Default
Some fields are private.
Methods
pub fn is_empty(&self) -> boolcopypub 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).
cutpub fn cut(ctx: &egui::Context, state: &mut AppState)
Copy the selection to the clipboard and delete it (pinned elements stay).
pastepub 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.
paste_alignedpub 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.
paste_toolpub 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.
start_match_typepub fn start_match_type(state: &mut AppState)
Start match type: with one element selected it is the source, otherwise the first click picks it.
match_type_toolpub 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::commandscrates/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
set_key_overridespub fn set_key_overrides(keys: &std::collections::BTreeMap<String, String>)
Use keys (command id → two letters, or empty) as the custom shortcuts.
is_letter_keyspub fn is_letter_keys(keys: &str) -> bool
Two ASCII capital letters, the form of the keys typed in a view.
UiCommandpub enum UiCommand
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash
Variants
HomeNewOpenSaveSaveAsCloseProjectImportIfcImportCad
Import a DWG or DXF drawing into the active view.
ImportImage
Import a picture or an SVG drawing into the active view.
ImportSkp
Insert a SketchUp model into the open project.
ImportObj
Insert a Wavefront OBJ model into the open project.
ImportGltf
Insert a glTF model (.glb, .gltf) into the open project.
ExportIfcExportPdfExportSvgExportImageExportDxfAboutCheckUpdatesPreferencesUndoRedoDefault3DPlace(Category)
The placement tool of a model category.
StructurePlace(Category, cc_core::StructuralMaterial)
Start the column or beam tool on a type of the given structural material.
NewComponentLoadComponentComponentLibraryEditComponent
Open the component modeling environment on the selected component.
CompExtrusion
Environment tools and actions.
CompRevolutionCompSweepCompBlendCompRefPlaneCompDimensionCompEqualCompConnectorCompSaveFileCompFinishCompCancelSketchLine
Sketch mode: drawing tools, picking the walls, finish and cancel.
SketchRectSketchPolygonSketchPolygonOutSketchCircleSketchEllipseSketchSplineSketchArc3SketchArcCenterSketchArcTangentSketchPoint
A measured point of a terrain (its elevation from the options bar).
SketchPickWallsSketchFinishSketchCancelEditBoundary
Open the sketch of the selected floor, ceiling, roof or mass.
EditProfile
Open the profile of the selected sweep’s type in a sketch.
EditTitleBlock
Open the active sheet’s title block in the editor.
NewTitleBlock
Create a title block from the standard layout and open it.
TbLines
Sketch lines and arcs of a title block.
TbText
Place a text on a title block.
TbImage
Place a picture on a title block.
SelectSelectInstancesColumnsAtGridsGridFrame
Opens the Grid Frame dialog.
SteelBuildingLightSteelFrame
Opens the Wall Framing dialog for light steel.
WoodFrame
Opens the Wall Framing dialog for wood.
AlignGridEndsBeamsOnGridsBeamsBetweenColumnsStructuralSchedulesFootingsUnderColumnsStripFootingsUnderWallsFoundationSlabSlabJoinSupportsAnalyticalViewAnalyticalExportTrussBracing
Brace the bay between two selected columns, else start the Bracing tool.
TypicalRebarConnection(cc_core::connection::ConnectionKind)
Place connections of a kind on the selected members, else the active level’s.
RebarViewSteelScheduleStructuralPlanNumberStructureStructureTagsPlaceFixturePlaceDeviceSystemsPlumbingPlanElectricalPlanMepSchedulesMepConnectMepSizingPanelDiagramPlaceDeviceOf(cc_core::DeviceKind)
Place a communications or lightning protection device (its built-in type made on first use).
EarthRingLpsCheckCablingCommunicationsPlanLightningPlanDimension(DimensionMode)TextLevelMarkPlanLevelMarkSectionAddLeaderDetailLineFilledRegionMaskingRegionLineStylesBrowserOrganizationDetailComponentCreateDetailComponentMoveCopyElementsRotateMirrorPickMirrorDrawArrayAlignPushPullMassWalls
Walls, floors and a roof from the selected masses.
MassSlabsMassRoofOffsetTrimCornerTrimExtendSplitToggleJoinMeasureJoinGeometryUnjoinGeometryAttachTopDetachTopPaint
Paint faces with a material in a 3D view.
RemovePaintGroupUngroupExplode
Explode the selected imported drawing into native 2D elements.
PinUnpinDeletePasteCutClipboardCopyMatchTypeFloorPlanCeilingPlanNew3DSectionCallout
Draw a callout: a detail view of a region of the active view.
ElevationsLegendDraftingViewScheduleSheetZoomFitCloseInactiveViews
Close every view tab but the active one.
VisibilityGraphicsViewFiltersViewTemplatesSunSettingsRender
Path trace the active 3D view in the render window.
OverrideGraphicsHideInViewTempHideTempIsolateTempHideCategoryTempIsolateCategoryTempResetTempPermanentPhasesDesignOptionsActiveOptionDemolishCurtainGridProjectInfoSiteLocationUnitsLevelsMaterialsFillPatternsProfilesMacroRecordMacroRunVisualProgramming
Open or close the visual programming editor.
PluginsPluginCommandsToggleRibbonCommandPaletteMethods
pub fn all() -> Vec<UiCommand>
Every command, in ribbon order.
pub fn from_keys(keys: &str) -> Option<UiCommand>
The command a two-letter key sequence runs.
pub fn from_id(id: &str) -> Option<UiCommand>
The command named id (see UiCommand::id).
pub fn icon(self) -> Iconpub fn badge(self) -> Option<Badge>
The mark of the kind of action: creating, importing, exporting.
pub fn label(self, state: &AppState) -> String
Button label.
pub fn title(self, state: &AppState) -> String
Tooltip title: the label, plus what undo and redo would change.
pub fn description(self) -> String
What the command does, one or two sentences.
pub fn shortcut(self) -> Option<String>
Keyboard shortcut: a Ctrl chord or a two-letter sequence typed in a view; two-letter keys follow the user’s choices (Preferences → Shortcuts).
pub fn id(self) -> String
A stable name of the command, under which its custom keys are kept.
pub fn customizable(self) -> bool
Whether the user may change the keys: two-letter ones and commands without keys (Ctrl chords, Delete and Esc are fixed).
pub fn default_shortcut(self) -> Option<&'static str>
The keys the command has before any change by the user.
pub fn engine(self) -> Option<&'static str>
The engine command that makes the change, as scripts and the MCP server call it.
pub fn unavailable(self, state: &AppState) -> Option<String>
Why the command cannot run now, or None when it can.
pub fn selected(self, state: &AppState) -> bool
Whether the command’s tool or mode is the active one.
DEVICE_TOOLSpub const DEVICE_TOOLS: [cc_core::DeviceKind; 4]
Communications and lightning protection devices placed by a tool of their own.
phase_viewpub fn phase_view(state: &AppState) -> Option<cc_core::ViewId>
The active view when it is a 2D view with a phase (plans, elevations, sections).
graphics_viewpub fn graphics_view(state: &AppState) -> Option<cc_core::ViewId>
The active view when it has visibility/graphics (plans, elevations, sections, 3D, drafting views).
invokepub fn invoke(state: &mut AppState, ctx: &egui::Context, command: UiCommand)
Run command if it is available; otherwise say why in the status bar.
runpub fn run(state: &mut AppState, ctx: &egui::Context, command: UiCommand)
cc_app::component_envcrates/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
VIEW_SCALEpub(crate) const VIEW_SCALE: u32
Scale the views are drawn at (text and dimension sizes).
Pickpub enum Pick
What is selected in the environment.
Traits: Debug, Clone, PartialEq
Variants
Plane(String)Dimension(usize)Piece(usize)
A piece, by its index in the definition.
Equal(usize)
An equality (EQ), by its index.
Connector(usize)
A connector, by its index.
Sheet(Vec<usize>)
2D pieces of a title block, by their indices in def.sheet.
EnvToolpub enum EnvTool
The tool of the environment.
Traits: Debug, Clone, PartialEq, Default
Variants
SelectRefPlane { first: Option<(ComponentViewKind, DVec2)> }
Two clicks along the plane’s line in a view.
Dimension { first: Option<(ComponentViewKind, String)> }
Two parallel planes, then the line’s place.
Equal { picked: Vec<String>, view: Option<ComponentViewKind> }
Three parallel planes: an outer one, the one kept halfway, the other.
Connector
A click in the plan, front or side view places a connector.
SheetText
A click on a title block’s Sheet view places a text.
SheetImage { picture: std::sync::Arc<crate::title_block_env::Picture>, start: Option<DVec2> }
A drag on a title block’s Sheet view places a picture.
Envpub struct Env
Fields
type_id: ElementTypeId
The type the environment shows (its parameter values).
dock: DockState<ComponentViewKind>pick: Option<Pick>tool: EnvToolstart_depth: usize
Undo depth when the environment opened (Cancel goes back to it).
created: bool
The component was made as the environment opened (New Component): Finish picks the tool that places it.
sheet: Option<crate::title_block_env::SheetEditor>
A title block shows on one Sheet view instead (crate::title_block_env).
Some fields are private.
openpub 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).
open_onpub 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.
open_newpub 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.
target_typepub fn target_type(state: &AppState) -> Option<ElementTypeId>
The type of the selected component element, or the one the component tool places.
save_filepub fn save_file(state: &mut AppState)
Save the component as a .ccomp file.
finishpub fn finish(state: &mut AppState)
Leave the environment keeping the changes.
cancelpub fn cancel(state: &mut AppState)
Leave the environment undoing every change made in it.
componentpub(crate) fn component(state: &AppState) -> Option<(String, cc_core::ComponentDef)>
The component’s definition, name and parameter values of the shown type.
type_refpub(crate) fn type_ref(state: &AppState) -> Ref
plane_from_linepub 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.
plane_atpub fn plane_at(view: &ComponentView, p: DVec2, tol: f64) -> Option<String>
The plane of view whose line passes within tol (model units) of p.
piece_atpub fn piece_at(view: &ComponentView, p: DVec2, tol: f64) -> Option<usize>
The piece with an edge within tol of p.
connector_atpub fn connector_at(view: &ComponentView, p: DVec2, tol: f64) -> Option<usize>
The connector whose marker is within tol of p.
connector_from_clickpub 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).
dimension_atpub fn dimension_at(view: &ComponentView, p: DVec2, tol: f64) -> Option<usize>
The dimension whose text is within tol of p.
ribbonpub fn ribbon(ui: &mut Ui, state: &mut AppState)
The Create tab of the ribbon.
optionspub fn options(ui: &mut Ui, state: &mut AppState)
The hint of the active tool, for the options bar.
centralpub fn central(ui: &mut Ui, state: &mut AppState)
The central area: the component’s views in tabs.
set_toolpub fn set_tool(state: &mut AppState, tool: EnvTool)
escapepub fn escape(state: &mut AppState)
Esc steps back: the tool’s first pick, the tool, the selection.
delete_pickpub fn delete_pick(state: &mut AppState)
Delete removes the selected plane or dimension.
draft_fieldpub(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.
panelpub fn panel(ui: &mut Ui, state: &mut AppState)
The component’s types, parameters and the selection’s properties.
ref_problemspub(crate) fn ref_problems(ui: &mut Ui, def: &cc_core::ComponentDef)
The planes and dimensions that do not resolve, in the danger color.
types_rowpub(crate) fn types_row(ui: &mut Ui, state: &mut AppState)
The type whose values the views show.
paramspub(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.
piece_propspub 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_sketchcrates/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
PieceKindpub enum PieceKind
What the sketch becomes.
Traits: Debug, Clone, Copy, PartialEq, Eq, Default
Variants
ExtrusionRevolution
Turned about an axis picked after the outline is finished.
Sweep
A section carried along an open path (the path is what is drawn).
Blend
A bottom outline, then a top one.
PieceSketchpub struct PieceSketch
A piece being sketched: what it becomes and where it stands.
Traits: Debug, Clone, PartialEq
Fields
kind: PieceKindvoid: boolview: Option<ComponentViewKind>
The view the sketch is drawn in (set by its first curve, or the edited piece’s plane).
edit: Option<usize>
The piece whose sketch is edited.
old: Vec<ProfilePoint>
The edited outline’s (or path’s) points as they were, and a blend’s top.
old_top: Vec<ProfilePoint>bottom: Option<Vec<SketchCurve>>
A blend’s bottom outline, once finished.
axis: bool
The outline of a revolution is finished and waits for its axis.
section: (f64, f64)
A sweep’s section: width (or diameter) and height, round or not.
round: boolMethods
pub fn new(kind: PieceKind) -> Selfsection_pointspub 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).
umpub(crate) fn um(v: f64) -> String
A number rounded to the micrometer, as an expression.
offsetpub fn offset(e: &str, d: f64) -> String
e + d, folded into a number when e is one.
snappub 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.
samepub(crate) fn same(a: Segment, b: Segment) -> bool
Whether two segments are the same (an arc of the same radius, the same ellipse).
writtenpub(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).
piecepub fn piece(state: &AppState) -> Option<&PieceSketch>
The open sketch’s piece, if it is one.
startpub fn start(state: &mut AppState, kind: PieceKind)
Start sketching a new piece of kind.
editpub fn edit(state: &mut AppState, index: usize)
Open the sketch of piece index (Edit Sketch).
finishpub 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.
canvaspub 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.
optionspub 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_uicrates/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.
placepub 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.
editpub 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.
propspub fn props(ui: &mut Ui, state: &mut AppState, id: ElementId, connection: &Connection)
The rows of a selected connection.
cc_app::curtain_uicrates/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
GridModepub enum GridMode
What a click of the Curtain Grid tool does.
Traits: Debug, Clone, Copy, PartialEq, Eq, Default
Variants
AddLine
Put in a grid line (vertical or horizontal, see CurtainOptions::axis).
RemoveLine
Take out the line nearest the click.
Segment
Merge the cells on both sides of the clicked segment, or split them again.
Panel
Give the clicked panel CurtainOptions::panel.
Methods
pub const ALL: [GridMode; 4]pub fn key(self) -> &'static strPanelChoicepub enum PanelChoice
The panel the tool puts in.
Traits: Debug, Clone, Copy, PartialEq, Eq, Default
Variants
Type
The type’s panel again.
GlassSolidEmptyComponent(ElementTypeId)CurtainOptionspub struct CurtainOptions
Options of the Curtain Grid tool.
Traits: Debug, Clone, Copy, PartialEq, Default
Fields
mode: GridModeaxis: GridAxis
Direction of new lines (plans only add vertical ones).
panel: PanelChoicegrid_toolpub 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.
has_curtain_typepub fn has_curtain_type(state: &AppState) -> bool
Whether the project has a curtain wall type.
new_type_labelpub fn new_type_label() -> String
The wall tool’s list entry that makes a curtain type.
new_curtain_typepub 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.
options_barpub fn options_bar(ui: &mut Ui, state: &mut AppState)
The options bar of the Curtain Grid tool.
palette_rowspub 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.
type_sectionspub 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_uicrates/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
OptionsDialogpub struct OptionsDialog
The open Design Options dialog.
Some fields are private.
openpub fn open(state: &mut AppState)
showpub fn show(ctx: &Context, state: &mut AppState)
active_labelpub fn active_label(state: &AppState) -> String
The name of the option being edited, or of the main model.
active_menupub fn active_menu(ui: &mut Ui, state: &mut AppState)
The menu of the option being edited: the main model, then every option.
view_sectionpub 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.
template_rowspub fn template_rows(ui: &mut Ui, state: &mut AppState, template: cc_core::TemplateId)
A view template’s choices (in the template manager’s grid).
element_rowspub 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_uicrates/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
PlaceOptionspub struct PlaceOptions
Options of the Detail Component tool.
Traits: Debug, Clone, Copy, PartialEq, Default
Fields
rotation: f64
Degrees counter-clockwise.
scale: f64mirrored: booloptionspub fn options(ui: &mut Ui, state: &mut AppState)
The options bar of the tool: rotation, scale and mirror.
toolpub 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.
selectionpub 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).
create_from_selectionpub 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.
propspub 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_uicrates/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
DetailModepub enum DetailMode
How the Detail Line tool draws.
Traits: Debug, Clone, Copy, PartialEq, Eq, Default
Variants
Line
One line from two points.
Polyline
Lines chained end to end.
Arc3
An arc through its two ends and a point on it.
ArcCenter
An arc by its center, start and end.
CircleEllipseRectangleMethods
pub const ALL: [DetailMode; 7]pub fn key(self) -> &'static strDetailOptionspub struct DetailOptions
Options of the Detail Line tool (kept between uses, in the options bar).
Traits: Debug, Clone, Copy, PartialEq, Eq, Default
Fields
mode: DetailModestyle: LineStyleRef
A built-in style or one of the project’s.
DetailDrawpub struct DetailDraw
The curve being drawn in a view.
Traits: Debug, Clone
Some fields are private.
toolpub 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.
createpub(crate) fn create(state: &mut AppState, view: ViewId, style: LineStyleRef, curves: &[SketchCurve])
Make curves detail lines of view (one undo step); they are selected.
typingpub 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.
typed_targetpub fn typed_target(state: &mut AppState) -> &mut TypedInput
Where typed values go: the detail line being drawn (see typing),
else the other tools’ lengths.
escapepub fn escape(state: &mut AppState) -> bool
Esc while a curve is being drawn: drop the typed value, else its picks. Returns whether it did.
view_ownedpub 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).
nearpub fn near(line: &DetailLine, p: DVec2, r: f64) -> bool
Whether a detail line passes within r of p (a quick bounds check for snapping).
gripspub 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.
split_pickpub 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.
offset_pickpub 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.
optionspub fn options(ui: &mut Ui, state: &mut AppState)
The options bar of the Detail Line tool: the mode and the line style.
style_labelpub 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.
style_pickerpub 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.
propspub 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::dialogcrates/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
BUTTON_SIZEpub const BUTTON_SIZE: egui::Vec2
Minimum size of footer buttons.
Kindpub enum Kind
Icon shown next to the message of an alert.
Traits: Debug, Clone, Copy, PartialEq, Eq
Variants
WarningErrorStylepub enum Style
Visual weight of a footer button.
Traits: Debug, Clone, Copy, PartialEq, Eq
Variants
PrimarySecondaryDangerstyled_buttonpub fn styled_button(ui: &mut Ui, label: &str, style: Style) -> egui::Response
A highlighted button with the standard footer size.
Footerpub struct Footer
Footer buttons, declared in display order; Dialog::show reports which was clicked.
Traits: Default
Some fields are private.
Methods
pub fn primary(&mut self, label: impl Into<String>) -> usize
The main action (Enter triggers it when no text field has focus).
pub fn secondary(&mut self, label: impl Into<String>) -> usizepub fn danger(&mut self, label: impl Into<String>) -> usizepub fn disable(&mut self, index: usize)
Grey out the button index (as returned by Footer::primary and
the others, auxiliary buttons too): it cannot be clicked and Enter
does not press it.
pub fn extra(&mut self, label: impl Into<String>) -> usize
An auxiliary button on the left side. Its index follows the actions’.
pub fn toggle(&mut self, label: impl Into<String>, on: bool) -> usize
An auxiliary button that stays pressed while on (a mode of the
dialog the button turns on and off). Its index follows the actions’.
DialogResponsepub struct DialogResponse
Fields
clicked: Option<usize>
Index returned by the Footer method of the clicked button.
dismissed: bool
Closed with Esc or the close button.
Dialogpub struct Dialog
Some fields are private.
Methods
pub fn new(id: impl std::hash::Hash + std::fmt::Debug, title: impl Into<String>) -> Selfpub fn width(mut self, width: f32) -> Self
Width of the body content.
pub fn kind(mut self, kind: Kind) -> Self
Show an alert icon next to the body.
pub fn show(self, ctx: &Context, body: impl FnOnce(&mut Ui), footer: impl FnOnce(&mut Footer)) -> DialogResponsetwo_columnspub 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::sessioncrates/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
beginpub fn begin(state: &mut AppState)
Mark the start of the dialog’s edits (no-op if already marked).
commitpub fn commit(state: &mut AppState)
Keep the edits.
cancelpub fn cancel(state: &mut AppState)
Undo every edit made since begin.
cc_app::dialogscrates/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
showpub fn show(ctx: &Context, state: &mut AppState)
ok_cancelpub(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.
add_project_fieldpub(crate) fn add_project_field(state: &mut AppState) -> bool
Add a project field with an unused name (Field 1, Field 2…) and no value.
rename_project_fieldpub(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).
remove_project_fieldpub(crate) fn remove_project_field(state: &mut AppState, name: &str) -> bool
Remove project field name.
material_combopub(crate) fn material_combo(ui: &mut Ui, state: &AppState, id: impl Hash + std::fmt::Debug, current: &mut String) -> bool
cc_app::dim_editcrates/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
Targetpub enum Target
What an edited value drives.
Traits: Debug, Clone, PartialEq
Variants
Dimension(ElementId)
The value of a dimension element.
Offset { ids: Vec<ElementId>, dir: DVec2, current: f64 }
A temporary dimension of the selection: ids move along dir so
that the measured current distance becomes the typed one.
ValueEditpub struct ValueEdit
The open value field.
Traits: Debug, Clone
Some fields are private.
openpub fn open(state: &mut AppState, view: ViewId, target: Target, at: Pos2)
Open the value field for target at the screen point at.
canvaspub 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).
showpub fn show(ui: &Ui, state: &mut AppState, view: ViewId)
The value field over view, when open there.
apply_textpub fn apply_text(state: &mut AppState, target: &Target, text: &str) -> Result<(), String>
Parse text for target and apply it.
set_dimension_valuepub 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.
Temppub 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
from: DVec2to: DVec2away: DVec2
Unit direction the element moves for a larger value (away from to).
tempspub 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_uicrates/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
type_sectionspub fn type_sections(ui: &mut Ui, state: &mut AppState, ty: &ElementType)
The dimension type’s sections; nothing for other types.
cc_app::engine_editcrates/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
elementspub 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.
elements_identitypub 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.
elementpub 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).
element_typepub 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).
viewpub 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).
sheetpub 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.
materialpub 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).
unitspub 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).
infopub 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).
systempub 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).
levelpub 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).
level_heightpub 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_dialogcrates/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
labelpub fn label(project: &Project, p: Pattern) -> String
A pattern’s name: the built-in’s, translated, or the project pattern’s.
choicespub fn choices(project: &Project) -> Vec<(Pattern, String)>
The patterns a picker offers: the built-in ones, then the project’s.
paintpub 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.
swatchpub fn swatch(ui: &mut Ui, project: &Project, pattern: Pattern, size: egui::Vec2) -> egui::Response
A small framed swatch of pattern in black on white.
pickerpub 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.
FillPatternsDialogpub struct FillPatternsDialog
The open Fill Patterns dialog.
Some fields are private.
openpub fn open(state: &mut AppState)
showpub fn show(ctx: &Context, state: &mut AppState)
open_importpub fn open_import(state: &mut AppState, path: PathBuf)
Read the patterns of the .pat file at path and offer them.
cc_app::gesturescrates/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
set_trackpad_panspub fn set_trackpad_pans(on: bool)
Follow the Trackpad scrolling pans preference.
Gesturepub struct Gesture
What the scroll and pinch of this frame ask a view to do.
Traits: Debug, Clone, Copy, PartialEq
Fields
zoom_scroll: f32
Scroll that zooms, in points (a wheel; positive: in).
pinch: f32
Pinch (or Ctrl+scroll) zoom factor (1: none).
pan: Vec2
How far the content moves on screen, in points (two fingers on a trackpad).
Methods
pub fn zoom(&self, rate: f64) -> f64
The zoom factor, with rate per point of wheel scroll.
readpub fn read(ui: &Ui) -> Gesture
The gesture of this frame (call it only while the view is hovered).
cc_app::gpucrates/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
Apipub enum Api
A family of graphics backends to start the window with.
Traits: Clone, Copy, Debug, PartialEq, Eq
Variants
Native
The platform’s native APIs (Vulkan, DirectX 12, Metal).
Gl
OpenGL.
Env(wgpu::Backends)
The backends named by the WGPU_BACKEND environment variable.
Methods
pub fn backends(self) -> wgpu::Backendsplanpub 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).
required_limitspub 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.
wgpu_optionspub fn wgpu_options(api: Api) -> egui_wgpu::WgpuConfiguration
eframe’s wgpu options for a start-up with api.
startup_planpub 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).
beginpub fn begin(api: Api)
A start-up with api begins: write its marker.
startedpub fn started() -> bool
Whether the start-up under way has shown its first frame.
note_framepub 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.
failedpub fn failed(api: Api, error: &str)
A start-up with api failed with an error: log it and remove its marker.
restartpub 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.
report_failurepub fn report_failure(error: &str)
Every API failed: log it and tell the user (the app has no window).
cc_app::graph_uicrates/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
GraphEditorpub struct GraphEditor
The graph editor’s state (AppState::graph).
Traits: Default
Fields
open: boolgraph: Graphpath: Option<PathBuf>dirty: boolreport: Option<Result<Value, String>>
The last run’s result (graph_run), or why it could not run.
selected: BTreeSet<u64>hovered: bool
Whether the pointer is over the panel: its keys go to the graph.
allow_files: bool
The user let this graph’s commands work with files: a grant of this session, never saved with the graph and reset when another opens.
Some fields are private.
togglepub fn toggle(state: &mut AppState)
Open or close the panel.
runpub fn run(state: &mut AppState)
Run the graph through the engine (one undo step).
open_pathpub fn open_path(state: &mut AppState, path: PathBuf)
Open the graph file at path in the editor.
keyspub 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.
showpub fn show(ui: &mut Ui, state: &mut AppState)
The panel: toolbar, canvas and inspector.
cc_app::graphics_dialogcrates/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
Targetpub enum Target
Whose graphics are edited.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash
Variants
View(ViewId)Template(TemplateId)Editspub 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
pub(crate) fn begin(state: &mut AppState) -> Selfpub(crate) fn owns(&self) -> bool
Whether these edits own the shared session (no other data dialog was open when they began).
pub(crate) fn finish(self, state: &mut AppState, ok: bool)GraphicsDialogpub struct GraphicsDialog
The open Visibility/Graphics dialog.
Fields
target: TargetSome fields are private.
OverrideDialogpub struct OverrideDialog
The open element override dialog.
Some fields are private.
FilterEditorpub struct FilterEditor
The open filter editor.
Some fields are private.
TemplateManagerpub struct TemplateManager
The open view template manager.
Some fields are private.
keypub(crate) fn key(v: impl Hash) -> u64
runpub(crate) fn run<C: cc_engine::Command + serde::Serialize>(state: &mut AppState, merge: Option<u64>, command: C) -> bool
overrides_jsonpub(crate) fn overrides_json(o: &GraphicOverride) -> serde_json::Value
openpub fn open(state: &mut AppState, target: Target)
Open Visibility/Graphics for a view or template.
open_overridespub fn open_overrides(state: &mut AppState)
Open the override dialog for the selected elements in the active view.
open_filterspub fn open_filters(state: &mut AppState)
open_templatespub fn open_templates(state: &mut AppState)
showpub fn show(ctx: &Context, state: &mut AppState)
override_cellspub(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.
headerpub(crate) fn header(ui: &mut Ui, text: String)
override_headerspub(crate) fn override_headers(ui: &mut Ui)
view_rowspub fn view_rows(ui: &mut Ui, state: &mut AppState, view: ViewId)
The view’s template and Visibility/Graphics in its properties.
controlledpub 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_uicrates/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
GridFrameDialogpub struct GridFrameDialog
Traits: Debug, Clone
Fields
base: LevelIdtop: LevelIdcolumn_type: Option<ElementTypeId>beam_type: Option<ElementTypeId>secondary: boolparallel_to: Option<ElementId>spacing: f64error: Option<String>openpub fn open(state: &mut AppState)
Open the dialog: from the active level (else the lowest) to the next one.
combopub(crate) fn combo<T: PartialEq + Copy>(ui: &mut egui::Ui, id: &str, value: &mut T, items: &[(T, String)])
showpub fn show(ctx: &Context, state: &mut AppState)
cc_app::homecrates/cc_app/src/home.rs
Home screen: open or create a project, recent projects and samples.
Items: sample_project · show · push_recent
sample_projectpub fn sample_project(name: &str) -> Option<Project>
showpub fn show(ui: &mut Ui, state: &mut AppState)
push_recentpub 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::i18ncrates/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
pub use cc_engine::i18n::*Items: t
tmacro_rules! t
t!("key") or t!("key", "name" => value, ...).
cc_app::iconscrates/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
Iconpub enum Icon
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash
Variants
NewOpenSaveSaveAsExportAboutUpdateWallDoorWindowNicheFloorCeilingRoofSelectMeasureGroupUngroupExplodeSelectInstancesCopyDeleteUndoRedoFloorPlanCeilingPlanView3DSectionCalloutElevationLegendDraftingViewScheduleSheetTitleBlockZoomFitProjectInfoSiteLocationLevelsMaterialsFillPatternsProfilesMacroRecordMacroRunTextDetailLineDetailComponentFilledRegionMaskingRegionLineStylesBrowserOrganizationLevelMarkPlanLevelMarkSectionLeaderChevronDownChevronUpSearchChevronRightPlusHomeArrowLeftCloseProjectCloseRoomGridDimensionColumnBeamColumnsAtGridsGridFrameSteelBuildingWallFramingAlignGridEndsBeamsOnGridsBeamsBetweenColumnsFootingFootingsUnderColumnsStripFootingFoundationSlabSlabSupportsAnalyticalTrussBraceConnectionRebarRebarViewStructuralPlanNumberMarksStructureTagsStairRampRailingComponentMoveRotateMirrorPickMirrorDrawArrayTrimCornerTrimExtendSplitOffsetAlignPinUnpinJoinJoinGeometryUnjoinGeometryCutPasteMatchTypeDimLinearRefPlaneConnectorShaftTopographyPadAttachTopFinishExtrusionDrawLineDrawRectDrawPolygonDrawPolygonOutDrawCircleDrawEllipseDrawSplineDrawArc3DrawArcCenterDrawArcTangentDrawPointEditBoundaryEditProfileRevolutionSweepBlendEqualDimOrdinateDimAngularDimRadialDimDiameterPipeConduitCableTrayValveLightningConductorAirTerminalEarthElectrodeEarthRingLpsCheckDataOutletRackCablingLightningPlanCommunicationsPlanPlumbingFixtureOutletPlumbingPlanElectricalPlanSystemsConnectSizingVisibilityFilterViewTemplateSunRenderHideIsolateOverrideGraphicsResetTemporaryPhasesDesignOptionsActiveOptionDemolishPaintCurtainGridImageLibrarySettingsKeyboardInterfaceCloseViewsMassPushPullCadImportPluginGraphMethods
pub const ALL: [Icon; 188]Badgepub 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
New
Creates something new.
Import
Brings data in from a file.
Export
Writes data out to a file.
Remove
Removes something.
Tonespub struct Tones
Colors of a two-tone icon and its badge.
Traits: Debug, Clone, Copy
Fields
ink: Color32tint: Color32badge: Color32
Badge background; the badge glyph uses badge_glyph.
badge_glyph: Color32Methods
pub fn of(palette: &crate::theme::Palette, badge: Option<Badge>, enabled: bool, selected: bool) -> Tones
Theme tones of an icon in a given state; badges take their semantic color.
paintpub fn paint(painter: &Painter, rect: Rect, icon: Icon, color: Color32)
Paint icon centered in rect (the largest square that fits), in one color.
paint_tonedpub 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::jobscrates/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
Basepub enum Base
What the command runs on.
Traits: Debug, Clone, Copy, PartialEq, Eq
Variants
Fresh
A new document (opening a project, importing an IFC model): the result replaces the open one, as the finish step decides.
Current
A copy of the open document, which the result replaces (with its undo history and the command’s undo step) when the command succeeds.
Finishpub 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.
Jobpub struct Job
A running job.
Some fields are private.
busypub fn busy(state: &AppState) -> bool
A job is running: shortcuts, dropped files and new jobs wait.
startpub 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.
pollpub fn poll(state: &mut AppState)
Install the result of a job that ended; call it once per frame.
waitpub fn wait(state: &mut AppState)
Wait for the running job and install its result (at startup, before the window shows, and in tests).
cancelpub fn cancel(state: &mut AppState)
Stop waiting for the running job: its result is dropped and the document stays as it was.
showpub fn show(ctx: &Context, state: &mut AppState)
The progress dialog of the running job.
cc_app::level_mark_uicrates/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
hostspub fn hosts(view: &View) -> bool
Whether level marks go in view: plans, elevations and sections.
toolpub 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.
propspub 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.
type_rowspub 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::librarycrates/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
Entrypub struct Entry
A component file found in a library folder (from component_library_list).
Traits: Debug, Clone, Default
Fields
path: PathBufcomponent: Stringkind: Stringtypes: Vec<(String, String)>parameters: Vec<String>connectors: Vec<String>Librarypub struct Library
State of the open library window.
Traits: Debug, Clone, Default
Fields
entries: Vec<Entry>errors: usize
Files that could not be read.
search: Stringkind: Option<String>
Only this kind (by its Debug name), or all.
selected: Option<PathBuf>outlines: Vec<Vec<DVec2>>
Plan outlines of the selected component (for its thumbnail).
save_component: Option<String>
The project component to save into the library, and the folder.
save_folder: Option<PathBuf>Some fields are private.
openpub fn open(state: &mut AppState)
Open the library window, reading the folders.
showpub fn show(ctx: &Context, state: &mut AppState)
cc_app::line_styles_dialogcrates/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
LineStylesDialogpub struct LineStylesDialog
The open Line Styles dialog.
Some fields are private.
Methods
pub fn edits_finish(self, state: &mut AppState, keep: bool)
Close the dialog’s edits: keep them (OK) or undo them (Cancel).
openpub fn open(state: &mut AppState)
showpub fn show(ctx: &Context, state: &mut AppState)
cc_app::lps_cabling_uicrates/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
device_toolpub 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.
earth_ringpub fn earth_ring(state: &mut AppState)
An earth ring around the walls of the active level (or the lowest).
showpub fn show(ctx: &Context, state: &mut AppState)
meters_textpub 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_browsercrates/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
Tabpub enum Tab
Traits: Debug, Clone, Copy, PartialEq, Eq, Default
Variants
IdentityGraphicsAppearancePhysicalBrowserpub struct Browser
Browser state kept between frames.
Traits: Debug, Clone, Default
Fields
selected: Option<String>tab: Tabsearch: Stringname_edit: Option<String>
Name being typed, committed on Enter or when the field loses focus.
error: Option<String>showpub fn show(ctx: &Context, state: &mut AppState)
KEYSpub const KEYS: [&str; 12]
Keys used at runtime (checked by the i18n tests).
cc_app::mcp_bridgecrates/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).
mcp_argspub fn mcp_args(args: &[String]) -> Option<Vec<String>>
The ccad arguments for the app’s arguments, when they ask for the MCP server.
runpub fn run(args: Vec<String>) -> i32
Runs ccad mcp with the app’s standard streams and returns its exit code.
cc_app::member_host_uicrates/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
finishedpub(crate) fn finished(r: &egui::Response) -> bool
Whether a drag or a typed value ended.
lengthpub(crate) fn length(ui: &mut Ui, label: &str, v: &mut f64, range: RangeInclusive<f64>) -> bool
A length row; true when the edit ended.
member_rowspub(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::modifycrates/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
ModifyOptionspub struct ModifyOptions
Options of the transform tools, kept between uses.
Traits: Debug, Clone, Default
Fields
multiple: bool
Copy keeps placing copies from the same base point.
rotate_copy: bool
Rotate and mirror make a copy instead of moving.
mirror_copy: boolcount: u32
Number of items in an array, including the original.
angle: f64
Angle typed in the options bar, degrees.
offset: f64
Offset distance, meters.
point_elevation: f64
Elevation of the next terrain point a sketch places, meters above the level (kept from one sketch to the next).
pad_elevation: f64
Elevation of the next building pad sketched, meters above the level.
wall_face: Option<cc_core::LocationLine>
The face of the walls a sketch’s From Walls follows (None: the
outside finish faces, the inside ones for ceilings).
startpub fn start(state: &mut AppState, tool: Tool)
Start a transform tool on the current selection; without one, explain.
start_pickpub fn start_pick(state: &mut AppState, tool: Tool)
Start a pick tool (trim, split, offset, align): it acts on clicked elements.
paint_ghostpub(crate) fn paint_ghost(painter: &Painter, xf: &Xf, drawing: &Drawing2D, ids: &BTreeSet<ElementId>, t: &PlanTransform)
handlepub fn handle(ui: &Ui, resp: &Response, painter: &Painter, state: &mut AppState, level: LevelId, xf: &Xf, drawing: &Drawing2D, tool: &Tool)
apply_base_targetpub(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.
apply_rotationpub fn apply_rotation(state: &mut AppState, targets: &BTreeSet<ElementId>, center: DVec2, angle: f64)
Rotate (or copy rotated) by angle radians about center, and finish.
axis_ofpub(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).
apply_mirrorpub(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.
alignablepub(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).
align_edgepub(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.
align_commandpub(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.
join_toolpub 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.
start_attachpub 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.
attach_targetpub fn attach_target(state: &AppState, id: ElementId) -> bool
Whether id is something a wall’s top attaches to.
attach_toolpub 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.
attach_pickpub(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.
attach_topub(crate) fn attach_to(state: &mut AppState, target: ElementId)
Attach the walls the tool holds to target, then go back to selecting them.
detach_topspub fn detach_tops(state: &mut AppState)
Detach Top: the selected walls keep their own tops again.
join_pickpub(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).
set_pinnedpub fn set_pinned(state: &mut AppState, pinned: bool)
Pin or unpin the selection (one undo step).
cc_app::modify3dcrates/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
PickCachepub struct PickCache
Cached pick data of one 3D view.
Traits: Default
Some fields are private.
works_in_3dpub fn works_in_3d(tool: &Tool) -> bool
Whether tool works in the 3D view (it then takes the clicks there).
active_3dpub fn active_3d(state: &AppState) -> bool
Whether the active view is a 3D view.
Framepub struct Frame
The camera of a 3D view as drawn in rect.
Traits: Debug, Clone, Copy
Fields
rect: Rectcamera: CameraStateSome fields are private.
Methods
pub fn new(rect: Rect, camera: CameraState) -> Selfpub fn ray(&self, pos: Pos2) -> Ray
The ray through a screen position.
pub fn screen(&self, p: DVec3) -> Option<Pos2>
Where a world point shows on screen; None behind the eye.
pub fn segment(&self, a: DVec3, b: DVec3) -> Option<(Pos2, Pos2)>
The part of the segment a–b in front of the camera’s near plane,
on screen: an end behind it moves to where the segment crosses it
(None when the whole segment is behind), so a line passing by the
eye is not flung across the screen.
ray_plane_zpub fn ray_plane_z(ray: Ray, z: f64) -> Option<DVec3>
Where ray meets the horizontal plane at height z (in front of its origin).
nearest_on_screenpub 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.
snap_pointspub 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.
orthopub fn ortho(a: DVec2, p: DVec2) -> DVec2
Keep the plan offset from a to p along its main axis (Shift).
handlepub 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_dialogcrates/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
NewComponentpub struct NewComponent
The dialog’s state: the name typed and the kind picked.
Traits: Debug, Clone
Fields
name: Stringkind: ComponentKindkindspub(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.
openpub fn open(state: &mut AppState)
Open the dialog (kept as it is when already open).
showpub fn show(ctx: &Context, state: &mut AppState)
createpub 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.
placepub 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_dialogcrates/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.
openpub fn open(state: &mut AppState)
Open the dialog with the template picked last (kept when it is already open).
showpub fn show(ctx: &Context, state: &mut AppState)
cc_app::obj_uicrates/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
ObjOptionspub struct ObjOptions
The choices of the import dialog, kept for the next import.
Traits: Debug, Clone, Copy, Default
Fields
units: ObjUnitsz_up: boolmerge: boolimport_objpub fn import_obj(state: &mut AppState)
Pick an .obj file and open the options dialog for it.
import_gltfpub fn import_gltf(state: &mut AppState)
Pick a .glb or .gltf file and open the options dialog for it.
showpub fn show(ctx: &Context, state: &mut AppState)
The options dialog of a picked file; OK starts the import.
cc_app::opening_placecrates/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
Partpub enum Part
Which part of the opening a snap lines up.
Traits: Debug, Clone, Copy, PartialEq, Eq
Variants
CenterStartEdge
The edge toward the wall’s start.
EndEdge
The edge toward the wall’s end.
Snappedpub 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
point: DVec2part: PartPlacementpub struct Placement
Where the opening goes: its center along the wall, or why it cannot.
Traits: Debug, Clone, PartialEq
Fields
offset: f64
Center along the wall (wall-local u).
snapped: Option<Snapped>outside: bool
The typed distance places it past an end of the wall.
center_rangepub 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.
placepub 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.
paint_dimensionspub 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::paintcrates/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
HIGHLIGHTpub const HIGHLIGHT: Color32
Highlight on the drawing paper, white in both themes.
PREVIEWpub const PREVIEW: Color32
Xfpub struct Xf
Maps drawing coordinates to the screen.
Traits: Clone, Copy
Fields
screen: Pos2
Screen position of origin.
origin: DVec2scale: f64
Screen points per drawing unit.
Methods
pub fn to_screen(self, p: DVec2) -> Pos2pub fn to_world(self, s: Pos2) -> DVec2stroke_forpub fn stroke_for(style: LineStyle, highlighted: bool) -> Stroke
fill_polygonpub fn fill_polygon(painter: &Painter, pts: Vec<Pos2>, color: Color32)
PaintOptionspub struct PaintOptions<'a>
Fields
highlight: &'a BTreeSet<ElementId>px_per_mm: f64
Screen pixels per paper millimeter, for text.
mono: Option<Color32>
Draw everything in a single color (ghost previews).
only: Option<&'a BTreeSet<ElementId>>
Only elements in this set (ghost previews).
Budgetpub(crate) struct Budget
The vertices a drawing still may add, and the pixels its tiny lines took.
Fields
used: usizerefused: bool
Whether anything was refused for want of room.
Some fields are private.
Methods
pub(crate) fn with_left(left: usize) -> Self
A budget of left vertices.
frame_leftpub(crate) fn frame_left(ctx: &egui::Context) -> usize
The vertices the drawings painted so far in this frame left.
frame_usepub(crate) fn frame_use(ctx: &egui::Context, n: usize)
Count n vertices as used in this frame.
Gatepub(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
Budget(&'a mut Budget)Decided(bool)Drawnpub(crate) enum Drawn
What a primitive draws.
Variants
Nothing
Nothing: out of view, too small, left out or out of budget.
Shapes
The shapes added to the output.
Text { at: Pos2, px: f32 }
Its text, at this screen point and size (laid out by the caller).
paint_drawingpub fn paint_drawing(painter: &Painter, d: &Drawing2D, xf: &Xf, opts: &PaintOptions)
prim_shapespub(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.
text_culledpub(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.
image_texturepub(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.
paint_textpub(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_cachecrates/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
PaintCachepub struct PaintCache
Painted drawings by view.
Traits: Default
Some fields are private.
Methods
pub fn paint<T: 'static>(&mut self, painter: &Painter, view: ViewId, owner: &Rc<T>, d: &Drawing2D, xf: Xf, highlight: &BTreeSet<ElementId>, px_per_mm: f64) -> Xf
Paint d, the drawing of view belonging to owner, with xf and
the selection highlight (texts at px_per_mm). Returns the
transform it was painted with: xf moved by less than a pixel, so
the cached meshes stay on whole pixels; what is drawn over the
drawing should use it.
cc_app::paint_uicrates/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
startpub 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.
options_barpub fn options_bar(ui: &mut Ui, state: &mut AppState, remove: bool)
The options bar: the material to paint with, and what to do.
pickpub 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::palettecrates/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
Palettepub struct Palette
The open palette.
Traits: Default
Some fields are private.
Methods
pub fn new(session: &cc_engine::Session) -> Palette
The palette over the session’s commands (built-in and plugins’).
open_commandpub 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.
togglepub fn toggle(state: &mut AppState)
Open or close the palette.
showpub fn show(ctx: &egui::Context, state: &mut AppState)
cc_app::phases_dialogcrates/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
PhasesDialogpub struct PhasesDialog
The open Phases dialog.
Some fields are private.
openpub fn open(state: &mut AppState)
showpub fn show(ctx: &Context, state: &mut AppState)
view_sectionpub 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).
element_rowspub fn element_rows(ui: &mut Ui, state: &mut AppState, el: &Element)
The phases an element is built and demolished in.
demolishablepub 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.
demolishpub fn demolish(state: &mut AppState, view: ViewId, ids: &[ElementId]) -> bool
Demolish ids in the view’s phase; returns whether it was done.
start_demolishpub 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.
demolish_toolpub 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_uicrates/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
Tabpub enum Tab
Which list the window shows.
Traits: Debug, Clone, Copy, PartialEq, Eq, Default
Variants
InstalledAvailableListedpub struct Listed
A plugin of the plugins folder, as listed.
Traits: Debug, Clone
Fields
dir: PathBufid: Stringname: Stringversion: Stringdescription: Stringauthors: Vec<String>license: Stringhomepage: Stringasks_files: boolcommands: Vec<(String, String)>
Its commands, when loaded: (full name, description).
error: Option<String>
Why it could not be read or loaded.
Pluginspub struct Plugins
Plugins state of the app (kept when the document changes).
Traits: Debug, Default
Fields
open: bool
The Plugins window is open.
tab: Tablisted: Vec<Listed>
The plugins of the folder, read at the last load.
selected: Option<String>
The plugin picked in the window (by id).
search: Stringnotice: Option<Result<String, String>>
The last install or removal, for the window.
Some fields are private.
Methods
pub fn commands(&self) -> Vec<(&str, &[(String, String)])>
The plugin commands, by plugin: (plugin name, [(command, description)]).
loadpub 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.
drain_messagespub 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).
openpub fn open(state: &mut AppState)
Open the Plugins window.
showpub fn show(ctx: &Context, state: &mut AppState)
cc_app::preferencescrates/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
UI_SCALESpub const UI_SCALES: [u32; 8]
Interface scales offered (percent).
AUTOSAVE_MINUTESpub const AUTOSAVE_MINUTES: [u32; 6]
Autosave intervals offered (minutes; 0 turns autosave off).
RECENT_COUNTSpub const RECENT_COUNTS: [usize; 6]
Numbers of recent projects offered.
MAX_MACROSpub const MAX_MACROS: usize
The macro menu lists at most this many files.
Preferencespub 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
theme: ThemeChoicecheck_updates: bool
Check for a newer release at startup (at most once a day).
ui_scale: u32
Interface scale in percent (the egui zoom factor), within UI_SCALES’s range.
font_size: u32
Text size in percent of the normal size, independent of the scale.
ribbon_collapsed: bool
The ribbon starts collapsed (only its tabs shown).
detailed_tooltips: bool
Tooltips of commands show what they do and the engine command, not only the name.
select_drag_3d: bool
A left drag in 3D views draws a selection box (Shift+drag orbits); otherwise it orbits and Shift+drag selects.
trackpad_pans: bool
Two fingers on a trackpad pan the views and a pinch zooms; otherwise
any scroll zooms, as a mouse wheel does (see gestures.rs).
cad_blocks: bool
Import CAD brings a drawing’s blocks in as detail components instead of exploding them into the imported drawing.
snaps: crate::snaps::SnapSettings
Which points the tools snap to.
shortcut_keys: BTreeMap<String, String>
Custom two-letter keys by command id (UiCommand::id); empty keys
take a command’s keys away.
library_folders: Vec<PathBuf>
Folders of the component library.
macro_folder: Option<PathBuf>
Where macros are recorded to and listed from.
projects_folder: Option<PathBuf>
Where the project file dialogs start.
autosave_minutes: u32
Minutes between autosave copies of unsaved changes (0: off).
recent_count: usize
How many recent projects the home screen lists.
plugin_folder: Option<PathBuf>
Where plugins are installed and loaded from (None: the default
folder, see Preferences::plugins_dir).
plugins_off: BTreeSet<String>
Plugins turned off (by id): not loaded.
plugins_files: BTreeSet<String>
Plugins the user allowed to work with files (the files permission).
panels: crate::side_panels::PanelLayout
Where the Project Browser and Properties are docked.
structure_material: cc_core::StructuralMaterial
The material the Structure tab’s column and beam tools place.
new_project_system: cc_core::MeasurementSystem
The template last picked in the New Project dialog, picked first next time.
Methods
pub fn read(get: impl Fn(&str) -> Option<String>, zoom: f32) -> Self
Read the preferences with get (a storage lookup). zoom is the
interface zoom eframe restored, used when no scale was stored yet
(it kept the Ctrl+Plus/Minus zoom before this preference existed).
pub fn write(&self, mut set: impl FnMut(&str, String))
Write the preferences with set (a storage write).
pub fn autosave_interval(&self) -> Option<Duration>
Time between autosave copies, or None when autosave is off.
pub fn macro_dir(&self) -> Option<&Path>
The macros folder, if set and present.
pub fn projects_dir(&self) -> Option<&Path>
The default projects folder, if set and present.
pub fn plugins_dir(&self) -> Option<PathBuf>
The plugins folder: the one set, else plugins in the app’s data
folder (None when there is none).
pub fn zoom(&self) -> f32
The interface zoom factor.
pub fn font_scale(&self) -> f32
The font size multiplier.
load_languagepub 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.
loadpub 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).
savepub fn save(state: &AppState, mut set: impl FnMut(&str, String))
Store every preference of state (and the language).
Lookpub struct Look
What the interface last applied of the preferences (theme, zoom, font size).
Traits: Debug, Clone, Copy
Some fields are private.
Methods
pub fn current(ctx: &Context) -> Self
The look ctx shows now.
sync_lookpub 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.
trim_recentpub fn trim_recent(state: &mut AppState)
Keep at most prefs.recent_count recent projects.
macro_filespub 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.
Sectionpub enum Section
A page of the Preferences window.
Traits: Debug, Clone, Copy, PartialEq, Eq, Default
Variants
GeneralInterfaceFileLocationsSavingShortcutsMethods
pub const ALL: [Section; 5]pub fn label(self) -> StringPreferencesDialogpub struct PreferencesDialog
State of the open Preferences window. Changes show at once; Cancel restores the values the window opened with.
Traits: Debug, Clone
Fields
section: SectionSome fields are private.
openpub fn open(state: &mut AppState, section: Section)
Open the Preferences window on section (or show that section if it is open).
showpub fn show(ctx: &Context, state: &mut AppState)
cc_app::profile_sketchcrates/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
targetpub fn target(state: &AppState) -> Option<ElementTypeId>
The sweep type Edit Profile would open: that of the one selected sweep.
curves_ofpub 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.
openpub fn open(state: &mut AppState, type_id: ElementTypeId)
Open the profile of sweep type type_id in a sketch.
edit_selectedpub fn edit_selected(state: &mut AppState)
Edit Profile from the ribbon: the selected sweep’s type.
is_openpub fn is_open(state: &AppState) -> bool
Whether the open sketch is a sweep’s or a structural profile (which then takes the central area).
section_curvespub 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.
open_sectionpub 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).
finish_sectionpub 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.
leave_sectionpub 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.
centralpub 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_dialogcrates/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
shape_keypub fn shape_key(code: &str) -> String
The i18n key of a shape code’s name (profile-shape-cold-lipped-u).
param_keypub fn param_key(name: &str) -> String
The i18n key of what a shape parameter measures (profile-param-bf-top).
ProfilesDialogpub struct ProfilesDialog
The open Profile Manager.
Fields
selected: Option<ProfileId>catalog: Option<Catalog>Some fields are private.
Catalogpub struct Catalog
Import from catalog: a series, a filter and the designations picked.
Fields
series: String
The series’ code.
Some fields are private.
openpub 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).
section_sketch_openpub fn section_sketch_open(state: &AppState) -> bool
Whether a structural profile’s sketch is open (the manager waits for it).
settle_abandonedpub 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.
resumepub 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).
showpub fn show(ctx: &Context, state: &mut AppState)
cc_app::propertiescrates/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
keypub(crate) fn key(parts: impl Hash) -> u64
bodypub fn body(ui: &mut Ui, state: &mut AppState)
The properties of the selection (or the active view), under a header drawn by the caller.
MultiSummarypub 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.
underlay_rowspub 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.
underlay_patchpub 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.
length_dragpub 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).
size_dragpub 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).
field_labelpub 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).
slope_dragpub 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).
paper_dragpub 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`).
weight_dragpub 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”`).
decimal_paper_dragpub 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.
ParamEditpub enum ParamEdit
A new value typed in a param_editor.
Variants
Number(f64)Text(String)param_editorpub 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.
number_dragpub 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.
param_valuepub 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::recoverycrates/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
data_dirpub fn data_dir() -> Option<PathBuf>
The app’s data folder (where eframe keeps its preferences).
folderpub fn folder() -> Option<PathBuf>
The folder of the recovery copies.
crash_logpub 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.
Recoverypub struct Recovery
Recovery state of the running session.
Some fields are private.
Methods
pub fn new(dir: Option<PathBuf>) -> Self
Recovery in dir; the entries already there are offered.
pub fn set_interval(&mut self, interval: Option<Duration>)
Follow the autosave preference: copies every interval, or none (None).
pub fn tick(&mut self, state: &AppState)
Called once a frame: write a copy in the background when it is due, remove it once the document has no unsaved changes.
pub fn write_now(&mut self, state: &AppState)
Write a copy now, on this thread (after a panic, before the app goes).
pub fn exit(&mut self)
A clean exit: the user saved or chose to discard the changes.
pub fn dialog(&mut self, ctx: &egui::Context, state: &mut AppState)
The start-up dialog offering the copies of earlier sessions.
log_panicpub fn log_panic(info: &std::panic::PanicHookInfo<'_>)
Append a panic to the crash log (no recursion, no panics: errors are ignored).
log_eventpub 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.
install_panic_hookpub 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_uicrates/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
takes_openingspub fn takes_openings(category: Category) -> bool
Whether a sketch of category takes loops inside its outline as openings.
startpub 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.
createpub 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.
propspub fn props(ui: &mut Ui, state: &mut AppState, id: ElementId, region: &Region)
The properties of a selected region: its boundary style, view and size.
type_sectionpub 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_uicrates/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
Resumepub 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.
RenderWindowpub struct RenderWindow
The open render window.
Some fields are private.
openpub fn open(state: &mut AppState)
Open the window on the active view (when it is a 3D view).
open_forpub fn open_for(state: &mut AppState, view: ViewId)
Open the window on view, with the camera its viewport shows now.
showpub fn show(ctx: &Context, state: &mut AppState)
cc_app::ribboncrates/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
category_iconpub fn category_icon(category: Category) -> Icon
Icon of a model category, shared by the ribbon, options bar and browser.
env_grouppub fn env_group(ui: &mut Ui, state: &mut AppState, caption: String, commands: &[UiCommand])
A group of the component environment’s ribbon.
command_tooltippub 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.
key_cappub(crate) fn key_cap(ui: &mut Ui, keys: &str) -> egui::Response
A keyboard shortcut drawn as a key cap.
ribbonpub fn ribbon(ui: &mut Ui, state: &mut AppState)
dimension_iconpub fn dimension_icon(mode: DimensionMode) -> Icon
selected_textpub fn selected_text(state: &AppState) -> Option<cc_core::ElementId>
The text note selected alone, if any.
env_stackspub 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).
options_barpub fn options_bar(ui: &mut Ui, state: &mut AppState)
status_barpub fn status_bar(ui: &mut Ui, state: &mut AppState)
cc_app::schedule_uicrates/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
Tabpub enum Tab
The pages of the schedule definition dialog.
Traits: Debug, Clone, Copy, PartialEq, Eq, Default
Variants
FieldsFilterSortingFormattingAppearanceMethods
pub const ALL: [Tab; 5]pub fn label(self) -> Stringopenpub fn open(state: &mut AppState, view: ViewId, tab: Tab)
Open the definition dialog of schedule view on tab.
propspub 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.
showpub fn show(ui: &mut Ui, state: &mut AppState, view_id: ViewId)
dialogpub 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_markcrates/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
selectpub 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).
Partpub enum Part
What a drag of a section mark holds.
Traits: Debug, Clone, Copy, PartialEq
Variants
Body
The whole mark, moved.
End { at_start: bool, fixed: DVec2 }
One end; fixed is the other.
Segment { at_start: bool }
The inner end of a split line’s piece next to the start or the end.
flippub fn flip(state: &mut AppState) -> bool
Turn the selected section to look the other way (Space).
set_splitpub 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::sheetcrates/cc_app/src/sheet.rs
Sheet composer: paper, title block and placed viewports.
Items: show
showpub fn show(ui: &mut Ui, state: &mut AppState, sheet_id: ViewId)
cc_app::sheet_propscrates/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
today_isopub fn today_iso() -> String
Today as YYYY-MM-DD.
rowspub fn rows(ui: &mut Ui, state: &mut AppState, id: ViewId)
The sheet’s own rows (inside its properties section).
fields_sectionpub 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.
title_block_errorpub 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_panelscrates/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
Panepub enum Pane
A side panel.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash
Variants
BrowserPropertiesMethods
pub const ALL: [Pane; 2]pub fn title(self) -> StringSidepub enum Side
A side of the window.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash
Variants
LeftRightPanelLayoutpub 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
left: Vec<Vec<Pane>>right: Vec<Vec<Pane>>Methods
pub fn side(&self, side: Side) -> &Vec<Vec<Pane>>pub fn find(&self, pane: Pane) -> Option<(Side, usize, usize)>
The side, column (from the edge) and row of pane.
pub fn apply(&mut self, pane: Pane, target: Target) -> bool
Move pane to target; false when nothing changed (or the target
names the pane itself).
pub fn to_text(&self) -> String
The stored form: left=browser+properties;right=, columns separated by
commas and the panels of a column by +.
pub fn from_text(text: &str) -> Option<Self>
Read Self::to_text’s form; None unless it names every panel once.
Targetpub enum Target
Where a moved panel goes.
Traits: Debug, Clone, Copy, PartialEq, Eq
Variants
Edge(Side)
A column of its own at the window’s edge on that side.
Stack { other: Pane, below: bool }
In other’s column, above or below it.
Beside { other: Pane, right: bool }
A column of its own next to other’s, to its right or left on screen.
showpub 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.
menupub fn menu(ui: &mut Ui, state: &mut AppState, pane: Pane) -> bool
The docking choices for pane; true when one was taken.
target_atpub 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_uicrates/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
SiteDialogpub struct SiteDialog
The open Site Location window.
Some fields are private.
openpub fn open(state: &mut AppState)
Open the window on the project’s location (else a view of the whole country map).
showpub fn show(ctx: &Context, state: &mut AppState)
cc_app::sketch_modecrates/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
Targetpub enum Target
What finishing the sketch makes.
Traits: Debug, Clone, Copy, PartialEq, Eq
Variants
New { category: Category, type_id: ElementTypeId }
A new element of category and type.
Edit { id: ElementId }
A new outline for an element (Edit Boundary).
Piece
A piece of the component environment (see Session::piece).
Profile { type_id: ElementTypeId }
The profile of a sweep type (Edit Profile, see crate::profile_sketch).
Section { profile: ProfileId }
Section = a structural profile’s sketch (Edit sketch in the Profile Manager,
see crate::profile_sketch).
Sheet
Lines of a title block on its Sheet view (see crate::title_block_env).
Detail
Detail lines being drawn (see crate::detail_ui): each curve
becomes an element as soon as it is drawn, so there is nothing to finish.
Drawpub enum Draw
How clicks draw.
Traits: Debug, Clone, Copy, PartialEq, Eq, Default
Variants
Select
Pick curves to change them.
Line
Two points, chained by default.
Rect
Two opposite corners.
Polygon
The center, then a corner.
PolygonOut
The center, then the middle of a side.
Circle
The center, then a point on it.
Arc3
The two ends, then a point on the arc.
ArcCenter
The center, the start, then the end.
ArcTangent
From the free end of a curve, along it, to the end.
Ellipse
The center, the end of an axis, then the other axis’s half length.
Spline
Points a smooth curve passes through: a click on the last point (a double click) or Enter ends it, a click on the first closes it.
Move
Move the picked curves: base point, then target.
Copy
Copies of the picked curves: base point, then targets.
Rotate
Rotate the picked curves: center, reference direction, final direction.
MirrorPick
Mirror the picked curves across a line of the sketch.
MirrorAxis
Mirror the picked curves across an axis drawn with two points.
Offset
A copy of a curve, or of its chain, at a distance.
TrimCorner
Two curves trimmed or extended to meet.
TrimExtend
Curves trimmed or extended to a reference curve.
Split
A curve split in two.
Point
A terrain’s measured point, at the elevation of the options bar.
Methods
pub fn on_selection(self) -> bool
The tools that act on the picked curves.
Sessionpub struct Session
An open sketch.
Traits: Debug, Clone
Fields
target: Targetcurves: Vec<SketchCurve>draw: Drawpicks: Vec<DVec2>
Points picked for the curve being drawn.
chain: bool
Lines continue from the last end.
sides: usize
Sides of the next polygon.
selected: BTreeSet<usize>piece: Option<crate::component_sketch::PieceSketch>
What a sketch of the component environment makes.
points: Vec<DVec3>
A terrain’s measured points (plan position and elevation above the
level); the elevation of the next one is in the options bar
(crate::modify::ModifyOptions::point_elevation).
selected_points: BTreeSet<usize>
The picked points (indices into points), deleted with the curves.
typed: TypedInput
Values typed after the first point (a length and an angle, or a rectangle’s width and depth; Tab switches the field).
Some fields are private.
Methods
pub fn new(target: Target, curves: Vec<SketchCurve>) -> Selfpub fn typing(&self) -> bool
The tool takes typed values: it has its first point and the next one ends a segment from it (a line, a radius, an axis, a move) or is a rectangle’s opposite corner.
pub fn typed_point(&self, p: DVec2) -> DVec2
The point the cursor p stands for with the typed values: along
the cursor’s direction from the last pick at the typed length (and
angle from the X axis), or a rectangle’s corner with the typed width
and depth on the cursor’s side.
pub fn nothing_selected(&self) -> bool
Nothing is picked: no curve and no point.
pub fn clear_selection(&mut self)
Unpick every curve and point.
pub fn add_point(&mut self, p: DVec3)
Add a terrain point (one undo step).
pub fn open_path(&self) -> bool
The sketch is a sweep’s path, open by design.
pub fn add(&mut self, curves: Vec<SketchCurve>)pub fn can_undo(&self) -> boolpub fn can_redo(&self) -> boolpub fn undo(&mut self)pub fn redo(&mut self)pub fn delete_selected(&mut self)
Remove the selected curves and points (one undo step).
pub fn set_curve(&mut self, i: usize, curve: SketchCurve)
Change curve i (one undo step).
pub fn transform_selected(&mut self, t: &PlanTransform, copy: bool) -> BTreeSet<usize>
The picked curves moved by t (one undo step), or copies of them;
returns the copies’ indices.
pub fn snap_points(&self) -> Vec<DVec2>
Ends, centers and middles to snap to.
curve_gripspub(crate) fn curve_grips(c: &SketchCurve) -> Vec<(u8, DVec2)>
The grips of a curve, each with its handle number (see moved).
movedpub(crate) fn moved(c: &SketchCurve, which: u8, p: DVec2) -> SketchCurve
Curve c with its grip which moved to p.
boundary_targetpub fn boundary_target(state: &AppState) -> Option<ElementId>
The element whose boundary Edit Boundary would open: one selected floor, ceiling, roof or mass.
edit_boundarypub fn edit_boundary(state: &mut AppState)
Open the sketch of the selected element’s outline (Edit Boundary).
takes_pointspub fn takes_points(state: &AppState) -> bool
The open sketch makes (or edits) a terrain, which takes measured points.
cancelpub fn cancel(state: &mut AppState)
Leave the sketch without changing the model.
finishpub 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.
error_textpub fn error_text(e: &SketchError) -> String
A sketch error as a message.
escapepub fn escape(state: &mut AppState)
Escape: drop the curve being drawn, then leave the drawing tool, then the selection.
set_drawpub fn set_draw(state: &mut AppState, draw: Draw)
Pick a drawing or modify tool; those acting on the picked curves need some.
pick_wallspub 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).
canvaspub 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.
interactpub 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.
drawpub(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.
finish_splinepub(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.
ribbonpub fn ribbon(ui: &mut Ui, state: &mut AppState)
The sketch’s ribbon: mode, drawing tools and tools.
optionspub fn options(ui: &mut Ui, state: &mut AppState)
The options bar: chaining, polygon sides, the modify tools’ options and the hint.
propertiespub fn properties(ui: &mut Ui, state: &mut AppState)
The selected curve’s values in the properties palette.
cc_app::snap_geomcrates/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
crossingpub 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.
perpendicularpub 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.
tangentpub 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::snapscrates/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
SnapSettingspub 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
enabled: bool
Off: no object snap at all, whatever the others say.
elements: bool
Every element the view draws, by its lines; otherwise only the points and lines the tools take from the model (walls, grids, outlines).
endpoint: boolmidpoint: boolcenter: boolintersection: boolperpendicular: booltangent: boolnearest: bool
The nearest point of a line or an arc.
alignment: bool
Guides from points acquired by hovering them.
Methods
pub fn get(&self, option: SnapOption) -> boolpub fn get_mut(&mut self, option: SnapOption) -> &mut boolpub fn effective(self) -> Self
The settings the tools go by: with the master switch off, no kind is on.
pub fn to_text(self) -> String
As stored: the codes of the options that are off, separated by commas (so an option added later is on for settings stored before it).
pub fn from_text(text: &str) -> Self
Read what Self::to_text wrote; unknown codes are ignored.
SnapOptionpub enum SnapOption
A snap setting: its storage code and the key of its name.
Traits: Debug, Clone, Copy, PartialEq, Eq
Variants
EnabledElementsEndpointMidpointCenterIntersectionPerpendicularTangentNearestAlignmentMethods
pub const ALL: [SnapOption; 10]pub const KINDS: [SnapOption; 8]
The kinds of snap point, which the master switch turns off together.
pub fn code(self) -> &'static strpub fn key(self) -> &'static str
The i18n key of its name.
drawing_snappub 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_uicrates/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
Editedpub struct Edited
What a set of controls did this frame.
Traits: Default
Fields
changed: booldone: bool
A drag or text edit ended, or a discrete choice was made.
layout_controlspub 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.
build_rowspub 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).
posts_rowspub 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.
rules_rowspub 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.
check_rowspub fn check_rows(ui: &mut Ui, g: &cc_geom::StairGeom)
Riser, tread, Blondel’s step and the broken rules of a laid-out stair.
create_commandpub 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.
tool_optionspub fn tool_options(ui: &mut Ui, state: &mut AppState)
Options bar of the stair tool.
ramp_layout_controlspub 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.
ramp_rules_rowspub fn ramp_rules_rows(ui: &mut Ui, rules: &mut cc_core::RampRules) -> Edited
Accessibility rules of a ramp type.
ramp_check_rowspub fn ramp_check_rows(ui: &mut Ui, g: &cc_geom::RampGeom)
Slope, flights and the broken rules of a laid-out ramp.
ramp_commandpub 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.
ramp_tool_optionspub fn ramp_tool_options(ui: &mut Ui, state: &mut AppState)
Options bar of the ramp tool.
cc_app::statecrates/cc_app/src/state.rs
Application state shared by all panels and views.
Items: RibbonTab · PendingAction · Dialogs · AppState
RibbonTabpub enum RibbonTab
Traits: Debug, Clone, Copy, PartialEq, Eq, Default
Variants
FileArchitectureStructureMep
Building services: plumbing and electrical.
MassingSite
Conceptual masses and the terrain.
Insert
Importing and exporting files, loading components.
ModifyAnnotateViewManagePendingActionpub enum PendingAction
An action that discards unsaved changes, waiting for confirmation.
Traits: Debug, Clone, PartialEq
Variants
New(cc_core::MeasurementSystem)
A new project from the template of this measurement system.
OpenOpenPath(std::path::PathBuf)OpenSample(&'static str)ImportIfcCloseQuitDialogspub struct Dialogs
Traits: Default
Fields
project_info: boolunits: boolmaterial_browser: crate::material_browser::Browserlevels: boolmaterials: booltype_editor: Option<ElementTypeId>new_component: Option<crate::new_component_dialog::NewComponent>
The New Component dialog: the name typed and the kind picked.
type_rename: Option<String>
Type name being edited by “Rename” in the type dialog.
type_rename_focus: bool
The rename field takes the focus on its next frame.
type_layers_open: bool
The layer editor is expanded in the type dialog.
edit_start: Option<usize>
Undo depth when the open data dialog started editing (see dialog::session).
level_selected: Option<LevelId>
Level picked in the levels dialog: the one a level is added above or below.
delete_level: Option<LevelId>
Level waiting for delete confirmation.
schedule_def: Option<ViewId>
Schedule whose definition dialog is open, and the page it shows.
schedule_tab: crate::schedule_ui::Tabconfirm: Option<PendingAction>new_project: Option<cc_core::MeasurementSystem>
The New Project dialog, with the template picked in it.
error: Option<String>about: boolsystems: bool
Plumbing systems and electrical circuits.
sizing: bool
Sizing of the pipes and circuits.
lps_check: bool
The lightning protection coverage check, with the class it checks
and its last result (class, document revision, lps_check output).
lps_class: cc_core::LpsClasslps_result: Option<(cc_core::LpsClass, u64, serde_json::Value)>cabling: bool
The structured cabling per rack, with its last result (document revision, cabling_list output).
cabling_result: Option<(u64, serde_json::Value)>graphics: Option<crate::graphics_dialog::GraphicsDialog>
Visibility/Graphics of a view or view template.
element_override: Option<crate::graphics_dialog::OverrideDialog>
Graphic overrides of the selected elements in a view.
filters: Option<crate::graphics_dialog::FilterEditor>
The view filter editor.
templates: Option<crate::graphics_dialog::TemplateManager>
The view template manager.
phases: Option<crate::phases_dialog::PhasesDialog>
Phases, phase filters and phase graphics.
design_options: Option<crate::design_options_ui::OptionsDialog>
Design option sets and their options.
browser_org: Option<crate::browser_org_dialog::BrowserOrgDialog>
The project browser’s organization schemes.
line_styles: Option<crate::line_styles_dialog::LineStylesDialog>
The project’s line styles.
sun: Option<crate::sun_ui::SunDialog>
The Sun Settings of a view.
render: Option<crate::render_ui::RenderWindow>
The render window of a 3D view (View → Render).
render_resume: Option<crate::render_ui::Resume>
The render window waiting for Sun Settings, opened from it, to close.
fill_patterns: Option<crate::fill_patterns_dialog::FillPatternsDialog>
The fill pattern manager.
profiles: Option<crate::profiles_dialog::ProfilesDialog>
The Profile Manager.
grid_frame: Option<crate::grid_frame_ui::GridFrameDialog>
Structure → Grid Frame.
steel_building: Option<crate::steel_building_ui::SteelBuildingDialog>
Structure → Steel Building.
wall_framing: Option<crate::wall_framing_ui::WallFramingDialog>
Structure → Light Steel Frame / Wood Frame.
profiles_resume: Option<crate::graphics_dialog::Edits>
The Profile Manager’s edits while one of its profiles is in a sketch (Edit sketch): Finish and Cancel open it again with them, so its Cancel still undoes everything.
library: Option<crate::library::Library>
The component library window.
obj_import: Option<std::path::PathBuf>
The .obj file whose import options are being asked.
obj_options: crate::obj_ui::ObjOptions
The last choices of the OBJ import dialog.
preferences: Option<crate::preferences::PreferencesDialog>
The Preferences window.
AppStatepub struct AppState
Fields
session: Session
The engine session: document, derived geometry, drawings and sheets.
multi_summary: Option<std::sync::Arc<crate::properties::MultiSummary>>
The multi-selection rows’ copy of the selected elements, per revision and selection.
paint_cache: crate::paint_cache::PaintCache
The 2D views’ drawings as painted, kept between frames.
snap_cache: Option<(u64, Option<LevelId>, std::sync::Arc<crate::tools::ModelSnaps>)>
The model’s snap candidates (document revision, level, candidates).
cad_snap_index: std::collections::HashMap<ElementId, crate::tools::CadIndexEntry>
Each imported drawing’s snap index, kept while its drawing stays the same.
selection: BTreeSet<ElementId>tool: Toolinteraction: Interactionmodify: crate::modify::ModifyOptions
Options of the transform tools.
dim_continuous: bool
Continuous (chained) placement of aligned and linear dimensions.
truss: crate::tools::TrussOptions
Options of the truss tool.
bracing: crate::tools::BracingOptions
Options of the bracing tool.
mep: crate::tools::MepOptions
Options of the pipe, conduit and device tools.
curtain: crate::curtain_ui::CurtainOptions
Options of the Curtain Grid tool.
paint_material: String
The material of the Paint tool.
active_view: Option<ViewId>view2d: HashMap<ViewId, View2DState>view3d: HashMap<ViewId, View3DState>open_requests: Vec<ViewId>
Views the dock should open (or focus) this frame.
open_tabs: usize
View tabs open (kept by the dock each frame).
close_others_than: Option<ViewId>
Close every view tab but this one on the next frame.
dialogs: Dialogsribbon_tab: RibbonTabribbon_collapsed: bool
The ribbon shows only its tabs; clicking one shows its panel over the views (ribbon_peek).
ribbon_peek: boolpalette: Option<crate::palette::Palette>
The open command palette.
rename: Option<(ViewId, String)>
Browser inline rename in progress.
sheet_selection: Option<(ViewId, usize)>
Selected viewport on a sheet: (sheet, viewport index).
section_selection: Option<ViewId>
View whose mark is selected: a section’s in a plan (see
crate::section_mark) or a callout’s (see crate::callout_ui).
message: String
Status bar message.
cursor: Option<glam::DVec2>
Cursor position in the active 2D view’s coordinates.
key_buffer: String
Typed shortcut letters (e.g. “WA”).
typed: crate::tools::TypedInput
Typed length for the wall tool.
wall_height: f64
Default height for new walls.
tool_system: cc_core::MeasurementSystem
The measurement system the tools’ sizes were last set for (see
AppState::follow_system).
wall_location_line: cc_core::LocationLine
Location line for new walls.
stair_layout: cc_core::StairLayout
Plan layout for new stairs (shape, turn, landing, winders, radius).
sweep: crate::tools::SweepOptions
Options for new swept profiles (height, closed path, side).
railing_host: crate::tools::RailingHostOptions
Railings on a picked stair or ramp instead of a drawn path.
ramp_layout: cc_core::RampLayout
Plan layout for new ramps (shape, turn, slope, landing, radius).
wall_arc: bool
The wall tool draws arcs (start, end, then a point on the arc).
strip_arc: bool
The footing tool, with a strip type, draws arc strips as the wall tool draws arcs.
beam_arc: bool
The beam tool draws arc beams the same way.
wall_top_level: Option<LevelId>
Level new walls rise to (None: unconnected, wall_height tall).
quit_confirmed: bool
Allow the window to close after the user confirmed.
textures_to_free: Vec<egui::TextureId>
egui textures of closed 3D views, freed by the app when the GPU is available.
generation: u64
Bumped whenever the document is replaced (new/open).
show_home: bool
The home screen is shown instead of the project.
project_open: bool
A project is open (false after “Close Project” and at startup without a file; the document is then an unused placeholder).
recent: Vec<std::path::PathBuf>
Recently opened or saved projects, most recent first.
prefs: crate::preferences::Preferences
The app preferences (saved with eframe; see preferences.rs).
updates: crate::update::Updates
Update checks and the notice of a newer release.
plugins: crate::plugins_ui::Plugins
The plugins of the plugins folder and the Plugins window.
site: Option<crate::site_ui::SiteDialog>
The open Site Location window.
thumbnail_jobs: Vec<crate::thumbnails::Job>job: Option<crate::jobs::Job>
The file being opened or imported on a worker thread (see jobs.rs).
requested_samples: std::collections::BTreeSet<&'static str>
Samples whose thumbnail was already requested this session.
clipboard: crate::clipboard::Clipboard
Cut or copied elements of this document.
zoom_default: crate::canvas::ZoomCommand
Command of the views’ zoom button (the last one chosen from its menu).
value_edit: Option<crate::dim_edit::ValueEdit>
Value field open over a view (dimension values).
component_env: Option<crate::component_env::Env>
The component modeling environment, when open (it replaces the views).
sketch: Option<crate::sketch_mode::Session>
The open sketch of an outline (see crate::sketch_mode).
text_edit: Option<crate::text_tool::TextEditor>
Text editor open over a view (text notes).
text_options: crate::text_tool::TextOptions
Options of the text tools.
detail: crate::detail_ui::DetailOptions
Options of the Detail Line tool (mode and line style).
detail_draw: Option<crate::detail_ui::DetailDraw>
Detail lines being drawn (the picks of the curve in progress).
detail_component: crate::detail_component_ui::PlaceOptions
Options of the Detail Component tool (rotation, scale, mirror).
callout: crate::callout_ui::CalloutOptions
Options of the Callout tool (scale, drafting view pointed to).
graph: crate::graph_ui::GraphEditor
The visual programming editor (see crate::graph_ui).
Some fields are private.
Methods
pub fn new(doc: Document) -> Selfpub fn replace_document(&mut self, doc: Document)
Replace the document (new/open), resetting view state.
pub fn follow_system(&mut self)
Tool sizes still at one measurement system’s default take the other
system’s when the project’s changes (a new imperial project, or its
units switched): new walls 3 m or 10’-0” tall, offsets and truss
depths 1 m or 3’-0”, the gaps and spiral radii of new stairs and
ramps (see cc_core::Defaults::flights). Sizes the user typed stay.
pub fn sync(&mut self)
Rebuild derived geometry after model changes and drop stale selection.
pub fn project(&self) -> &Projectpub fn drawing(&mut self, view: ViewId) -> Option<Rc<Drawing2D>>
Cached drawing for a graphical view.
pub fn invalidate_drawings(&mut self)
Drop cached drawings (e.g. after a language change alters their text).
pub fn sheet(&mut self, view: ViewId) -> Option<Rc<cc_views::Sheet>>
Cached composition of a sheet view (paper millimeters).
pub fn open_view(&mut self, view: ViewId)pub fn follow_selection(&mut self)
Picking objects with the Select tool opens the Modify tab (drawing tools, which select what they create, keep their tab).
pub fn typing_segment(&self) -> bool
A segment is being drawn with typed input (wall, grid, move, copy, array), or a door or window placed at a typed distance (issue #250).
pub fn typing_two_lengths(&self) -> bool
The tool takes two typed lengths (Tab switches between them): a door or window’s distances from the start and from the end of its wall.
pub fn set_tool(&mut self, tool: Tool)pub fn active_level(&self) -> Option<LevelId>
Level of the active plan view, if the active view is a plan.
pub fn delete_selection(&mut self)pub fn create_element(&mut self, name: String, level: LevelId, type_id: ElementTypeId, kind: cc_core::ElementKind) -> ElementId
Create an element in one transaction and select it (test setup; the tools create elements through engine commands).
pub fn view_title(&self, view: ViewId) -> String
Title shown in tabs and window title for a view.
cc_app::steel_building_uicrates/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
SteelBuildingDialogpub struct SteelBuildingDialog
Traits: Debug, Clone, Default
Fields
span: f64eave_height: f64slope_percent: f64roof: FrameRoofbays: u32bay_spacing: f64origin: [f64; 2]rotation: f64column_type: Option<ElementTypeId>
None: the catalog default.
rafter_type: Option<ElementTypeId>purlins: boolpurlin_type: Option<ElementTypeId>purlin_spacing: f64girts: boolgirt_type: Option<ElementTypeId>girt_spacing: f64error: Option<String>openpub fn open(state: &mut AppState)
showpub fn show(ctx: &Context, state: &mut AppState)
editpub 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.
propspub fn props(ui: &mut Ui, state: &mut AppState, id: ElementId, building: &SteelBuilding)
The rows of a selected steel building.
cc_app::sun_overlaycrates/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
SunViewpub struct SunView
A 3D view’s resolved sun.
Traits: Default
Some fields are private.
Methods
pub fn update(&mut self, project: &Project, geom: &ModelGeometry, view: &View, revision: u64, camera: &CameraState) -> Option<cc_render::Light>
Bring the light and the diagram up to date for view at document
revision, the viewer looking through camera; returns the light
(None: the view has no sun, and the camera’s light is used).
pub fn paint(&self, painter: &Painter, frame: &Frame)
Paint the sun path diagram (when the view shows it) through frame.
cc_app::sun_uicrates/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
SunDialogpub struct SunDialog
The open Sun Settings dialog.
Some fields are private.
openpub fn open(state: &mut AppState)
Open the dialog on the active view (when it takes a sun).
open_forpub 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).
showpub fn show(ctx: &Context, state: &mut AppState)
view_rowspub 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_dialogcrates/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
panelspub fn panels(state: &AppState) -> Vec<(ElementId, String)>
The distribution boards of the project: (element, label).
boardspub fn boards(state: &AppState, board: DeviceKind) -> Vec<(ElementId, String)>
The boards (or racks) of the project: (element, label).
system_combopub 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”.
showpub fn show(ctx: &Context, state: &mut AppState)
sizingpub 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::tablecrates/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
ROW_Hpub const ROW_H: f32
Height of a table row and of a section header.
LABEL_SHAREpub const LABEL_SHARE: f32
Share of the table width taken by the label column.
FONT_SIZEpub const FONT_SIZE: f32
font_sizepub fn font_size() -> f32
Text size of the tables, following the font size preference.
sectionpub 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.
rowpub 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.
row_tippub 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).
boxedpub 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.
checkboxpub fn checkbox(ui: &mut Ui, checked: &mut bool) -> egui::Response
A checkbox without text, as boxed.
labeled_checkboxpub 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.
button_rowpub 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.
readonly_rowpub fn readonly_row(ui: &mut Ui, label: &str, value: String)
A row whose value cannot be edited (shown dimmed).
header_blockpub fn header_block(ui: &mut Ui, icon: Icon, title: &str, subtitle: &str)
Header with a large icon tile, a title and a subtitle.
paddedpub fn padded<R>(ui: &mut Ui, add: impl FnOnce(&mut Ui) -> R) -> R
Content with the panel’s side padding (headers, buttons, lists).
live_textpub 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.
commit_textpub 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_toolcrates/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
LeaderShapepub enum LeaderShape
The leader a new text gets.
Traits: Debug, Clone, Copy, PartialEq, Eq, Default
Variants
NoneStraight
One segment from the text to the point.
Elbow
Two segments: from the text to an elbow, then to the point.
Methods
pub const ALL: [LeaderShape; 3]pub fn key(self) -> &'static strTextOptionspub struct TextOptions
Options of the text tools (kept between uses, shown in the options bar).
Traits: Debug, Clone, Copy, PartialEq, Default
Fields
multiline: boolwidth: f64
Wrapping width of multiline text, paper millimeters.
leader: LeaderShapesymbol: LeaderSymbolTextTargetpub enum TextTarget
What the editor’s text goes to.
Traits: Debug, Clone, PartialEq
Variants
New { type_id: ElementTypeId, position: DVec2, leaders: Vec<Leader>, width: Option<f64> }
A new note at position with leaders.
Existing(ElementId)
An existing note.
TextEditorpub struct TextEditor
The text editor open over a view.
Traits: Debug, Clone
Some fields are private.
text_toolpub 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.
add_leader_toolpub 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.
canvaspub 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.
showpub 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.
optionspub fn options(ui: &mut Ui, state: &mut AppState, adding_leader: bool)
Options bar of the text tools.
symbol_combopub 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::themecrates/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
Palettepub struct Palette
Color tokens of a theme.
Traits: Debug, Clone, Copy
Fields
app_bg: Color32
Application background behind panels (ribbon strip, dock gaps).
panel: Color32
Side panels, ribbon and popups.
surface: Color32
Section headers and subtle fills inside panels.
canvas: Color32
Background of view tabs and the home screen.
paper: Color32
Paper under 2D drawings: white in both themes, since drawings are dark lines and text.
sheet_bg: Color32
Area around a sheet.
border: Color32border_strong: Color32text: Color32text_muted: Color32text_faint: Color32accent: Color32accent_soft: Color32accent_text: Color32hover: Color32pressed: Color32danger: Color32warning: Color32success: Color32
Positive actions: badges of commands that create something.
temporary: Color32
Border of a view with temporary hide/isolate.
icon_ink: Color32
Plain interface icons (strokes).
icon_tint: Color32
Second tone of two-tone icons (their soft fills).
matte: Color32
Neutral dark matte around a rendered picture (dark in both themes, so the picture’s tones read the same).
matte_text: Color32
Text and marks drawn on Palette::matte.
dark: bool
Whether this is a dark theme (egui base visuals).
LIGHTpub const LIGHT: Palette
Color tokens of the light theme.
DARKpub const DARK: Palette
Color tokens of the dark theme.
palettepub fn palette(ctx: &egui::Context) -> &'static Palette
The palette of the theme ctx shows.
FONT_SCALE_RANGEpub const FONT_SCALE_RANGE: std::ops::RangeInclusive<f32>
Smallest and largest font size multipliers.
font_scalepub fn font_scale() -> f32
The multiplier of the interface text sizes (see set_font_scale).
set_font_scalepub 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.
ShownPalettepub struct ShownPalette
The palette of the theme shown: read like a constant (PALETTE.text).
Traits: Debug, Clone, Copy, std::ops::Deref
PALETTEpub static PALETTE: ShownPalette
The colors of the theme the interface shows (see sync).
syncpub 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).
ThemeChoicepub enum ThemeChoice
The user’s theme preference.
Traits: Debug, Clone, Copy, PartialEq, Eq, Default
Variants
System
Follow the operating system.
LightDarkMethods
pub const ALL: [ThemeChoice; 3]pub fn code(self) -> &'static str
Stored form of the preference.
pub fn from_code(code: &str) -> Option<Self>pub fn label(self) -> Stringset_themepub fn set_theme(ctx: &egui::Context, choice: ThemeChoice)
Show the theme choice asks for.
APP_ICON_PNGpub const APP_ICON_PNG: &[u8]
The application icon (256 px PNG).
logopub fn logo(ctx: &egui::Context) -> Option<egui::TextureHandle>
Texture of the application icon, loaded by apply for the ribbon.
RADIUSpub const RADIUS: u8
Corner radius of buttons, fields and popups.
semiboldpub fn semibold() -> FontFamily
Font family of the semibold weight, for titles and emphasis.
titlepub fn title(text: impl Into<String>) -> RichText
Section or panel title text.
panel_headerpub 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.
captionpub fn caption(text: impl Into<String>) -> RichText
Small uppercase-free caption, used for group labels.
mutedpub fn muted(text: impl Into<String>) -> RichText
Secondary text.
applypub fn apply(ctx: &egui::Context)
Install fonts, text styles, spacing and colors.
dock_stylepub fn dock_style(style: &egui::Style) -> egui_dock::Style
Dock (view tabs) style matching the theme.
cc_app::thumbnailscrates/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
SIZEpub const SIZE: [u32; 2]
Thumbnail size in pixels (3:2).
Jobpub enum Job
A thumbnail waiting to be rendered (rendering needs the GPU, which only the app loop has).
Traits: Debug, Clone, PartialEq
Variants
Project(PathBuf)
The open document, saved at this path.
Sample(&'static str)
A bundled sample project.
project_filepub fn project_file(path: &Path) -> Option<PathBuf>
sample_filepub fn sample_file(name: &str) -> Option<PathBuf>
processpub fn process(state: &mut AppState, rs: &egui_wgpu::RenderState)
Render pending thumbnails.
cc_app::title_block_envcrates/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
MMpub const MM: f64
Millimeters per canvas unit (the canvas is in paper meters).
Previewpub enum Preview
The paper the Sheet view shows.
Traits: Debug, Clone, Copy, PartialEq
Variants
Sheet(ViewId)
A sheet’s own paper.
Paper { size: SheetSize, portrait: bool }
An ISO size, portrait or landscape.
SheetEditorpub struct SheetEditor
The Sheet view’s state.
Traits: Debug, Clone, PartialEq
Fields
sheet: Option<ViewId>
The sheet the editor opened from: fields read it (else sample values).
preview: Previewraw_keys: bool
Show {keys} as typed instead of their values.
editing: Option<(usize, Vec<ProfilePoint>)>
The stroke whose sketch is open, with its points as they were.
Some fields are private.
Methods
pub fn new(sheet: Option<ViewId>, system: MeasurementSystem) -> Self
The editor of sheet’s title block, else previewed on the paper of
a new sheet of the project’s system.
is_openpub fn is_open(state: &AppState) -> bool
Whether the component environment shows a title block.
sheet_title_block_ofpub fn sheet_title_block_of(state: &AppState, id: ViewId) -> Option<ElementTypeId>
The title block type of sheet id.
sheet_title_blockpub fn sheet_title_block(state: &AppState) -> Option<ElementTypeId>
The active sheet’s title block type.
edit_sheetpub 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.
new_title_blockpub 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.
iso_paperpub fn iso_paper(size: SheetSize, portrait: bool) -> DVec2
An ISO paper in millimeters, portrait (long side up) or landscape.
paperpub fn paper(state: &AppState, preview: Preview) -> DVec2
The paper shown, millimeters.
scope_extrapub fn scope_extra(paper: DVec2) -> [(&'static str, f64); 2]
The names expressions read for the paper, millimeters.
SheetPlanepub struct SheetPlane
A line pieces snap to and are written against.
Traits: Debug, Clone, PartialEq
Fields
name: String
What a coordinate on it is written as (0, SheetWidth, a plane’s name).
label: String
What the canvas labels it.
vertical: bool
A vertical line (it fixes x); else horizontal (it fixes y).
at: f64
Where it stands, millimeters.
edge: bool
A paper edge (locked).
planespub 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.
plane_viewpub 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.
field_valuepub 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.
centralpub fn central(ui: &mut Ui, state: &mut AppState)
The Sheet view: the paper, the planes, the title block, and the tools.
text_boxpub 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.
piece_atpub 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.
pieces_inpub fn pieces_in(pieces: &SheetPieces, a: DVec2, b: DVec2) -> Vec<usize>
The pieces wholly inside the window from a to b (millimeters), in order.
Picturepub 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
bytes: Vec<u8>aspect: f64picturepub 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.
picture_filepub 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.
image_rectpub 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.
pick_imagepub fn pick_image(state: &mut AppState)
Image: pick a picture file, then drag its rectangle.
coordinatepub 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.
place_textpub fn place_text(state: &mut AppState, planes: &[SheetPlane], at: DVec2)
Place a text at at (millimeters) and pick it.
field_menupub 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.
insert_fieldpub 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.
sheet_plane_from_linepub 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.
is_sheet_sketchpub fn is_sheet_sketch(state: &AppState) -> bool
Whether the open sketch draws a title block’s lines.
start_linespub fn start_lines(state: &mut AppState)
Lines: a new sketch on the Sheet view.
chainspub 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.
finish_strokepub 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.
edit_strokepub fn edit_stroke(state: &mut AppState, index: usize)
Edit Sketch of stroke index: its lines and arcs on the Sheet view.
delete_piecespub fn delete_pieces(state: &mut AppState, list: &[usize])
Delete pieces list, in one step.
ribbonpub fn ribbon(ui: &mut Ui, state: &mut AppState)
The Create tab of the title block editor.
optionspub fn options(ui: &mut Ui, state: &mut AppState)
The options bar: the preview paper, raw keys, and the tool’s hint.
panel_contentpub 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::toolscrates/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
Toolpub enum Tool
Traits: Debug, Clone, PartialEq
Variants
SelectWall { type_id: ElementTypeId, }Hosted { category: Category, type_id: ElementTypeId, }Sketch { category: Category, type_id: ElementTypeId, }SectionCallout
Draw a callout’s rectangle in a plan, section or elevation.
DetailLine
Draw detail lines in the active 2D view (mode and style in
AppState::detail, see crate::detail_ui).
Room { type_id: ElementTypeId, }Grid { type_id: ElementTypeId, }Dimension { type_id: ElementTypeId, mode: DimensionMode, }Column { type_id: ElementTypeId, material: Option<cc_core::StructuralMaterial>, }Beam { type_id: ElementTypeId, material: Option<cc_core::StructuralMaterial>, }Footing { type_id: ElementTypeId, }
Click to place a pad footing; Space turns it by 90°. With a strip type, draw strip footings as walls are drawn (lines or arcs).
Truss { material: cc_core::StructuralMaterial, }
Click the two ends of a truss (options in AppState::truss) of the Structure tab’s material.
Bracing { material: cc_core::StructuralMaterial, }
Click the two column axes of a braced bay (options in AppState::bracing).
Stair { type_id: ElementTypeId, }Ramp { type_id: ElementTypeId, }Railing { type_id: ElementTypeId, }Sweep { type_id: ElementTypeId, }
Click the points of a swept profile’s path (options in AppState::sweep).
Component { type_id: ElementTypeId, }Pipe { type_id: ElementTypeId, }
Click the ends of pipe runs, one after the other (options in AppState::mep).
Conduit { type_id: ElementTypeId, }
Click the ends of conduit runs, one after the other.
CableTray { type_id: ElementTypeId, }
Click the ends of cable tray runs, one after the other.
LightningConductor { type_id: ElementTypeId, }
Click the ends of lightning protection conductors, one after the other.
Valve { type_id: ElementTypeId, }
Click a pipe to place a valve on it.
MoveCopyRotateMirror { draw: bool, }
Mirror across a picked line (draw: false) or a drawn axis.
ArrayTrimCornerTrimExtendSplitOffsetAlignPushPull
Push or pull a face of a mass in a 3D view.
ToggleJoin
Click near a wall end to allow or disallow its join.
Measure
Measure between two points; the result stays until the next pick.
JoinGeometry { unjoin: bool, }
Pick an element, then others to join (or unjoin) their geometry with it.
AttachTop
Click the roof, ceiling or floor the selected walls’ tops attach to
(the walls are kept in interaction.targets).
Paste
Place the clipboard with a click.
MatchType
Pick an element, then click others to give them its type.
Text { type_id: ElementTypeId, }
Place text notes (options in AppState::text_options).
LevelMark { type_id: ElementTypeId, }
Place level marks in plans, elevations and sections.
DetailComponent { type_id: ElementTypeId, }
Place detail components in 2D views (options in AppState::detail_component).
AddLeader { id: ElementId, }
Add a leader to the text note id.
Opening { host: ElementId, floor: bool, }
Sketch an opening in host: a courtyard in a roof, or a shaft or
stairwell in a floor (floor).
Demolish
Click elements to demolish them in the view’s phase.
CurtainGrid
Click curtain walls to edit their grids and panels (options in AppState::curtain).
Paint { remove: bool, }
Click faces in a 3D view to paint them with AppState::paint_material
(or to take their paint off).
Methods
pub fn name_key(&self, project: &Project) -> &'static str
Translation key of the tool’s name as the options bar shows it: the footing tool drawing a strip type is named for strips, the component tool for the plumbing fixtures or devices it places.
pub fn key(&self) -> &'static str
Translation key of the tool name.
pub fn type_id(&self) -> Option<ElementTypeId>pub fn material(&self) -> Option<cc_core::StructuralMaterial>
The structural material a column or beam tool’s types keep to.
pub fn category(&self) -> Option<Category>pub fn with_type(&self, id: ElementTypeId) -> Toolpub fn for_category(project: &Project, category: Category) -> Option<Tool>
Tool for creating elements of category with its default type
(foundations: a pad footing with the first pad type).
DimensionModepub enum DimensionMode
What the dimension tool places.
Traits: Debug, Clone, Copy, PartialEq, Eq, Hash, Default
Variants
AlignedLinear
Horizontal or vertical, chosen by where the line is placed.
Ordinate
Running dimensions from an origin, horizontal or vertical.
AngularRadialDiameterMethods
pub const ALL: [DimensionMode; 6]pub fn key(self) -> &'static strpub fn hint_key(self) -> &'static strDragpub enum Drag
Traits: Debug, Clone
Variants
Box { start: Pos2, }Grip { id: ElementId, at_start: bool, fixed: DVec2, }
An end handle of a wall, beam or grid; fixed is the other end.
DetailGrip { id: ElementId, which: u8, }
A grip of a selected detail line (see crate::sketch_mode::moved for which).
Bend { id: ElementId, a: DVec2, b: DVec2, }
The curvature handle of an arc wall from a to b: the arc passes through the cursor.
Move { start: DVec2, ids: Vec<ElementId>, copy: bool, }Tag { tag: cc_views::TagHandle, start: DVec2, }
The tag of an element, as drawn when the drag started.
Section { view: ViewId, part: crate::section_mark::Part, start: DVec2, }
A section’s mark in a plan: the whole mark, an end or a piece of
its split line, grabbed at start.
Callout { view: ViewId, part: crate::callout_ui::Part, start: DVec2, }
A callout’s mark: the whole mark or a corner, grabbed at start.
Hotspot { id: ElementId, name: String, z: f64, shape: cc_core::HotspotShape, color: Color32, }
A hotspot of a scripted component, at elevation z (absolute).
Interactionpub struct Interaction
Transient state of the active tool.
Traits: Debug, Clone, Default
Fields
targets_lines: Vec<(glam::DVec2, glam::DVec2)>
Lines under the measuring tool’s first pick.
anchor: Option<DVec2>
Wall chain anchor or section start.
points: Vec<DVec2>
Sketch points.
flip_hand: booldrag: Option<Drag>targets: Vec<ElementId>
Elements a transform tool acts on (the selection when it started).
center: Option<DVec2>
Rotation center.
placing_center: bool
The next click sets the rotation center.
tracked: Vec<DVec2>
Points acquired for alignment guides (see snap).
prev_dir: Option<DVec2>
Direction back along the previous segment of a chain (angle reference).
rotation: f64
Rotation of the next component, degrees.
plane_z: Option<f64>
Height of the working plane of a tool in the 3D view (the first point picked).
dim_chain: Option<DimChain>
The dimension chain being continued (continuous dimensioning).
push: Option<(ElementId, cc_core::mass::MassFace, glam::DVec3, glam::DVec3)>
Push/pull: the mass face picked (the mass, the face, a point on it and its outward normal).
chain: Vec<ChainStep>
The segments a chain tool placed, latest last (see chain_back).
chain_redo: Vec<ChainStep>
Segments taken back, latest last, for redo.
Methods
pub fn is_idle(&self) -> boolChainAtpub 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.
ChainSteppub 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.
chain_backpub 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.
chain_forwardpub fn chain_forward(state: &mut AppState) -> bool
Ctrl+Y after chain_back: place the segment again and go on from its end.
DimChainpub 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
view: ViewIdlast: DVec2dir: DVec2line: DVec2linear: bool
Linear (horizontal or vertical) rather than aligned dimensions.
ordinate: bool
Running dimensions from the origin last.
Snappub(crate) struct Snap
Traits: Debug, Clone, Copy
Fields
point: DVec2Some fields are private.
Methods
pub(crate) fn plain(point: DVec2, on_point: bool) -> Self
A snap to point, shown as an end point when on_point, else free.
pub(crate) fn nearest(point: DVec2) -> Self
A snap to the nearest point of a line.
pub(crate) fn is_free(&self) -> bool
Whether nothing was snapped to.
snap_atpub(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.
cad_snappub(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).
CadIndexEntrypub 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.
underlay_snappub(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).
round_steppub(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.
round_finepub(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.
select_boxpub(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.
ModelSnapspub(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.
draw_snappub(crate) fn draw_snap(painter: &Painter, xf: &Xf, s: Snap)
labelpub(crate) fn label(painter: &Painter, pos: Pos2, text: String)
TEMP_DIMpub(crate) const TEMP_DIM: Color32
Color of temporary dimensions.
dim_textpub(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.
temp_measurepub(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.
temp_dimensionpub(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).
dimension_linepub(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.
TypedInputpub 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
length: Stringangle: Stringangle_active: bool
Typing goes to the angle.
Methods
pub fn is_empty(&self) -> boolpub fn clear(&mut self)pub fn push(&mut self, ch: char)pub fn pop(&mut self)pub fn length_value(&self) -> Option<f64>pub fn angle_value(&self) -> Option<f64>pub fn second_length(&self) -> Option<f64>
The second field read as a length, for tools that take two (a rectangle’s width and depth).
pub fn type_char(&mut self, ch: char, second_is_length: bool) -> bool
Takes a character typed into the active field, if it belongs in a
value: digits and decimal marks, and in feet and inches the marks,
fractions (12'6 1/2") and, inside a length already started, a space
or a dash. second_is_length when the second field is a length too.
pub fn apply(&self, a: DVec2, p: DVec2, reference: Option<DVec2>) -> DVec2
The end of a segment from a toward the cursor p, with the typed
length and the typed angle from reference (the X axis by default;
the angle turns to the cursor’s side of it).
handlepub fn handle(ui: &Ui, resp: &Response, painter: &Painter, state: &mut AppState, view: &View, xf: &Xf, drawing: &Drawing2D)
run_createpub(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.
MepOptionspub struct MepOptions
Options of the pipe and conduit tools and of placing devices, kept between uses.
Traits: Debug, Clone, PartialEq, Default
Fields
system: Option<cc_core::SystemId>
System of new pipes.
circuit: Option<cc_core::SystemId>
Circuit of new conduits and devices.
data: Option<cc_core::SystemId>
Cabling (a rack’s data system) of new data outlets.
lightning: Option<cc_core::SystemId>
Lightning protection system of new conductors and devices (None: the engine’s default).
offset: Option<f64>
Elevation of new pipes and conduits above the level (None: the engine’s default).
slope: Option<f64>
Fall of new pipes, percent (None: the default for the system and diameter).
chain: Option<f64>
Elevation where the next run of a chain starts (the end of the last one).
rise: Option<f64>
Elevation a chain goes up or down to at its last point before the next run (a vertical run), set by changing the elevation while drawing.
device_typepub 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.
ComponentGrouppub 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
GenericFixtureDeviceOwn(cc_core::DeviceKind)component_grouppub fn component_group(project: &Project, type_id: ElementTypeId) -> ComponentGroup
Which tool places type_id (Generic for any type that is no fixture or device).
tool_typespub 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).
mep_component_typepub fn mep_component_type(project: &Project, device: bool) -> Option<ElementTypeId>
The first component type that is an electrical device (device) or a plumbing fixture.
Runpub enum Run
What a run tool draws.
Traits: Debug, Clone, Copy, PartialEq, Eq, Drop
Variants
PipeConduitTrayConductorTrussOptionspub struct TrussOptions
Truss tool options, kept between uses.
Traits: Debug, Clone, PartialEq, Default
Fields
shape: cc_core::truss::TrussShapepattern: cc_core::truss::TrussPatternheight: f64
Chord to chord (flat), or the rise (mono, gable), meters.
panels: u32
Number of panels; 0 picks about one per 1.5 m.
copies: u32spacing: f64
Copy to copy, meters.
truss_commandpub 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.
BracingOptionspub struct BracingOptions
Bracing tool options, kept between uses.
Traits: Debug, Clone, PartialEq, Default
Fields
pattern: cc_core::bracing::BracingPatternheight: f64
One storey, meters.
stories: u32flip: bool
A diagonal rises toward the first click instead of the second.
alternate: bool
Diagonals change direction storey by storey.
bracing_commandpub 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.
foundation_typepub fn foundation_type(project: &Project, kind: cc_core::FoundationKind) -> Option<ElementTypeId>
The first foundation type of kind.
is_strippub fn is_strip(project: &Project, type_id: ElementTypeId) -> bool
grid_crossingspub(crate) fn grid_crossings(project: &Project) -> Vec<DVec2>
Intersections of grid lines, offered as snap points.
beam_commandpub 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).
RailingHostOptionspub 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
on: boolboth: bool
Both sides of the host, not only the side nearest the click.
railing_hostpub fn railing_host(state: &AppState, id: ElementId) -> bool
Whether id is a stair or a ramp (an element railings can follow).
SweepOptionspub struct SweepOptions
Options of the swept profile tool.
Traits: Debug, Clone, Copy, Default, PartialEq
Fields
base_offset: f64
Height of the path above the level.
closed: bool
The path runs back to its first point.
flip: bool
The profile on the right of the path.
finish_sweeppub fn finish_sweep(state: &mut AppState, level: LevelId, type_id: ElementTypeId)
Create the swept profile from the points clicked so far.
finish_railingpub fn finish_railing(state: &mut AppState, level: LevelId, type_id: ElementTypeId)
Create the railing from the points clicked so far.
linear_directionpub(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.
line_atpub(crate) fn line_at(drawing: &Drawing2D, p: DVec2, tol: f64) -> Option<(DVec2, DVec2)>
The linework segment (of an element) nearest to p within tol.
point_on_segmentpub(crate) fn point_on_segment(a: DVec2, b: DVec2, p: DVec2, tol: f64) -> bool
Whether p lies on the segment a-b within tol.
arc_atpub(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).
arc_previewpub(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.
place_opening_3dpub(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.
add_openingpub 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.
move_elementspub fn move_elements(state: &mut AppState, ids: &[ElementId], delta: DVec2)
Translate elements; hosted elements slide along their host unless it moves too.
copy_elementspub 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.
duplicatepub fn duplicate(state: &mut AppState, ids: &[ElementId], delta: DVec2)
Copy elements by delta; hosted elements follow copied hosts.
rotate_elementspub 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).
mirror_elementspub 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).
rotate_selectionpub 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_uicrates/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
patterns_forpub fn patterns_for(shape: TrussShape) -> Vec<TrussPattern>
The patterns offered for a shape (gable-only ones on gables).
tool_optionspub fn tool_options(ui: &mut Ui, state: &mut AppState)
The options bar of the Truss tool.
editpub 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.
propspub fn props(ui: &mut Ui, state: &mut AppState, id: ElementId, truss: &Truss)
The rows of a selected truss.
cc_app::type_dialogcrates/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
showpub fn show(ctx: &Context, state: &mut AppState)
cc_app::units_dialogcrates/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
showpub fn show(ctx: &Context, state: &mut AppState)
cc_app::updatecrates/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
RELEASES_APIpub const RELEASES_API: &str
The GitHub API endpoint of the latest (non-draft, non-prerelease) release.
NO_CHECK_ENVpub const NO_CHECK_ENV: &str
Set (to anything but 0 or nothing) to turn every update check off.
CHECK_INTERVALpub const CHECK_INTERVAL: Duration
Time between automatic checks.
Versionpub struct Version
A release version major.minor.patch (build metadata ignored).
Traits: Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash, std::fmt::Display
Fields
major: u64minor: u64patch: u64Methods
pub fn parse(text: &str) -> Option<Version>
Parse 1.2.3 or v1.2.3 (build metadata +... ignored). Pre-releases
(1.2.3-beta) and anything else give None.
Releasepub struct Release
A published release.
Traits: Debug, Clone, PartialEq, Eq
Fields
version: Versionurl: String
Its page on GitHub (built from the tag, never taken from the response).
assets: Vec<crate::update_install::Asset>
Its packages and checksum list (only links to this repository’s releases).
Outcomepub enum Outcome
The result of a check.
Traits: Debug, Clone, PartialEq, Eq
Variants
UpToDateAvailable(Release)Failed
No answer, or one that could not be read.
Disabled
Checks are turned off by NO_CHECK_ENV.
currentpub fn current() -> Option<Version>
The version of this build.
evaluatepub 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).
disabled_by_envpub fn disabled_by_env() -> bool
Whether NO_CHECK_ENV turns checks off.
auto_check_duepub 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.
nowpub fn now() -> u64
Seconds since the Unix epoch (0 if the clock is before it).
Updatespub struct Updates
Update checks of the app: when the last ran, the check in progress and what to show.
Traits: Debug, Default
Fields
last_check: Option<u64>
When the last check started (seconds since the Unix epoch).
skipped: Option<Version>
A version the user chose to skip: its notice is not shown again.
available: Option<Release>
A newer release whose notice is shown.
report: Option<Outcome>
The result of a check the user asked for, shown in a dialog.
install: Option<Install>
Update Now: its progress or result, shown in a dialog.
on_exit: Option<crate::update_install::Next>
What an installed update starts when the app closes (the new version, or the installer).
Some fields are private.
Methods
pub fn start_if_due(&mut self, ctx: &egui::Context, enabled: bool)
Start an automatic check if one is due (enabled: the preference is on).
pub fn start(&mut self, ctx: &egui::Context, manual: bool)
Start a check (manual: the user asked, so the result is reported).
pub fn checking(&self) -> bool
A check the user asked for is running.
pub fn cancel_report(&mut self)
Stop reporting the check in progress (it still finishes quietly).
pub fn poll(&mut self)
Take the result of the check in progress, if it arrived.
pub fn update_now(&mut self, ctx: &egui::Context, release: &Release)
Update Now: install release here (or show how), in the update dialog.
pub fn poll_install(&mut self)
Take the result of Update Now, if it arrived.
pub fn dismiss(&mut self)
Hide the notice until the next check.
pub fn skip(&mut self)
Hide the notice and do not notify this version again.
Installpub enum Install
Update Now, as the dialog shows it.
Traits: Debug
Variants
Running(Version, String, crate::update_install::Running)
Downloading and verifying version (its release page for a manual download).
Ready(Version, crate::update_install::Next)
Done: what is left to do.
Command(String, String)
The package manager updates this copy: the command, and the release page.
Failed(String, String)
Failed (why, and the release page for a manual download).
Planpub enum Plan
How Update Now would update to release here, if it can.
Variants
Install(crate::update_install::InstallKind, crate::update_install::Asset, String)
Download, verify and install package (with the release’s checksum list).
Command(String)
Show the package manager’s command.
planpub fn plan(release: &Release) -> Option<Plan>
What Update Now does for release on this installation, or None (Download only).
noticepub 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_installcrates/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:
.msi, under Program Files): run msiexec /passive
when the app closes; ConstructCraft starts again when it is done..zip (anywhere else on Windows, ccad.exe beside the app):
the archive is unpacked in a staging folder, the running executables
are renamed to .old (Windows allows renaming a running program) and
the new ones take their names; the .old files go at the next start..dmg is opened; the user drags the app to Applications..deb: never replaced; the window shows the apt command..tar.gz, builds from source): Download only.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
DOWNLOAD_PREFIXpub const DOWNLOAD_PREFIX: &str
Packages and the checksum list must come from this repository’s releases.
SUMSpub const SUMS: &str
The checksum list every release carries.
Assetpub struct Asset
A file attached to a release.
Traits: Debug, Clone, PartialEq, Eq
Fields
name: Stringurl: Stringassets_ofpub 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.
InstallKindpub enum InstallKind
How this copy of ConstructCraft was installed.
Traits: Debug, Clone, PartialEq, Eq
Variants
AppImage(PathBuf)
An AppImage (the file).
Msi
The Windows installer, under Program Files.
Portable(PathBuf)
The Windows .zip: this executable (with ccad.exe beside it).
MacApp
A macOS .app (from the .dmg).
Deb
The Debian package, under /usr.
Other
Anything else: Download only.
detectpub 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).
this_installpub fn this_install() -> InstallKind
This copy’s installation.
package_forpub 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).
installs_itselfpub fn installs_itself(kind: &InstallKind) -> bool
Whether Update Now can install for kind (the others get Download, or a command).
deb_commandpub fn deb_command(asset: &Asset) -> String
The command that installs a downloaded .deb.
expected_sha256pub 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.
Progresspub struct Progress
Progress of an update, shared with the window that shows it.
Traits: Debug, Default
Fields
done: AtomicU64total: AtomicU64
The package’s size when the server gives it (0: unknown).
cancel: AtomicBoolNextpub enum Next
What to do once the package is in place.
Traits: Debug, Clone, PartialEq, Eq
Variants
Restart(PathBuf)
The new version replaced this one: start this program when the app closes.
Installer(PathBuf, String)
Run this installer (.msi) when the app closes, then start the app. The SHA-256 it was
verified with at download is checked again just before it runs: it waits in the temporary
folder, where another program could replace it.
Opened
The disk image was opened: the user finishes in the Finder.
installpub 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.
swap_executablepub 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.
remove_old_executablespub fn remove_old_executables(exe: &Path)
Remove the .old executables a previous update left beside exe.
installer_commandpub 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.
finishpub fn finish(next: &Next)
Start what an update left to do, as the app closes.
Runningpub struct Running
A running update: its progress, and the result when it is done.
Traits: std::fmt::Debug
Fields
progress: Arc<Progress>Some fields are private.
Methods
pub fn start(ctx: &egui::Context, kind: InstallKind, package: Asset, sums_url: String) -> Result<Running, String>
Start installing package on a background thread.
pub fn poll(&self) -> Option<Result<Next, String>>
The result, once the thread is done.
cc_app::view3dcrates/cc_app/src/view3d.rs
Interactive 3D view backed by cc_render::Renderer3D.
Items: View3DState · fit_camera · show
View3DStatepub struct View3DState
Fields
camera: CameraStatetexture: Option<egui::TextureId>picks: crate::modify3d::PickCache
Snap points and previews of the modify tools.
pixel_size: Option<[u32; 2]>
Size of the viewport in pixels when last drawn (the render window’s View size).
Some fields are private.
Methods
pub(crate) fn auto_fitted(&self) -> bool
Whether the camera is still the one fitted to the model (never moved since: a resized view fits it again).
pub fn request_fit(&mut self)
Frame the model on the next frame, remembering the camera.
pub fn nav(&self) -> ZoomNavpub fn apply(&mut self, cmd: ZoomCommand)
Run a zoom command of the view toolbar (“fit all” is handled by the caller).
fit_camerapub fn fit_camera(camera: &mut CameraState, geom: &cc_geom::ModelGeometry, aspect: f32)
Zoom the camera to frame the whole model.
showpub fn show(ui: &mut Ui, state: &mut AppState, view_id: ViewId, render_state: Option<&egui_wgpu::RenderState>)
cc_app::view_cubecrates/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
KEYSpub const KEYS: [&str; 10]
Translation keys used at runtime (checked by the i18n tests).
CubeActionpub struct CubeAction
What the user asked of the cube this frame.
Traits: Debug, Default
Fields
look_from: Option<DVec3>
View from this direction (unit vector from the target to the eye).
orbit: Option<Vec2>
Orbit by a drag (as on the canvas).
turn: f64
Turn around Z by this many degrees.
home: bool
angles_frompub 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).
showpub 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_uicrates/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
WallFramingDialogpub struct WallFramingDialog
Traits: Debug, Clone
Fields
system: FramingSystemspacing: f64stud_type: Option<ElementTypeId>
None: the catalog default.
track_type: Option<ElementTypeId>header_type: Option<ElementTypeId>double_top: boolblocking: boolerror: Option<String>Methods
pub fn new(system: FramingSystem) -> Self
The system’s defaults: spacing, top plates, catalog types, no blocking.
openpub fn open(state: &mut AppState, system: FramingSystem)
walls_to_framepub 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.
commandpub fn command(d: &WallFramingDialog, walls: &[ElementId]) -> WallFramingCreate
The command OK runs for walls.
showpub fn show(ctx: &Context, state: &mut AppState)
editpub 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.
propspub fn props(ui: &mut Ui, state: &mut AppState, id: ElementId, framing: &WallFraming)
The rows of a selected framing.
member_rowpub 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.