Skip to content

DWG 2013 and 2018: solids and regions keep their geometry (data store section) - #19

Merged
SkryxDev merged 1 commit into
mainfrom
dwg-datastore
Nov 14, 2026
Merged

SkryxDev merged 1 commit into
mainfrom
dwg-datastore

Conversation

@SkryxDev

Copy link
Copy Markdown
Member

What

From AutoCAD 2013, 3DSOLID, REGION and BODY keep their modeler description in the DWG's data store section (AcDb:AcDsPrototype_1b). DraftCraft's DWG writer didn't write it, so these entities were left out of 2013/2018 saves, and the reader didn't read it. Now both do.

  • crates/dwg/src/datastore.rs (new): the section read to records and written as AutoCAD lays out a new store (segment index, data index, data segments, blob01 pages for records over 0x40000 bytes, schema index and data, search index). The reader is checked and capped against hostile bytes. AutoCAD's empty sections are written back byte for byte.
  • Writer: the section is added after AcDb:XrefManifest when the drawing has solids. The 2013+ modeler entity is written as AutoCAD writes it (wireframe block, group 290, GUID, history), with the "data store" bit of its common entity data set. Without that bit AutoCAD reports "ASM body missing" for every solid, even though the section holds them.
  • Reader: decodes the 2013+ entity and turns the section's records into the DXF's ACDSDATA groups, so a DWG read keeps what the DXF of the same drawing keeps.

Checked

  • AutoCAD 2027 opened files written by DraftCraft from an AutoCAD drawing with four bodies (a box, a sphere, a region, and a 2.9 MB union stored in three blob pages), as DWG 2013 and DWG 2018, with and without solid history. Every body is drawn and AUDIT reports 0 errors.
  • AutoCAD's own 2013 and 2018 solid files read in DraftCraft with all four bodies, and write back identically.
  • New tests:
    • datastore unit tests: round trip, AutoCAD's layout, blob pages, several data segments, hostile bytes.
    • acis_data_store::dwg_keeps_the_solids_geometry (no longer ignored).
    • acis_data_store::dwg_solids_point_at_their_data_store_records (the bit).
  • cargo test -p draftcraft-dwg -p draftcraft-io, clippy -D warnings, cargo xtask wasm.

Not in this PR

  • The solids' history objects (ACSH_ types, the subentity managers) are still not written. AutoCAD opens the solids without their history.
  • AutoCAD's own 2018 files store the description as ASM BinaryFile4 (version 22300), and its DXF and 2013 files as ACIS BinaryFile (21800). AutoCAD reads the DXF form in a 2018 file, so the writer keeps the form the drawing has.

🤖 Generated with Claude Code

… section)

From AutoCAD 2013 a 3DSOLID, REGION or BODY keeps its modeler description in the file's
data store section (AcDb:AcDsPrototype_1b), not in the entity. DraftCraft now reads and
writes that section, so these entities survive a DWG 2013/2018 save and open.

- crates/dwg/src/datastore.rs: the section read to records (checked reader, capped counts
  and sizes, blob pages followed) and written as AutoCAD lays out a new store: segment
  index, data index, data segments, blob pages for records over 0x40000 bytes, schema
  index and data, search index. AutoCAD's empty sections come out byte for byte.
- The writer puts the section after AcDb:XrefManifest when the drawing has solids, and
  writes the 2013+ modeler entity as AutoCAD does (wireframe block, group 290, GUID,
  history), with the "data store" bit of its common entity data set: without that bit
  AutoCAD reports "ASM body missing" for every solid.
- The reader decodes the 2013+ entity and turns the section's records into the DXF's
  ACDSDATA groups, so a DWG read keeps what the DXF of the same drawing keeps.

Checked in AutoCAD 2027: solids-2018 (four bodies, one of 2.9 MB in blob pages, with and
without solid history) written as DWG 2013 and 2018 opens with every body drawn, AUDIT 0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@SkryxDev
SkryxDev requested a review from withshalom November 14, 2026 16:20
@SkryxDev
SkryxDev merged commit 861fb10 into main Nov 14, 2026
1 check passed
@SkryxDev
SkryxDev deleted the dwg-datastore branch November 14, 2026 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant