forked from 1b-agent/opencadstudio-upstream
Bring the Equal constraint to reference parity
Equal was applied through a generic gather-then-apply flow and, with the default size-retaining solve mode, never changed anything: the solver held both sizes and the relation could not be met. Now: - GCEQUAL joins ECONSTRAINT and GEOMCONSTRAINT Equal; both objects are picked inside the command (`Select first object or [Multiple]:`, `Select second object:`; Multiple gathers `Select objects to make equal to the first:`), a selection made beforehand is not used, a miss says `No object found.` and re-asks, an unsupported object or the same object twice is reported and re-asked, a repeat is refused. - The follower is resized in place before the relation is added: a line or straight polyline segment keeps its start and direction and its end moves to the first object's length; a circle or arc keeps its center and takes the radius. - During edits the side that is not being edited follows the same rule: its size is not retained, its start (or center) and other vertices are held and its direction kept, so only its length or radius changes; a chain of Equal relations follows along. Co-Authored-By: Claude Fable 5.1 <[email protected]>
This commit is contained in:
1 parent
1f0b888833
commit
8520ee45e8
10 files changed
+598
-5
No files matched your search
@@ -1569,8 +1569,17 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
|
||||
"PCONSTRAINT" | "ECONSTRAINT" | "LCONSTRAINT"
|
||||
| "NRCONSTRAINT" => {
|
||||
"ECONSTRAINT" | "GCEQUAL" => {
|
||||
use crate::modules::parametric::EqualConstraintCommand;
|
||||
// Both objects are picked inside the command, as in the
|
||||
// reference; a selection made beforehand is not used.
|
||||
self.tabs[i].scene.deselect_all();
|
||||
let command = EqualConstraintCommand::new();
|
||||
self.command_line.push_info(&command.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(command));
|
||||
}
|
||||
|
||||
"PCONSTRAINT" | "LCONSTRAINT" | "NRCONSTRAINT" => {
|
||||
let handles = self.tabs[i].scene.selected_handles_in_order();
|
||||
if handles.is_empty() {
|
||||
use crate::modules::draw::select::SelectObjectsCommand;
|
||||
@@ -1587,8 +1596,7 @@ impl OpenCADStudio {
|
||||
let (kind, label) = match cmd {
|
||||
"PCONSTRAINT" => (ConstraintKind::Parallel, "Parallel constraint"),
|
||||
"LCONSTRAINT" => (ConstraintKind::Colinear, "Colinear constraint"),
|
||||
"NRCONSTRAINT" => (ConstraintKind::Normal, "Normal constraint"),
|
||||
_ => (ConstraintKind::Equal, "Equal constraint"),
|
||||
_ => (ConstraintKind::Normal, "Normal constraint"),
|
||||
};
|
||||
return Some(self.apply_cmd_result(CmdResult::AddParametricConstraint {
|
||||
kind,
|
||||
|
||||
Reference in new issue
Block a user