* claim: #6981 * Drive Joints: say why a rigid joint can't be driven and offer Edit Joint (#6981) Drive Joints opened on joint 0 when no joint moved, and its preview ran joint.drive on that rigid joint, so the dialog showed a red "a rigid joint does not move" with a Create Issue button. The dialog now says a rigid joint holds its parts still and how to let them move (Revolute to rotate, Slider to slide, Cylindrical for both), with an Edit Joint button that turns it into Edit Joint on that joint. Its commands refuse a rigid joint, so nothing is previewed and OK stays off. A rigid joint picked in the browser opens Drive Joints on it to say the same; the joint box lists only joints that move. joint.drive's own refusal names the types that move and joint.edit. * Drive Joints: the rigid joint message in Arabic, Hebrew and Vietnamese (#6981) Main now delivers ar, he and vi complete, so every new message needs them. --------- Co-authored-by: MateuszSychXpl <151755914+MateuszSychXpl@users.noreply.github.com>
This commit is contained in:
@@ -856,7 +856,7 @@ fn drive(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let id = joint_id(s, p.get("joint"), cmd)?;
|
||||
let kind = s.doc.assembly.joints.iter().find(|j| j.id == id).map(|j| j.kind).ok_or_else(|| bad(cmd, "joint"))?;
|
||||
if kind == JointKind::Rigid {
|
||||
return Err(bad(cmd, "a rigid joint does not move"));
|
||||
return Err(bad(cmd, "a rigid joint does not move: joint.edit can make it revolute (turns), slider (slides) or cylindrical (both)"));
|
||||
}
|
||||
let mut q = values_param(s, p, kind, cmd)?;
|
||||
if p.get("values").is_none() && p.get("value").is_none() {
|
||||
|
||||
@@ -192,6 +192,9 @@ fn rigid_cycles_solve_and_conflicts_report() {
|
||||
let c = r["conflicts"].as_array().cloned().unwrap_or_default();
|
||||
assert_eq!(c.len(), 1, "{r}");
|
||||
assert!(c[0]["why"].as_str().unwrap_or("").contains("off by"), "{r}");
|
||||
// A rigid joint has nothing to drive: the refusal names the types that move (#6981).
|
||||
let e = s.execute("joint.drive", &json!({"joint": "Wrong", "value": 1})).map(|_| ()).unwrap_err().to_string();
|
||||
assert!(e.contains("does not move") && e.contains("joint.edit") && e.contains("revolute") && e.contains("cylindrical"), "{e}");
|
||||
// Suppressing it clears the conflict.
|
||||
let r = run(&mut s, "joint.edit", json!({"joint": "Wrong", "suppressed": true}));
|
||||
assert_eq!(r["conflicts"].as_array().map(Vec::len), Some(0));
|
||||
|
||||
Reference in New Issue
Block a user