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 <[email protected]>
This commit is contained in:
1 parent
9ee809d389
commit
30c5ccbba1
10 files changed
+395
-1
No files matched your search
@@ -2163,6 +2163,14 @@ pub trait CadCommand: Send {
|
||||
}
|
||||
|
||||
/// Returns `true` when the command needs entity picking (hit-test) instead of point picking.
|
||||
/// PR2: this command creates a dimension whose measurement must be
|
||||
/// compensated when its points are picked through a paper-space viewport,
|
||||
/// and whose explicit object pick may land on model geometry displayed
|
||||
/// inside one. See `crate::app::dim_viewport`.
|
||||
fn measures_through_viewports(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
fn needs_entity_pick(&self) -> bool {
|
||||
false
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user