Files
cadcraft/crates/engine
3146b47656 fix(engine): WBLOCK writes only what the block or selection uses (#2423) (#2621)
* fix(engine): WBLOCK writes only what the block or selection uses (#2423)

WBLOCK of a block, or of selected objects, copied the source drawing's
whole layer, linetype, style and block tables into the new file, so a
5-object symbol carried 40 unused layers and 20 blocks. The written
drawing is now purged of what nothing in it uses, as AutoCAD's WBLOCK
writes it: purge::purge_unused runs PURGE All's scan on a plain Drawing
until a pass removes nothing (a block can free its layer), keeping the
defaults and the current ones. Writing the entire drawing is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(engine): PURGE's scan counts leaders' dimension styles and styles used by other styles

From the review of #2621: PURGE (and now WBLOCK, which runs its scan)
took as unused a dimension style only a LEADER used, a linetype only a
dimension style or a dimension's override named (DIMLTYPE, DIMLTEX1,
DIMLTEX2), and a text style only a complex linetype's text used, and
removed them while the objects still named them. The scan counts all
three now; text_styles_in_use, which STYLE's delete also asks, includes
complex linetypes' text styles.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(engine): PURGE's scan counts multiline styles' linetypes and table styles' text styles

From the review of #2621: a linetype only a multiline style's element
used, and a text style only a table style's cell style used, were taken
as unused and purged while the styles still named them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: austin62jake <340374338+austin62jake@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-02 14:25:41 -07:00
..