brep_app/workbench/
simulation.rs1use super::{ButtonState, FeatureInfo, Workbench, WorkbenchButton};
14
15pub const PANEL_ID: &str = "simulation";
17
18pub const NEW_STUDY_BUTTON_ID: &str = "simulation.new_study";
20pub const ADD_MOTOR_BUTTON_ID: &str = "simulation.add_motor";
21
22fn includes(_feature: &FeatureInfo<'_>) -> bool {
24 false
25}
26
27fn is_assembly(state: &ButtonState) -> bool {
29 state.engine.simulation_available()
30}
31
32fn add_motor_disabled(state: &ButtonState) -> Option<&'static str> {
33 if state.engine.simulation_motor_mates().is_empty() {
34 Some("Add a distance or angle mate first: a motor drives one")
35 } else {
36 None
37 }
38}
39
40static BUTTONS: &[WorkbenchButton] = &[
41 WorkbenchButton {
42 id: NEW_STUDY_BUTTON_ID,
43 glyph: "\u{E0D2}",
45 ribbon_path: "Home/Simulation/New study", size: crate::workbench::CommandSize::Large, tooltip: "New motion study of this assembly",
46 when: Some(is_assembly),
47 pressed: None,
48 disabled: None,
49 caption: None,
50 menu: &[],
51 },
52 WorkbenchButton {
53 id: ADD_MOTOR_BUTTON_ID,
54 glyph: "\u{E0D3}",
56 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",
57 when: Some(is_assembly),
58 pressed: None,
59 disabled: Some(add_motor_disabled),
60 caption: None,
61 menu: &[],
62 },
63];
64
65static PANELS: &[&str] = &[PANEL_ID];
66
67pub static SIMULATION: Workbench = Workbench {
68 id: "simulation",
69 label: "Simulation",
70 glyph: "\u{E0D1}",
72 includes,
73 buttons: BUTTONS,
74 panels: PANELS,
75};