Feat: LENGTHEN command (LEN) — extend or trim Line/Arc
Options via text input after entity pick: DE <delta> — extend by delta (negative trims) TO <total> — set absolute total length / arc length P <percent> — scale by percentage <number> — plain number treated as DE delta Closest end to pick point is modified. Uses CmdResult::LengthenEntity. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
ae0a4b12b5
commit
f6efe7a06a
5 changed files with 237 additions and 1 deletions
|
|
@ -371,6 +371,30 @@ impl H7CAD {
|
|||
self.restore_pre_cmd_tangent();
|
||||
self.command_line.push_output(&msg);
|
||||
}
|
||||
CmdResult::LengthenEntity { handle, pick_pt, mode } => {
|
||||
use crate::modules::home::modify::lengthen::lengthen_entity;
|
||||
let result = self.tabs[i].scene.document
|
||||
.get_entity(handle)
|
||||
.and_then(|e| lengthen_entity(e, pick_pt, &mode));
|
||||
match result {
|
||||
Some(new_entity) => {
|
||||
let label = self.history_label_from_active_cmd(i, "LENGTHEN");
|
||||
self.push_undo_snapshot(i, label);
|
||||
self.tabs[i].scene.erase_entities(&[handle]);
|
||||
self.tabs[i].scene.add_entity(new_entity);
|
||||
self.tabs[i].dirty = true;
|
||||
self.command_line.push_output("LENGTHEN: applied.");
|
||||
self.refresh_properties();
|
||||
}
|
||||
None => {
|
||||
self.command_line.push_error("LENGTHEN: entity type not supported.");
|
||||
}
|
||||
}
|
||||
self.tabs[i].active_cmd = None;
|
||||
self.tabs[i].snap_result = None;
|
||||
self.tabs[i].scene.clear_preview_wire();
|
||||
self.restore_pre_cmd_tangent();
|
||||
}
|
||||
CmdResult::DivideEntity { handle, n } => {
|
||||
use crate::modules::home::inquiry::divide::divide_entity;
|
||||
let pts = self.tabs[i].scene.document
|
||||
|
|
|
|||
|
|
@ -985,6 +985,13 @@ impl H7CAD {
|
|||
self.tabs[i].active_cmd = Some(Box::new(cmd));
|
||||
}
|
||||
|
||||
"LENGTHEN"|"LEN" => {
|
||||
use crate::modules::home::modify::lengthen::LengthenCommand;
|
||||
let cmd = LengthenCommand::new();
|
||||
self.command_line.push_info(&cmd.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(cmd));
|
||||
}
|
||||
|
||||
"DIVIDE"|"DIV" => {
|
||||
use crate::modules::home::inquiry::divide::DivideCommand;
|
||||
let cmd = DivideCommand::new();
|
||||
|
|
@ -1024,7 +1031,7 @@ impl H7CAD {
|
|||
"HELP"|"?" => {
|
||||
self.command_line.push_output(
|
||||
"Draw: LINE CIRCLE ARC PLINE RECT POLY POINT ELLIPSE SPLINE RAY XLINE HATCH | \
|
||||
Modify: MOVE COPY ROTATE SCALE MIRROR ERASE OFFSET EXTEND FILLET CHAMFER STRETCH EXPLODE TRIM BREAK JOIN | \
|
||||
Modify: MOVE COPY ROTATE SCALE MIRROR ERASE OFFSET EXTEND FILLET CHAMFER STRETCH EXPLODE TRIM BREAK JOIN LENGTHEN | \
|
||||
Array: ARRAY ARRAYRECT ARRAYPOLAR ARRAYPATH | \
|
||||
Text: TEXT MTEXT LEADER MLEADER | \
|
||||
Dimension: DIMLINEAR DIMANGULAR DIMRADIUS | \
|
||||
|
|
|
|||
Loading…
Reference in a new issue