Feat: ROADMAP Phase 1-5 batch — trim/extend, plot scale, viewport UX, mline caps, table alignment

- TRIM/EXTEND: Ray and XLine entities supported as cutting boundaries and trim targets;
  trim results in Ray→Line/Ray, XLine→Ray/Ray or Line; hover preview added
- Plot scale override: Fit/1:1/1:2/1:5/1:10/1:20/1:50/1:100/2:1 buttons added to Page Setup
  panel; PageSetupCommit applies scale to PlotSettings
- Viewport UX: locked viewport gets orange border; selected viewport gets white border
- Named view → viewport assignment: Choice dropdown in properties panel copies
  view_target/direction/height to the viewport entity
- MLine caps: perpendicular start/end cap lines added for open (non-closed) MLines
- Wipeout polygon grips: boundary vertices become editable grips when clipping_enabled+Polygonal;
  world→pixel back-projection on drag
- Table cell alignment: CellStyle.alignment (1-9) drives left/center/right + top/middle/bottom
  text positioning; cxf::measure_text() helper added
- New commands/features: DIMCONTINUE (DCO), DIMBASELINE (DBA), TOLERANCE (TOL), TABLE,
  ATTDEF, ATTEDIT, ATTDISP, BREAKATPOINT (BAP), PLOTWINDOW (PW), MLINE (ML);
  DIMSTYLE/DIMCURRENT/CLAYER/LTSCALE/CELTSCALE/SCALETEXT/XDATA/UCSICON/REGEN/DRAWORDER extended
- PLINE arc mode: A/L/CLOSE text input, bulge computation, arc preview
- Warning cleanup: removed unused imports and unreachable patterns

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Hakan Seven 2026-04-03 15:31:05 +03:00
commit 0aef1fc12f
27 changed files with 2217 additions and 100 deletions

View file

@ -7,8 +7,6 @@
//
// BREAK @ (at-sign as second point) → Break at a single point (splits without gap).
use std::f64::consts::TAU;
use acadrust::entities::{Arc as ArcEnt, Line as LineEnt, LwPolyline};
use acadrust::types::Vector3;
use acadrust::{EntityType, Handle};
@ -20,6 +18,7 @@ use crate::scene::wire_model::WireModel;
// ── Ribbon definition ──────────────────────────────────────────────────────
#[allow(dead_code)]
pub fn tool() -> ToolDef {
ToolDef {
id: "BREAK",
@ -285,3 +284,50 @@ impl CadCommand for BreakInteractiveCommand {
None
}
}
// ── BREAKATPOINT (BAP) — split at a single point, no gap ──────────────────
pub struct BreakAtPointCommand {
target: Option<Handle>,
}
impl BreakAtPointCommand {
pub fn new() -> Self {
Self { target: None }
}
}
impl CadCommand for BreakAtPointCommand {
fn name(&self) -> &'static str { "BREAKATPOINT" }
fn prompt(&self) -> String {
if self.target.is_none() {
"BREAKATPOINT Select object:".into()
} else {
"BREAKATPOINT Specify break point:".into()
}
}
fn needs_entity_pick(&self) -> bool {
self.target.is_none()
}
fn on_entity_pick(&mut self, handle: Handle, _pt: Vec3) -> CmdResult {
if handle.is_null() {
return CmdResult::NeedPoint;
}
self.target = Some(handle);
CmdResult::NeedPoint
}
fn on_point(&mut self, pt: Vec3) -> CmdResult {
match self.target {
Some(handle) => CmdResult::BreakEntity { handle, p1: pt, p2: pt },
None => CmdResult::Cancel,
}
}
fn on_enter(&mut self) -> CmdResult {
CmdResult::Cancel
}
}