Commit Graph
794 Commits
Author SHA1 Message Date
Hakan Seven 4bf14baea4 feat(ui): add configurable Iced themes 2026-07-28 09:33:12 +03:00
Hakan Seven 73545520c8 refactor(tabs): use context menu widget 2026-07-28 01:34:45 +03:00
Hakan Seven ce1091cea5 refactor(ui): use pin for anchored overlays 2026-07-28 01:25:39 +03:00
Hakan Seven b9de8940bc refactor(statusbar): unify popup menus 2026-07-28 01:02:00 +03:00
Hakan Seven d5be78a187 fix(selection): separate transient visibility
Keep object isolation out of persisted entity visibility and clear stale grips across block-editor transitions.

Refs #512

Refs #517
2026-07-27 23:36:02 +03:00
Hakan Seven 7f41e1666f feat(options): set default save format
Avoid false data-loss warnings when preserving the source format.\n\nCloses #529
2026-07-27 22:37:47 +03:00
Hakan Seven c21f3e1a19 feat(tabs): add drag-and-drop reordering
Closes #526
2026-07-27 22:14:58 +03:00
Hakan Seven b629dc32de feat(wipeout): add polygon creation modes
Closes #528
2026-07-27 21:50:50 +03:00
Hakan Seven b8889ccd20 feat(mview): add viewport creation options
Support polygonal and object viewports through native clip-boundary handles, including clipped rendering and selection.

Closes #525
2026-07-27 19:28:51 +03:00
Hakan Seven a3538ddc45 fix(mleader): use lineweight choices
Replace the raw sentinel input with typed CAD lineweight options so special
values display correctly and unsupported values cannot be entered.

Refs #522
2026-07-27 18:09:28 +03:00
Hakan Seven dce2533767 fix(start): collapse panels by available space
Collapse Tutorials, Supporters, then Recent Documents as the panels stop
fitting.

Refs #519
2026-07-27 17:57:46 +03:00
Hakan Seven 4a30928f5a fix(ui): refine empty drawing state
Show drawing defaults when nothing is selected and disable layout controls on Start.

Refs #514
Refs #515
2026-07-27 17:37:17 +03:00
Hakan Seven 759f2316aa fix(hatch): apply pattern property edits
Closes #476
2026-07-27 16:44:31 +03:00
Hakan Seven ecb29767d4 feat(offset): add multiple mode
Closes #477
2026-07-27 16:21:31 +03:00
Hakan Seven 8018ab1523 feat(view): implement LIMITS command
Closes #478
2026-07-27 16:15:28 +03:00
Hakan Seven 2acc4f7978 fix(io): guard concurrent drawing saves
Hold edit leases and compare disk fingerprints before replacement so another editor cannot be silently overwritten.

Offer retry, reload, Save As, or explicit overwrite recovery.

Closes #498
2026-07-27 13:18:31 +03:00
Hakan Seven 9d973a0fd6 feat(ui): add drawing tab context menu
Refs #493
2026-07-27 13:18:31 +03:00
Hakan Seven 7f1a1ff57b fix(viewport): stabilize grid and grip clipping
Keep the grid on UCS XY, derive spacing from zoom, and clip perspective lines by screen density without dropping the near side.
2026-07-27 11:36:07 +03:00
Hakan Seven 6fb68d1c7c feat(scene): integrate DWG object data 2026-07-26 23:38:38 +03:00
Hakan Seven eb23715605 feat(scene): integrate standard DWG data 2026-07-26 22:30:14 +03:00
Hakan Seven 731df4a725 feat(cad): integrate standard codec coverage
Render, edit, query, select, and explode newly decoded standard entity variants. Pin acadifc de8d6b5 and preserve None color semantics.
2026-07-26 19:30:43 +03:00
Hakan Seven bca65600cd fix: stabilize web loading and paper rendering 2026-07-25 21:34:29 +03:00
Hakan Seven deec48ad99 perf: keep heavy work off UI thread 2026-07-25 18:49:18 +03:00
Hakan Seven 12bf126646 perf: remove large drawing stalls
Keep resident geometry and GPU resources stable across edits, MSPACE zoom, and Model/Paper switches. Add unified PERF output for tracing remaining costs.
2026-07-25 13:34:48 +03:00
Hakan Seven 2bc4c1c8f3 perf: eliminate initial hover freeze 2026-07-25 10:09:23 +03:00
Hakan Seven 39449ec684 perf: speed large drawing workflows 2026-07-25 09:05:52 +03:00
Hakan Seven 71e0b88839 perf: optimize large drawing workflows 2026-07-25 02:58:46 +03:00
Hakan Seven da34c6817a perf: eliminate dense edit stalls
Keep resident wires, draw depths, GPU slabs, and edit history incremental across entity changes. Defer rollover work to avoid cursor jumps on dense drawings.
2026-07-25 01:06:00 +03:00
Hakan Seven ea93e169ea perf: make edit history incremental
Replace full-document snapshots with Arc first-touch deltas and batch cache invalidation. Reuse interaction and GPU category caches across unrelated edits.
2026-07-24 23:25:33 +03:00
Hakan Seven 90714d34b2 perf: expand spatial interaction indexing
Share subprimitive broad-phase queries across snap, hover, selection, hatch, and mesh paths while preserving exact hit tests.\n\nRefs #433
2026-07-24 22:00:40 +03:00
Hakan Seven 4db763ef27 perf: unify spatial interaction queries
Dense drawings previously rescanned full geometry for snapping, tracking, and selection.\n\nRefs #433
2026-07-24 20:49:05 +03:00
Hakan Seven ece5598372 fix: correct viewport stretch and SHX plots
Anchor the opposite viewport corner during grip and STRETCH resizing.
Match plotted stroke-font pen widths to the SDF atlas unless CTB overrides.

