feat(trim): TRIM/EXTEND options — edges, fence, crossing, edge, erase (#336)
Both commands gain a shared option mode machine:
- Cutting/Boundary edges (T/B): pick which objects act as the boundary
(picked edges highlight yellow, the hovered candidate half-strength);
Enter rebuilds the boundary set, empty = everything (quick mode).
- Fence (F): draw a dashed fence; every object crossing it is trimmed /
extended at each crossing, re-applied to the surviving pieces so a
fence across both overhanging ends clears both. Live red/cyan result
preview while placing points.
- Crossing (C): crossing-selection semantics — the dashed green window
picks objects crossing its edges AND wholly inside; runs through the
fence machinery with a synthesized inside click.
- Edge (E): boundaries extrapolate (lines run past their ends, arcs
close to full circles). Cuts that land on an implied extension draw a
dashed yellow guide from the boundary's drawn end to the cut point,
so the user sees which edge causes the cut. Extend previews also show
the added tail as a bright dashed slice of the true curve.
- Erase (R, TRIM): picks delete without needing an intersection, with a
red hover preview.
- Shift+click swaps trim<->extend per pick (new set_shift plumbing into
the entity-pick and hover paths); the hover preview follows the held
state. Project is out of scope for the 2D pipeline.
The per-type pick bodies moved to shared free fns (pick_trim_at /
pick_extend_at) used by direct picks, hover previews and the fence
pass; EXTEND's snapshot bookkeeping unified with TRIM's placeholder
flow. Option keywords now take precedence over the hex-handle reading
in feed_active_cmd ("F"/"C"/"E" are valid hex), and fence geos carry
sentinel handles — probing with NULL against NULL-handle geos excluded
the whole fence. Regression test: fence_trims_x_arm.
Closes #336
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
5f08b77ebc
commit
9b40881ab1
4 changed files with 1393 additions and 221 deletions
|
|
@ -20,11 +20,13 @@ impl OpenCADStudio {
|
|||
}
|
||||
let i = self.active_tab;
|
||||
let ctrl = self.ctrl_down;
|
||||
let shift = self.shift_down;
|
||||
let result: Option<CmdResult> = {
|
||||
let Some(cmd) = self.tabs[i].active_cmd.as_mut() else {
|
||||
return Task::none();
|
||||
};
|
||||
cmd.set_ctrl(ctrl);
|
||||
cmd.set_shift(shift);
|
||||
match input {
|
||||
StepInput::Point(p) => Some(cmd.on_point(p)),
|
||||
StepInput::Text(s) => cmd.on_text_input(&s),
|
||||
|
|
@ -176,6 +178,18 @@ impl OpenCADStudio {
|
|||
.as_ref()
|
||||
.is_some_and(|c| c.needs_entity_pick())
|
||||
{
|
||||
// Option keywords take precedence over the handle reading —
|
||||
// "F"/"C"/"E" are valid hex, but during TRIM/EXTEND they are the
|
||||
// Fence/Crossing/Edge options (#336). Only an unconsumed token
|
||||
// falls through to the handle interpretation.
|
||||
let consumed = self.tabs[i]
|
||||
.active_cmd
|
||||
.as_mut()
|
||||
.and_then(|c| c.on_text_input(token));
|
||||
if let Some(r) = consumed {
|
||||
let _ = self.apply_cmd_result(r);
|
||||
return;
|
||||
}
|
||||
if let Ok(v) = u64::from_str_radix(token.trim_start_matches("0x"), 16) {
|
||||
let handle = Handle::new(v);
|
||||
let pt = self.tabs[i]
|
||||
|
|
|
|||
Loading…
Reference in a new issue