use super::{ButtonState, FeatureInfo, Workbench, WorkbenchButton};
pub const PANEL_ID: &str = "simulation";
pub const NEW_STUDY_BUTTON_ID: &str = "simulation.new_study";
pub const ADD_MOTOR_BUTTON_ID: &str = "simulation.add_motor";
fn includes(_feature: &FeatureInfo<'_>) -> bool {
false
}
fn is_assembly(state: &ButtonState) -> bool {
state.engine.simulation_available()
}
fn add_motor_disabled(state: &ButtonState) -> Option<&'static str> {
if state.engine.simulation_motor_mates().is_empty() {
Some("Add a distance or angle mate first: a motor drives one")
} else {
None
}
}
static BUTTONS: &[WorkbenchButton] = &[
WorkbenchButton {
id: NEW_STUDY_BUTTON_ID,
glyph: "\u{E0D2}",
ribbon_path: "Home/Simulation/New study", size: crate::workbench::CommandSize::Large, tooltip: "New motion study of this assembly",
when: Some(is_assembly),
pressed: None,
disabled: None,
caption: None,
menu: &[],
},
WorkbenchButton {
id: ADD_MOTOR_BUTTON_ID,
glyph: "\u{E0D3}",
ribbon_path: "Home/Simulation/Add motor", size: crate::workbench::CommandSize::Large, tooltip: "Add a motor: drive a distance or angle mate at a speed or along a profile",
when: Some(is_assembly),
pressed: None,
disabled: Some(add_motor_disabled),
caption: None,
menu: &[],
},
];
static PANELS: &[&str] = &[PANEL_ID];
pub static SIMULATION: Workbench = Workbench {
id: "simulation",
label: "Simulation",
glyph: "\u{E0D1}",
includes,
buttons: BUTTONS,
panels: PANELS,
};