Skip to content

fix(entities): read the R13-R14 branches of INSERT, the dimensions and 3DFACE (#227) - #267

Merged
DrunkOnJava merged 3 commits into
mainfrom
fix/227-r14-insert-dimension
Oct 26, 2026
Merged

DrunkOnJava merged 3 commits into
mainfrom
fix/227-r14-insert-dimension

Conversation

@DrunkOnJava

Copy link
Copy Markdown
Owner

Summary

Read the R13-R14 branches §20.4.9 (INSERT), §20.4.22 (common dimension data) and §20.4.32 (3DFACE) print. All 24 R14 records that errored on the public corpus now close: 12 INSERT, the 11 dimensions of all seven types, and the 3DFACE. Each equals the R2000 save of the same drawing handle by handle, apart from the four dimension fields R14 does not store and one last-digit difference in a stored double (below).

Closes #227.

Spec reference

Section R13-R14 branch as printed What the decoder read
§20.4.9 INSERT BD x, y, z scales the R2000+ BB data flags with RD / DD scales
§20.4.22 common dimension data attachment BS, line spacing style BS, line spacing factor BD and actual measurement BD are R2000+ all four on R14
§20.4.32 3DFACE four 3BD corners and an unconditional invisible-edge BS the R2000+ flag bits, RD first corner and 3DD corners

On R13/R14 the four dimension fields are now left at 0, not given a default the record does not hold, and their struct docs say so. three_d_face::decode gains the version argument the branch needs.

Records it was measured on

R14 has no DXF export in the corpus. AutoCAD keeps handles across a save-as, so examples/probe_cross_release.rs (from #264, which merges first) compares each R14 record with the R2000 save of the same drawing:

Type R14 records Close Matched in sample_AC1015.dwg Equal
INSERT 14 (12 were erroring) 14 10 10
3DFACE 1 1 1 1
DIMENSION, seven types 11 11 11 10

Notes on the table:

  • The dimension comparison runs with --ignore=attachment,line_spacing_style,line_spacing_factor,actual_measurement, the four fields R14 does not store.
  • Four R14 INSERT handles do not occur in the R2000 save.
  • The one dimension that differs is the angular 2-line 0x516, in the last digit of its 16-point's x: 528.6474703372945 against 528.6474703372946. Both are raw RDs read exactly, so the two saves store doubles one unit in the last place apart. That is what AutoCAD wrote, not a reading the bits leave open.
C=~/Library/Caches/dwg-corpus/acadsharp
cargo run --release --example probe_decode_errors -- $C/sample_AC1014.dwg INSERT        # 0 erroring
cargo run --release --example probe_decode_errors -- $C/sample_AC1014.dwg DIMENSION     # 0 erroring
cargo run --release --example probe_cross_release -- $C/sample_AC1014.dwg $C/sample_AC1015.dwg INSERT
cargo run --release --example probe_cross_release -- $C/sample_AC1014.dwg $C/sample_AC1015.dwg DIMENSION_LINEAR \
    --ignore=attachment,line_spacing_style,line_spacing_factor,actual_measurement

Coverage, ../../samples

Unchanged, TOTAL 3911 / 525 / 9. The three nextgis R14 files of the 19 hold none of these types.

Public corpus: tools/corpus/baseline.tsv (regenerated, committed)

-sample_AC1014.dwg   acadsharp AC1014  676 461 105 ...
+sample_AC1014.dwg   acadsharp AC1014  700 461  81 ...

52-file total: 13781 / 1985 / 308 → 13805 / 1985 / 284 on its own. measure.py check passes. The row is regenerated on top of earlier merges in the serial rebase.

Class census and reference closure

Unchanged on all 19 files of ../../samples and in the baseline's census and closure columns.

Docs

  • docs/data/spec-coverage.tsv: §20.4.9, §20.4.22 to §20.4.29 and §20.4.32 → closes with the measurement. docs/spec-coverage.md is regenerated.
  • ARCHITECTURE.md: new §7r. The module docs of insert.rs and three_d_face.rs gain the R13-R14 branch.

Test plan

  • cargo fmt --all -- --check
  • cargo clippy --all-targets --all-features -- -D warnings
  • RUSTFLAGS="-D warnings" cargo test --release --all-features (real-file tests ran against ../../samples)
  • RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features
  • tools/corpus/measure.py check passes against the committed baseline
  • Adds no unit tests; adapts 2. three_d_face::tests::{roundtrip_triangle_face, roundtrip_quad_face_with_invisible_edges} now pass Version::R2000 to the new decode(c, version) signature. They build R2000-shape payloads, and their assertions are unchanged.

Source-provenance declaration

By submitting this PR I certify that my contribution does not incorporate executable code from any source whose license is incompatible with Apache-2.0. Specifically:

  • No Autodesk DWG SDK source (RealDWG, ObjectARX, ObjectDBX) or NDA-protected Autodesk documentation was consulted or imported.
  • No Open Design Alliance Teigha / Drawings SDK source was consulted or imported. The ODA's public Open Design Specification for .dwg files PDF is explicitly allowed (see CLEANROOM.md).
  • No GPL-licensed DWG implementation source (LibreDWG, etc.) was consulted or imported.

My contribution is based on §20.4.9, §20.4.22 and §20.4.32 of the ODA's freely-redistributable Open Design Specification for .dwg files (v5.4.1) and on the corpus bytes. No third-party code or comments were read.

Developer Certificate of Origin

By submitting this PR, I certify that the contribution complies with the Developer Certificate of Origin 1.1.

…d 3DFACE (#227)

§20.4.9, §20.4.22 and §20.4.32 each print an R13-R14 branch the
decoders never read: INSERT's three BD scales instead of the R2000+ data
flags, the common dimension data without the R2000+ attachment, line
spacing and actual measurement, and 3DFACE's four 3BD corners with an
unconditional invisible-edge BS. All 24 R14 records that errored on the
public corpus (12 INSERT, 11 dimensions of all seven types, a 3DFACE)
now close, and each equals the R2000 save of the same drawing handle by
handle, apart from the four dimension fields R14 does not store and one
16-point x that the two saves store one ulp apart.

ARCHITECTURE.md §7r records it; tools/corpus/baseline.tsv records
sample_AC1014.dwg's new counts.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T13:31:11.006040Z 8370def New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

# Conflicts:
#	ARCHITECTURE.md
#	docs/data/spec-coverage.tsv
#	docs/spec-coverage.md
#	tools/corpus/baseline.tsv
@DrunkOnJava
DrunkOnJava enabled auto-merge (squash) October 26, 2026 13:30
@DrunkOnJava
DrunkOnJava merged commit 4439aba into main Oct 26, 2026
26 checks passed
@DrunkOnJava
DrunkOnJava deleted the fix/227-r14-insert-dimension branch October 26, 2026 13: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.

Every R14 INSERT and DIMENSION record errors on the public corpus

1 participant