Merge pull request #1447 from ramox81:codex/diameter-constraint-parity

#1447 branched from the same commit as #1443 and rewrote the radial
dimensional constraint a second time, so the two designs had to be
reconciled rather than stacked. #1447's is the one kept: it covers
DCRADIUS and DCDIAMETER through one command, places the dimension by the
direction the location was picked in rather than storing a text point,
and names the parameters `radN` / `diaN`. #1443's radial command result,
its entity builder call and its follow-up code are gone; its own
independent work stays — the ribbon's small-button grid and tool
descriptions, the magnitude reading of a negative radius, and the centre
anchor a parameter edit resizes a circle about.

The DIMCONSTRAINT default follows #1443: running DCRADIUS or DCDIAMETER
directly leaves it alone, and the Dispatch arm sets it when DIMCONSTRAINT
is what asked for the command.

The second commit's radial drawing — the dimension line broken around the
text, the elbowed leader, the centre-mark and arrowhead rules — applied to
every radius and diameter dimension, not just a constraint's, and three
layout-parity tests said the old layout was the measured one. It is now
scoped to a dimensional constraint's own dimension, as #1443 scoped its
version, and ordinary radial dimensions draw as they did.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 5 committed 2026-09-22 17:51:16 +03:00
commit 889a19c362
9 files changed
+706 -415

No files matched your search

+20 -12
View File
@@ -1891,22 +1891,32 @@ impl OpenCADStudio {
self.tabs[i].active_cmd = Some(Box::new(command));
}
"DCRADIUS" => {
"DCRADIUS" | "DCDIAMETER" => {
use crate::modules::parametric::{DimConstraintAxis, DimConstraintCommand};
use crate::scene::parametric_constraints::next_radial_parameter_name;
// Run on its own it leaves DIMCONSTRAINT's default alone.
let name = next_radial_parameter_name(self.tabs[i].scene.named_parameters());
// The circle or arc is picked inside the command.
self.tabs[i].scene.deselect_all();
let command = DimConstraintCommand::new(DimConstraintAxis::Radius, name);
let diameter = cmd == "DCDIAMETER";
// Run on its own either one leaves DIMCONSTRAINT's default
// alone; the Dispatch arm sets it when DIMCONSTRAINT is what
// asked for this command.
// The reference asks for the circle itself, whatever is
// selected, so a pick-first set is left alone.
let name = next_radial_parameter_name(
self.tabs[i].scene.named_parameters(),
diameter,
);
let command = DimConstraintCommand::new(
if diameter {
DimConstraintAxis::Diameter
} else {
DimConstraintAxis::Radius
},
name,
);
self.command_line.push_info(&command.prompt());
self.tabs[i].active_cmd = Some(Box::new(command));
}
"DCONSTRAINT" | "DCDIAMETER" => {
if cmd == "DCDIAMETER" {
self.dim_constraint_last = "Diameter";
}
"DCONSTRAINT" => {
let handles = self.tabs[i].scene.selected_handles_in_order();
if handles.is_empty() {
use crate::modules::draw::select::SelectObjectsCommand;
@@ -1924,8 +1934,6 @@ impl OpenCADStudio {
"DCHORIZONTAL" => ("DCHORIZONTAL", DistanceMode::X),
"DCVERTICAL" => ("DCVERTICAL", DistanceMode::Y),
"DCALIGNED" => ("DCALIGNED", DistanceMode::Aligned),
"DCRADIUS" => ("DCRADIUS", DistanceMode::Radius),
"DCDIAMETER" => ("DCDIAMETER", DistanceMode::Diameter),
_ => ("DCONSTRAINT", DistanceMode::Auto),
};
match DistanceConstraintCommand::with_mode(