forked from 1b-agent/opencadstudio-upstream
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:
1 parent
27b5e124c7
commit
0aef1fc12f
27 files changed
+2217
-100
No files matched your search
@@ -573,6 +573,48 @@ impl H7CAD {
|
||||
}
|
||||
}
|
||||
}
|
||||
CmdResult::SetPlotWindow { p1, p2 } => {
|
||||
use acadrust::objects::{ObjectType, PlotSettings};
|
||||
let layout_name = self.tabs[i].scene.current_layout.clone();
|
||||
if layout_name == "Model" {
|
||||
self.command_line.push_error("PLOTWINDOW: switch to a paper space layout first.");
|
||||
} else {
|
||||
let block_handle = self.tabs[i].scene.current_layout_block_handle_pub();
|
||||
let doc = &mut self.tabs[i].scene.document;
|
||||
let ps_handle = doc.objects.iter().find_map(|(h, obj)| {
|
||||
if let ObjectType::PlotSettings(ps) = obj {
|
||||
if ps.page_name == layout_name { Some(*h) } else { None }
|
||||
} else { None }
|
||||
});
|
||||
let ps_entry = match ps_handle {
|
||||
Some(h) => doc.objects.get_mut(&h),
|
||||
None => {
|
||||
let nh = acadrust::Handle::new(doc.next_handle());
|
||||
let ps = PlotSettings::new(layout_name.clone());
|
||||
doc.objects.insert(nh, ObjectType::PlotSettings(ps));
|
||||
doc.objects.get_mut(&nh)
|
||||
}
|
||||
};
|
||||
let _ = block_handle;
|
||||
if let Some(ObjectType::PlotSettings(ps)) = ps_entry {
|
||||
// Convert world-space points to DXF coordinates (X, Z plane → DXF X, Y).
|
||||
let x1 = p1.x.min(p2.x) as f64;
|
||||
let y1 = p1.z.min(p2.z) as f64;
|
||||
let x2 = p1.x.max(p2.x) as f64;
|
||||
let y2 = p1.z.max(p2.z) as f64;
|
||||
ps.set_plot_window(x1, y1, x2, y2);
|
||||
self.push_undo_snapshot(i, "PLOTWINDOW");
|
||||
self.tabs[i].dirty = true;
|
||||
self.command_line.push_output(&format!(
|
||||
"PLOTWINDOW: ({x1:.3},{y1:.3}) → ({x2:.3},{y2:.3})"
|
||||
));
|
||||
}
|
||||
}
|
||||
self.tabs[i].active_cmd = None;
|
||||
self.tabs[i].snap_result = None;
|
||||
self.tabs[i].scene.clear_preview_wire();
|
||||
self.restore_pre_cmd_tangent();
|
||||
}
|
||||
}
|
||||
// Focus the command-line input while a command is active; blur it when the command ends.
|
||||
if self.tabs[i].active_cmd.is_some() {
|
||||
|
||||
Reference in new issue
Block a user