Expand description
Motion studies for BREP assemblies.
A study lives in its assembly document’s simulation block (model).
Motors are mates: the author picks distance or angle mates and drives each
at a constant speed or along a motion profile, and every other part follows
through the assembly solver on each frame. Clips drive the rest of the
timeline (mate on/off, camera, visibility, transparency, sections, exploded
views). sample turns a study at one time into what the caller applies:
mate overrides for the solver and the display state. forms describes a
motor’s and a clip’s fields for a schema-driven form. This crate needs
neither the kernel nor a GPU.
use brep_simulation::{Drive, Motor, Simulation};
let mut sim = Simulation::default();
let study_id = sim.add_study("Open the lid");
let motor_id = sim.next_id("MOT");
let study = sim.study_mut(&study_id).unwrap();
study.motors.push(Motor {
id: motor_id,
constraint: "ANG1".into(),
from: 0.0,
to: 2.0,
drive: Drive::Speed { speed: 45.0 },
});
// One second in, a 45 degree/s motor has moved the mate 45 degrees on from
// its document value (10 here).
let frame = study.sample(1.0, &|_: &str| Some(10.0));
assert_eq!(frame.mates["ANG1"].value, Some(55.0));Re-exports§
pub use model::Clip;pub use model::ClipBody;pub use model::Drive;pub use model::Motor;pub use model::Simulation;pub use model::Study;pub use sample::FrameSample;pub use sample::MateOverride;
Modules§
- forms
- The Simulation pane’s forms: a motor’s and a clip’s fields as the app’s
schema-driven form engine reads them (an
inputParamsSchemaofnumber,options,booleanandreference_selectionfields), a FLAT view of the item for the form to edit (the engine binds top-level keys), which fields hide for the item’s current mode, and the way back — the patchsimulation_patchmerges into the item. Pure functions: the pane draws, this decides what it draws and what an edit means. - model
- The
simulationblock: the motion studies of an assembly document. - sample
- A study at one time: what the solver and the display are asked for.