BREP_app 0.4.0

The BREP CAD application: an eframe (egui + wgpu) host that draws the brep-render 3D engine into an egui frame — native + wasm from one codebase.
Documentation
//! The "Assembly" workbench — assemblies build-spec §8.1.
//!
//! Creatable set: the shared building blocks (sketch `S` / datum `D` / plane
//! `P`) plus the ASSEMBLY COMPONENT (`ACOMP`) — in-context sketches on
//! component faces are an allowed reference use (spec §3), so S/D/P stay
//! creatable here. Everything else (modeling + sheet metal) is filtered out of
//! the creation UI; the history itself stays fully visible/editable regardless
//! of workbench (standing rule).
//!
//! Claims the two assembly panels (Assembly Structure tree + Assembly
//! Constraints), which therefore show ONLY under Assembly (and "All").

use super::{FeatureInfo, Workbench, WorkbenchButton};

/// The Assembly Structure tree panel's id (claim + registration key).
/// The Assembly Constraints panel's id (the requirements-§5 record id).
pub const CONSTRAINTS_PANEL_ID: &str = "assemblyConstraints";
/// The BOM panel's id (the columned parts list).
pub const BOM_PANEL_ID: &str = "assemblyBom";

/// Datum / Plane / Sketch / Component (`ACOMP`).
fn includes(feature: &FeatureInfo<'_>) -> bool {
    matches!(feature.type_code, "S" | "D" | "P" | "ACOMP")
}

/// The assembly toolbar tools. A click surfaces the button id out of the
/// toolbar to the shell: `"assembly.add_component"` opens the insert-component
/// modal (the same `FileAction::InsertComponent` flow the ACOMP palette pick
/// routes through), `"assembly.auto_constrain"` opens the inference window and
/// scans the current placement, and `"assembly.interference"` (build-spec §9)
/// runs the engine's pairwise check and opens the results window. Like every workbench button,
/// "All" carries them automatically via the deduped union.
static BUTTONS: &[WorkbenchButton] = &[
    WorkbenchButton {
        id: "assembly.add_component",
        // ⊕ (U+2295, circled plus) — ADD a part instance; renders in the
        // bundled DejaVu font (no tofu).
        glyph: "\u{2295}",
        tooltip: "Add component (insert a part from the library or a saved model)",
    },
    WorkbenchButton {
        id: "assembly.step_parts_library",
        // `menu_book` Material Symbol (base glyph U+1F4DA) — the online
        // step.parts library. `toolbar_button` auto-renders it as a layered
        // colour icon straight from the SVG catalog.
        glyph: "\u{1F4DA}",
        tooltip: "step.parts library — browse & import an online STEP part as a component",
    },
    WorkbenchButton {
        id: "assembly.auto_constrain",
        // Our own artwork (U+E067): two parts closing on a shared axis with the
        // inference spark. Catalogued SVG, like every picture the app draws.
        glyph: "\u{E067}",
        tooltip: "Auto constraints \u{2014} infer mates (concentric, touch align, coincident) from where the components already sit",
    },
    WorkbenchButton {
        id: "assembly.interference",
        // ∩ (U+2229, intersection) — the pairwise-INTERSECT tool; renders in the
        // bundled DejaVu font (no tofu).
        glyph: "\u{2229}",
        tooltip: "Interference check (pairwise intersect)",
    },
];

/// The assembly panels this workbench claims (claim-based visibility —
/// unclaimed panels stay visible everywhere; these show only here + All).
static PANELS: &[&str] = &[CONSTRAINTS_PANEL_ID, BOM_PANEL_ID];

pub static ASSEMBLY: Workbench = Workbench {
    id: "assembly",
    label: "Assembly",
    glyph: "\u{E064}",
    includes,
    buttons: BUTTONS,
    panels: PANELS,
};