Reject ambiguous origin and construction plane names (#247)
* Reject ambiguous origin and construction plane names * Reserve origin plane names for construction planes; suggest the other alias A construction plane can no longer be created with or renamed to XY, XZ, YZ, Top, Front or Right, so a plane argument can't become ambiguous in new designs. For older designs that already hold such a plane, the ambiguity error now also names the origin plane's other alias (XY for Top...). The existing tests build those legacy names directly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: bherbruck <brennen.herbruck@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
6 files changed
+176
-1
No files matched your search
@@ -25,6 +25,8 @@ fn section(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
// A named plane's world axis: which component of a point lies along its normal.
|
||||
let (origin, normal, axis) = match p.get("plane") {
|
||||
Some(Value::String(n)) if Plane::named(n.trim()).is_some() => {
|
||||
// Apply the same ambiguity check as modelling commands before treating a name as an origin alias.
|
||||
super::features::plane_param(s, p.get("plane"), cmd)?;
|
||||
let pl = Plane::named(n.trim()).ok_or_else(|| bad(cmd, format!("unknown plane `{n}`")))?;
|
||||
let normal = pl.normal();
|
||||
let axis = [normal.x, normal.y, normal.z].iter().position(|c| c.abs() > 0.5);
|
||||
|
||||
Reference in new issue
Block a user