cad-editor/src/app/commands
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Hakan Seven 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 <noreply@anthropic.com>
2026-07-23 13:32:26 +03:00
..
blocks.rs fix(xref): show merged xref layers in Layer Manager on attach (#407) 2026-07-21 15:59:26 +03:00
dim.rs feat(view): bare ZOOM prompts with mode options 2026-07-21 23:18:18 +03:00
display.rs feat(commands): prompt the path/file commands for their path (bucket D) 2026-07-16 14:40:11 +03:00
draw.rs feat(commands): step POLYSOLID (select polyline, then width + height) 2026-07-16 14:47:45 +03:00
fileops.rs feat(commands): prompt the path/file commands for their path (bucket D) 2026-07-16 14:40:11 +03:00
inquiry.rs feat(pedit): convert prompt, join, fit/spline/decurve; join fixes (#263) 2026-07-22 20:06:04 +03:00
layerprops.rs fix(plan): show options on activation instead of flipping the view (#326) 2026-07-22 16:53:32 +03:00
layers.rs feat(commands): step the rest of the keyword/value commands 2026-07-16 13:29:04 +03:00
mod.rs feat(select): PICKADD/PICKDRAG command-line toggles (#226) 2026-07-22 21:35:37 +03:00
styleprops.rs fix(purge): drop orphaned blocks, anonymous blocks, and stale draw-order 2026-07-23 13:32:26 +03:00
view.rs feat(commands): prompt the path/file commands for their path (bucket D) 2026-07-16 14:40:11 +03:00