Commit Graph
537 Commits
Author SHA1 Message Date
Hakan Seven 8429ad50ec fix: harden dimension and constraint bar changes 2026-09-17 18:04:06 +03:00
Hakan Seven a785cda92a Merge pull request #1335 from CiberNin/fix/dimension-layout-parity 2026-09-17 17:58:10 +03:00
Hakan Seven 80f2d5fd72 fix: solve concentric geometry in kernel 2026-09-17 17:39:01 +03:00
Hakan Seven 16c417f81d Merge pull request #1332 from ramox81/codex/concentric-constraint-parity
# Conflicts:
#	src/entities/arc.rs
#	src/entities/ellipse.rs
#	src/modules/parametric/mod.rs
#	src/scene/parametric_solve.rs
#	src/ui/overlay.rs
2026-09-17 17:24:14 +03:00
Hakan Seven e8125c8702 fix: preserve selected smooth curve geometry 2026-09-17 17:19:09 +03:00
Hakan Seven 76451f7298 Merge pull request #1331 from ramox81/codex/smooth-constraint-parity
# Conflicts:
#	src/app/commands/styleprops.rs
2026-09-17 17:10:49 +03:00
Christopher Overbeck 0fdbc80e16 fix(dimension): measured cell width, DIMTMOVE 1 hook start, diameter sign, #1323 offset kept
- The per-character width estimate is 0.66 text heights, measured by
  rendering the text of 106 saved dimension pictures with the bundled
  fonts; the old 0.60 left every fit and hook estimate ten percent narrow.
  With it, the "text plus DIMGAP must clear the arrowheads" rule reproduces
  AutoCAD's arrow placement for 1047 of 1078 pictured linear dimensions
  whose text sits between the extension lines.
- DIMTMOVE 1 stores where the leader's hook starts, not where it ends: on 39
  such radial dimensions the stored point sits DIMASZ plus DIMGAP before the
  text. The hook now runs from the stored point one arrow toward the text.
- The diameter prefix is U+2205, matching the %%c expansion and the pictures.
- A diameter whose text the user dragged keeps the DIMTAD lift from #1323;
  the four AutoCAD-authored diameters with DIMTAD above in the sample all
  store the lifted point directly, so this applies only to dragged text.
2026-09-17 09:06:54 -05:00
Christopher Overbeck 8463c830f7 fix(text): resolve %%c to U+2205, the diameter sign AutoCAD writes
Saved dimension pictures across 1311 diameter dimensions carry U+2205 (806) or a
literal %%c (168); U+2300 never appears. The bundled romans and simplex fonts
have U+2205 and lack Latin O-stroke, so one character now serves the %%c
expansion and, in the dimension formatter, the diameter prefix.
2026-09-17 09:06:54 -05:00
Christopher Overbeck 9e18f855cc fix(dimension): size a limits stack from the MText stack layout
The fit and break estimates used two halves at STACK_HALF_SCALE; the stack
is laid out from the lower half's baseline to the upper half's cap, which is
STACK_RAISE + STACK_HALF_SCALE of the run height. The taller estimate flips
arrows outside for a few more stacked texts that AutoCAD drew that way.
2026-09-17 08:41:14 -05:00
Christopher Overbeck 533365dc91 fix(dimension): apply a negative DIMLFAC only where AutoCAD applied it
A negative DIMLFAC scales a paper-space dimension only when it measures
model space through a viewport. AutoCAD records the factor it used as
ACAD_DIMASSOC_CALC_DIMLFAC; a zero there marks a dimension of paper-space
geometry, which reads its sheet distance unscaled. Regenerating such a
dimension multiplied it by the factor anyway, turning 4.457 into 18.110.
2026-09-17 08:41:14 -05:00
Christopher Overbeck 2cf0fc2c42 fix(dimension): run the dimension line out to outside text, straight radial leaders near horizontal
Text placed past an extension line along the dimension's own axis pulls the
dimension line out to its near edge rather than stopping at the two-arrow
stub. A radial leader already within 15 degrees of horizontal runs straight to
the text instead of turning a hook, and a diameter with outside text draws its
single leader for every DIMTMOVE except 2, which keeps only the arrowhead.

Subset parity: 870 of 1076 pictured dimensions now regenerate as drawn.
2026-09-17 08:41:14 -05:00
Christopher Overbeck 85619f49d6 fix(dimension): lay out regenerated dimensions the way their pictures were drawn
Comparing the saved picture block of every dimension in a set of production
drawings with the geometry regenerated after a refresh showed half of them
differing. The differences trace to a few layout rules:

- The stored text middle point (group 11) is where the text was drawn, for
  automatic and hand-placed text alike; a regenerated dimension keeps it and
  only a cleared point is placed from the style.
- Arrows move outside when the text, where it is drawn, would run into an
  arrowhead. The text is measured along the dimension line, so horizontal
  text on a vertical dimension counts its height, a limits stack its two
  lines and `\P` continuation lines their number.
- Text pushed outside starts past the two-arrow stub and a gap; arrow
  length is DIMASZ, not the text height.
- Horizontal text outside a non-horizontal dimension gets a leg to its
  height and a hook one arrow long that it sits against, both when drawn
  and when auto-placed.
- A radius with outside text draws no line to the centre unless DIMTOFL,
  a leader to a hook the text sits against, and an arrowhead whose body
  points toward the text. A diameter with outside text and no DIMTOFL is a
  single leader with one arrowhead, no line across the circle.
- DIMTMOVE 1 stores the hook end; the leader is drawn to it exactly.
- Width estimates measure the widest `\P` line and skip MText format codes.

On a 30-drawing subset with 1076 pictured dimensions the regenerated
drawing now matches the picture for 838 of them, up from 584.
2026-09-17 08:41:14 -05:00
ramox81 a6a70420c4 fix: align concentric constraint behavior 2026-09-17 15:31:26 +03:00
ramox81 025398bbb1 Preserve spline grip display mode after smooth solve 2026-09-17 14:54:33 +03:00
ramox81 5497f455ef Complete spline fit and control grip modes 2026-09-17 14:29:26 +03:00
Hakan Seven 58405025ee Merge pull request #1325 from MarcelP102/codex/formating-fix 2026-09-17 09:41:31 +03:00
Marcel fca96b57de Use shared unit formatters across property and dynamic views 2026-09-17 08:30:20 +02:00
Hakan Seven df53117541 Merge pull request #1323 from ghost/diameter-grip-text-alignment 2026-09-17 07:15:26 +03:00
Hakan Seven 45d9ce9782 Merge pull request #1321 from ghost/dimlim-nominal-replacement 2026-09-17 07:12:53 +03:00
Hakan Seven 03f4e7cb86 Merge pull request #1309 from ghost/embed-print-fonts 2026-09-17 06:57:42 +03:00
codallos 1f71a70580 Fix diameter dimension grip and text alignment 2026-09-16 19:21:03 -06:00
Christopher Overbeck 3e98e17512 fix(dimension): keep the limits stack when both offsets are zero
Production drawings show AutoCAD stacking two equal limits for a DIMLIM
style with zero offsets; the plain-value shortcut matched one drawing from
another authoring tool and broke twenty-five that AutoCAD wrote.
2026-09-16 19:33:06 -05:00
Christopher Overbeck 7b5b86469e fix(dimension): round printed values half away from zero, scale alternate units, stack alternate limits
AutoCAD prints 0.4255 as 0.426; Rust's formatter rounds the binary value,
which sits a hair below the decimal tie, and printed 0.425. Decimal
dimension text, tolerances and limits now settle the tie the way the
drawings do.

Alternate units multiplied the raw measurement instead of the displayed
DIMLFAC-scaled value, so a paper-space dimension's bracketed value was off
by the viewport factor, and alternate limits were written high/low with a
slash where AutoCAD stacks them like the primary limits.
2026-09-16 19:20:47 -05:00
Christopher Overbeck a30db2d4f3 fix(dimension): plain value for DIMLIM without offsets, stored angle for degenerate angular text
A limits style whose upper and lower offsets are both zero prints the plain
value in AutoCAD, not a stack of two equal numbers. A three-point angular
dimension whose extension point sits on its vertex has no measurable angle;
AutoCAD keeps showing the angle it stored, and the text now does too instead
of reading 0 degrees. Both cases came out of comparing saved picture blocks
with regenerated text across a set of production drawings.
2026-09-16 18:28:58 -05:00
Christopher Overbeck 86f63f5fd1 fix(dimension): DIMLIM replaces the nominal with a limits stack
Dimensions with DIMLIM on were regenerated as the nominal value plus a
separate stacked pair, and the pair was built from the unscaled
measurement. AutoCAD prints only the upper limit over the lower one, with
the offsets applied to the DIMLFAC-scaled, DIMRND-rounded value, and keeps
both halves at the same number of decimals under DIMTZIN. Drawings with a
limits-only style looked right on load, from their saved picture blocks,
and gained an extra number as soon as an associative refresh dropped the
picture.

