Repository navigation
feat(dxf): write the CLASSES section from the class table (#126) - #368
Merged
Merged
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5c48fad5a3
ℹ️ 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".
…nt from the stream for a source before R2004 (#126)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
dwg-to-dxfnow writes the CLASSES section, which it left out, from the drawing's class table (AcDb:Classes), andprobe_dxf_classes(wired into the Corpus job) pairs every class with AutoCAD's own export of the same drawing. Follow-on to #347, #357 and #359 (#126), one PR per section; it is independent of the ENTITIES PR and touchesdxf_convert.rsat one call between HEADER and TABLES.A
CLASSrecord is the DXF name (1), the C++ name (2), the application (3), the proxy capability flags (90), from R2004 the instance count (91), the was-a-proxy flag (280) and the entity flag (281, item class id 0x1F2), in the order of the table. For a target of R2000 or later; R12 has no CLASSES section and an R14 target is not measured.Spec reference
ODA v5.4.1 §21 (the class section): per class the class number, the proxy flags (a
BS, written unsigned:0x8401reads as-31743signed), the application name, C++ class name and DXF class name, the was-a-proxy flag and the item class id, and from R2004 the instance count.src/dxf_classes.rs: the writer.src/dxf_convert.rs: one call between HEADER and TABLES.examples/probe_dxf_tables.rs:tables_onlynow finds the TABLES section where it is instead of assuming it is the second (a CLASSES section sits before it).Test plan
cargo fmt --all -- --check,cargo clippy --all-targets --all-features -- -D warnings,RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-featurescargo run --release --features dxf-reader --example probe_dxf_classes -- <dwg-corpus>pairs every written class with the export's of the same DXF name (42 drawings R2000 to R2018, 10 without a twin of the release skipped), compares groups and checks the order. Exit 0, 0 disagree:Three differences between AutoCAD's export and the table are measured and applied: from R2004 the export does not list LAYOUT or ACDBPLACEHOLDER (both are listed in an R2000 export); an R2000 export names
AcDbDataTable's recordACDBDATATABLE, where the table and every later export sayDATATABLE; and the flags are unsigned (the first run showed-31743where AutoCAD wrote33793). The 67 relations are all group 91, the instance count: the export counts the objects it holds, among them those AutoCAD creates when it loads the file (more DICTIONARYVARs and CELLSTYLEMAPs) or leaves out, so the DWG's own count differs by a few on those classes. The 11 export-only classes (7 CELLSTYLEMAP, 4 DATATABLE) are ones AutoCAD registers on load; they are listed and not written.main) and header.python3 tools/maintainer/train/arch.py checkandpython3 tools/ci/spec_coverage.py --check: 0 problems.cargo test --release --all-featuresruns in CI; I did not run it locally on this head (the change adds a module and one call).LAYOUT/ACDBPLACEHOLDERrule on a drawing whose export does list them, and the instance count's exactness (a relation, not an agreement).Existing tests and code changed
None of the existing tests 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:
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.