Skip to content

feat(dxf): score MLINE in the value oracle (§20.4.50) - #391

Merged
DrunkOnJava merged 3 commits into
mainfrom
feat/dxf-oracle-mline
Oct 28, 2026
Merged

DrunkOnJava merged 3 commits into
mainfrom
feat/dxf-oracle-mline

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Oct 27, 2026 •

Copy link
Copy Markdown
Owner

Summary

The value oracle scores MLINE (§20.4.50) against AutoCAD's DXF export under AcDbMline: 18 records, R2000 to R2018 (3 per release).

Scored: the scale (40), justification (70), flags (71), vertex and element counts (72, 73), base point (10) and extrusion (210); then per vertex its position, segment direction and miter direction (11, 12, 13) and per element the parameter counts (74, 75) with the segment parameters (41) and the area-fill parameters (42). Repeated structures are scored under one field name each. The vertices come in the order the decoder holds them, so each group is taken as the next of its code.

Spec reference

Spec §20.4.50 MLINE. Before and after, on the 49 drawing pairs:

Records Equal Default Different DWG only Not decoded
before (main) 18 paired, listed under "Paired records no scorer covers: no scorer yet" - - - - -
after 18 1434 0 0 0 72

No field comes out different. The DWG's open-or-closed word equals the DXF flags in group 71 unchanged (the decoder's own note says its bits are open/closed, suppressed start and end; on these records the two agree). The not-decoded groups are the style name and handle (2, 340), the owner and the layer.

tools/oracle/baseline.tsv gains the 138 new rows; no existing row changes (the ratchet against main's baseline passes). The §20.4.50 row of docs/spec-coverage.md says what the oracle measured; its state stays closes.

Test plan

  • cargo fmt --all -- --check, cargo clippy --all-targets --all-features -- -D warnings, cargo test --release --all-features, RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features, python3 tools/ci/spec_coverage.py --check
  • Real files, no new unit tests. The oracle over the pinned corpus reproduces the committed TSV and passes its ratchet against main's baseline:
cargo run --release --features dxf-reader --example dxf_oracle -- <corpus-dir> \
    --baseline tools/oracle/baseline.tsv --tsv oracle.tsv --details
cmp oracle.tsv tools/oracle/baseline.tsv

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. This matters because dwg-rs is Apache-2.0 and must remain compatible.

My contribution is based on:

  • The ODA's freely-redistributable Open Design Specification for .dwg files (v5.4.1);
  • Public reverse-engineering notes, research papers, or blog posts cited inline;
  • Reading algorithm-description comments (not executable code) in permissively-licensed projects (MIT / Apache / BSD) to resolve spec ambiguities — disclose any such reading in this PR body so it can be recorded in CLEANROOM.md.

No such reading was needed: the mapping is the spec's DXF column and the DXF Reference's AcDbMline groups, read from AutoCAD's own exports as data.

See CLEANROOM.md for the full allowed/forbidden source list and the honest scope of what "clean-room" means for this project.

Developer Certificate of Origin

By submitting this PR, I certify that the contribution complies with the
Developer Certificate of Origin 1.1.
Specifically, I affirm that the contribution is my own work (or rightfully
licensed to me) and that it can be distributed under the project's Apache-2.0
license.

I will sign off commits with git commit -s when asked, which adds a
Signed-off-by trailer to the commit message asserting the DCO.

Refs #99, #102, #147.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 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-28T09:47:10.433732Z 915c7d7 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.

The MLINE decoder is now compared with AutoCAD's export field by field,
under AcDbMline: the scale (40), justification (70), flags (71), vertex and
element counts (72, 73), base point (10) and extrusion (210), then per
vertex its position, segment direction and miter direction (11, 12, 13)
and per element the parameter counts (74, 75) with the segment parameters
(41) and area-fill parameters (42). The vertices come in the order the
decoder holds them, so each group is taken as the next of its code. The
style is a name and a handle (2, 340) and is not decoded.

On the 49 drawing pairs: 18 records, R2000 to R2018 (3 per release), 1434
values equal the export, none differ and every decoded value has a DXF
group. The DWG's open-or-closed word equals the DXF flags in group 71
unchanged. tools/oracle/baseline.tsv gains the 138 new rows, and the
§20.4.50 row of docs/spec-coverage.md says what the oracle measured. The
oracle's section map files MLINE under §20.4.50.

Refs #99, #102, #147
@DrunkOnJava
DrunkOnJava force-pushed the feat/dxf-oracle-mline branch from d0aaea8 to 42217e1 Compare October 27, 2026 19:23
@DrunkOnJava
DrunkOnJava enabled auto-merge (squash) October 28, 2026 10:01
@DrunkOnJava
DrunkOnJava merged commit 417aee1 into main Oct 28, 2026
25 checks passed
@DrunkOnJava
DrunkOnJava deleted the feat/dxf-oracle-mline branch October 28, 2026 10:09
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