Commit graph cad-editor/Cargo.lock
Author SHA1 Message Date
Hakan Seven
de37ee04bf fix(scene): viewport auto-fit fallback + f64-precision projection
Three changes to make paper-space viewports render correctly on
UTM-scale drawings whose viewports were saved with default
view_target=(0, 0, 0) and a view_center pointing at empty WCS:

1. **Auto-fit fallback.** When the saved view's WCS rect doesn't
   overlap the IQR-bounded content cluster (`world_offset ±
   local_extent_max`), override `view_center` with `world_offset` and
   recompute `view_height` to fit the cluster into the paper viewport.
   Matches AutoCAD's silent auto-fit-on-open for stale / uninitialized
   viewports; without it those viewports rendered blank.

2. **f64 projection inner loop.** The previous f32 path computed
   `(wire_offset_rel - target_offset_rel).dot(view_right) -
   view_center` by subtracting values at ~5e6 magnitude (f32 ULP
   ~0.5 m) to land on a small paper offset. The cancellation produced
   centimetre-scale jitter on paper output even when the model was
   clean. Reconstruct the wire WCS coord, subtract the display center,
   and dot-project in f64; cast to f32 only at the final paper
   position where magnitudes are bounded by the viewport rect.

3. **examples/inspect_viewports.rs** — diagnostic that dumps every
   viewport's saved view fields (view_target, view_center, view_height
   vs paper height, custom_scale, status flags) plus drawing-level
   insertion_units and model-space extents. Used to verify that
   acadrust's DWG reader reads view_height correctly; the
   `view_height == vp.height` patterns observed on real files turn out
   to be genuine "default 1:1" file content rather than a reader bug
   (a round-trip test through DwgWriter / DwgReader survives all
   per-viewport values).

Also: switch the `acadrust` patch from `HakanSeven12/acadrust@feat/
expose-blockrecord-is-loaded` (a stale branch with the abandoned
is_loaded experiment) to `hakanaktt/acadrust@main`. Upstream main
now carries the layout paper-dimensions and mirrored-arc fixes that
this branch used to add — plus PR #20's DXF reading fixes that the
old branch was missing.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 19:32:36 +03:00
Hakan Seven
68fe77c133 chore: release v0.2.9
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-16 13:04:58 +03:00
Hakan Seven
a997490814 chore: release v0.2.8
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 23:39:19 +03:00
Hakan
4d58a905e0 chore: release v0.2.7
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 09:46:47 +03:00
Hakan
e88a946176 feat(xref): honor BlockRecord is_loaded — skip Unloaded xrefs
When the host DWG marks an xref as Unloaded (via XREF→Unload in
AutoCAD), the user explicitly chose NOT to load that reference. We
were ignoring that and pulling the external file in anyway, which
on large drawings could push GPU memory past the device budget.

Bump the acadrust dep to the branch that exposes
`BlockRecord::is_loaded`, then short-circuit `resolve_xrefs` for
any entry with `is_loaded == Some(false)`. New `XrefStatus::Unloaded`
surfaces this in the command-line log so the user can see which
references were skipped (and can re-load them via the XREF dialog).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-14 11:20:11 +03:00
Hakan
2e985fdc9c chore: release v0.2.6
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-13 17:34:21 +03:00
Hakan Seven
2600ae1815 chore: release v0.2.5 2026-05-12 22:29:22 +03:00
Hakan Seven
406e04f2f0 chore: repin acadrust to 622729f on clean HakanSeven12 fork
Old fork was deleted and re-forked from upstream; the mirror-handedness fix
is now isolated on fix/mirrored-arc-handedness with no other diverging work.
2026-05-12 22:18:23 +03:00
Hakan Seven
200f10fd25 fix(explode): correct arc/ellipse direction in mirrored INSERT blocks
Mirrored INSERTs reverse OCS handedness, but acadrust's explode used to
keep the original normal — making CCW-around-normal arcs and ellipses
sweep the wrong way. The fix lives in acadrust 7c711e9, which flips the
new normal when det < 0 and reprojects center/major_axis/angles into the
new OCS. H7CAD's fix_mirrored_arc workaround is no longer needed.
2026-05-12 22:04:12 +03:00
Hakan Seven
04b898106c chore: release v0.2.4 2026-05-12 20:54:03 +03:00
Hakan
4b4c0d31d2 chore: switch acadrust to GitHub source, fix removed is_annotative field
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-07 09:50:02 +03:00
Hakan Seven
b83c982bc2 fix(scene): hatch pattern scale and per-entity annotative check
- Hatch pattern_scale multiplied by annotation_scale in model space so
  pattern density stays consistent when CANNOSCALE changes
- Annotative check now uses AcAnnoPO xdata (R2007+ marker) instead of
  relying solely on group-code-293 flag; falls back to is_annotative
  for files with no xdata (old DXF backward compat)
