Skip to content

feat(dxf): write the OBJECTS section, paired with AutoCAD's export (#126) - #372

Merged
DrunkOnJava merged 35 commits into
mainfrom
feat/dxf-objects
Oct 27, 2026
Merged

DrunkOnJava merged 35 commits into
mainfrom
feat/dxf-objects

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Oct 27, 2026 •

Copy link
Copy Markdown
Owner

Summary

Stacked on #371 (BLOCKS): this branch contains that commit, so until #371 lands the diff shows both; the OBJECTS change is the second commit, c9cff76.

dwg-to-dxf now writes the OBJECTS section from the decoded objects, in AutoCAD's order, and probe_dxf_objects (wired into the Corpus job) pairs every record with AutoCAD's own export. Follow-on to #371 (#126), one PR per section. The kinds written first are the dictionary family (DICTIONARY and ACDBDICTIONARYWDFLT with each entry's key and handle, DICTIONARYVAR), XRECORD, SCALE and ACDBPLACEHOLDER; a dictionary entry whose object is not written yet is left out, and the probe states why. The placeholder records the converter wrote for every object (an owner of 0 and no body) are gone: an object is written with its owner, reactors, extension dictionary and body, or counted in the skipped comment.

Spec reference

ODA v5.4.1 §20.4.44 DICTIONARY, §20.4.45 DICTIONARYWDFLT, §20.4.74 DICTIONARYVAR, §20.4.92 SCALE, §20.4.104 XRECORD. The handle stream of an object is read by tables::handles::refs (owner, reactors, extension dictionary, then the object's own handles: a dictionary's item handles in key order, a WDFLT's default after them). An XRECORD's data is typed by the group code's range, as in DXF (XRecord::items).

  • src/dxf_objects.rs: the planner, the order and the writer; src/dxf_convert.rs: the planned handles feed TABLES and ENTITIES, then OBJECTS is built last with every handle the output defines.
  • src/objects/xrecord.rs: XRecord::items, XValue, XItem. Up to R2004 items reads the data through feat(objects): read XRECORD values and extended entity data in the code page each string names (§28, §20.4.104, #375) #380's extended_data::xrecord_items (each string in the code page its page byte names; a string outside ASCII in a page the crate does not name is refused and the XRECORD counted (not written)); from R2007 it reads the UTF-16 strings itself.
  • plan() offers a handle only for an object whose record writes, so the handles the tables, entities and dictionaries are told are all emitted.

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: 921 passed, 0 failed (26 result lines), run on c579b1a; the pushed head differs from it only by the merge of main with feat(dxf): score MULTILEADER in the value oracle (§20.4.48) #385, which changes the DXF oracle's files (examples/dxf_oracle/scorers.rs, tools/oracle/) and two spec-coverage lines. This branch adds no unit test. CI runs it on the head too.
  • Shown working on real files, no new unit tests: cargo run --release --features dxf-reader --example probe_dxf_objects -- <dwg-corpus> pairs every record with the export's (42 drawings R2000 to R2018, 10 without a twin of the release skipped): 5,944 written, 5,736 paired, 0 disagree, 0 extra, in AutoCAD's order. Exit 0.
kind                    written  paired  groups   agree relation  disagree  extra  om.grp
ACDBDICTIONARYWDFLT          42      42     294     294        0         0      0       0
ACDBPLACEHOLDER              42      42      84      84        0         0      0       0
DICTIONARY                 2147    2113   14529   12778        0         0      0    1779
DICTIONARYVAR               365     365    1825    1825        0         0      0       0
SCALE                       826     826    6608    6608        0         0      0       0
XRECORD                    2522    2348  233042  232952      184         0      0       0

The order is a walk, not a sort: AutoCAD's export starts at the named object dictionary and then at every object not owned by an object (a table's, a table record's, a block's or an entity's extension dictionary), in the order of its owner in TABLES, BLOCKS and ENTITIES, and visits a dictionary's entries and then an object's extension dictionary, level by level. The probe checks the order of every paired record against the export's.

What is not paired, with a stated reason: the export registers again 1,020 DICTIONARYs, 107 DICTIONARYVARs and 1,111 XRECORDs (extension dictionaries and what they hold) under handles of its own, which the probe pairs by owner or by the dictionary key that holds them; 208 records the export does not hold at all (34 dictionaries, 174 XRECORDs: an extension dictionary whose owner it writes without one, an entry its dictionary lacks, what those own, an owner it does not write); 184 group values are relations the probe names (the editing time and save date of DWGPROPS, the saved file's identity of ACAD_LAST_SAVED_VERSION_INFO, a handle of an object the export registers again, the styles AutoCAD lists again in an ACDB_RECOMPOSE_DATA XRECORD (group 330, which the probe now compares after the record's owner), the tail of a round-trip XRECORD that AutoCAD consumes on load). 4,360 dictionary entries are written and 1,751 left out (1,670 name objects not written yet, 81 objects the export made itself, 58 objects it leaves out). Extended data on a dictionary (28 groups) is not decoded.

  • The other probes on the head of this PR: tables (1,239 records, 8,761 groups, 0 disagree, 0 extra), entities, BLOCKS, header, header variables, entity colour: all exit 0.
  • python3 tools/maintainer/train/arch.py check and python3 tools/ci/spec_coverage.py --check: 0 problems.
  • Not measured on the corpus: R13 and R14 objects (the probes skip AC1014 drawings); a dictionary with both entries and an extension dictionary (none in the corpus, so the order of the two is by the walk's rule, not measured).

Existing tests and code changed

None of the existing tests changed. dxf_convert no longer calls the placeholder collector for a drawing whose tables and entities are written (the fallback path for the others keeps it), and the wording of the probes' reasons for a material or visual style handle changes from "written as an untyped record" to "not written to OBJECTS yet", since the untyped records are gone.

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 (v5.4.1) is the source for §20.4.44, §20.4.45, §20.4.74, §20.4.92 and §20.4.104.
  • No GPL-licensed DWG implementation source (LibreDWG, etc.) was consulted or imported.

The only other inputs are the public corpus and AutoCAD's own DXF exports of its drawings. No algorithm-description comments in other projects were read.

Developer Certificate of Origin

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

@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-27T21:39:55.408132Z f70883b 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: c9cff7684a

ℹ️ 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/objects/xrecord.rs Resolved
Comment thread src/dxf_objects.rs Resolved
Comment thread examples/probe_dxf_objects.rs Resolved

@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: db5475a028

ℹ️ 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/dxf_objects.rs Resolved
Comment thread src/dxf_objects.rs Resolved

@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: 426e066d3f

ℹ️ 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/dxf_entities.rs Resolved

@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: 7965340c9b

ℹ️ 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/dxf_objects.rs Resolved

@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: 1f11366f3f

ℹ️ 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_dxf_objects.rs Resolved
@DrunkOnJava
DrunkOnJava enabled auto-merge (squash) October 27, 2026 21:05
…pplication data (§20.4.104, #126)

The probe's bracket walk read a `102 {ACAD_REACTORS` inside an XRECORD's application
data as a structural reactor bracket, so a 330 to an absent handle there counted as a
dangling reactor. It now stops at `100 AcDbXrecord` through the same
`DxfRecord::data_start` that `top_level` uses, now public. A second synthetic check
writes that payload beside a control XRECORD with a real reactor to an absent handle:
the payload must count as an application's handle and the control as one dangling
reactor.
@DrunkOnJava
DrunkOnJava merged commit cfba139 into main Oct 27, 2026
25 checks passed
@DrunkOnJava
DrunkOnJava deleted the feat/dxf-objects branch October 27, 2026 21:52
DrunkOnJava added a commit that referenced this pull request Oct 27, 2026
… an auto-merge that cannot fire (#417)

* fix(ci): hand back a PR with an unsigned commit instead of waiting on an auto-merge that cannot fire

main's ruleset requires signed commits. On 2026-10-27 #372 carried one
unsigned commit (842fa62) and sat BLOCKED with all 25 checks green and
auto-merge on for half an hour, until land.sh's deadline would have expired.
land.sh now lists the PR's unverified commits before turning auto-merge on
and exits 5 naming them.

* fix(ci): read every page of a PR's commits when checking signatures

Codex on #417: the check read only the first 100 commits. It now passes
--paginate and joins the unverified SHAs from every page.
DrunkOnJava added a commit that referenced this pull request Oct 28, 2026
…10-27 (#416)

* docs: bring README, ROADMAP and CHANGELOG up to the landings of 2026-10-27

README's code-page and DXF writer text named work in review that has landed
(#371, #380, #382, #384); jev_review.py prose ranked those sentences 0.72 to
0.96. ROADMAP's "where it stands" table was a 2026-10-21 snapshot whose
numbers, CI row and release row were all out of date; it now points to the
rendered numbers instead of repeating them. CHANGELOG gains #371, #380, #382,
#384, #385 and #404.

* docs(changelog): record the CI-only merge train (#408)

* docs: OBJECTS landed (#372): README, ROADMAP and CHANGELOG

* docs: LAYOUT, GROUP and MLINESTYLE (#373), the class map writer (#405) and the double-byte round trip (#414) landed

* docs: VISUALSTYLE landed (#413)

* docs(readme): name the skipped types still in review without per-type counts; MATERIAL landed (#325)

* docs(readme): point to the open decoder PRs instead of a list that each landing makes stale
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