feat: HATCHEDIT command to edit existing hatch pattern, scale, and angle

Add HATCHEDIT (HE alias) command. Works on pre-selected hatch or via
entity pick. Accepts text options: P <pattern>, S <scale>, A <angle>.
Enter applies changes; rebuilds hatch entity and GPU model via add_hatch.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-04-07 11:08:51 +03:00
commit f6d716dfc5
7 changed files with 206 additions and 2 deletions

View file

@ -802,6 +802,28 @@ impl H7CAD {
self.tabs[i].active_cmd = Some(Box::new(new_cmd));
}
"HATCHEDIT"|"HE" => {
use crate::modules::home::draw::hatchedit::HatcheditCommand;
// If a single hatch is already selected, skip the pick step.
let sel = self.tabs[i].scene.selected_entities();
if sel.len() == 1 {
let (h, _) = sel[0];
if let Some(model) = self.tabs[i].scene.hatches.get(&h).cloned() {
let cmd = HatcheditCommand::with_handle(
h, model.name.clone(), model.scale, model.angle_offset,
);
self.command_line.push_info(&cmd.prompt());
self.tabs[i].active_cmd = Some(Box::new(cmd));
} else {
self.command_line.push_error("HATCHEDIT: selected entity is not a hatch.");
}
} else {
let cmd = HatcheditCommand::new();
self.command_line.push_info(&cmd.prompt());
self.tabs[i].active_cmd = Some(Box::new(cmd));
}
}
"GRADIENT" => {
use crate::modules::home::draw::hatch::GradientCommand;
let outlines = self.tabs[i].scene.closed_outlines();