use super::{ButtonState, FeatureInfo, Workbench, WorkbenchButton};
pub const CONSTRAINTS_PANEL_ID: &str = "assemblyConstraints";
pub const BOM_PANEL_ID: &str = "assemblyBom";
fn includes(feature: &FeatureInfo<'_>) -> bool {
matches!(feature.type_code, "S" | "D" | "P" | "ACOMP")
}
pub const ADD_COMPONENT_BUTTON_ID: &str = "assembly.add_component";
fn needs_component_button(state: &ButtonState<'_>) -> bool {
!super::includes_feature(&state.engine.settings.workbench, "ACOMP")
}
static BUTTONS: [WorkbenchButton; 4] = [
WorkbenchButton {
id: ADD_COMPONENT_BUTTON_ID,
glyph: "\u{E058}",
ribbon_path: "Home/Assembly/Add component", size: crate::workbench::CommandSize::Large, tooltip: "Add component (insert a part from the library or a saved model)",
when: Some(needs_component_button),
pressed: None,
disabled: None,
caption: None,
menu: &[],
},
WorkbenchButton {
id: "assembly.step_parts_library",
glyph: "\u{1F4DA}",
ribbon_path: "Home/Assembly/step.parts library", size: crate::workbench::CommandSize::Large, tooltip: "step.parts library — browse & import an online STEP part as a component",
when: None,
pressed: None,
disabled: None,
caption: None,
menu: &[],
},
WorkbenchButton {
id: "assembly.auto_constrain",
glyph: "\u{E067}",
ribbon_path: "Home/Assembly/Auto constraints", size: crate::workbench::CommandSize::Large, tooltip: "Auto constraints \u{2014} infer mates (concentric, touch align, coincident) from where the components already sit",
when: None,
pressed: None,
disabled: None,
caption: None,
menu: &[],
},
WorkbenchButton {
id: "assembly.interference",
glyph: "\u{2229}",
ribbon_path: "Home/Assembly/Interference check", size: crate::workbench::CommandSize::Large, tooltip: "Interference check (pairwise intersect)",
when: None,
pressed: None,
disabled: None,
caption: None,
menu: &[],
},
];
pub static ADD_COMPONENT: &WorkbenchButton = &BUTTONS[0];
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,
};