forked from 1b-agent/opencadstudio-upstream
Measure paper-space dimensions through the viewport they were picked in
DIMLINEAR / DIMALIGNED / DIMRADIUS / DIMDIAMETER / DIMANGULAR created on a sheet now report the model measurement of the geometry seen through a viewport, at any viewport scale, while definition points, the dimension line and the text stay in paper coordinates and the annotation keeps its sheet size (DIMSCALE is untouched). A viewport frame is a similarity - uniform scale plus in-plane twist - so projecting the model span onto the paper axis and compensating gives exactly the raw paper measurement times 1/scale. No geometry is rewritten: the compensation is persisted once as a negative DIMLFAC override on the dimension and applied once by the linear formatter, so preview text, dimension text, the properties measurement row and DXF/DWG export all agree. User measurement multipliers fold into the same magnitude, and an explicit text override still bypasses formatting entirely, so it is never re-scaled. Angular dimensions are never compensated - a similarity preserves angles. Mixed input (one point through viewport A, another through viewport B or on the sheet) is refused rather than silently mis-measured: the command line explains why and the dimension falls back to plain paper measurement. A dimension measured through a viewport is left unassociated: its definition points are projected paper coordinates, so inferring a paper-space association would bind it to geometry that is not there. PR3 records the real dimension -> viewport -> entity chain. The result is one ordinary dimension entity carrying one style override, so undo/redo works through the existing history with no new out-of-document state. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
9ee809d389
commit
30c5ccbba1
10 files changed
+395
-1
No files matched your search
@@ -9,6 +9,7 @@ pub(crate) mod config;
|
||||
pub use automation::{export_headless, serve};
|
||||
mod command_driver;
|
||||
pub(crate) mod commands;
|
||||
mod dim_viewport;
|
||||
mod document;
|
||||
mod drafting_settings;
|
||||
pub(crate) mod expr_eval;
|
||||
@@ -508,6 +509,12 @@ pub(super) struct OpenCADStudio {
|
||||
cursor_size: i32,
|
||||
/// Selection-box size setting (PICKBOX, 0..=50).
|
||||
pick_box: i32,
|
||||
/// PR2: accepted snaps for the points the active dimension command has
|
||||
/// collected, in collection order. Transient command state — the committed
|
||||
/// result is an ordinary dimension entity, so undo/redo needs nothing here.
|
||||
pub(crate) dim_accepted_snaps: Vec<crate::scene::viewport_ref::AcceptedSnap>,
|
||||
/// Name of the command `dim_accepted_snaps` belongs to.
|
||||
pub(crate) dim_accepted_snaps_owner: Option<String>,
|
||||
/// Use REFEDIT rather than BEDIT when double-clicking an attribute-free block.
|
||||
double_click_block_refedit: bool,
|
||||
/// Open ATTEDIT when double-clicking a block with attributes.
|
||||
@@ -3634,6 +3641,8 @@ impl OpenCADStudio {
|
||||
zoom_factor: 60,
|
||||
cursor_size: 5,
|
||||
pick_box: 3,
|
||||
dim_accepted_snaps: Vec::new(),
|
||||
dim_accepted_snaps_owner: None,
|
||||
double_click_block_refedit: false,
|
||||
double_click_block_attedit: true,
|
||||
grip_object_limit: settings::DEFAULT_GRIP_OBJECT_LIMIT,
|
||||
|
||||
Reference in new issue
Block a user