forked from 1b-agent/opencadstudio-upstream
Equal: ask for the second object again after a refused pick, name the kind it needs
A second object of the wrong kind (a circle after a line, a line after a circle) or a pair that already carries Equal now reports and asks for the second object again instead of ending the command. The mismatch message names what the first object asks for — `Select a line segment, polyline segment, text, MText, major or minor axis of ellipse or elliptical arc.` after a length object, `Select a circle or arc.` after a radius object — and the same-pick message carries the reference's double space. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
ad6f902ed7
commit
842ae461fc
3 files changed
+18
-6
No files matched your search
@@ -3357,8 +3357,13 @@ impl OpenCADStudio {
|
||||
|| equal_size_follower(&self.tabs[i].scene.document, first, other)
|
||||
.is_none()
|
||||
{
|
||||
self.command_line
|
||||
.push_error(EqualConstraintCommand::INVALID_OBJECT);
|
||||
// The reference names the kind the first object
|
||||
// asks for.
|
||||
let message = match equal_size(&self.tabs[i].scene.document, first) {
|
||||
Some(EqualSize::Radius(_)) => EqualConstraintCommand::INVALID_RADIUS_OBJECT,
|
||||
_ => EqualConstraintCommand::INVALID_LENGTH_OBJECT,
|
||||
};
|
||||
self.command_line.push_error(message);
|
||||
continue;
|
||||
}
|
||||
let exists = self.tabs[i]
|
||||
@@ -3378,7 +3383,10 @@ impl OpenCADStudio {
|
||||
}
|
||||
followers.push(other);
|
||||
}
|
||||
if multiple && !finishing {
|
||||
// A refused second object is asked for again, as in the
|
||||
// reference; Multiple keeps asking anyway.
|
||||
let keep = (multiple && !finishing) || (!multiple && followers.is_empty());
|
||||
if keep {
|
||||
if let Some(prompt) =
|
||||
self.tabs[i].active_cmd.as_ref().map(|command| command.prompt())
|
||||
{
|
||||
@@ -3601,7 +3609,7 @@ impl OpenCADStudio {
|
||||
("No valid constraint point found.", Some(first))
|
||||
} else {
|
||||
(
|
||||
"The object or point is already selected. Select a different object or constraint point.",
|
||||
"The object or point is already selected. Select a different object or constraint point.",
|
||||
Some(first),
|
||||
)
|
||||
};
|
||||
|
||||
@@ -31,8 +31,12 @@ impl EqualConstraintCommand {
|
||||
pub const NO_OBJECT: &'static str = "No object found.";
|
||||
pub const INVALID_OBJECT: &'static str =
|
||||
"Invalid selection for Equal. Select a line, polyline segment, circle or arc.";
|
||||
pub const INVALID_LENGTH_OBJECT: &'static str =
|
||||
"Invalid selection for Equal. Select a line segment, polyline segment, text, MText, major or minor axis of ellipse or elliptical arc.";
|
||||
pub const INVALID_RADIUS_OBJECT: &'static str =
|
||||
"Invalid selection for Equal. Select a circle or arc.";
|
||||
pub const SAME_OBJECT: &'static str =
|
||||
"The object or point is already selected. Select a different object or constraint point.";
|
||||
"The object or point is already selected. Select a different object or constraint point.";
|
||||
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
|
||||
@@ -200,7 +200,7 @@ impl HorizontalConstraintCommand {
|
||||
if first.handle == second.handle && (first.point - second.point).length() <= 1.0e-9 {
|
||||
self.step = Step::SecondPoint(first);
|
||||
return CmdResult::ReportError(
|
||||
"The object or point is already selected. Select a different object or constraint point."
|
||||
"The object or point is already selected. Select a different object or constraint point."
|
||||
.to_string(),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user