Feat: PEDIT command (PE) — polyline edit (close/open/width)

Entity pick → text input subcommands:
  C / CLOSE  → set closed flag
  O / OPEN   → clear closed flag
  W <value>  → set uniform width on LwPolyline vertices
  X / EXIT   → cancel

Command stays active after each op (CmdResult::PeditOp) for multiple edits.
Supports LwPolyline and Polyline2D.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
This commit is contained in:
Hakan SevenandClaude Sonnet 4.6 committed 2026-04-03 09:19:36 +03:00
1 parent 05ccc80048
commit 330b8b58f4
5 files changed
+139

No files matched your search

+19
View File
@@ -487,6 +487,25 @@ impl H7CAD {
self.tabs[i].scene.clear_preview_wire();
self.restore_pre_cmd_tangent();
}
CmdResult::PeditOp { handle, op } => {
use crate::modules::home::modify::pedit::apply_pedit;
let changed = self.tabs[i].scene.document
.get_entity_mut(handle)
.map(|e| apply_pedit(e, &op))
.unwrap_or(false);
if changed {
self.push_undo_snapshot(i, "PEDIT");
self.tabs[i].dirty = true;
self.command_line.push_output("PEDIT: applied.");
self.refresh_properties();
} else {
self.command_line.push_error("PEDIT: operation not applicable to this entity.");
}
// Keep command active — user may apply more ops
self.command_line.push_info(
"PEDIT Enter option [C=Close O=Open W=Width X=Exit]:"
);
}
CmdResult::JoinEntities(handles) => {
use crate::modules::home::modify::join::join_entities;
let pairs: Vec<_> = handles.iter()
+7
View File
@@ -1018,6 +1018,13 @@ impl H7CAD {
self.tabs[i].active_cmd = Some(Box::new(cmd));
}
"PEDIT"|"PE" => {
use crate::modules::home::modify::pedit::PeditCommand;
let cmd_obj = PeditCommand::new();
self.command_line.push_info(&cmd_obj.prompt());
self.tabs[i].active_cmd = Some(Box::new(cmd_obj));
}
"ALIGN"|"AL" => {
use crate::modules::home::modify::align::AlignCommand;
let cmd = AlignCommand::new();