Repository navigation
feat(dxf): write the ENTITIES section of 15 kinds, paired with AutoCAD's export (#126) - #358
Conversation
… writer's other layers (#126)
…ency (§2.11) The common entity data read the transparency BL first and the RGB BL second. The two have the same width, so every record still closed on its boundary and the values were never compared; AutoCAD's export of an R2004 LINE (420 8404418, 440 16777216) shows the stream carries the RGB word first (0xC2802142 then 0x01000000).
…ment it does not read (#126)
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: 8fa266851f
ℹ️ 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".
…INSERT without its block, and escapes MTEXT once (#126)
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6084acfc28
ℹ️ 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".
…children sort by a position map (#126)
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 805622abb1
ℹ️ 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".
…n R14 source with tables (#126)
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8992aeaf32
ℹ️ 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".
# Conflicts: # .github/workflows/ci.yml # ARCHITECTURE.md # Cargo.toml # src/common_entity.rs
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b198c12e1e
ℹ️ 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".
# Conflicts: # ARCHITECTURE.md
Codex's review of #358 linked LibreDWG source as evidence for a finding, which CLEANROOM.md bans the project from consulting. Codex follows the Review guidelines of a committed AGENTS.md, so this one points every agent to CLAUDE.md and tells the reviewer to ground findings in the spec, the public DXF Reference, the pinned AutoCAD output or this repository, never in a banned implementation, and not to ask for unit tests.
… writes 0 for a text dash's 75, and the probe expects no polygon mesh (#126)
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 98a57db66a
ℹ️ 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".
…, with the code page tracked in #370
Summary
dwg-to-dxfnow writes the ENTITIES section: the model space and paper space entities of 15 kinds whose decoders close on the corpus, each with AutoCAD's group codes in AutoCAD's order, and a new probe (probe_dxf_entities, wired into the Corpus job) pairs every written entity with the one in AutoCAD's own export and compares it group for group. Follow-on to #347 and #357 (#126), one PR per section.Kinds written: LINE, POINT, CIRCLE, ARC, ELLIPSE, SOLID, RAY, XLINE, 3DFACE, TEXT, LWPOLYLINE, MTEXT (before R2018: no background fill, columns or embedded-object form yet), POLYLINE (2D, 3D and polyface) with VERTEX and SEQEND. An INSERT, with its ATTRIBs and SEQEND, is written by the code but skipped (and counted) until the block it names is a written definition: BLOCKS writes only the two space blocks today, so no output holds an INSERT of a block it lacks, and the BLOCKS PR lifts the gate and measures them. A decoded entity of any other kind is not written, and the probe counts them by kind. Children are written after their parent in the order its handle stream names them, SEQEND last.
What the writer needed from the decoders:
Nolinks, the visual style flags (CommonEntityData).src/entity_refs.rs: the handles an entity's handle stream holds (layer, linetype, material, plot style, shadow and colour book handles) resolved against the tables.X 9text area,LtypeEntry::text_area), which the header probe had listed as an omission.Spec reference
ODA v5.4.1 §20.4.1 common entity data and common entity handle data, §2.11 CMC colour, and the entity sections §20.4.2 to §20.4.50 and §20.4.60 for the 15 kinds above. Group codes and order are AutoCAD's, read from its exports of the corpus (the AcDbEntity run is 67, 8, 6, 347, 62, 420, 430, 440, 48, 60, 370).
src/dxf_entities.rs: the writer, one function per kind.src/dxf_convert.rs:convertbuilds the tables, then the entities with the handles it knows.src/common_entity.rs: the kept fields, and one decoder fix below.Test plan
cargo fmt --all -- --check,cargo clippy --all-targets --all-features -- -D warnings,RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features, all clean on this head (rebased onb9beccb).cargo run --release --features dxf-reader --example probe_dxf_entities -- <dwg-corpus>pairs every written entity with AutoCAD's export of the same drawing (42 drawings R2000 to R2018, 10 without a twin of the release skipped): 732 entities written, 732 paired, 5,099 groups, 5,099 agree, 0 disagree, 0 extra, and each entity's groups in AutoCAD's order. The probe expects every export record of a kinddxf_entities::kinds(release)lists to be written, whatever the output holds. Exit 0.Kinds the writer does not write yet, counted as entities in AutoCAD's exports of the corpus that the converter did not write (the "not written" column; the 5 MTEXT and 1 of the ATTRIB are R2018 embedded-object forms): INSERT 36, ATTRIB 24 and 12 SEQENDs of INSERTs (these three wait for BLOCKS), DIMENSION 66, MULTILEADER 90, HATCH 48, MLINE 18, TOLERANCE 18, 3DSOLID 12, ACAD_TABLE 12, MESH 12, SPLINE 12, VIEWPORT 12, IMAGE 6, LEADER 6, PDFUNDERLAY 6, REGION 6, SHAPE 6, WIPEOUT 6.
Every omitted group carries a stated reason in the probe's output, and none is a disagreement: extended data on entities (not decoded, 1000 to 1071), the
ACAD_REACTORSbracket (the reacting entities are not all written with their handles), group 347 (the material object is still written as an untyped record), groups 420 and 430 for a colour book colour (its RGB and name are in an AcDbColor object), and an extension dictionary the export made itself (its handle is at or above the DWG's$HANDSEED).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 (every cargo job on this Mac waits on a governor lease).Existing tests and code changed
src/common_entity.rs: the entity colour's two optional words were read in the wrong order. §2.11 puts the RGB word first and the transparency after; the decoder read the transparency first. The twin of a LINE writes420 8404418and440 16777216where the stream reads0xC2802142then0x01000000, which fixes the order. The words were read and dropped, so no decoded count moves.src/tables/ltype.rs:LtypeEntrygainstext_area.src/graph.rs: one existing unit test builds anLtypeEntryby field, so it gainstext_area: Vec::new()to compile. Nothing it asserts changed.src/entity_refs.rs:EntityRefsgainslinks(the R13 to R2000 previous and next entity handles, which order a polyline's vertices before R2004).examples/probe_dxf_header.rs: the omission reason for$CELTYPE,$DIMLTYPEand$DIMLTEX1/2naming a complex linetype is gone, since TABLES writes one now (the probe pairs them).examples/probe_dxf_tables.rs: the group order check, andgroup_reasonno longer takes a document it does not read.No other test 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.