Closes #435
2026-07-24 19:26:10 +03:00
Hakan Seven ceddb287f5 fix(renderer): match leader and dash styles
Read canonical ACAD/DSTYLE overrides for leader color and arrow size. Scale block-local linetype patterns through INSERT transforms.

Closes #436
2026-07-24 19:04:57 +03:00
Hakan Seven a413f75548 fix(snap): preserve OTRACK precision
Keep tracking geometry in f64 until screen projection so typed and dynamic distances no longer expose f32 drift.\n\nCloses #439
2026-07-24 17:56:06 +03:00
Hakan Seven 658aa4a4a5 fix(start): complete Start page workflow
Track Save As paths, persist the selected section, and size tabbed
panels from their actual available width.

Refs #443
2026-07-24 17:44:07 +03:00
Hakan SevenandClaude Opus 4.8 0e61836e91 fix(properties): name AEC / proxy objects instead of "Unknown"
Selecting a proxy object we render from its cached graphics (an AEC
Wall/Door/Window and the like) showed "Unknown" as its type. The entity
now carries its real DXF class name from the CLASSES section (acadrust
bump), so surface it: ui_name_or_class title-cases the class ("AEC_WALL"
→ "Aec Wall") for the properties Type row and the status-bar label, and
still says "Unknown" only when the class truly can't be named.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-07-23 23:59:27 +03:00
Hakan SevenandClaude Opus 4.8 f1a348260f fix(group): preserve groups when pasting, cross-drawing too
PR #446 kept a fully-copied group grouped for the in-drawing COPY/ARRAY
path, but clipboard paste (Ctrl+C / Ctrl+V, PASTECLIP) runs through
finalize_paste, a separate route that never touched groups — so pasted
copies came out ungrouped, and a cross-drawing paste had no group data at
all.

Unify all copy routes on one shared Scene::recreate_groups(sources,
handle_map): copy_complete_groups now gathers the live source groups and
delegates to it, while paste snapshots the complete groups into the
clipboard at copy time (ClipboardDeps.groups) and recreates them over the
pasted handles. A group whose whole membership is copied now stays grouped
whether the copy lands in the same drawing, via the clipboard, or in a
different file; partially-selected groups still stay ungrouped.

Closes #440

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-07-23 15:09:06 +03:00
Jonathan 27cd957e4e Merge branch 'HakanSeven12:main' into main 2026-07-23 13:14:53 +02:00
Hakan SevenandClaude Fable 5 f2ad1cc0c8 feat(thumbnail): on-screen framing + PNG/RLE8 preview, far smaller files
The embedded DWG preview was the whole drawing fit to a canvas, encoded
as a 24-bit uncompressed DIB (~180 KB at 256²) — the bulk of the gap
between an OCS-saved file and AutoCAD's. Three changes:

- Frame it like the screen. `from_scene` now projects every wire vertex
  through the live camera into a viewport-aspect canvas, so the thumbnail
  is the current pan / zoom / rotation and only the visible region, not
  the full extent. Off-screen / clipped segments don't draw (a `None`
  projection or NaN separator breaks the polyline run). Works for any
  view. `stamp_thumbnail` passes the model pane's pixel size and the
  target version.

- PNG for R2013+ (AC1027+). A line drawing on a flat background is almost
  one colour, so PNG collapses to a few KB. PNG previews are only valid
  from R2013, so older targets keep a BMP.

- BMP is now 8-bit palettised, BI_RLE8-compressed (was 24-bit raw). The
  long single-colour runs of a preview compress to a handful of KB; a
  view with >256 colours (rare) falls back to the 24-bit DIB. A full
  256-entry palette is written so the reader's `(1<<bpp)*4` pixel-data
  offset lands correctly.

Net: the preview drops from ~120 KB to ~2-5 KB on every version.

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-07-23 14:09:38 +03:00
Jonathan 3e48959456 Merge branch 'main' of https://github.com/HakanSeven12/OpenCADStudio 2026-07-23 13:07:55 +02:00
Jonathan 39ae993b48 Fix: group copies 2026-07-23 13:07:29 +02:00
Hakan SevenandClaude Fable 5 3326c5f0c8 fix(purge): drop orphaned blocks, anonymous blocks, and stale draw-order
PURGE left behind three classes of dead data that AutoCAD removes,
so an OCS-purged drawing stayed far larger than AutoCAD's (a 23 MB test
file purged to 3.5 MB in OCS vs 0.58 MB in AutoCAD):

- Anonymous blocks (`*U`/`*D`/`*T`/dynamic-block variants) were skipped
  wholesale. Leftover unreferenced ones now purge like AutoCAD's, held
  live only when actually referenced.

- Block liveness now comes from REACHABILITY: a block is kept only if it
  is reached from a real layout container by following block references
  (INSERT names, dimension *D, table *T / cell blocks, MultiLeader
  content). The old flat "named by some INSERT" scan could not free a
  mutually-referencing dead subgraph — e.g. the dependent blocks a
  detached xref leaves behind, whose head carried a DANGLING layout
  handle that `is_layout()` mistook for a real layout and shielded. That
  subgraph (here 467k lines) is now purged; live xrefs, reached from the
  layout that inserts them, stay. The used-set also gains the by-handle
  block references (table/MultiLeader/dimstyle-arrow) so purging
  anonymous blocks can't delete an in-use block no INSERT names.

- SortEntitiesTable objects (per-block draw order) were never removed, so
  each purged block's table lingered still listing the handle of every
  deleted entity — 341k stale handles / ~2.7 MB of dead weight the save
  re-emitted. Drop every table whose owning block is gone.

Net on the test file: 3.5 MB -> 0.81 MB (AutoCAD 0.58 MB).

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-07-23 13:32:26 +03:00
Hakan SevenandClaude Fable 5 1f4bdfa741 fix(save): default Save-As format to the drawing's own version
The Save-As dialog hard-coded the format dropdown to the latest
(DWG/DXF 2018) regardless of what was opened, so a round-trip silently
re-targeted the version. Default it to the loaded document's own version
and DWG-vs-DXF kind instead (from `document.version` + the file
extension), which always matches one of the dropdown options. A new,
unsaved drawing keeps its document default. QSAVE on an existing file
already preserved the version; only Save-As was wrong.

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-07-23 13:32:26 +03:00
Kevin GriffinandClaude Fable 5 f347a20a4c perf(scene): return the memoized wire set by Arc, not by deep copy
entity_wires() cloned the entire wire set — every point, fill, and snap
buffer of every entity — on each call, although the set is already
memoized behind an Arc and none of the 18 call sites mutates it. On
large mesh imports (#358: 42M faces, ~210 MB of wire content per 1M
triangles) that is a multi-GB allocation + memcpy on every pick, snap,
selection, or plot pass.

Return the Arc instead. Call sites iterate as before; the two
window-plot paths that build a culled owned subset now clone only the
wires inside the plot window, and the print pipeline moves the Arc into
its async task.