- acadrust patched to local path for is_annotative field

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-06 22:19:28 +03:00
Hakan
543c626feb chore: release v0.2.3
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-06 11:50:13 +03:00
Hakan Seven
8be415213a chore: release v0.2.2 2026-05-03 21:40:24 +03:00
Hakan Seven
97169bf1d6 chore: bump version to 0.2.1
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-02 15:46:17 +03:00
Hakan Seven
428a115acf chore: update H7CAD version to 0.2.0 in Cargo.lock 2026-05-01 20:53:45 +03:00
Hakan Seven
9974456a5d chore: bump version to 0.1.9
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-01 15:54:37 +03:00
Hakan Seven
9d6efe326a chore: bump version to 0.1.8
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-01 10:54:36 +03:00
Hakan Seven
3298ebff91 fix: use PlotSettings paper dimensions for correct paper-space rendering
paper_limits() now reads paper_width/paper_height/plot_rotation from the
Layout object (populated by a patched acadrust from the embedded DWG
PlotSettings). This fixes layouts where min/max_limits do not match the
physical paper size (e.g. A4 portrait content inside A3 landscape limits).

DXF files use codes 44/45/73 from raw_plot_settings_codes; DWG files use
the PlotSettings block embedded in the LAYOUT object. Both fall back to
min/max_limits when paper_width is zero.

Depends on HakanSeven12/acadrust feat/layout-paper-dimensions (PR #21 on
hakanaktt/acadrust); using that fork until the PR is merged.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-01 08:04:35 +03:00
Hakan Seven
089612584d chore: bump version to 0.1.7
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 17:08:32 +03:00
Hakan Seven
432e35ded3 perf: parallel wire tessellation with Rayon (Option C)
Extract tessellate_one body into a Send-compatible free function
tessellate_entity, then drive it with rayon::into_par_iter() in
wires_for_block(). Spreads file-open and post-edit tessellation across
all CPU cores. Navigation frames are unaffected (Options A/B cache
eliminates per-frame tessellation entirely).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-26 02:36:34 +03:00
Hakan Seven
87eabc9372 chore: bump acadrust 0.3.3 → 0.3.4, H7CAD 0.1.5 → 0.1.6
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 01:51:15 +03:00
Hakan Seven
de04b7e351 chore: bump version to 0.1.5
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 22:23:00 +03:00
Hakan Seven
070ad1f9c5 feat: add Report/About/Changelog buttons to Support ribbon group
- REPORT opens GitHub new-issue page
- ABOUT opens a dialog window with version, OS and arch info + Copy Info button
- CHANGELOG opens GitHub releases page
- Fix Windows build: add windows-sys as target-specific dependency for PRINT command

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 22:22:33 +03:00
Hakan Seven
62fbaf5da4 fix: hide block definition entities from viewport
Block-definition geometry (entities stored inside named blocks) was
leaking into the viewport when DXF files omit the owner-handle group
code (330) on block-content entities.

The fix tightens `belongs_to_visible_block`: when `owner_handle` is
null, the current layout block-record's `entity_handles` list is used
as the authoritative allow-list before falling back to the older
"not-in-any-other-block" heuristic.  This ensures block definitions
are never rendered directly, only when referenced via an INSERT.

Bumps version to 0.1.4.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-22 22:03:32 +03:00
Hakan Seven
4312b6c3a5 feat: raster image render pipeline (IMAGE command + GPU textured quad)
- Add IMAGE / IMAGEATTACH / IM command with async file-picker (rfd)
- src/scene/image_model.rs: ImageModel with RGBA pixel data + quad corners
- src/scene/pipeline/image_gpu.rs: ImageGpu with wgpu texture, sampler, opacity uniform
- src/scene/pipeline/mod.rs: image render pipeline (pass 2, between hatches and meshes)
- src/scene/render.rs: include images in Primitive, call upload_images in prepare
- src/scene/mod.rs: images HashMap, populate_images_from_document, cache on add_entity
- src/modules/home/draw/raster_image.rs: ImageCommand (two-click: origin + width, aspect-correct preview)
- src/io/mod.rs: pick_image_file() async helper (file dialog + dimension decode)
- app: ImagePick / ImagePickResult messages, populate on file open and undo/redo

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-06 23:19:08 +03:00
Hakan Seven
98578cc5c0 Chore: bump version to 0.1.3 2026-04-03 22:03:26 +03:00
Hakan Seven
6f62a6eb6f acadrust update 2026-04-03 21:52:00 +03:00
Hakan Seven
748d90af7e Fix: disable snap during entity-pick and selection-gathering modes
Snap is now suppressed (both cursor indicator and coordinate snapping)
when a command is in entity-pick mode (needs_entity_pick) or
selection-gathering mode (is_selection_gathering), and restored
automatically when the mode ends.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-31 23:05:24 +03:00
Hakan Seven
e1d296da10 Phase 7: Plot settings and PDF export
- Add printpdf 0.9.1 dependency for native PDF generation.
- New src/io/pdf_export.rs: converts paper-space WireModels to a PDF
  page (per-wire stroke color, line weight in Pt, NaN-split segments).
  White/near-white colors are inverted to black for print output.
- Add PlotExport / PlotExportPath messages: opens a save-file dialog
  and writes a .pdf next to the drawing file.
- Add PageSetupOpen/Close/WidthEdit/HeightEdit/Commit messages: a
  centered modal panel lets the user enter paper width and height (mm);
  on commit the Layout object's min/max_limits are updated in-place.
- Register PRINT / PLOT / EXPORT and PAGESETUP (PS) commands in
  dispatch_command; fix MVIEW error message to English.
- Layout ribbon gains a "Plot" group with Page Setup and Export PDF
  ribbon buttons.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-31 08:05:17 +03:00
Hakan Seven
ab2e7b508d version update 2026-03-31 00:39:03 +03:00
Hakan Seven
d2fdac7f1e first commit 2026-03-22 14:56:27 +03:00