Skip to main content

brep_render/
engine_state.rs

1//! [`EngineState`] — the windowing-agnostic viewer state machine the host UI
2//! programs against (R3): scene + camera + controls + settings + emphasis, plus
3//! the whole event/command/query surface (run-history feed, pointer/wheel
4//! ingestion, camera commands, picking, world→screen, visibility). No GPU, no
5//! canvas — the wasm `Engine` and the winit desktop shell both wrap this; it is
6//! fully unit-testable on native.
7//!
8//! Everything crosses the R3 boundary as plain JSON/scalars: the host never holds a
9//! renderer object, only names, ids, and JSON.
10
11use crate::controls::ArcballControls;
12use crate::history::History;
13use crate::pick::{self, PickOptions};
14use crate::scene::RenderScene;
15use crate::style::{Emphasis, RenderSettings};
16use crate::view::ViewCamera;
17use crate::widgets::{gizmo_camera, WidgetOverlay, WidgetRegistry};
18use brep_kernel::HistoryRequest;
19use std::collections::HashMap;
20
21/// One DIALOG row's hover state — which panel lit it, the row's own TEXT, and
22/// what that text resolved to in the scene.
23///
24/// The row text is the memo key rather than the candidate's name because the two
25/// differ whenever the derived-face fallback fires (a fillet's `Edges` row reads
26/// `A|B[0]` while the face it lights is `F1:BLEND:A|B[0]` — see
27/// [`EngineState::hover_entity_by_name`]). An unresolvable row memoizes as
28/// `candidate: None`, so a held hover over a name the scene does not carry scans
29/// the scene ONCE, not once per frame.
30#[derive(Clone)]
31pub(crate) struct DialogHover {
32    /// Which panel set it (`"history"`, `"constraints"`, `"pmi"`, `"refsel"`) —
33    /// [`EngineState::dialog_hover_end`] acts only for the owner that set it, so a
34    /// pane that never hovered a row cannot end another pane's hover.
35    pub(crate) owner: &'static str,
36    /// The row's TEXT, exactly as the dialog listed it.
37    pub(crate) row: String,
38    /// What it resolved to, or `None` for a row the scene does not carry.
39    pub(crate) candidate: Option<pick::PickCandidate>,
40}
41
42pub struct EngineState {
43    pub scene: RenderScene,
44    pub camera: ViewCamera,
45    pub controls: ArcballControls,
46    pub settings: RenderSettings,
47    pub emphasis: Emphasis,
48    /// In-scene overlay widgets: datums/dimensions/curves, transform
49    /// gizmo, ViewCube — fed as JSON, drawn by the render core's overlay pass.
50    pub widgets: WidgetRegistry,
51    /// The engine-owned editable model recipe (ordered features + rollback
52    /// index) — the SINGLE source of truth for the model. The UI never keeps its
53    /// own copy; it mutates/reads this through the `history_*` / feature methods.
54    pub history: History,
55    /// The build report (`{featureErrors, unresolved, displayErrors}`) of the
56    /// last history run, so the UI can show it without re-running.
57    history_report: String,
58    /// The Properties-panel metadata store: user attributes keyed by OBJECT NAME
59    /// (solid / face / edge kernel name), NOT feature id — so a record survives
60    /// feature edits as long as the object's name persists. Persisted with the
61    /// model (a top-level `metadata` field in the history document); see the
62    /// [`crate::metadata`] module for the store + the object-info/measurement API.
63    pub metadata: crate::metadata::MetadataStore,
64    /// Bumped whenever settings change so the renderer re-derives per-solid
65    /// base styles (a cheap key, not a per-frame diff).
66    pub settings_generation: u64,
67    /// The engine sets this whenever the camera/scene/emphasis changed; the
68    /// presentation shell renders only when it is set (R22 on-demand render —
69    /// the OrthoCameraIdle matrix-compare analogue, made explicit).
70    pub dirty: bool,
71    /// The modal reference-selection state (the ref-select widget). `Some` while
72    /// the user is picking references for a feature-dialog field; `None`
73    /// otherwise. The picked-name list here is the SINGLE source of truth while
74    /// active (the UI reads it back; the viewport appends to it on a pick).
75    pub ref_select: Option<RefSelectState>,
76    /// Which entity KINDS a plain viewport click may select (the selection
77    /// filter, mirroring the earlier `SelectionFilter.allowedSelectionTypes`). `select_top_at`
78    /// consults it via `pick_filtered`; see the appended `SelectionFilter` impl
79    /// block near the end of this file for the state + honoring logic.
80    pub selection_filter: SelectionFilter,
81    /// The transform-controls gizmo controller: which feature (if any) has the
82    /// move/rotate gizmo armed (via the in-viewport center-sphere toggle), plus the
83    /// in-flight handle drag. All the arm/drag/apply logic lives in the appended
84    /// transform-gizmo impl block near the end of this file.
85    pub transform_gizmo: TransformArm,
86    /// The COMPONENT Move gizmo controller (assemblies §8.5): which ACOMP
87    /// instance has the bbox-center move/rotate gizmo armed, the translate/
88    /// rotate cycle mode, and the commit-on-release drag. Exclusive with
89    /// `transform_gizmo` (shared widget slot). See `component_move.rs`.
90    pub component_move: ComponentMoveArm,
91    /// The active engine-native sketch edit (`Some` while in sketch mode). Holds
92    /// the live [`crate::sketch::SketchSession`] plus the pre-entry camera + roll
93    /// to restore on exit. All the enter/exit/new logic lives in the appended
94    /// sketch-mode impl block at the END of this file.
95    sketch_edit: Option<SketchEdit>,
96    /// Sketch-mode camera lock. When true (the default on every sketch entry), the
97    /// camera is held flat-on to the sketch plane and an empty drag only PANS —
98    /// no orbit. Toggling it back on re-faces the camera to the plane. Meaningful
99    /// only while `sketch_edit` is `Some`. See the sketch-mode impl block.
100    sketch_camera_locked: bool,
101    /// Set for ONE frame when the sketch entity-LIST panel hovers a row (it calls
102    /// [`sketch_hover_entity`](Self::sketch_hover_entity)). The viewport, which
103    /// draws AFTER the panel and would otherwise `sketch_clear_hover` because the
104    /// pointer is off the viewport, consumes this flag via
105    /// [`take_sketch_list_hover`](Self::take_sketch_list_hover) and keeps the
106    /// panel-set hover so list→canvas highlight survives the frame.
107    sketch_list_hover_active: bool,
108    /// Transient user-facing notices (e.g. a sketch solve that failed after an
109    /// edit). The shell drains them each frame via [`take_notices`](Self::take_notices)
110    /// into a toast overlay; the engine only queues. Replaces the swallowed
111    /// `eprintln!` on the interactive re-solve paths.
112    notices: Vec<String>,
113    /// Notices that are NOT errors — a warning, or a success such as "Updated 2
114    /// part(s)" — with their severity, queued by
115    /// [`push_notice_as`](Self::push_notice_as). Beside [`Self::notices`] rather
116    /// than in it, so every existing `push_notice` stays an error unchanged.
117    graded_notices: Vec<(NoticeSeverity, String)>,
118    /// Committed-sketch visibility: the feature ids whose persistent committed-sketch
119    /// overlay is HIDDEN (its Scene-tree checkbox off). Absent = visible. See the
120    /// committed-sketch impl block appended at the END of this file.
121    hidden_sketches: std::collections::HashSet<String>,
122    /// The committed-sketch feature ids whose overlay groups were fed on the LAST
123    /// [`refresh_committed_sketches`](Self::refresh_committed_sketches), so an id that
124    /// is no longer shown (rolled back, deleted, hidden, or became the active edit)
125    /// can have its now-stale groups cleared.
126    shown_sketch_ids: Vec<String>,
127    /// The board bodies fed on the LAST
128    /// [`refresh_board_geometry`](Self::refresh_board_geometry), in stack order,
129    /// so a body this build did not produce can be swept out of the scene.
130    /// Parallels [`shown_sketch_ids`].
131    shown_board_ids: Vec<String>,
132    /// The eCAD board those bodies were built from — the rebuild test. A
133    /// SCHEMATIC edit rewrites the whole `pcb` block with the same board inside
134    /// it, and this is what makes that edit free.
135    board_built_from: Option<brep_ecad_core::board::Board>,
136    /// The pin-to-net map those bodies' NET COLOURS were built from. The board
137    /// alone does not decide them — a copper island carries the net of the pads
138    /// it touches, and which net a pad carries is the SCHEMATIC's answer — so
139    /// this is the second half of the rebuild test. Empty for a board with no
140    /// placements, which can carry no net at all.
141    board_pin_nets: std::collections::BTreeMap<(brep_ecad_core::Uuid, String), String>,
142    /// What that build cost, for the Scene tree and the tests.
143    board_build: board_geometry::BoardBuild,
144    /// The built bodies themselves, KEPT across runs. The scene reconcile drops
145    /// every derived body, so without this a dense board would be re-meshed on
146    /// every history run; a clone of these is what goes back in instead.
147    board_displays: Vec<crate::scene::SolidDisplay>,
148    /// The named plane FRAMES the last history run resolved `(frame name, frame)`.
149    /// Stored so [`refresh_construction_datums`](Self::refresh_construction_datums)
150    /// (and datum selection) can display/pick the construction datum/plane frames
151    /// without re-running. Filled from the run's
152    /// [`crate::pipeline::SceneBuildReport::frames`]; the D/P filter is applied at
153    /// display time (a frame name maps to its producing feature TYPE via the
154    /// history). See the appended construction-datum impl block at the END.
155    construction_frames: Vec<(String, brep_kernel::Frame)>,
156    /// The solved sketch PROFILES the last history run produced `(sketch id,
157    /// profile)`. Stored so [`refresh_committed_sketches`](Self::refresh_committed_sketches)
158    /// can synthesize each committed sketch's SHEET SOLID (planar face + named
159    /// boundary edges + corner vertices) without re-running. Filled from the run's
160    /// [`crate::pipeline::SceneBuildReport::profiles`]; rollback / active-edit /
161    /// visibility gating is applied at display time.
162    sketch_profiles: Vec<(String, brep_kernel::SketchProfile)>,
163    /// The named PATH chains the last history run produced `(path name, curves)`.
164    /// Stored alongside [`sketch_profiles`](Self::sketch_profiles) so
165    /// [`refresh_committed_sketches`](Self::refresh_committed_sketches) can draw the
166    /// sketch geometry no closed profile covers: a sketch's OPEN chain publishes no
167    /// profile, so the sheet builder had nothing to draw it from and an open sketch
168    /// was invisible in 3D. Filled from the run's
169    /// [`crate::pipeline::SceneBuildReport::paths`]; the per-segment `{id}:G{gid}`
170    /// entries are the display input (the whole-chain `{id}` entry duplicates them
171    /// and `{id}:REF:{source}` is projected reference geometry).
172    sketch_paths: Vec<(String, Vec<brep_kernel::NurbsCurve>)>,
173    /// The named world POINTS the last history run produced `(point name, point)`.
174    /// Stored alongside [`sketch_paths`](Self::sketch_paths) so
175    /// [`refresh_committed_sketches`](Self::refresh_committed_sketches) can draw the
176    /// sketch points no segment covers: a points-only sketch (a hole-placement
177    /// sketch) publishes no profile and no path, so it had nothing to draw from
178    /// and was invisible in 3D. Filled from the run's
179    /// [`crate::pipeline::SceneBuildReport::points`]; the per-point `{id}:P{pid}`
180    /// entries are the display input (construction points are skipped at draw
181    /// time, like construction geometry).
182    sketch_points: Vec<(String, brep_kernel::ScenePoint)>,
183    /// The named axis LINES the last history run produced `(axis name, line)`.
184    /// Stored so the feature-dimension angle gizmo can resolve a revolve `axis`
185    /// reference to a world line without re-running. Filled from the run's
186    /// [`crate::pipeline::SceneBuildReport::axes`].
187    sketch_axes: Vec<(String, brep_kernel::Axis)>,
188    /// The wire-harness routing report of the last APPLIED run (`None` before
189    /// the first run). Filled from [`crate::pipeline::SceneBuildReport::wire_harness`];
190    /// the harness panel reads it, the committed-curve display reads the port
191    /// kinds off it. See the appended wire-harness impl block.
192    wire_harness_report: Option<brep_kernel::WireHarnessReport>,
193    /// The PORTS tail's report of the last APPLIED run (`None` before the first
194    /// run, and for a document that declares no `ports` block). Filled from
195    /// [`crate::pipeline::SceneBuildReport::ports`]; the Qualify panel reads it,
196    /// and it is the only place the tail's refused names and unresolved
197    /// references surface, the tail not being a feature.
198    ports_report: Option<brep_kernel::PortsReport>,
199    /// The PMI tail's report of the last APPLIED run (`pmi_ops.rs`).
200    pub(crate) pmi_report: Option<brep_kernel::PmiReport>,
201    /// The ACTIVE PMI view (engine memory, never persisted): its camera,
202    /// display state and explode poses are applied; its annotations drawn.
203    pub(crate) pmi_active_view: Option<String>,
204    /// The annotation whose form the PMI panel shows (engine memory). Never
205    /// assign `Some` here: go through [`EngineState::open_pmi_annotation`], the
206    /// one place that counts the open.
207    pub(crate) pmi_open_annotation: Option<String>,
208    /// The VIEW whose form the PMI panel shows (engine memory) — exclusive
209    /// with [`Self::pmi_open_annotation`], since the pane shows one dialog.
210    /// Never assign `Some` here: go through [`EngineState::open_pmi_view`].
211    pub(crate) pmi_open_view: Option<String>,
212    /// The annotation SELECTED in the PMI tree or by its viewport label: the
213    /// tree row's highlight and the label's accent. Cleared with the selection
214    /// (Esc / Clear / a click on empty space); read through
215    /// [`EngineState::pmi_selected_annotation`], which prunes a stale id.
216    pub(crate) pmi_selected_annotation: Option<String>,
217    /// The VIEW selected in the PMI tree — its row's highlight. Selecting a
218    /// view never ACTIVATES it (a double click does); exclusive with
219    /// [`Self::pmi_selected_annotation`], since the tree selects one row.
220    /// Read through [`EngineState::pmi_selected_view`], which prunes a stale id.
221    pub(crate) pmi_selected_view: Option<String>,
222    /// How many times a PMI dialog — an annotation's or a view's — has been
223    /// OPENED: monotonic, never reset, closes do not count. The app's dialog
224    /// door keys on it beside the subject so a re-open of the dialog that is
225    /// ALREADY open is still one open event (a viewport label double click on the
226    /// annotation whose form is up, which a user makes precisely because they
227    /// are on another tab).
228    pub(crate) pmi_dialog_opens: u64,
229    /// The modeling camera / visibility / wireframe remembered on entering
230    /// the PMI workbench, restored when a view deactivates or the workbench
231    /// is left.
232    pub(crate) pmi_modeling: Option<pmi_ops::PmiModelingSnapshot>,
233    /// The un-exploded displays of the solids the active view's explode
234    /// annotations posed, for an exact restore.
235    pub(crate) pmi_explode_originals: std::collections::HashMap<String, crate::scene::SolidDisplay>,
236    /// `(world_per_pixel, view direction)` the PMI overlay was last baked at.
237    pub(crate) pmi_overlay_key: Option<(f64, [f64; 3])>,
238    pub(crate) pmi_hovered: Option<String>,
239    pub(crate) pmi_label_hover_active: bool,
240    /// The sheet the sheet viewport shows (engine memory, never persisted).
241    /// `None` = the 3D view (`sheet_ops.rs`).
242    pub(crate) sheet_open: Option<String>,
243    /// The sheet or placed view whose form the Sheets pane shows. Never assign
244    /// `Some` here: go through [`EngineState::open_sheet_object`], the one
245    /// place that counts the open.
246    pub(crate) sheet_open_object: Option<String>,
247    /// How many times a sheet object's form has been OPENED — the sheet half
248    /// of the same counter as [`Self::pmi_dialog_opens`], read by the
249    /// app's dialog door so a re-open of the object already open still counts.
250    pub(crate) sheet_object_opens: u64,
251    /// The placed view, sheet dimension or ordinate set SELECTED in the Sheets
252    /// tree or on the paper: the tree row's highlight and the object's accent
253    /// on the sheet. Cleared with the selection; read through
254    /// [`EngineState::sheet_selected_object`], which prunes a stale id.
255    pub(crate) sheet_selected_object: Option<String>,
256    /// The last projected sheet, kept until the model or the block moves: a
257    /// sheet is a hidden-line pass over the whole model and must never run
258    /// per frame.
259    pub(crate) sheet_cache: Option<sheet_ops::SheetCache>,
260    /// The sheet's exact passes on the runner and waiting for it.
261    pub(crate) sheet_lines: sheet_ops::SheetLinesWork,
262    /// The open document's name, as the shell means it (the tab, the file, the
263    /// root PRODUCT of a STEP export). Engine memory, never persisted: the
264    /// document does not carry its own name, the SHELL owns it, and it is here
265    /// because a drawing sheet's TITLE BLOCK prints it. Set every frame by the
266    /// app from the active tab (a no-op when unchanged).
267    pub(crate) document_name: String,
268    /// What the spline-anchor cage overlay was last fed for — `(spline id,
269    /// selected anchor, applied run generation)` — so the per-frame refresh
270    /// the history panel makes while an SP form is open is a no-op until one
271    /// of those moves. See `spline_edit.rs`.
272    spline_overlay_key: Option<(String, Option<usize>, u64)>,
273    /// Whether the ports placed components carry (`ACOMP1:PORT1`) draw their
274    /// sheets. The app sets it from the active workbench — one that shows the
275    /// Wire Harness panel; a document's own PORT features always draw.
276    component_ports_visible: bool,
277    /// The spline whose anchor editor is open (fed by the history panel with
278    /// the cage overlay), so a viewport click on one of its anchor dots selects
279    /// that anchor; the index of the last such pick, until the panel takes it.
280    spline_edit_feature: Option<String>,
281    spline_anchor_picked: Option<usize>,
282    /// Construction datum/plane visibility: the frame NAMES whose datum plane is
283    /// HIDDEN (its Scene-tree checkbox off). Absent = visible. Mirrors
284    /// [`hidden_sketches`].
285    hidden_datums: std::collections::HashSet<String>,
286    /// The datum frame NAMES fed to the widget on the LAST
287    /// [`refresh_construction_datums`](Self::refresh_construction_datums). The datum
288    /// feed REPLACES its set wholesale each call, so this is a bookkeeping mirror of
289    /// what is currently shown (parallels [`shown_sketch_ids`]).
290    shown_datum_names: Vec<String>,
291    /// The history-run seam (M2a of the off-thread runner). Owns the scene-free
292    /// runner + its delta baseline (`name → last-emitted handle`) ACROSS reruns:
293    /// [`rerun_history`](Self::rerun_history) SUBMITS a run tagged with
294    /// [`run_generation`](Self::run_generation), and [`pump`](Self::pump) drains
295    /// the completed reply and [`apply_run_output`](Self::apply_run_output)s its
296    /// delta to [`Self::scene`]. The [`InlineRunner`](crate::runner::InlineRunner)
297    /// default runs synchronously (submit → immediate poll, byte-identical to the
298    /// old in-place reconcile); a background thread/worker impl slots in behind the
299    /// same trait in M2b/M3. Reset on a document switch
300    /// ([`set_history_json`](Self::set_history_json)) so a new model rebuilds fully.
301    pub(crate) runner: Box<dyn crate::runner::HistoryRunner>,
302    /// Monotonic run counter: bumped each time [`rerun_history`](Self::rerun_history)
303    /// SUBMITS a run, and stamped onto the reply so a stale reply (a newer run that
304    /// finished first) can be dropped. `run_generation != applied_generation` means
305    /// a run is in flight (always equal for the synchronous Inline runner).
306    run_generation: u64,
307    /// The generation of the last reply [`pump`](Self::pump) APPLIED — the high-water
308    /// mark that gates stale replies.
309    applied_generation: u64,
310    /// The latest [`crate::runner::RunProgress`] of the run in flight (a
311    /// background runner posts one before each feature it executes), or
312    /// `None` when nothing is running. Names what the spinner is waiting on.
313    run_progress: Option<crate::runner::RunProgress>,
314    /// The feature the last CANCELLED run was executing (`Some("")` when the
315    /// run was cancelled before any progress arrived), cleared by the next
316    /// submit. The history header shows it until the model is rebuilt.
317    cancelled_run: Option<String>,
318    /// A TRANSIENT expressions source the runs evaluate instead of the
319    /// document's own (the family table's row preview). Never written into
320    /// the history: not saved, not undone, not dirty. See
321    /// [`Self::set_expression_preview`].
322    expression_preview: Option<ExpressionPreview>,
323    /// How many run replies came back from the runner (applied or dropped as
324    /// stale). A run the runner coalesced away never replies, so this counts
325    /// the runs actually EXECUTED.
326    runs_replied: u64,
327    /// A pending one-shot "frame the scene once the in-flight run lands" request.
328    /// Import / Open SUBMIT an async run (native [`ThreadRunner`], wasm worker) and
329    /// want to `zoom_to_fit` the RESULT — but the scene is still empty when they
330    /// return, so an immediate fit frames nothing (bbox empty → no-op). Instead they
331    /// set this flag and [`pump`](Self::pump) performs the fit on the first apply that
332    /// leaves the run no longer pending. Under the synchronous Inline runner the run
333    /// applies inside the submitting call's own `pump`, so the fit is still immediate.
334    pending_fit: bool,
335    /// EAGER provenance `name → creating-feature id` for the current resident
336    /// solids, shipped with each run ([`crate::pipeline::RunOutput::provenance`]) and
337    /// replaced wholesale in [`apply_run_output`](Self::apply_run_output). Answers
338    /// `creating_feature` + the Info tab's `creatingFeature` WITHOUT a cold
339    /// `execute_history` — the freeze side-door once the run lives off-thread.
340    pub(crate) provenance: std::collections::HashMap<String, String>,
341    /// EAGER ENTITY ORIGIN `face/edge NAME → ORIGINATING feature id` (FIRST writer in
342    /// timeline order), shipped with each run
343    /// ([`crate::pipeline::RunOutput::entity_origin`]) and replaced wholesale in
344    /// [`apply_run_output`](Self::apply_run_output). Unlike `provenance` (the SOLID's
345    /// LAST writer) this is the feature that gave the face/edge its NAME — the answer
346    /// `creating_feature` returns for a face/edge (the "Edit owning feature" action +
347    /// the Info tab's `creatingFeature`), so it rolls to the entity's origin, not the
348    /// owning solid's last producer.
349    pub(crate) entity_origin: std::collections::HashMap<String, String>,
350    /// Object-info MEASUREMENT cache `name → merged object-info JSON`, filled by
351    /// [`pump_queries`](crate::metadata) from the runner's replies and served every
352    /// frame a selection persists (so `object_info_json` fires ONE query per
353    /// selection, not one per frame). Invalidated on any geometry change
354    /// (`apply_run_output`) or metadata edit (`set_metadata_attribute`).
355    pub(crate) info_cache: std::collections::HashMap<String, String>,
356    /// In-flight measurement queries `id → object NAME` — the key needed to MERGE a
357    /// reply back into the info cache (inject `name` + `creatingFeature`, the latter
358    /// now resolved by the entity name itself). Cleared alongside `info_cache` on a
359    /// geometry change so a stale reply is dropped rather than caching a superseded
360    /// measurement.
361    pub(crate) pending_query: std::collections::HashMap<u64, String>,
362    /// Monotonic measurement-query id (pairs a [`crate::runner::MeasureReply`] back
363    /// with its `pending_query` entry).
364    pub(crate) next_query_id: u64,
365    /// Off-thread mesh reconstructions awaiting a runner reply.
366    pub(crate) pending_mesh_imports: std::collections::HashMap<u64, MeshImportDestination>,
367    pub(crate) mesh_preview_results: std::collections::VecDeque<crate::runner::MeshImportReply>,
368    /// Monotonic id for pairing mesh import replies with submissions.
369    pub(crate) next_mesh_import_id: u64,
370    /// Topology requests in flight (see [`crate::runner::TopologyRequest`]).
371    pub(crate) pending_topology: std::collections::HashSet<u64>,
372    /// Every resident handle asked for since the last applied run, answered or
373    /// not: a handle the runner could not clone is not asked for again until a
374    /// run brings new handles.
375    pub(crate) topology_asked: std::collections::HashSet<u32>,
376    /// Monotonic id for pairing topology replies with requests.
377    pub(crate) next_topology_id: u64,
378    /// The run's ASSEMBLY tail as the runner read it
379    /// ([`crate::pipeline::AssemblySync`]) — the constraint state, statuses, DOF
380    /// and overlay rows every assembly panel reads, adopted from the reply of the
381    /// last applied run. `None` for a componentless document. This is what
382    /// replaced the second, main-side `execute_history`: see `assembly_ops`.
383    pub(crate) assembly_sync: Option<crate::pipeline::AssemblySync>,
384    /// The scene's assembly COMPONENT records (deterministic id order), adopted
385    /// from [`Self::assembly_sync`] — the Assembly Structure tree's source.
386    /// Empty for componentless documents.
387    pub(crate) assembly_components: Vec<crate::pipeline::ComponentSnapshot>,
388    /// The [`Self::applied_generation`] the main-side kernel assembly SESSION was
389    /// last installed for (`None` = never). Only a constraint MUTATION needs one
390    /// — its solve runs against the resident geometry of the thread that asks —
391    /// so only `ensure_assembly_session` sets this. See `assembly_ops`.
392    pub(crate) assembly_session_generation: Option<u64>,
393    /// Every output name the last applied run CONSUMED
394    /// ([`crate::pipeline::RunOutput::consumed`]) — what the committed-sketch
395    /// refresh hides a consumed sketch by, and what it used to re-execute the
396    /// whole history on the UI thread to learn.
397    pub(crate) consumed_names: std::collections::HashSet<String>,
398    /// Re-entrancy guard for the parts-library resync in [`Self::pump`] (a
399    /// refused run re-runs, and `rerun_history` pumps).
400    pub(crate) library_resync: bool,
401    /// The assembly-constraint viewport overlays (build-spec §8.4) — the cached
402    /// [`crate::constraint_overlays::ConstraintOverlay`] records the engine last
403    /// built from the kernel session (`assembly_overlay_json` + state), the source
404    /// of the drawn leader/arrow group, the label feed, and the grabbable-handle
405    /// hit regions. Refreshed after every history apply and every constraint
406    /// mutation; see the appended assembly-overlay impl block.
407    pub(crate) constraint_overlays: Vec<crate::constraint_overlays::ConstraintOverlay>,
408    /// A live GRAB on a constraint's distance-arrow / angle-arc handle (`Some`
409    /// between `constraint_drag_begin` and `constraint_drag_release`): the drag
410    /// previews the value locally and COMMITS on release via
411    /// `assembly_update_constraint_json` (which auto-solves).
412    pub(crate) constraint_drag: Option<ConstraintDrag>,
413    /// The `world_per_pixel` the constraint overlay buffers were last baked at
414    /// (screen-constant arc/rod sizing): `ensure_constraint_overlay_current`
415    /// re-bakes when the camera zoom moves it materially. `0.0` = never baked.
416    constraint_overlay_wpp: f64,
417    /// The `world_per_pixel` the FEATURE-DIMENSION gizmo group
418    /// (`feature-dim-leaders`) was last baked at. The leaders' rod/cone/origin
419    /// sphere — and the angular arc's whole world RADIUS — are
420    /// `pixels × world_per_pixel`, so a zoom makes the drawn gizmo stale;
421    /// `ensure_feature_dimension_overlay_current` re-bakes on a material move.
422    /// `0.0` = nothing baked (gizmo disarmed / not in dimension mode).
423    /// See `feature_dims`.
424    pub(crate) feature_dim_overlay_wpp: f64,
425    /// The `world_per_pixel` the live SKETCH overlay groups (geometry, points,
426    /// preview, `sketch-dim-leaders`, `sketch-constraint-glyphs`) were last baked
427    /// at — construction dashes, dimension arrowheads and constraint glyphs are
428    /// all screen-constant. `ensure_sketch_overlay_current` re-bakes on a material
429    /// zoom. `0.0` = nothing baked (not in sketch mode). See `sketch_input`.
430    pub(crate) sketch_overlay_wpp: f64,
431    /// The constraint id whose referenced ELEMENTS the panel/label hover is
432    /// currently highlighting (dedupe key so a held hover doesn't re-bump the
433    /// emphasis generation every frame).
434    constraint_hovered: Option<String>,
435    /// Set for ONE frame when a constraint LABEL hover applied the element
436    /// highlight; the viewport's modeling hover branch consumes it (mirrors
437    /// [`Self::take_sketch_list_hover`]) so the scene hover doesn't clobber it.
438    constraint_label_hover_active: bool,
439    /// The SCENE-TREE row the pointer is over, as the pick candidate its hover
440    /// lit (the row→viewport highlight). Kept so
441    /// [`scene_tree_hover_end`](Self::scene_tree_hover_end) clears ONLY a hover
442    /// the tree itself set — never one the viewport lit in the meantime — and as
443    /// the dedupe key that keeps a held row hover from re-bumping the emphasis
444    /// generation every frame. See `scene_query.rs`.
445    scene_tree_hovered: Option<pick::PickCandidate>,
446    /// Set for ONE frame while a Scene-tree row is hovered; the viewport's
447    /// modeling hover branch consumes it via
448    /// [`take_scene_tree_hover`](Self::take_scene_tree_hover) and skips the
449    /// pointer-off-viewport `clear_hover` (mirrors
450    /// [`Self::take_sketch_list_hover`]) so the row-set highlight survives.
451    scene_tree_hover_active: bool,
452    /// The DIALOG row the pointer is over — a feature form's reference line, its
453    /// read-only `Outputs` line, or the reference picker card's picked-name line
454    /// (the row→viewport highlight, the twin of the Scene tree's above). Its OWN
455    /// slot, not the tree's: History, Constraints, PMI and the Scene tree can all
456    /// be on screen at once in a split dock, and a shared slot would let the pane
457    /// that draws second end the hover the pane that drew first had just set. See
458    /// [`DialogHover`] for what it memoizes and `scene_query.rs` for the API.
459    dialog_hovered: Option<DialogHover>,
460    /// Set for ONE frame while a dialog row is hovered; the viewport's modeling
461    /// hover branch consumes it via [`take_dialog_hover`](Self::take_dialog_hover)
462    /// and skips the pointer-off-viewport `clear_hover` (mirrors
463    /// [`Self::take_scene_tree_hover`]) so the row-set highlight survives.
464    dialog_hover_active: bool,
465    /// The constraint SELECTED via its viewport label chip (`Some` = selected):
466    /// drives the chip's selected accent, the context bar's Delete-constraint
467    /// action, and clears with the selection (Esc / Clear / delete). Read
468    /// through [`Self::selected_constraint`], which prunes a stale id.
469    selected_constraint: Option<String>,
470    /// The feature SELECTED in the history tree, beside the geometry selection
471    /// that selecting it made. It stays selected only while that geometry
472    /// selection is unchanged — a viewport pick, Esc or Clear replaces the
473    /// geometry and so deselects the feature. Read through
474    /// [`Self::selected_feature`].
475    selected_feature: Option<(String, selection_ux::FeatureSelection)>,
476    /// How many times a constraint's dialog has been OPENED through
477    /// [`Self::assembly_set_constraint_open`] — the constraint half of the same
478    /// counter as [`Self::pmi_dialog_opens`], read by the app's dialog door
479    /// so a re-open of the constraint already open still counts. The flag
480    /// itself lives in the kernel (it is part of the saved document), so this
481    /// counts the OPENS this engine performed, not the flag's history.
482    pub(crate) constraint_opens: u64,
483    /// The STEP product structure a [`Self::probe_step_assembly`] parsed, held
484    /// until the import dialog's button decides its fate: consumed by
485    /// [`Self::import_probed_step_assembly`], dropped by
486    /// [`Self::discard_probed_step_assembly`] (Cancel), by the next probe, or by
487    /// a document switch. The ONE parse of a structured STEP import lives here —
488    /// the dialog needs the counts BEFORE the user chooses, and re-parsing
489    /// multi-MB Part-21 text on the way back would double the most expensive step
490    /// of the import. See `model_io`'s import block.
491    pub(crate) pending_step_assembly: Option<brep_kernel::StepAssembly>,
492    /// STEP probes submitted to the runner and not yet answered (their ids).
493    pub(crate) pending_step_probes: std::collections::HashSet<u64>,
494    /// Answered probes awaiting [`Self::take_step_probe`], oldest first.
495    pub(crate) step_probe_results: std::collections::VecDeque<(u64, StepProbeOutcome)>,
496    /// Monotonic id pairing a probe reply with its submission.
497    pub(crate) next_step_probe_id: u64,
498}
499
500/// What a STEP probe found, as the file panel consumes it (see
501/// [`EngineState::submit_step_probe`]).
502#[derive(Debug, Clone, PartialEq)]
503pub enum StepProbeOutcome {
504    /// Product structure: the parsed assembly is stashed for
505    /// [`EngineState::import_probed_step_assembly`]; these are its counts.
506    Structure(model_io::StepAssemblyProbe),
507    /// No structure worth keeping — take the flat lane.
508    Flat,
509    /// The text did not parse as Part 21; the flat lane refuses it with its
510    /// own wording.
511    Failed(String),
512}
513
514/// A live constraint-handle drag: which constraint + which `inputParams` field
515/// (`distance` / `angle`), the params snapshot the commit mutates, and the live
516/// preview value the overlay/label show while dragging.
517#[derive(Debug, Clone)]
518pub struct ConstraintDrag {
519    pub id: String,
520    pub field: &'static str,
521    pub params: serde_json::Value,
522    pub preview: f64,
523}
524
525/// WHO a finished reference-selection commits to: a history FEATURE's params
526/// (the original widget) or an ASSEMBLY CONSTRAINT's `inputParams` (same modal,
527/// different commit lane — see `assembly_ops::begin_ref_select_for_constraint`).
528#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
529pub enum RefSelectTarget {
530    #[default]
531    Feature,
532    AssemblyConstraint,
533    /// ONE SPLINE ANCHOR's port attachment: `path` is unused, the picked name
534    /// must be a PORT feature id (a click on a port's drawn sheet), and Finish
535    /// writes `persistentData.spline.points[index].attachment` (see
536    /// `spline_edit.rs`).
537    SplineAnchor { index: usize },
538    /// A PMI annotation's reference field: `feature_id` is the annotation id;
539    /// Finish writes the picked names into its params through the PMI block
540    /// (`pmi_ops.rs`). Vertex picks are `{solid}@x,y,z` in WORLD coordinates.
541    Pmi,
542    /// ONE CONNECTION POINT's reference field: `feature_id` is the point's
543    /// part-local ADDRESS (`J1.VCC`) — a connection point is data, not a
544    /// feature, so there is no id to carry — and `path` is the block key the
545    /// pick writes (`pointRef` / `directionRef`). Finish writes it through
546    /// `ports_ops::ports_commit_ref`, and NOTHING ROLLS: a point resolves at
547    /// the tail of the run, so the geometry it may name is what is on screen.
548    PortPoint { field: ports_ops::PortRefField },
549    /// A drawing-sheet object's reference field — a dimension's anchors, an
550    /// ordinate set's datum or members, a section's cutting line, a detail's
551    /// centre or rim: `feature_id` is the object id, the picks are ANCHORS
552    /// clicked on the open sheet's paper (`sheet_ops.rs`), and nothing rolls.
553    Sheet,
554}
555
556/// The modal state of the reference-selection widget while it is ACTIVE: which
557/// feature-dialog field is being filled, what it accepts, and the running list
558/// of picked kernel names (the source of truth — added by picking in the view,
559/// removed via the per-line X). See the ref-select methods below.
560#[derive(Debug, Clone, Default)]
561pub struct RefSelectState {
562    /// The id of the feature whose param is being edited.
563    pub feature_id: String,
564    /// The JSON path into that feature's `inputParams` the names write to
565    /// (`["targetSolid"]`, `["boolean","targets"]`, `["faceRef"]`, …).
566    pub path: Vec<String>,
567    /// A human label for the modal heading (the field's label).
568    pub label: String,
569    /// The allowed pick kinds (`["SOLID"]`, `["FACE"]`, …) — the type constraint.
570    pub filter: Vec<String>,
571    /// Whether the field takes a LIST of references (else a single one).
572    pub multiple: bool,
573    /// The picked kernel names — the running selection (source of truth).
574    pub names: Vec<String>,
575    /// The rollback step to restore on Finish/Cancel (the edited feature's own
576    /// step): entering the mode rolls to the pre-feature "before" state, so we
577    /// remember where to return.
578    pub restore_index: usize,
579    /// Which surface Finish commits the names to (feature params vs an
580    /// assembly constraint's `inputParams`). Defaults to [`RefSelectTarget::Feature`].
581    pub target: RefSelectTarget,
582}
583
584impl Default for EngineState {
585    fn default() -> Self {
586        Self {
587            scene: RenderScene::new(),
588            camera: ViewCamera::default(),
589            controls: ArcballControls::new(),
590            settings: RenderSettings::default(),
591            emphasis: Emphasis::default(),
592            widgets: WidgetRegistry::new(),
593            history: History::default(),
594            history_report: String::new(),
595            metadata: crate::metadata::MetadataStore::new(),
596            settings_generation: 1,
597            dirty: true,
598            ref_select: None,
599            selection_filter: SelectionFilter::default(),
600            transform_gizmo: TransformArm::default(),
601            component_move: ComponentMoveArm::default(),
602            sketch_edit: None,
603            sketch_camera_locked: true,
604            sketch_list_hover_active: false,
605            notices: Vec::new(),
606            graded_notices: Vec::new(),
607            hidden_sketches: std::collections::HashSet::new(),
608            shown_sketch_ids: Vec::new(),
609            shown_board_ids: Vec::new(),
610            board_built_from: None,
611            board_pin_nets: Default::default(),
612            board_build: board_geometry::BoardBuild::default(),
613            board_displays: Vec::new(),
614            construction_frames: Vec::new(),
615            sketch_profiles: Vec::new(),
616            sketch_paths: Vec::new(),
617            sketch_points: Vec::new(),
618            sketch_axes: Vec::new(),
619            wire_harness_report: None,
620            ports_report: None,
621            sheet_open: None,
622            sheet_open_object: None,
623            sheet_object_opens: 0,
624            sheet_selected_object: None,
625            sheet_cache: None,
626            sheet_lines: Default::default(),
627            document_name: String::new(),
628            pmi_report: None,
629            pmi_active_view: None,
630            pmi_open_annotation: None,
631            pmi_open_view: None,
632            pmi_selected_annotation: None,
633            pmi_selected_view: None,
634            pmi_dialog_opens: 0,
635            pmi_modeling: None,
636            pmi_explode_originals: std::collections::HashMap::new(),
637            pmi_overlay_key: None,
638            pmi_hovered: None,
639            pmi_label_hover_active: false,
640            spline_overlay_key: None,
641            component_ports_visible: false,
642            spline_edit_feature: None,
643            spline_anchor_picked: None,
644            hidden_datums: std::collections::HashSet::new(),
645            shown_datum_names: Vec::new(),
646            runner: Box::new(crate::runner::InlineRunner::new()),
647            run_generation: 0,
648            applied_generation: 0,
649            run_progress: None,
650            cancelled_run: None,
651            expression_preview: None,
652            runs_replied: 0,
653            pending_fit: false,
654            provenance: std::collections::HashMap::new(),
655            entity_origin: std::collections::HashMap::new(),
656            info_cache: std::collections::HashMap::new(),
657            pending_query: std::collections::HashMap::new(),
658            next_query_id: 0,
659            pending_mesh_imports: std::collections::HashMap::new(),
660            mesh_preview_results: std::collections::VecDeque::new(),
661            next_mesh_import_id: 0,
662            pending_topology: std::collections::HashSet::new(),
663            topology_asked: std::collections::HashSet::new(),
664            next_topology_id: 0,
665            assembly_components: Vec::new(),
666            assembly_sync: None,
667            assembly_session_generation: None,
668            consumed_names: std::collections::HashSet::new(),
669            library_resync: false,
670            constraint_overlays: Vec::new(),
671            constraint_drag: None,
672            constraint_overlay_wpp: 0.0,
673            feature_dim_overlay_wpp: 0.0,
674            sketch_overlay_wpp: 0.0,
675            constraint_hovered: None,
676            constraint_label_hover_active: false,
677            scene_tree_hovered: None,
678            scene_tree_hover_active: false,
679            dialog_hovered: None,
680            dialog_hover_active: false,
681            selected_constraint: None,
682            selected_feature: None,
683            constraint_opens: 0,
684            pending_step_assembly: None,
685            pending_step_probes: std::collections::HashSet::new(),
686            step_probe_results: std::collections::VecDeque::new(),
687            next_step_probe_id: 1,
688        }
689    }
690}
691
692impl EngineState {
693    pub fn new() -> Self {
694        Self::default()
695    }
696
697    fn pick_options(&self) -> PickOptions {
698        PickOptions {
699            double_sided: self.settings.pick_double_sided,
700            ..PickOptions::default()
701        }
702    }
703}
704
705/// Has the camera's `world_per_pixel` moved MATERIALLY (>0.5%) away from the
706/// value an overlay group's screen-constant sizing was baked at?
707///
708/// The ONE judgement every camera-keyed overlay re-bake shares
709/// (`ensure_overlays_current` and the per-group ensures it drives), so
710/// "what counts as a zoom" cannot drift between them. `baked == 0.0` means
711/// "never baked" — a state each caller handles itself, so it reads as NOT
712/// stale here. The band is what keeps a quiet frame quiet: float jitter in the
713/// camera never trips it, so there is no per-frame re-bake loop.
714pub(crate) fn overlay_wpp_stale(baked: f64, now: f64) -> bool {
715    baked > 0.0 && (now - baked).abs() > baked * 0.005
716}
717
718// ============================================================================
719// MODULE MAP — engine_state is split into topic children. THIS file is the
720// module root: it keeps the EngineState/RefSelectState structs, Default, the
721// constructor + shared pick_options, the child `mod` declarations, and the
722// re-exports that preserve the original `engine_state::*` public paths.
723// Append new work to the matching child (or add a new child + re-export here).
724// ============================================================================
725
726/// The assembly surface (Wave-3): main-side session sync + component
727/// projection, constraint CRUD with the document fold (pose-authority
728/// contract), the insert-component flow, component fix/select actions, the
729/// constraint flavor of the reference picker, and `document_signature` — the
730/// ONE parts-library `sourceSignature` hash every writer shares.
731mod assembly_ops;
732/// Assembly-constraint viewport overlays (build-spec §8.4): overlay refresh from
733/// the kernel session, the grabbable distance/angle handle pick + drag preview +
734/// `assembly_update_constraint_json` commit, movedSolids re-tessellation, the
735/// drag-path document fold, label feed + element hover, and tests.
736mod assembly_overlay;
737/// BOM export (assemblies build-spec §9): the `{partName, sourceKey,
738/// quantity}` parts list off the main-side parts library + live component
739/// projection, serialized as CSV / JSON for the file dialog's Export modal.
740mod bom;
741/// Camera & view commands (zoom-to-fit, resize, pointer/wheel ingestion,
742/// projection, standard views, camera state/matrices, world→screen) plus the
743/// widget-overlay feeds (datums/overlay/dimensions/transform JSON), the
744/// ViewCube (incl. `apply_look_direction`), `datum_pick`, the widget
745/// transform-handle hover/pick/drag path, and `dimension_anchors_json`.
746mod camera_widgets;
747/// Committed-sketch persistent overlays: sheet-solid synthesis from stored
748/// profiles (`refresh_committed_sketches`), per-sketch visibility, the
749/// Scene-tree rows + `sketch_entities_json`, and the committed-sketch tests.
750/// The board's 3D bodies (substrate + copper + via barrels), derived from the
751/// document's `pcb` block after every run — see the module notes.
752mod board_geometry;
753mod committed_sketches;
754/// The COMPONENT Move gizmo (assemblies §8.5): translate→rotate→off cycle at
755/// the member-bbox center, fixed-refusal, free-move drag with the pose commit
756/// (and re-solve) on release. See `ComponentMoveArm`.
757mod component_move;
758/// Assembly COMPONENT read surface: the app-side component projection derived
759/// from the history's ACOMP features + the scene's namespaced solid names
760/// (`component_of_solid` / `component_info` / `component_bbox_center`), and its
761/// tests + shared assembly fixtures.
762mod components;
763/// Construction datum/plane display: frame→feature mapping,
764/// `refresh_construction_datums`, datum visibility + selection + entity rows,
765/// and the construction-datum tests.
766mod construction_datums;
767/// Expressions & configurator surface (`expressions_json`, `set_expressions`,
768/// `configurator_json`, `expression_variables_json`) + parsing helpers + tests.
769mod expressions;
770pub use expressions::ExpressionPreview;
771/// The feature-dimension gizmo (dimension arrows / angle arc / center-sphere
772/// toggle): arm state, `__brep`-style annotation JSON, overlay publishing,
773/// drag + set-value writeback, `FEATURE_DIM_OVERLAY`, fd_* math helpers, tests.
774mod feature_dims;
775/// The assembly interference check (build-spec §9): the bbox-prefiltered
776/// pairwise non-destructive INTERSECT sweep over component instances
777/// (`interference_check`), its report types, and the pure pair planner.
778mod interference;
779/// History runs & the feature CRUD surface: `run_history_json`, the
780/// runner/pump/apply seam, history JSON accessors, roll/update/add/delete/
781/// reorder, engine undo/redo, `load_model_and_fit`,
782/// and the history-cache rollback tests.
783mod history_ops;
784/// Model I/O: `import_step_feature`, `export_step_text`, `export_stl_text`,
785/// `triangle_normal`, and the io tests.
786mod model_io;
787/// Construction PLANES as ordinary pick candidates: the combined
788/// scene+plane-card candidate list (`pick_candidates_at`), the planes-aware
789/// single-hit pick (`pick_top_at`), the shared candidate ordering, and the
790/// plane-pick tests. Read its header for how a plane competes for a pick.
791mod plane_pick;
792/// Scene & object queries: `pick_json`/`hover_json`, settings + emphasis +
793/// visibility + color overrides, `scene_listing_json`, `depth_range_bbox`,
794/// `scene_entities_json`/select-by-name, mass properties + object info, tests.
795mod scene_query;
796/// The selection-filter state + kind gating (`SelectionFilter`,
797/// `select_filtered_at`, hide-selected) and its tests.
798mod selection_filter;
799/// Selection & hover UX: clear/select-top/selection JSON, the modal
800/// ref-select widget (incl. `set_json_at`), hover/candidate cycling, and the
801/// live sketch overlay feed (`set_sketch_overlay`/`clear_sketch_overlay`) +
802/// selection UX tests.
803mod selection_ux;
804/// Sketch editing ops appended after dimensions: dimension labels/value/drag,
805/// sketch undo/redo + diagnostics dump, trim, external edge refs
806/// (pick/link/reproject), and hand-draw strokes.
807mod sketch_edit_ops;
808/// Sketch-mode viewport input: overlay refresh, uv picking, hover/click/drag,
809/// the draw tools + pending-geometry helpers, and delete-selection.
810mod sketch_input;
811/// Sketch mode session: `SketchDrag`/`SketchEdit` state, plane-frame helpers,
812/// enter/exit/new sketch, and the camera lock.
813mod sketch_mode;
814/// Sketch entity-list panel rows + notices + solver settings
815/// (`SketchEntityRow`), and the constraint palette/actions
816/// (`SketchConstraintAction`, add-constraint builders, ground/construction
817/// toggles, cleanup).
818mod sketch_panel;
819/// The transform-controls gizmo: `GizmoMode`/`TransformArm`, arm/drag/apply,
820/// pose ⇄ params JSON, quaternion helpers (`rotate_euler_xyz_f64`), tests.
821mod transform_gizmo;
822/// The wire-harness surface: the document's `wireHarness` block (connection
823/// add / edit / remove / bundles toggle — checkpointed document edits that
824/// re-run the history, whose tail routes them), the applied run's routing
825/// report, the endpoint list, and the panel's hover highlight.
826mod wire_harness_ops;
827/// The PORTS surface: the ports tail's report of the last applied run — the
828/// one place the tail's resolved points, refused names and unresolved
829/// references reach a caller, the tail not being a feature.
830mod ports_ops;
831pub use ports_ops::PortRefField;
832// Every harness wire as a BOM line with its cut length (MF QTY), or the reason
833// the last applied run cannot give one.
834mod wire_bom;
835mod pmi_ops;
836pub use pmi_ops::{pmi_view_params, pmi_view_schema, world_vertex_ref, PmiModelingSnapshot, PmiViewPatch};
837// Drawing sheets: the `sheets` block, the open sheet and the projection cache.
838mod sheet_ops;
839pub(crate) mod pmi_overlay;
840/// The 3D spline-anchor editor: the resolved anchor list, the value edits
841/// (position / distances / flip / side / add / remove / reorder / detach),
842/// the anchor flavour of the transform gizmo, the port-attach flavour of the
843/// reference picker, and the direction-cage overlay.
844mod spline_edit;
845
846// Re-exports preserving the original `engine_state::*` public surface.
847pub use assembly_ops::{document_signature, ComponentInsert};
848pub use board_geometry::{
849    default_color as board_default_color, BoardBuild, BOARD_SOLID_PREFIX, SUBSTRATE_SOLID,
850    VIAS_SOLID,
851};
852pub use bom::PART_ATTRIBUTES;
853pub use component_move::ComponentMoveArm;
854pub use components::ComponentInfo;
855pub use interference::{InterferencePair, InterferenceReport};
856pub use model_io::{
857    EmbeddedOnly, PartSink, StepAssemblyImport, StepAssemblyProbe, StepAssemblyReport,
858};
859pub use selection_filter::SelectionFilter;
860pub use sketch_mode::{SketchDrag, SketchEdit};
861pub use sketch_panel::{NoticeSeverity, SketchConstraintAction, SketchEntityRow};
862pub use wire_harness_ops::ConnectionPatch;
863pub use wire_bom::{WireBomLine, WireLengthState};
864pub use spline_edit::SplineAnchorRow;
865pub use transform_gizmo::{GizmoMode, TransformArm};
866pub(crate) use transform_gizmo::rotate_euler_xyz_f64;
867
868
869
870/// Reconstruction results either append to a document or remain uncommitted.
871#[derive(Clone, Copy, PartialEq, Eq)]
872pub(crate) enum MeshImportDestination {
873    Document,
874    Preview,
875}