Repository navigation
DXF export: the full R2000 file structure strict readers need (#9144) - #9662
Merged
bherbruck merged 2 commits intoOct 30, 2026
Merged
Conversation
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…angency-labs#9144) The view and flat pattern DXF left out parts of the AC1015 file that a strict reader expects: the CLASSES section, the VPORT, VIEW, UCS, APPID and DIMSTYLE tables (with *Active, ACAD and Standard) and the ACAD_GROUP dictionary under the root dictionary. They are written now, along with $DWGCODEPAGE; the active viewport looks at the whole drawing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PaddleStroke
force-pushed
the
fix/9144-dxf-strict-readers
branch
from
October 30, 2026 21:36
914d769 to
0936027
Compare
PaddleStroke
marked this pull request as ready for review
October 30, 2026 21:38
bherbruck
enabled auto-merge
October 30, 2026 21:50
bherbruck
added this pull request to the merge queue
Oct 30, 2026
Merged
via the queue into
tangency-labs:main
with commit Oct 30, 2026
8d22b3a
112 of 122 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Change
Fixes #9144: AutoCAD 2025 did not recognise a DXF from Export Current View as DXF.
The writer (
crates/io/src/dxf_out.rs, shared by the view export and the flat pattern export) declares AutoCAD 2000 (AC1015), but the file left out parts of that release's structure that a strict reader expects. Checked against the public DXF reference and the minimal R2000 content the ezdxf documentation lists, the file was missing:CLASSESsection (may be empty, but must be there);VPORT,VIEW,UCS,APPID(withACAD) andDIMSTYLE(withStandard, whose handle goes under group code 105);ACAD_GROUPdictionary named by the root dictionary inOBJECTS.All of those are written now, in the reference's table order, plus
$DWGCODEPAGE(ANSI_1252; every character the writer emits is ASCII, other letters are\U+XXXX). The*Activeviewport is centred on the drawing's extents with a height that holds all of it, so the drawing opens zoomed to fit rather than on an empty origin. Entities, layers and linetypes are unchanged.I could not open the file in AutoCAD (no commercial CAD products are used for this project), so the fix brings the file in line with the published structure; the reporter's confirmation would close the loop.
Changes a default: no
Validation
New regression test
dxf_out::tests::a_strict_reader_finds_every_section_table_and_the_group_dictionary: section order HEADER, CLASSES, TABLES, BLOCKS, ENTITIES, OBJECTS; the nine tables in order, each with as many records as its count says;APPID=ACAD;DIMSTYLEStandardwith a 105 handle;*Activecentred on (15, 5) for a (0, 0)–(30, 10) drawing and holding it; root dictionary →ACAD_GROUPdictionary owned by the root; every handle (5 and 105) unique and below$HANDSEED; every owner (330) is 0 or a handle in the file; SolidCraft's own reader still reads the entities.cargo test -p solidcraft-io: 196 passed, 0 failed (2 ignored, as before).cargo clippy -p solidcraft-io --all-targets -- -D warnings: clean.cargo fmt --check: clean.Independent check with ezdxf 1.4.5 (MIT, installed in a scratch folder), on a drawing with LINE, LWPOLYLINE, CIRCLE, ARC, ELLIPSE, rational SPLINE and TEXT on VISIBLE / HIDDEN / SKETCH layers. ezdxf's loader silently creates missing tables, so I also checked the raw tags against its documented minimal R2000 content:
ezdxf.readfile(strict)recover+auditfixes/errorsACAD_GROUPACAD_GROUPpresent)ACAD, noStandarddimstyle; noACAD_GROUPNot run: the engine's view/sheet DXF tests (they parse the ENTITIES and LAYER sections, which are unchanged; the engine build is very long on the shared machine),
cargo xtask wasm(the change is string writing insolidcraft-io, no new dependencies), and AutoCAD itself.Screenshots of the behavior (when observable)
No screenshot: nothing changes in the app. The difference is in the file's structure, shown by the table above.
Integration status
Rebased on upstream
mainat cc9787f; no conflicts. Draft PRs #8435 and #8515 also touchdxf_out.rs(Drawings DXF model); this change only adds sections/tables insidewrite_dxf_drawing, so a rebase either way should be small.🤖 Generated with Claude Code