Merge pull request #1331 from ramox81/codex/smooth-constraint-parity

# Conflicts:
#	src/app/commands/styleprops.rs
This commit is contained in:
Hakan Seven committed 2026-09-17 17:10:49 +03:00
commit 76451f7298
18 files changed
+762 -127

No files matched your search

+29 -8
View File
@@ -1206,17 +1206,38 @@ impl OpenCADStudio {
}
}
"SMOOTHCONSTRAINT" => {
"GCSMOOTH" | "SMOOTHCONSTRAINT" => {
use crate::modules::parametric::SmoothConstraintCommand;
let handles = self.tabs[i].scene.selected_handles_in_order();
if handles.is_empty() {
use crate::modules::draw::select::SelectObjectsCommand;
let sel = SelectObjectsCommand::new(cmd);
self.command_line.push_info(&sel.prompt());
self.tabs[i].active_cmd = Some(Box::new(sel));
let command = SmoothConstraintCommand::new();
self.command_line.push_info(&command.prompt());
self.tabs[i].active_cmd = Some(Box::new(command));
} else if handles.len() != 2 {
self.tabs[i].scene.deselect_all();
self.command_line.push_error(
"Smooth requires an open spline first and a target curve second.",
);
let command = SmoothConstraintCommand::new();
self.command_line.push_info(&command.prompt());
self.tabs[i].active_cmd = Some(Box::new(command));
} else {
let Some(refs) = self.tabs[i].scene.smooth_constraint_refs(&handles) else {
self.command_line
.push_output("Select one open spline and one open target curve.");
let first = self.tabs[i].scene.document.get_entity(handles[0]);
let second = self.tabs[i].scene.document.get_entity(handles[1]);
let refs = first.zip(second).and_then(|(first, second)| {
SmoothConstraintCommand::preselected_refs(
(first, handles[0]),
(second, handles[1]),
)
});
let Some(refs) = refs else {
self.tabs[i].scene.deselect_all();
self.command_line.push_error(
"Smooth requires an open spline first and a line, arc, polyline segment or open spline second.",
);
let command = SmoothConstraintCommand::new();
self.command_line.push_info(&command.prompt());
self.tabs[i].active_cmd = Some(Box::new(command));
return None;
};
use crate::command::CmdResult;