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
@@ -15,6 +15,7 @@ mod xray;
|
||||
mod zoom_ext;
|
||||
mod zoom_in;
|
||||
mod zoom_out;
|
||||
pub mod plot_window;
|
||||
pub mod zoom_window;
|
||||
|
||||
use crate::modules::{CadModule, RibbonGroup};
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
// PLOTWINDOW command — pick two corners to define the plot window area.
|
||||
//
|
||||
// Works only in paper space layouts. After picking P1 and P2, writes the
|
||||
// window to the layout's PlotSettings (PlotType::Window).
|
||||
|
||||
use crate::command::{CadCommand, CmdResult};
|
||||
use crate::scene::wire_model::WireModel;
|
||||
use glam::Vec3;
|
||||
|
||||
pub struct PlotWindowCommand {
|
||||
p1: Option<Vec3>,
|
||||
}
|
||||
|
||||
impl PlotWindowCommand {
|
||||
pub fn new() -> Self {
|
||||
Self { p1: None }
|
||||
}
|
||||
}
|
||||
|
||||
impl CadCommand for PlotWindowCommand {
|
||||
fn name(&self) -> &'static str { "PLOTWINDOW" }
|
||||
|
||||
fn prompt(&self) -> String {
|
||||
if self.p1.is_none() {
|
||||
"PLOTWINDOW Specify first corner of plot window:".into()
|
||||
} else {
|
||||
"PLOTWINDOW Specify opposite corner:".into()
|
||||
}
|
||||
}
|
||||
|
||||
fn on_point(&mut self, pt: Vec3) -> CmdResult {
|
||||
match self.p1 {
|
||||
None => {
|
||||
self.p1 = Some(pt);
|
||||
CmdResult::NeedPoint
|
||||
}
|
||||
Some(p1) => CmdResult::SetPlotWindow { p1, p2: pt },
|
||||
}
|
||||
}
|
||||
|
||||
fn on_enter(&mut self) -> CmdResult {
|
||||
CmdResult::Cancel
|
||||
}
|
||||
|
||||
fn on_mouse_move(&mut self, pt: Vec3) -> Option<WireModel> {
|
||||
let p1 = self.p1?;
|
||||
// Draw the selection rectangle.
|
||||
Some(WireModel {
|
||||
name: "plotwindow_preview".into(),
|
||||
points: vec![
|
||||
[p1.x, p1.y, p1.z], [pt.x, p1.y, p1.z],
|
||||
[pt.x, p1.y, p1.z], [pt.x, pt.y, pt.z],
|
||||
[pt.x, pt.y, pt.z], [p1.x, pt.y, pt.z],
|
||||
[p1.x, pt.y, pt.z], [p1.x, p1.y, p1.z],
|
||||
],
|
||||
color: WireModel::CYAN,
|
||||
selected: false,
|
||||
pattern_length: 0.0,
|
||||
pattern: [0.0; 8],
|
||||
line_weight_px: 1.0,
|
||||
snap_pts: vec![],
|
||||
tangent_geoms: vec![],
|
||||
key_vertices: vec![],
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user