Joints: a link ratio between an angle and a distance is per degree (#1433)

A motion link's ratio is read in b's units per a's (mm per degree, degrees per mm) when an angle and a distance are linked; stored values stay per radian, so saved designs are unchanged. Follow-up to #1415.

Co-authored-by: SychPL <[email protected]>
This commit is contained in:
Mateusz SychandSychPL authored and GitHub committed 2026-10-15 14:05:24 -04:00
1 parent 1e984c8e46
commit 02fe495d38
5 files changed
+50 -8

No files matched your search

+2 -1
View File
@@ -878,7 +878,8 @@ pub fn commands(app: &SolveApp, k: &Asm, inputs: &[SelInput]) -> Result<Vec<(Str
Asm::MotionLink { a, b, ia, ib, ratio, offset } => {
let js = &s.doc.assembly.joints;
let (Some(ja), Some(jb)) = (js.get(*a), js.get(*b)) else { return Err("needs two joints".into()) };
// The offset as typed: the engine reads it in Joint 2's units (deg or mm).
// The offset as typed: the engine reads it in Joint 2's units (deg or mm), and the
// ratio in Joint 2's units per Joint 1's.
let ratio = eval(ratio, ValueKind::Unitless)?;
cmd("joint.motion_link", json!({"a": ja.id, "b": jb.id, "ia": ia, "ib": ib, "ratio": ratio, "offset": offset.trim()}))
}