Measured (tests/mem_probe_meshent.rs, 1M-triangle MESH, release):
resident after entity_wires() drops 758 -> 547 MB (866 -> 646 B/face).

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-07-22 12:56:36 -07:00
Hakan SevenandClaude Fable 5 0c578b03f3 feat(select): PICKADD/PICKDRAG command-line toggles (#226)
PICKADD 0 = click/box/lasso replaces the selection (Shift toggles),
empty click clears; PICKADD 1 (default) keeps today's accumulate.
PICKDRAG 1 = press-drag spans a rectangle marquee through the box
machinery; PICKDRAG 0 (default) keeps the freeform lasso. Both persist
in settings.json. Also re-points the start-page gate test at the
start_allowed fn it moved into (#388/389 refactor left it broken).

Closes #226

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-07-22 21:35:37 +03:00
Hakan SevenandClaude Fable 5 90fd69df06 feat(matchprop): match every style-affecting property (#281)
MATCHPROP copied only the general properties (and text style/height),
so matching dimension-to-dimension or hatch-to-hatch looked like it did
nothing — the visible differences live in type-specific style fields.

General set gains transparency. match_special_props transfers every
STYLE-affecting field the destination supports — never content or
placement:

- Text: style, height, width factor, oblique (style+height cross
  TEXT <-> MTEXT); MText adds line spacing, drawing direction and the
  background fill block.
- Dimension / Leader / Tolerance: the dim style name crosses all
  three, and the ACAD_DSTYLE override record is replicated through
  set_entity_xdata (cleared on the destination when the source carries
  none, so the match is exact). Restyled dimensions drop their baked
  *D block and repaint immediately.
- Hatch: pattern definition, type, angle, scale, solid flag and
  gradient — the boundary stays.
- LwPolyline: constant width (vertex widths included) and linetype
  generation.
- MultiLeader: style plus all style overrides (path type, line
  color/type/weight, landing/dogleg, arrowhead, text style/color/
  frame/height, overall scale, override flags); leader geometry, text
  and block content stay.

Closes #281

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-07-22 20:24:53 +03:00
Hakan SevenandClaude Fable 5 e7eb84b514 feat(pedit): convert prompt, join, fit/spline/decurve; join fixes (#263)
PEDIT reworked around a mode machine:

- Picking a line/arc asks "Object is not a polyline. Turn it into one?
  [Yes/No] <Y>" — Yes converts in place (arc keeps its bulge) and
  editing continues on the result. Pickfirst: an already-selected
  polyline skips the select step, a selected line/arc goes straight to
  the convert prompt.
- Join gathers with the normal selection system (single picks AND
  window/crossing boxes) and merges through the JOIN machinery.
- Fit replaces every segment with a classic equal-parameter BIARC: two
  arcs per segment meeting tangentially at an inserted knee, both
  segments at a vertex sharing that vertex's tangent — the whole run is
  tangent-continuous (verified: zero tangent jump on L/closed/zigzag/S
  shapes). Spline resamples the vertex frame as a uniform cubic
  B-spline (8 samples per span); Decurve straightens every bulge.
- Earlier hardening kept: undo snapshot before the mutation, immediate
  repaint, polyline-only pick validation.
- Vertex editing lives on grips, so no Edit-vertex submode; instead the
  vertex grip hover menu gains Break — a closed polyline opens at the
  vertex, an open one splits into two (interior vertices only),
  handled driver-side as an entity replacement.

JOIN itself: segs_of now emits one segment per span of an OPEN
polyline (bulges kept), so polylines merge with their neighbours —
PEDIT Join's set always contains the target polyline and used to abort
every time; plain JOIN had the same gap. JOIN also honours pickfirst:
launched with two or more objects selected it joins them immediately.

Closes #263

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-07-22 20:06:04 +03:00
Hakan SevenandClaude Fable 5 b32a9b4083 fix(plan): show options on activation instead of flipping the view (#326)
PLAN acted like a ViewCube TOP click the moment it ran — already on Top
meant an immediate flip to Bottom, and the options never appeared. It
now prompts "[Current ucs / Ucs / World] <Current>:" right on
activation and only changes the view once an option runs: Current =
plan of the active UCS, World = world XY, Ucs = prompts for a named UCS
(case-insensitive lookup). The new plan_snap goes straight to the plan
view with no flip-to-opposite cube behaviour.

KeywordCommand gains with_default(): a bare Enter at the verb step
dispatches the default verb (PLAN's <Current>) instead of cancelling.

Closes #326

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-07-22 16:53:32 +03:00
Hakan SevenandClaude Fable 5 51f07f1208 feat(snap): Shift hard axis lock during point picks (#312)
Holding Shift while a command asks for a point captures the nearest
polar increment (or ortho axis, UCS-aware) from the rubber-band base
toward the cursor and pins the pick to that ray. Every candidate —
osnap hits included — projects onto the locked direction, so a snap far
off-axis contributes only its along-axis component; the click commits
exactly what the preview shows. The direction stays fixed while Shift
is held and drops the moment it releases. Grip drags get the same lock
from the grip origin.

Guards: engages only when the active command wants a point — never
during entity picks (Shift there is the TRIM/EXTEND swap), tangent
picks, selection gathering or window-corner picks.

Closes #312

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-07-22 16:34:47 +03:00
Hakan SevenandClaude Fable 5 9b28170d4b fix(undo): grip-drag history entry + mid-command Ctrl+Z steps (#332)
Grip drags mutated the document without ever pushing history — dragging
a polyline vertex (or any grip) could not be undone. The release-commit
now swaps the pre-drag backup in, snapshots that PRE state as a "GRIP"
entry, swaps the dragged result back and clears the redo stack; the
Esc-cancel path is unchanged and a no-move engaging click records
nothing.

Ctrl+Z during a drawing command steps the command instead of the
document undo swallowing the in-progress object (which also killed the
active command): new CadCommand::on_undo_step hook, consulted before
undo_active_tab. PLINE pops its last vertex (shared with the U option),
LINE reverts the last committed segment and keeps drawing from the
previous point (rides its existing U/UndoDocument path), and ARC
Continue reverts the last arc and resumes from the prior anchor with
the correct tangent via a new anchor history. With nothing placed yet
each falls through to the document undo.

Also drops the two warnings the #336 work left behind (unused Entity
import, dead Snapper::override_active).

Closes #332

Co-Authored-By: Claude Fable 5 <[email protected]>
2026-07-22 15:48:22 +03:00