sketch.create: refuse a face (or origin/x_dir/y_dir) next to plane (#1447)

sketch.create refuses a face (or origin/x_dir/y_dir) given next to plane, instead of silently ignoring one of them.
This commit is contained in:
HiroKenEz authored and GitHub committed 2026-10-15 13:32:10 -04:00
1 parent 3047aa60cd
commit 4e10c31fdd
2 files changed
+33

No files matched your search

+12
View File
@@ -623,6 +623,18 @@ pub(super) fn face_contains(m: &solidcraft_geom::Mesh, fi: usize, p: Vec3, tol:
fn create_sketch(s: &mut Session, p: &Value) -> Result<Value> {
let cmd = "sketch.create";
// These name the plane, so they belong inside `plane`. Next to it they were ignored and the
// sketch went to XY (or the plane given) without a word.
for (key, example) in [
("face", r#"{"plane": {"face": [x, y, z]}}"#),
("origin", r#"{"plane": {"origin": [x, y, z], "x_dir": [..], "y_dir": [..]}}"#),
("x_dir", r#"{"plane": {"origin": [x, y, z], "x_dir": [..], "y_dir": [..]}}"#),
("y_dir", r#"{"plane": {"origin": [x, y, z], "x_dir": [..], "y_dir": [..]}}"#),
] {
if p.get(key).is_some() {
return Err(bad(cmd, format!("`{key}` belongs inside `plane`: {example}")));
}
}
create_sketch_with_plane(s, p, plane_ref(s, p, cmd)?, None)
}