Commit Graph
2902 Commits
Author SHA1 Message Date
codallos 1f71a70580 Fix diameter dimension grip and text alignment 2026-09-16 19:21:03 -06: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
gianlucafiore 8c2d880e65 Fix hatch arc direction for polyline boundaries 2026-09-16 09:14:20 -03:00
Karim Jerbi 624fe53382 feat(snap): editable Snap X/Y spacing with Equal lock, grid snap locks
Drafting Settings dialog gets text inputs for Snap X/Y spacing plus a working Equal X and Y checkbox (mirrored inputs, Y follows X on apply). Snapper gains fixed snap_spacing_x/y (persisted in UserSettings, default 10) decoupled from the adaptive visible-grid step. Grid snap no longer aperture-gated: with Snap On it rounds every point to the grid, object snaps still override by tier. Adds parse/lock regression tests.
2026-09-16 11:39:38 +01:00
Karim Jerbi 1057790456 feat(ui): bring ALIASEDIT to shortcut-editor parity
Port press-to-capture dialog safeguards to the alias editor: transient top draft row with explicit accept, duplicate-alias and unknown-command danger styling plus persistent banners, reset-to-defaults with inline confirmation, Apply and Apply-and-Exit, alias count, Esc-cancels-draft-first, and unsaved-changes guard on close.
2026-09-16 09:32:06 +01:00
Hakan Seven 457f4b3dbb Fix block details hidden by wipeout masks (#1304) 2026-09-16 10:24:55 +03: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
Hakan Seven af847ad92e Merge pull request #1299: Add Windows SpaceMouse navigation 2026-09-16 09:41:25 +03:00
Hakan Seven 306d5d0957 Merge pull request #1302: Preserve valid zero-radius curves 2026-09-16 09:37:48 +03:00
Hakan Seven ffdb79a226 Merge pull request #1297: Fix perspective draw-order clipping 2026-09-16 09:35:59 +03:00
Hakan Seven 8f016d0431 Merge pull request #1298: Fix imported space layer invalidation 2026-09-16 09:31:26 +03:00
Hakan Seven 1a7aad8e04 Merge pull request #1293: Fix constraint indicator visibility 2026-09-16 09:28:49 +03:00
Hakan Seven 01a23673f1 Fix constrained corner and edge grip behavior 2026-09-16 08:45:09 +03:00
Karim Jerbi 1450fdeedf chore(i18n): sync locale catalog and translations with source strings
Remove the dead catalog entry for the deleted XREF dead-end text and add the 389 source strings missing from the catalog (data extraction, drafting settings, panels, commands). Every locale gets the English text as placeholder under common/insert following existing practice. scripts/test_locales.py passes (5077 lookups).
2026-09-15 23:56:32 +01:00
Karim Jerbi 4b351911bf fix(xref): deliver row-menu clicks via press-publishing rows
Each menu row is now a single mouse_area that publishes on PRESS instead of a button nested in a mouse_area. iced_aw ContextMenu keeps its overlay element in the widget struct, so every view rebuild wipes the overlay subtree state - including a button's is_pressed between press and release - and release-time clicks published nothing. Headless simulator tests through the real overlay guard row clicks, flyout clicks, the Change Path Type hover trigger, and pin the subtree-reset mechanism. Requires iced_test as a dev-dependency; the Cargo.lock gpu-allocator/windows edge is pinned back to 0.62.2 (see docs/review-context-menu-click-delivery.md).
2026-09-15 23:56:32 +01:00
Karim Jerbi be32af38a2 feat(xref): per-row path actions and right-click row selection
Row menu Select New Path and Find and Replace now act on the right-clicked row via dedicated XrefRowPathPick / XrefRowFindReplacePrompt messages (prefill + command-line focus, XOPEN output included). Rows use a RightClickArea wrapper so right-click selects the row even though ContextMenu captures the press, and opening or acting on the menu resets the Change Path Type flyout state.
2026-09-15 23:56:32 +01:00
Karim Jerbi 10758f3e59 fix(xref): Change Path Type flyout with hover reveal
The Change Path Type row shows a right-triangle affordance and reveals the Make Absolute / Make Relative / Remove Path submenu beside it. The flyout opens on hover only and a shared submenu-row style removes dead code from the earlier iterations.
2026-09-15 23:56:32 +01:00
Karim Jerbi 1c8e3ff3d7 feat(xref): 8-item filtered row menu, preview on selection, details display size
Row right-click menu is exactly Open, Attach..., Unload, Reload, Detach, Change Path Type group with Make Absolute, Make Relative, Remove Path, Select New Path, Find and Replace. Change Path Type renders as indented group. Open uses OCS for DWG and OS default for images and PDFs. Preview decodes on selection change, not only at refresh. Details shows placed display width and height for image instances.
2026-09-15 23:56:31 +01:00
Karim Jerbi 37085949a6 feat(xref): per-entry nested errors for Detach and Bind row operations
Detach and Bind on nested rows report the CLI-worded per-entry error instead of skipping silently. Adds GUI-path regression tests for every row operation on direct and nested rows, plus Reload All, Overlay, Change Path, and Find and Replace coverage.
2026-09-15 23:56:31 +01:00
Karim Jerbi e9151ea2f4 feat(xref): wider panel default, Attach DWG/Image/PDF menu, status icons
External References dock default 360 to 460 for the column-rich table. Attach split button reads Attach DWG with Attach Image and Attach PDF options, all menu rows full width. List view shows one distinct glyph and theme color per reference status.
2026-09-15 23:56:31 +01:00
Karim Jerbi 22a9bd602c feat(xref): row-level context menu actions and unified split-button toolbar
Right-click actions bound to the row under the cursor, split-button toolbar groups with shared borders and hover states, and a notice when an operation needs a selection first.
2026-09-15 23:56:31 +01:00
Karim Jerbi 494a872e8d feat(xref): row selection, resizable columns, tree view, and find-replace
Single, multi, and range row selection, resizable table columns, hierarchical tree presentation, and find-and-replace through the command line.
2026-09-15 23:56:31 +01:00
Karim Jerbi 019422d220 feat(xref): docked External References panel with previews and translations
Docked External References panel with host row, thumbnail previews, and translated interface strings.
2026-09-15 23:56:31 +01:00
Karim Jerbi d0d946a568 feat(xref): detach, unload, reload, bind, overlay, and path operations
Detach, unload, reload preserving host layer overrides, bind, overlay, and saved-path editing, with per-tab session state and a read-only web list.
2026-09-15 23:56:31 +01:00
Karim Jerbi 42219a4b8c feat(xref): reference list with stale and orphaned status detection
Reference list rows showing stale and orphaned states with handle-based identity.
2026-09-15 23:56:31 +01:00
Karim Jerbi 37e2b50e1c feat(xref): XREF command options and guided XATTACH
XREF command with status, reload, unload, detach, path, pathtype, bind, overlay, and attach options, plus guided XATTACH with unique naming and placement prompts.
2026-09-15 23:56:31 +01:00
Karim Jerbi f56d8a948e feat(xref): reference model with lexical paths, pathtypes, and statuses
Path normalization with stable keys, relative/absolute/none pathtypes, wildcard matching, and reference entries with loaded, stale, missing, and unreferenced states.
2026-09-15 23:56:30 +01:00
Christopher OverbeckandClaude Fable 5.1 8e14b10104 fix(io): keep zero-radius circles and arcs on open
Problem

The open guard rejects circles and arcs with a radius below 1e-10. A normal
open fails when a drawing contains one. The user gets the recovery prompt.
AutoCAD and nanoCAD open these drawings.

The check came from ace99541. Its comment says the tessellator cannot sample
a degenerate curve. That was true of truck's parameter_division. Commit
8c7ebdc9 removed truck. Commit 96be8214 made the kernel sample circles and
arcs by sweep angle with a floored segment count. The reason for the check
no longer exists.

Change

- Remove the near-zero radius check for circles and arcs.
- Keep the checks for non-finite values and radii above 1e10.
- Update the guard comments. The purge rejects parser desync. It does not
  reject degenerate geometry. Be generous in what you accept and strict in
  what you produce.
- Add tests: a zero radius passes the guard, an absurd radius does not.
- Change the automation purge test sample from radius 0 to radius 1e11.

Behavior

- Zero-radius circles and arcs load. They render as dots.
- Tessellation, hit testing, snapping, and hatch boundaries accept a zero
  radius.
- The DXF writer does not change.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-15 16:17:29 -05:00
Christopher Overbeck 4816652c1f Remove comments that repeat association operations 2026-09-15 16:03:17 -05:00
Christopher Overbeck 5424a19482 Track mixed paper and viewport dimension references 2026-09-15 16:00:11 -05:00
Hakan Seven cdf8bfe3ad Fix connected constraint grip previews and preserve anchored endpoints 2026-09-15 23:26:58 +03:00
Christopher Overbeck bd00d679a9 Integrate updated creation branch and upstream constraint fixes 2026-09-15 14:56:10 -05:00
Christopher Overbeck 71aae72219 Integrate upstream constraint editing fixes with viewport dimensions 2026-09-15 14:56:00 -05:00
Christopher Overbeck 64ce0b2e8c Resolve viewport dimension features and preserve valid measurements on refresh 2026-09-15 14:53:45 -05:00
Christopher Overbeck 3274d6d0fd Validate viewport object picks and cover angular arc acquisition 2026-09-15 14:53:29 -05:00
Hakan Seven bfd0c30329 Keep untouched constraint geometry fixed during grip edits 2026-09-15 22:34:57 +03:00
Hakan Seven 07d8d7eb00 Keep opposite line endpoint fixed during grip edits 2026-09-15 22:18:56 +03:00
Christopher Overbeck 7f018ab0f1 Merge viewport creation fixes and current upstream into associations 2026-09-15 14:14:33 -05:00
Christopher Overbeck 2ee3782850 Fix viewport dimension acquisition and preserve measurement scaling 2026-09-15 14:13:19 -05:00
Hakan Seven 08bb17b0b8 Fix constraint editing and glyph feedback 2026-09-15 21:55:40 +03: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
Karim Jerbi d3c12431af fix(command-line): standardize history markers and bold errors 2026-09-15 19:24:02 +01:00
Christopher Overbeck 6a63726eff Add Windows SpaceMouse navigation through 3DxWare 2026-09-15 13:20:19 -05:00
Guy Wydouw 93e65caca2 Fix layer invalidation for imported model space 2026-09-15 19:56:35 +02:00
Christopher OverbeckandClaude Fable 5.1 be7ba3d68e Record viewport associations for new dimensions
Removes PR3's `viewport_frame` seam in `viewport_ref.rs`; the frame is
PR1's camera-derived one everywhere.

The five dimension commands (DIMLINEAR / DIMALIGNED / DIMRADIUS /
DIMDIAMETER / DIMANGULAR) now record a real association when they
measure through a viewport. The commit path's one association gate
(`dimension_association_allowed`, added when PR2 was stacked) gains an
else-branch: where PR2 committed the dimension unassociated and PR1's
inference guard returned an empty source list, `Scene::attach_viewport_
dimension_association` now stores the whole chain — dimension ->
viewport -> block path -> entity -> feature — from the AcceptedSnaps PR1
captured, in definition-point slot order.

* `Scene::dimension_association_slot_points` names that order, including
  the radial dimensions `dimension_reference_points` does not cover.
* `OpenCADStudio::viewport_dimension_snaps` builds the slot array. A snap
  whose paper point is no longer the definition point it fills has its
  model point recomputed from that definition point through the frame:
  the object pick records one click for both extension origins, and a
  rotated DIMLINEAR projects its origins onto the measuring axis.
* Radial dimensions take their own path inside
  `attach_viewport_dimension_association`. Their single reference is an
  osnap type 10 carrying the radial marker (which circle / which polyline
  arc segment) and the angle around it; `source_reference` would hand
  back the generic curve-parameter marker -2, which
  `radial_source_for_marker` cannot find.

One measurement rule, documented in `viewport_ref::measurement_rule`:
`actual_measurement` is always the RAW measurement in the dimension's own
space (paper, for a viewport dimension), and the viewport compensation
lives only in the magnitude of the negative DIMLFAC override, applied
once by the formatter. PR2's persistence already followed it; PR3's
refresh did not — it substituted the model distance times
`model_factor()`, which made a refreshed dimension read `user_lfac` times
too much versus an identical freshly-created one. Refresh now writes the
paper measurement (a debug assert pins resolved paper points to the model
points through the frame), and `axis_distance` goes with it.

Block sub-entity snaps: verified that `block_cache` stamps the top-level
INSERT's handle onto every expanded and clipped sub-wire, so
`wire_source` can only ever report the INSERT — nested inserts included.
`OpenCADStudio::resolve_source_block_path` now descends from that INSERT
at accept time (using the object-pick path's existing
`resolve_measurable_entity`, so arbitrary depth, not just one level) and
fills `SnapSourceRef.block_path` with the real inner entity. Where the
descent cannot identify one — a non-planar-pickable type such as text,
hatch, spline or solid, or nesting past eight levels — the source stays
the INSERT with an empty path, which is coarser but never wrong. Both the
limitation and where it bites are documented on
`Scene::resolve_block_snap_source` and `SnapResult::source`.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-15 12:52:00 -05:00
Christopher OverbeckandClaude Fable 5.1 f80130560e Regenerate viewport dimensions when the viewport view changes
Panning, zooming, twisting or rescaling a layout viewport moves model
geometry across the sheet without touching that geometry, so nothing in
the ordinary entity-change path noticed and the dimensions drawn through
the viewport stayed where they were — detached from what they measure.

`Scene::notify_viewport_changed` announces the viewport itself as a
modified entity. That is all it takes: every trans-space reference
carries the viewport handle as the first link of its chain, so the
dependency lookup in `refresh_associative_dimensions` already finds the
associations from there, and the refresh re-places and re-measures them.

Called from each mutator that changes the paper<->model mapping: pan,
zoom, fit-to-bounds, view normalisation on entering MSPACE, the
view-direction/twist snaps, the viewcube camera path, and both
annotation-scale setters.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-15 12:46:04 -05:00
Christopher OverbeckandClaude Fable 5.1 e8246031fd Remap dimension associations across a copy
COPY, MIRROR and ARRAY duplicated a dimension's baked block but left the
copy with no association at all. Now a copy keeps one, on one condition:
every handle in every chain — the viewport, each INSERT on the block
path, the source entity, and an intersection's second chain — must have
been copied too. Then the whole chain is remapped onto the copies, so
the copy measures the copied geometry.

The condition is all-or-nothing on purpose. A partially-remapped chain
would leave a copy quietly driven by the original's geometry, which is
worse than no association; and copying a dimension on its own still
produces an unassociated dimension, which is exactly what the model
space path did before. It is the same rule `copy_complete_groups` uses
for groups, applied to a longer chain.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-15 12:46:04 -05:00
Christopher OverbeckandClaude Fable 5.1 2697b60d21 Create, resolve and refresh associations through viewports
This wires the chain walker into the association system proper, and adds
the entry point PR2 calls.

Resolution. `resolve_reference_chain` walks the chain, evaluates the
osnap feature in the entity's own coordinates, lifts it to model space
through the block path, and — when the chain goes through a viewport —
projects it onto the sheet with that viewport's `ViewportFrame`. Both
points are kept: the dimension holds paper points, the value it displays
is a model length. `ChainMap` is the one place that conversion lives,
including a `map_radial` that carries a radial source's plane into the
dimension's space so the radius/diameter/arc paths need no viewport
special-casing of their own. Which space a stored osnap point was
written in is not recoverable from the record — our own writer used
model/WCS, AutoCAD's trans-space records use the dimension's space, and
both turn up in the same drawing — so both readings are mapped down to
the entity and the one that lands on the geometry wins. It is only ever
a hint that disambiguates candidates, never the answer.

Creation. `Scene::attach_viewport_dimension_association` takes one
`AcceptedSnap` per definition point and writes the whole chain: viewport
handle, block path, entity, osnap type, sub-entity marker and parameter,
plus `trans_space` on the association. Every link becomes a reactor
target, not just the innermost entity, so a change anywhere along a
chain reaches the refresh through the ordinary dependency index.

Refresh. `refresh_associative_dimensions` now matches a changed handle
anywhere in a chain (including the second chain of an intersection), so
a viewport change reaches the dimensions drawn through it. Perpendicular
and tangent references resolve in a second pass, measured from the other
definition point. A dimension carries its sheet annotation with it: the
dimension-line standoff and a user-dragged text position move by the
centroid shift of the points that actually moved, so a one-ended edit
keeps the dimension line centred instead of collapsing it. For a
trans-space linear or aligned dimension the displayed value is
recomputed from the model points and multiplied only by the user's
DIMLFAC (`MeasurementScale::model_factor`) — the viewport compensation
is inherent in having measured in model space, and applying it again is
the double-scaling this three-PR effort exists to stop.

Broken references. Brokenness is derived, never written: a reference
whose source was erased simply stops resolving, the dimension keeps its
last valid appearance, and the record is left byte-for-byte as it was.
An undo that restores the source restores the link with no extra
bookkeeping. `Scene::dimension_association_status` reports it per slot.
`dimension_is_associative` now walks the chain too, instead of accepting
any surviving handle in `xrefs` — which was true even for a trans-space
reference whose actual geometry had gone, because the viewport was still
there.

Undo. Creating an association journals the new object and every reactor
list it touches; refreshing a dimension journals the dimension's
before-image. Both were previously invisible to the delta recorder.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-15 12:46:03 -05:00
Christopher OverbeckandClaude Fable 5.1 64c534f511 Resolve dimension references through viewport and block chains
An `AssocDimensionReference` addresses a feature through a chain of
handles — dimension -> [viewport] -> [insert ...] -> entity -> feature —
stored in `xrefs` (AutoCAD's `mainObjectIds`). The existing resolver read
only `xrefs[0]`. That is right for a model-space dimension on top-level
geometry and wrong for everything else: a paper-space dimension measuring
through a layout viewport has the VIEWPORT first, so resolution stopped
on a viewport entity, found no curve and gave up. Nine of the ten
association objects in the 115448 regression drawing are that shape.

`dimension_assoc_chain` walks the chain positionally, which is all the
file gives us: a leading VIEWPORT is the trans-space hop, INSERTs after
it are the block-instance path (with their composed transform), and the
first handle that is neither is the geometry. A chain of nothing but
INSERTs ends on the innermost one, which is how a block reference's own
insertion point is dimensioned. A handle that is no longer in the
document comes back as `ChainError::Missing` rather than as a silent
failure, so the caller can tell a broken link from an unsupported one.

The module also evaluates the osnap feature itself, in the entity's own
coordinates: centre, midpoint, quadrant, node/insertion, nearest,
perpendicular, tangent (closed form on a circle or arc; a Newton
refinement of (C(u) - P) . C'(u) = 0 on a spline, seeded from the stored
parameter — the shape of the 115448 tangent-to-spline reference), and
intersection / apparent intersection against the second object chain.
Types we do not evaluate return None and keep their stored data, so an
unsupported reference is left unresolved instead of being replaced by a
guess.

`Transform` has no inverse of its own and a block path is always affine,
so the 3x3 cofactor inverse lives here too. All arithmetic is f64.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-15 12:46:03 -05:00
Christopher OverbeckandClaude Fable 5.1 417e8e3676 Add a viewport frame seam for dimension association resolution
PR3 has to map a resolved model point onto the sheet, which needs the
layout viewport's paper<->model mapping. PR1 (feat/viewport-snap) owns
`Scene::viewport_frame` and is not visible from this branch, so this adds
the minimal stand-in the shared contract in `viewport_ref.rs` describes:
paper_center from the viewport rectangle's centre, model_target from the
saved view target, scale from `vp_effective_scale`, twist from the saved
view twist.

It is fenced off in one clearly marked block with merge instructions.
PR1's version is camera-derived, because it must agree with what is
actually drawn — including the auto-fit rescue `camera_for_viewport`
applies to stale saved views. Nothing else in PR3 reads viewport fields
directly, so replacing this one function is the whole merge.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-15 12:46:03 -05:00