1 parent
88f76adbc2
commit
6232fa33c2
27 files changed
+2176
-47
No files matched your search
@@ -1,5 +1,5 @@
|
||||
//! Assembly dialogs: New Component, Joint, As-built Joint, Joint Origin, Rigid Group, Drive
|
||||
//! Joints, Motion Link, Gear, Rack and Pinion, Screw (`dialogs_coupling`) and Interference. Joint origins are picked by hovering geometry: a face
|
||||
//! Joints, Motion Link, Gear, Rack and Pinion, Screw, Cam (`dialogs_coupling`) and Interference. Joint origins are picked by hovering geometry: a face
|
||||
//! snaps to its centre (or a round face to the centre of its nearer end), an edge to its middle
|
||||
//! (a round edge to its centre), a vertex to itself; the snap shows as a glyph with its z axis
|
||||
//! before the click. Joints and drives preview on the placed (world) model: the moving
|
||||
@@ -31,7 +31,7 @@ const TYPE_LABELS: [&str; 7] = ["Rigid", "Revolute", "Slider", "Cylindrical", "P
|
||||
/// What a joint origin input accepts (snaps on faces, edges and vertices).
|
||||
const SNAPS: u16 = FACES | EDGES | VERTICES;
|
||||
/// Commands whose effect is where occurrences sit (previewed on the placed model).
|
||||
const MOVES: [&str; 11] = [
|
||||
const MOVES: [&str; 12] = [
|
||||
"joint.create",
|
||||
"joint.as_built",
|
||||
"joint.drive",
|
||||
@@ -41,6 +41,7 @@ const MOVES: [&str; 11] = [
|
||||
"joint.gear",
|
||||
"joint.rack_pinion",
|
||||
"joint.screw",
|
||||
"joint.cam",
|
||||
"parts.insert",
|
||||
"parts.fastener",
|
||||
];
|
||||
@@ -72,6 +73,7 @@ pub enum Asm {
|
||||
offset: String,
|
||||
},
|
||||
Coupling(Box<crate::dialogs_coupling::CouplingForm>),
|
||||
Cam(Box<crate::dialogs_coupling::cam::CamForm>),
|
||||
Interference {
|
||||
result: Option<Value>,
|
||||
overlaps: Vec<Mesh>,
|
||||
@@ -151,13 +153,14 @@ impl Asm {
|
||||
"joint.rack_pinion" => "RACK AND PINION",
|
||||
_ => "SCREW",
|
||||
},
|
||||
Asm::Cam(_) => "CAM",
|
||||
Asm::Interference { .. } => "INTERFERENCE",
|
||||
Asm::Trace(_) => "MOTION TRACE",
|
||||
}
|
||||
}
|
||||
|
||||
pub fn previews(&self) -> bool {
|
||||
matches!(self, Asm::Joint(_) | Asm::Drive { .. } | Asm::RigidGroup | Asm::Coupling(_))
|
||||
matches!(self, Asm::Joint(_) | Asm::Drive { .. } | Asm::RigidGroup | Asm::Coupling(_) | Asm::Cam(_))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,6 +188,7 @@ pub fn start(app: &SolveApp, id: &str) -> Option<(Kind, Vec<SelInput>)> {
|
||||
(Asm::MotionLink { a: 0, b, ia: 0, ib: 0, ratio: "1".into(), offset: "0".into() }, vec![])
|
||||
}
|
||||
"joint.gear" | "joint.rack_pinion" | "joint.screw" => crate::dialogs_coupling::start(app, id)?,
|
||||
"joint.cam" => crate::dialogs_coupling::cam::start(app),
|
||||
"inspect.interference" => {
|
||||
(Asm::Interference { result: None, overlaps: Vec::new(), of: Vec::new() }, vec![SelInput::new("Bodies (all if none)", BODIES, true)])
|
||||
}
|
||||
@@ -686,6 +690,7 @@ pub fn rows(app: &mut SolveApp, ui: &mut egui::Ui, k: &mut Asm, inputs: &mut [Se
|
||||
ui.end_row();
|
||||
}
|
||||
Asm::Coupling(f) => enter |= crate::dialogs_coupling::rows(app, ui, f, inputs),
|
||||
Asm::Cam(f) => enter |= crate::dialogs_coupling::cam::rows(app, ui, f, inputs),
|
||||
Asm::Interference { result, overlaps, of } => {
|
||||
let picked: Vec<Sel> = inputs.first().map(|i| i.items.clone()).unwrap_or_default();
|
||||
row_label(ui, "");
|
||||
@@ -914,6 +919,7 @@ pub fn commands(app: &SolveApp, k: &Asm, inputs: &[SelInput]) -> Result<Vec<(Str
|
||||
cmd("joint.motion_link", json!({"a": ja.id, "b": jb.id, "ia": ia, "ib": ib, "ratio": ratio, "offset": offset.trim()}))
|
||||
}
|
||||
Asm::Coupling(f) => return crate::dialogs_coupling::commands(app, f, inputs),
|
||||
Asm::Cam(f) => return crate::dialogs_coupling::cam::commands(app, f, inputs),
|
||||
// The check runs from its Compute button; OK only closes.
|
||||
Asm::Interference { .. } => Vec::new(),
|
||||
Asm::Trace(f) => cmd("motion.trace.keep", trace::params(s, f, inputs)?),
|
||||
@@ -925,6 +931,9 @@ pub fn animate(app: &SolveApp, k: &Asm, cmds: &mut Vec<(String, Value)>) {
|
||||
if let Asm::Coupling(f) = k {
|
||||
crate::dialogs_coupling::animate(&app.session, f, cmds);
|
||||
}
|
||||
if let Asm::Cam(f) = k {
|
||||
crate::dialogs_coupling::cam::animate(&app.session, f, cmds);
|
||||
}
|
||||
let Asm::Joint(f) = k else { return };
|
||||
if !f.animate {
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user