Fit and fill estimates now count visible cells, so a stack is as wide as
its wider half at DIMTFAC, and the text-to-line offset uses the stacked
height.
2026-09-16 17:06:14 -05:00
Karim Jerbi ca0ee37d26 feat(snap): independent 3D object-snap system with six modes
Grid snap locks to SNAPUNIT instead of magnetizing; snapped 3D points keep elevation instead of flattening to z=0. New SnapTypes Vertex/EdgeMidpoint/FaceCenter/Knot/FacePerpendicular/NearestFace with their own F4 master toggle and mode set, tiers, and markers, fully independent of the 2D master. Solid B-rep corners/edge-midpoints/face-centers from mesh edges and kernel faces, spline knot points, and live perpendicular/nearest-to-face on mesh triangles merged priority-aware in move/click paths. Drafting Settings 3D Object Snap tab is fully live (was dead placeholders); Nearest-to-face off by default. TDD: behavioral LINE-to-solid tests plus engine/scene unit tests.
2026-09-16 16:43:37 +01:00
huanld 28efbffd57 feat: embed images (OLE2FRAME), print pipeline fixes, plot prefs, community fonts
- IMAGEEMBED: pack raster images into OLE2FRAME entities so a .dwg is
  self-contained; 'Embed Image' entry in the XREF attach menu; control/MCP
  op embed_image for external tools; dxf_name for OLE2FRAME queries.
- Scene: populate_images_from_document now rebuilds OLE2FRAME and PDF
  underlay models too (they used to vanish after any XREF op).
- Printing: add PRINTER_ENUM_NETWORK pass when listing printers; GDI
  spooler fallback (hayro raster at 300 DPI + StretchDIBits) for hosts
  whose PDF handler registers no print verb; DEVMODE orientation with a
  90-degree raster rotation fallback for v4 drivers; fix the fit-scale
  precedence bug that printed blank pages.
- PDF export dialogs on Windows use the async file dialog so the native
  overwrite confirmation no longer deadlocks the UI thread.
- Plot dialog: persist the chosen printer (saved on selection) and the
  picked plot window across sessions; page setups with no device no
  longer reset the output device.
- Community fonts: detect unresolvable .shx references on open and offer
  a download from the repository's fonts/ folder (contribution guide in
  fonts/README.md); custom font source URL setting for intranet font
  servers; downloaded fonts resolve from the per-user fonts directory.
2026-09-16 16:42:21 +07:00
Hakan Seven d10a0cf798 Merge pull request #1301: Add associative viewport dimensions
Refresh associations after complete SpaceMouse camera updates and recognize imported paper-space owners without Layout objects. Use kernel containment, intersection, perpendicular and spline tangent solving; pin cadkernel 7ce27f2 and add regressions.
2026-09-16 09:56:33 +03:00
Christopher Overbeck 5424a19482 Track mixed paper and viewport dimension references 2026-09-15 16:00:11 -05:00
Christopher Overbeck 2ee3782850 Fix viewport dimension acquisition and preserve measurement scaling 2026-09-15 14:13:19 -05:00
Christopher Overbeck 369e0c9fc5 Merge remote-tracking branch 'origin/main' into feat/viewport-dimensions
# Conflicts:
#	src/app/command_driver.rs
#	src/scene/mod.rs
2026-09-15 13:53:12 -05:00
Christopher OverbeckandClaude Fable 5.1 30c5ccbba1 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]>
2026-09-15 12:40:44 -05:00
Christopher OverbeckandClaude Fable 5.1 9ee809d389 Resolve the DIMLFAC sign convention and add the viewport measurement seams
DXF gives DIMLFAC a sign convention: a positive value scales every
dimension, a negative one applies |DIMLFAC| only to dimensions that live in
a paper-space layout (where it compensates a viewport's scale). The linear
formatter multiplied by the raw signed value, so a drawing with negative
DIMLFAC (e.g. 115448.dxf) rendered negative measurements.

Resolve the sign once, in `resolved_dimension_style`, the single place an
effective style is derived, so dimension text, alternate units, exploded and
baked text and the properties panel all agree. `extended_data` keeps the raw
signed value, so DXF/DWG export is unchanged. The properties "Measurement"
row now reports the value the text shows rather than the raw distance, while
`actual_measurement` (group 42) stays raw as the format requires.

Also adds the PR2 seams the dimension work builds on:
  * MeasurementScale::user_lfac_for_space / viewport_dimlfac_override —
    the persisted representation of viewport compensation.
  * Scene::viewport_frame and paper-point viewport resolution.
  * Model-geometry hit testing through a content viewport, including
    descent into block instances with the instance transform baked in.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-09-15 12:40:44 -05:00
Hakan Seven acde01cfc3 Merge pull request #1289 from ramox81/fix/coincident-standard-command
# Conflicts:
#	src/command.rs
#	src/scene/mod.rs
#	src/scene/parametric_solve.rs
2026-09-15 15:08:35 +03:00
ramox81 ba2b371269 Complete Coincident command behavior 2026-09-15 14:00:26 +03:00
kevin9327andClaude Opus 5 c13e86b87d fix(dimension): draw linear and aligned dimensions in their own plane off world Z
A linear or aligned dimension whose normal is not world Z was drawn and
exploded as if it lay in world XY. The builders read the offset and the
extension directions in XY only, so a dimension turned into a working plane
such as XZ lost its offset (now along Z): the dimension line fell onto the
measured points and the extension lines stuck out along world Y.

Move such a dimension into its own OCS before building it and map the result
back onto its plane, as arc length and large radial dimensions already do,
for both tessellation and EXPLODE.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-09-15 07:00:47 +09:00
Hakan Seven caec8dc53b Merge remote-tracking branch 'origin/main' 2026-09-14 20:24:54 +03:00
Hakan Seven 6c0badbdc8 fix: resolve annotation pull request findings 2026-09-14 20:16:46 +03:00
Hakan Seven 293d0796fb Merge pull request #1246 2026-09-14 19:58:35 +03:00
Hakan Seven f2fd2ae5ad fix: address open pull request review findings 2026-09-14 19:58:35 +03:00
Hakan Seven 2d20bdd51c Merge pull request #1251 2026-09-14 19:51:57 +03:00
Hakan Seven 05baa82241 Merge pull request #1256 2026-09-14 19:49:24 +03:00
ramox81 7dabc48fd3 Match Region properties palette 2026-09-14 16:16:20 +03:00
Karim Jerbi 546a6af186 perf(entities): direct quad-strip triangulation for wide arc tessellation
Optimize wide and tapered arc fill mesh generation by eliminating general
ear-clipping triangulation and optimizing arc boundary evaluation:

1. Replaced triangulate_planar with triangulate_band_ring and direct
   quad-strip vertex construction in wide_band_tris. Polyline band fills
   possess strict quad-strip topology (straight segments: 4-vertex trapezoid;
   arc segments: 2m-vertex annular sector). Generating triangles directly in
   O(N) time avoids Newell normal calculation, planar projection, Delaunay
   triangulation, and O(N^2) ear-clipping searches.
2. Exact buffer capacity pre-allocation in wide_band_tris based on ring
   lengths, eliminating dynamic reallocation during triangle emission.
3. Replaced top and bottom cap triangulation in thick_band_tube with
   triangulate_band_ring.
4. Unified inner and outer arc point calculation in polyline_segment_fill
   into a single loop using ang.sin_cos(), halving trigonometric calls and
   eliminating dynamic vector resizing.

Performance gains (wide_and_tapered_arc_tessellation benchmark across 7,500 entities):
- Latency: 27.34 ms -> 23.30 ms (-14.8%)
- Mean latency: 28.08 ms -> 24.15 ms (-14.0%)
- Throughput: 265.6k entities/s -> 321.9k entities/s (+21.2%)
- Correctness: 100% pass across all 45 polyline and 5 tessellation unit tests.
2026-09-14 12:31:07 +01:00
Hakan Seven 912b217d26 fix: delegate dimension transforms to cadcodec 2026-09-14 14:22:10 +03:00
Marcel a2adb3f6e3 Refactor grip dynamic input and polyline arc geometry 2026-09-14 13:15:57 +02:00
kevin9327andClaude Opus 5 23cd448c7f fix(dimension): rotate and mirror dimensions in working planes off world Z
With a working plane other than world XY, ROTATE and MIRROR handed a
non-ordinate dimension to acadrust's Entity::apply_transform, which only
translates those dimension types by where the transform sends the origin.
The definition points, plane and angles stayed unturned, so the dimension
jumped back once its block was baked again.

Send both through the existing Affine branch, which ALIGN already uses and
which transforms points, normal and stored angles together. The world-Z
paths are unchanged.

Co-Authored-By: Claude Opus 5 <[email protected]>
2026-09-14 19:52:20 +09:00
Marcel dfc859dcf5 Restrict parallel offsets to straight polyline segments 2026-09-14 12:47:17 +02:00
Marcel 6f008faa9a Preserve connected arc geometry when moving polyline segments 2026-09-14 12:19:03 +02:00
Marcel e67872386e Preserve connected arc geometry when moving polyline segments 2026-09-14 11:42:30 +02:00