Skip to content

fix(entities): route the R14 LWPOLYLINE and HATCH classes and read LWPOLYLINE's R13-R14 vertices (#229) - #264

Merged
DrunkOnJava merged 7 commits into
mainfrom
fix/229-routing
Oct 26, 2026
Merged

DrunkOnJava merged 7 commits into
mainfrom
fix/229-routing

Conversation

@DrunkOnJava

Copy link
Copy Markdown
Owner

Summary

Route the R14 LWPOLYLINE and HATCH classes to their decoders, and read LWPOLYLINE's R13-R14 vertex branch. All 24 R14 LWPOLYLINE and 8 R14 HATCH records of the public corpus now decode, and every one closes on its boundary. Each decodes to the same values as the R2000 save of the same drawing, handle by handle. Part of #229; what remains of it (MULTILEADER before R2010, LAYOUT before R2004 and on R2007, GEODATA) is recorded on the issue.

Spec reference

§20.4.85 LWPLINE and §20.4.75 HATCH are typed (varies). On R14 both carry a class number from AcDb:Classes rather than the fixed codes 0x4D / 0x4E, and dispatch routed only the fixed codes. This PR adds two class-name arms in decode_from_raw_with_class_map.

HATCH closes as it stands. LWPOLYLINE also needs §20.4.85's R13-R14 Only branch: every vertex is a 2RD, where R2000+ write the first as 2RD and the rest as 2DD against the previous vertex. Without that branch the records stopped 248 to 568 bits short.

Records it was measured on

R14 has no DXF twin. AutoCAD keeps handles across a save-as, so the new examples/probe_cross_release.rs compares the decoded value of every handle of a type between two saves of one drawing:

Drawings Type Records Close Equal to the R2000 save
sample_AC1014.dwg / sample_AC1015.dwg LWPOLYLINE 23 23 23
sample_AC1014.dwg / sample_AC1015.dwg HATCH 8 8 8
polyline2d_line_R14.dwg / polyline2d_line_2000.dwg LWPOLYLINE 1 1 1

The vertices are equal as doubles, bit for bit.

C=~/Library/Caches/dwg-corpus
cargo run --release --example probe_cross_release -- $C/acadsharp/sample_AC1014.dwg $C/acadsharp/sample_AC1015.dwg LWPOLYLINE
cargo run --release --example probe_cross_release -- $C/acadsharp/sample_AC1014.dwg $C/acadsharp/sample_AC1015.dwg HATCH
cargo run --release --example probe_cross_release -- $C/nextgis/polyline2d_line_R14.dwg $C/nextgis/polyline2d_line_2000.dwg LWPOLYLINE

Coverage, ../../samples

Unchanged, TOTAL 3911 / 525 / 9 (the three nextgis R14 files of the 19 hold neither type).

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

-polyline2d_line_R14.dwg nextgis   AC1014  165 127   0 ...
+polyline2d_line_R14.dwg nextgis   AC1014  166 126   0 ...
-sample_AC1014.dwg       acadsharp AC1014  676 461 105 ...
+sample_AC1014.dwg       acadsharp AC1014  707 430 105 ...

measure.py check passes against the committed baseline. No other column moves. It will be regenerated on top of whatever lands first in the serial rebase.

Class census and reference closure

Unchanged on all 19 files of ../../samples and in the 52-row baseline.

Docs

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
  • No unit tests added or changed.

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.75 and §20.4.85 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.

…POLYLINE's R13-R14 vertices (#229)

§20.4.85 and §20.4.75 type LWPLINE and HATCH (varies): on R14 both carry
a class number from AcDb:Classes rather than the fixed codes 0x4D and
0x4E, and dispatch routed only the fixed codes, so all 24 R14
LWPOLYLINE and 8 R14 HATCH records of the public corpus were skipped.
Routing the class names measures them. HATCH closes as it stands;
LWPOLYLINE also needs §20.4.85's R13-R14 branch, a 2RD for every vertex.

All 32 records close, and each decodes to the same value as the R2000
save of the same drawing, handle by handle, which
examples/probe_cross_release.rs checks. ARCHITECTURE.md §7q records it;
§20.4.85 moves to closes.
@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-26T15:01:45.019982Z 944da6c 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3ff4821c0e

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread examples/probe_cross_release.rs Resolved
# Conflicts:
#	ARCHITECTURE.md
#	docs/data/spec-coverage.tsv
#	docs/spec-coverage.md
#	tools/corpus/baseline.tsv
A handle of the kind present in only one of the two saves was counted
(left-only) or ignored (right-only) without failing, and a run that
compared nothing exited 0. Both now fail, with every unmatched handle
listed.
# 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 15:07
@DrunkOnJava
DrunkOnJava merged commit a591444 into main Oct 26, 2026
26 checks passed
@DrunkOnJava
DrunkOnJava deleted the fix/229-routing branch October 26, 2026 15:10
DrunkOnJava added a commit that referenced this pull request Oct 28, 2026
…d say what measured them (#140, #147, #148, #133, #127) (#398)

Seven rows leave partial for closes because no record of any kind errors on the
52 drawings of run 40532346172 and the errors their notes still quote were
fixed: TEXT, ATTRIB, ATTDEF (#258), MTEXT (#261), VIEW (#263, #284), DIMSTYLE
(#293) and HATCH (#264, the R14 records routed). §22 AcDb:Template goes from
missing to partial: dxf_header reads $MEASUREMENT from it (#320). §9 stays
closes, now tracked by #127 (R13) and carrying the per-release evidence behind
closing #128, #129 and #130. The page's Last measured line and the paragraph
that said closes came from a local 19-file corpus are updated.
DrunkOnJava added a commit that referenced this pull request Oct 28, 2026
…ain run (#195) (#401)

* docs(spec-coverage): move the rows the 2026-10-27 main run proves, and say what measured them (#140, #147, #148, #133, #127)

Seven rows leave partial for closes because no record of any kind errors on the
52 drawings of run 40532346172 and the errors their notes still quote were
fixed: TEXT, ATTRIB, ATTDEF (#258), MTEXT (#261), VIEW (#263, #284), DIMSTYLE
(#293) and HATCH (#264, the R14 records routed). §22 AcDb:Template goes from
missing to partial: dxf_header reads $MEASUREMENT from it (#320). §9 stays
closes, now tracked by #127 (R13) and carrying the per-release evidence behind
closing #128, #129 and #130. The page's Last measured line and the paragraph
that said closes came from a local 19-file corpus are updated.

* docs(criteria): re-measure the 1.0 requirements from the 2026-10-27 main run (#195)

Header, R2, R3, R4, R8, X1 and S3 now carry what run 40542129639 (main 61255e9)
and docs/data/spec-coverage.tsv say: 52 drawings with 0 errored records and 533
skipped, 53 sections scored by the DXF oracle with 22 values disagreeing, 90
closes, 13 partial, 6 decoder and 29 missing rows, a wasm32 compile of the
library in the Clippy job. X1 (DXF) moves from not measured to failed: the HEADER,
TABLES, ENTITIES and BLOCKS probes pair the written records with AutoCAD's export
and find 0 groups disagreeing, and 342 entity records of 18 kinds and the OBJECTS
section are not written. No other status changes.

* docs(criteria): R3 counts the rows #398 moves: 97 closes, 7 partial, 6 decoder, 28 missing (#195)

The counts are those of docs/data/spec-coverage.tsv with #398, whose moves run
40532346172 proves.
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