Skip to content

feat(objects): decode the dynamic-block evaluation objects from AutoCAD's own DWG and DXF output (#152) - #328

Merged
DrunkOnJava merged 13 commits into
mainfrom
feat/unp-dynblock
Oct 28, 2026
Merged

DrunkOnJava merged 13 commits into
mainfrom
feat/unp-dynblock

Conversation

@DrunkOnJava

Copy link
Copy Markdown
Owner

Summary

Stacked on #326 (which is stacked on #325): this branch contains #325's and #326's commits and lands after them; its own change is the single commit on top.

Decodes six dynamic-block evaluation objects ODA spec v5.4.1 never prints, on every release from R14 to R2018: BLOCKGRIPLOCATIONCOMPONENT, BLOCKLINEARGRIP, BLOCKVISIBILITYGRIP, BLOCKLINEARPARAMETER, BLOCKVISIBILITYPARAMETER and BLOCKSCALEACTION. The layouts are derived by the CLEANROOM.md method of 2026-10-26 from the data bits of AutoCAD-written drawings against AutoCAD's own DXF export of the same handles: a shared AcDbEvalExpr / AcDbBlockElement / AcDbBlockGrip base chain and a tail per class.

Spec reference

None: §20.4 has no entry for any of them, so there is no docs/data/spec-coverage.tsv row; the class row in docs/spec-coverage.md ("Classes the spec does not prescribe") is added as closes. Layout and evidence: ARCHITECTURE.md §7u (provisional letter). Per-class record: CLEANROOM.md (2026-10-26).

Evidence (cargo run --release --example probe_dynamic_blocks -- ../dwg-corpus, exit 0):

Class Records Close Values compared Differ
BLOCKGRIPLOCATIONCOMPONENT 42 42 252 0
BLOCKLINEARGRIP 14 14 204 0
BLOCKVISIBILITYGRIP 7 7 84 0
BLOCKLINEARPARAMETER 7 7 246 0
BLOCKVISIBILITYPARAMETER 7 7 198 0
BLOCKSCALEACTION 7 7 174 0
Total 84 84 1,158 0

R14 to R2018 on every class; R14 has no DXF twin, so its 12 records are boundary-only. Corpus baseline, relative to #326's head: decoded +84, skipped -84, errored 0 (measure.py check passes on this head). From R2007 the decoder also requires the string stream to be exhausted. One measured pairing is checked by the probe rather than assumed: the unset expression value f64::MAX / 10 is written 1.797693134862314E+99 in the DXF. Unverified by value (ARCHITECTURE.md §7u): the BL -1 that opens every record, the scale action's trailing byte, the order of the visibility parameter's two zero BS (groups 170 and 171), the meaning of the value type -9999, and the implied length four of the linear parameter's property list. Handles (330 to 333) are in the handle stream and are not decoded.

Test plan

  • cargo fmt --all -- --check, cargo clippy --all-targets --all-features -- -D warnings, RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features, cargo test --release --all-features pass locally on this head
  • Shown working on real files: probe_dynamic_blocks over the 52 pinned drawings (84 records, 1,158 values against the DXF twins, 0 differ)
  • python3 tools/ci/spec_coverage.py --check passes
  • No new unit tests. Tests touched: none. src/objects/small_classes.rs exposes three helpers (open_and_finish, read_small, unsupported) as pub(crate) for reuse.

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.
  • No GPL-licensed DWG implementation source (LibreDWG, etc.) was consulted or imported.

My contribution is based on AutoCAD's own output, by the method recorded in CLEANROOM.md (2026-10-26): AutoCAD-written DWG files compared with AutoCAD-written DXF exports of the same drawing, from the pinned public corpus (ACadSharp samples/sample_base; data files only). No third-party DWG or DXF implementation was consulted, ACadSharp's and ezdxf's reading code, comments, tests and derived data included. No vocabulary beyond the DXF group codes and subclass markers in the twins was used.

Developer Certificate of Origin

I affirm that the contribution is my own work and can be distributed under the project's Apache-2.0 license.

…49, #152)

ODA spec v5.4.1 prints no MATERIAL layout. The field list is derived by the
CLEANROOM.md method of 2026-10-26: the data bits of all 212 corpus records
(R14 to R2018) against the AcDbMaterial AutoCAD exported to DXF for the same
handle. Every record closes on its data-stream boundary on every release, from
R2007 on a string stream the list consumes entirely, and 13,058 values equal
the DXF twin by handle with 0 differences. Fields no DXF group shows are named
unknown_* and listed in ARCHITECTURE.md section 7s.

probe_material becomes the twin probe over the shared harness
(examples/support/twin.rs, identical to the objects lane's copy). The strings-only
read_strings and its tests are kept untouched. Baseline: decoded +212,
skipped -212, errored 0.
…XF output (#152)

WIPEOUTVARIABLES, ACDB_DYNAMICBLOCKPURGEPREVENTER_VERSION,
ACDB_BLOCKREPRESENTATION_DATA, PDFDEFINITION and DBCOLOR have no spec layout.
Each is derived by the CLEANROOM.md method of 2026-10-26 from the data bits of
the 42 corpus records (R14 to R2018) against the DXF object of the same handle.
All close on every release, from R2007 on a fully consumed string stream, and 50
values equal the DXF twin with 0 differences. DBCOLOR from R2004 reads the colour
word (group 420 and xdata 1071), name and book; its leading BS is unverified.
One probe per class over the shared twin harness. Baseline: decoded +42,
skipped -42, errored 0.
…AD's own DWG and DXF output (#152)

BLOCKGRIPLOCATIONCOMPONENT, BLOCKLINEARGRIP, BLOCKVISIBILITYGRIP,
BLOCKLINEARPARAMETER, BLOCKVISIBILITYPARAMETER and BLOCKSCALEACTION have no spec
layout. Derived by the CLEANROOM.md method of 2026-10-26 from the data bits of the
84 corpus records (R14 to R2018) against the DXF objects of the same handles: a
shared AcDbEvalExpr / AcDbBlockElement / AcDbBlockGrip base chain and a tail per
class. All close on every release, from R2007 on a fully consumed string stream, and
1,158 values equal the DXF twin with 0 differences. Handles are not decoded.
Baseline: decoded +84, skipped -84, errored 0.
@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-28T02:46:12.667632Z 06e46a3 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: bbd16cee0b

ℹ️ 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 src/entities/dispatch.rs Resolved
@DrunkOnJava DrunkOnJava added type:feature New capability, including a spec section not yet implemented area:objects Common object formats and non-graphical objects (§20.1 to §20.3, §20.4 objects, §28) labels Oct 28, 2026
DrunkOnJava added a commit that referenced this pull request Oct 28, 2026
@DrunkOnJava
DrunkOnJava enabled auto-merge (squash) October 28, 2026 02:49
@DrunkOnJava
DrunkOnJava merged commit 992d291 into main Oct 28, 2026
26 checks passed
@DrunkOnJava
DrunkOnJava deleted the feat/unp-dynblock branch October 28, 2026 02:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:objects Common object formats and non-graphical objects (§20.1 to §20.3, §20.4 objects, §28) type:feature New capability, including a spec section not yet implemented

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant