Repository navigation
feat(entities): decode ACAD_TABLE from §20.4.96 (#151) - #319
Conversation
§20.4.101 prints TABLESTYLE; the notes that declined it said §20.4 had no entry. Its until-R21 layout closes on its data-stream boundary on all 32 records of R14 to R2007 in the public corpus, and against AutoCAD's DXF export all 1896 values of the 24 R2000 to R2007 records equal it. Two readings come from the bits, not the spec's table: the data type, unit type and format string are R2007+ together, and every colour is the 44-bit TC on R2000 and R14 too. R2010 and later use §20.4.101.2's layout and stay Unhandled.
…ares, so the copies merge in any order
….4.101.2 and §20.4.102 (#151) Both objects are sequences of cell styles (§20.4.101.4, with the content format of §20.4.101.3 inside), read by one shared reader. All 20 TABLESTYLE records of R2010 to R2018 and all 32 CELLSTYLEMAP records of R14 to R2007 close on their data-stream boundary. Against AutoCAD's DXF export every value of the 24 CELLSTYLEMAP records with a twin equals it (7080) and so does every value of the cell styles of the 20 R2010+ TABLESTYLE records, compared with the drawing's one CELLSTYLEMAP object (5328); none differ. The spec's order of the repeated cell styles is title, header, data, not data, title, header, and each is led by a BL equal to its id; both are read from the bits.
The laid-out geometry of a table is a row, column and cell count, then per cell a flag, two sizes, a content count and per content two distances and five more numbers. It had no decoder, so all 14 records of the corpus (two tables on each of R14 to R2018) were skipped; all 14 close on their data-stream boundary. Against AutoCAD's DXF export (R2000 to R2018) all 3462 values of the 12 records with a twin equal it. The second table's objects have other handles in the DXF and are paired in file order.
The cells of a table and what they hold are a name and description, the columns, the rows and per row the cells, per cell its contents (a value, a field or a block) with an optional content format, then the cell style overrides of every column, row, cell and the table, the merged ranges and the table style handle. It had no decoder, so all 14 records of the corpus (two tables on each of R14 to R2018) were skipped; all 14 close on their data-stream boundary. Two readings the spec does not print come from the bits: from R2007 a string value is a BL byte count and UTF-16LE in the data stream, not a TV; and a value whose flags have bit 1 set keeps its data type and has no data. Against AutoCAD's DXF export (R2000 to R2018) all 26694 values of the 12 records with a twin equal it. The second table's object has another handle in the DXF and is paired in file order.
…alk so a table's embedded copy can use it
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. |
…ributes in the probe (#151)
A table entity is the INSERT fields and, until R2007, the rows, columns, cells and their property overrides (§20.4.96.1); from R2010 it is the INSERT fields and the table content of §20.4.97 with the break data (§20.4.96.2). It had no decoder, so all 14 records of the corpus (two tables on each of R14 to R2018) were skipped; all 14 close on their data-stream boundary. Five readings come from the bits where the spec is silent or wrong: every colour is a TC on every release, a text cell has no TV of its own from R2007, the cell alignment override is a BS and not an RS, the override flag word has an unnamed bit 0x40000 that carries no data, and R2010 and later open with the INSERT fields the spec's table leaves out. Against AutoCAD's DXF export (R2000 to R2018) all 2429 values of the 12 records with a twin equal it. The probe also reports, without counting it, how the content an R2010 entity embeds compares with the file's TABLECONTENT and TABLEGEOMETRY objects, which differ from it in one cell of each table.
44fdb55 to
61caaad
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 61caaad4d8
ℹ️ 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".
… count in the probe (#151) The field list ends its field references as a count and one handle each, and the review of #317 reports the DXF writing those handles after group 92. The probe expected AcDbFormattedTableData straight away, so a table with a field reference would break the sequence and leave its table style and merged ranges uncompared. The walk now passes over as many handle groups as the DXF's own count announces, as it does for the other handles the decoder does not read. No drawing of the corpus has a field reference (every export writes 92 as 0), so the corpus output is unchanged; the handle groups themselves were checked on a copy of a twin with two planted after each count.
…fore reading its cells (#151) columns times rows was a usize product of two counts that each pass their own cap, so on a 32-bit target 65,536 by 65,536 overflowed: a panic with overflow checks on, a wrap to zero that skipped the remaining-bits check without them. The product is now checked and a count that overflows or exceeds the remaining bits is the same decode error as before.
Resolved against main's squash of #303 (the TABLESTYLE R14 to R2007 commit this stack carried): its decoder, probe and section stay main's, and this branch's R2010 TABLESTYLE, CELLSTYLEMAP and cell-style reader sit beside them. - src and examples: both sides kept; dispatch and the objects table list the modern TABLESTYLE and CELLSTYLEMAP arms next to main's. - ARCHITECTURE.md: main's sections plus this branch's R2010 section as 7au; the duplicate until-R2007 section is main's 7ad. - README.md: main's. spec-coverage: this branch's newer TABLESTYLE and CELLSTYLEMAP rows, regenerated. - tools/corpus/baseline.tsv: regenerated by measurement; against main's it is decoded +52, skipped -52 and nothing else.
Bring the #313 head, which already carries main, into this branch. The one section this branch adds to ARCHITECTURE.md moves to 7av after #313's 7au, and the spec-coverage page is regenerated. tools/corpus/baseline.tsv is main's; the Corpus job measures the count change and the baseline is regenerated from its artifact.
Bring the #316 head, which carries #313 and main, into this branch. The section this branch adds to ARCHITECTURE.md moves to 7aw after #316's 7av, and the spec-coverage page is regenerated. tools/corpus/baseline.tsv is main's; the Corpus job measures the count change and the baseline is regenerated from its artifact.
Bring the #317 head, which carries #316, #313 and main, into this branch. The section this branch adds to ARCHITECTURE.md moves to 7ax after #317's 7aw, and the spec-coverage page is regenerated. tools/corpus/baseline.tsv is main's; the Corpus job measures the count change and the baseline is regenerated from its artifact.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3d904e0a64
ℹ️ 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".
…seline Brings in #316's regenerated baseline, then regenerates tools/corpus/baseline.tsv with measure.py baseline from the corpus-measurement artifact of the Corpus (public DWG) job on ee818e8. Against main: decoded +80, skipped -80, every other column unchanged (+52 TABLESTYLE R2010 and CELLSTYLEMAP, +14 TABLEGEOMETRY, +14 TABLECONTENT).
Brings in #317's regenerated baseline, then regenerates tools/corpus/baseline.tsv with measure.py baseline from the corpus-measurement artifact of the Corpus (public DWG) job on 3d904e0. Against main: decoded +94, skipped -94, every other column unchanged (+52 TABLESTYLE R2010 and CELLSTYLEMAP, +14 TABLEGEOMETRY, +14 TABLECONTENT, +14 ACAD_TABLE).
Merged three-way against 1f190eb, the #316 head this branch carried (the train's later #316 commits were never merged here), so #313 and #316 are main's squashes and this branch's TABLECONTENT decoder, probe, cell style walk, dispatch arm and spec-coverage rows for §20.4.97 to §20.4.100 stay; §20.4.101 is main's row. Its ARCHITECTURE section is renumbered 7be after main's 7bd. tools/corpus/baseline.tsv, tools/oracle/baseline.tsv, README.md and STATUS.md are main's; the train regenerates them from CI.
Merged three-way against 1e08844, the #317 head this branch carried, onto #317's refreshed head (which carries main, with #313 and #316 landed). This branch's ACAD_TABLE decoder, probe, dispatch arms and spec-coverage row stay; its ARCHITECTURE section is renumbered 7bf after #317's 7be. tools/corpus/baseline.tsv, tools/oracle/baseline.tsv, README.md and STATUS.md are main's; the train regenerates them from CI.
Merged three-way against 3fc1a9c, the newest #317 head this branch holds, so #317's TABLECONTENT is main's squash (bde3337) and the train's commits on it come in with main. This branch's ACAD_TABLE decoder, probe, dispatch arms and spec-coverage row stay, and its one-line call in examples/probe_tablecontent.rs stays on top of main's version. The ARCHITECTURE section is renumbered 7bg after main's 7bf. tools/corpus/baseline.tsv, tools/oracle/baseline.tsv, README.md and STATUS.md are main's; the train regenerates them from CI.
# Conflicts: # ARCHITECTURE.md
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 4940839785
ℹ️ 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".
…151) The insertion rotation is decoded in radians, and the DXF writes INSERT's group 50 in degrees (src/dxf_entities.rs writes it with to_degrees), so a rotated R2010+ table would have differed from its own twin. Compare it as to_degrees(), as probe_text and probe_viewport do for their angle groups. The cell rotation (145) and the cell style rotation (40) are scalar double groups, not angle groups, and stay compared as stored; no corpus table is rotated, which the probe doc now says.
…till skipped (#424) CHANGELOG gains the table objects (#313, #316, #317, #319), the nineteen classes derived from AutoCAD's output (#326 to #341), the DIMENSION scorer (#387), the BLOCK fixtures (#407), the maintainer tools (#406, #383) and the merge train's stack handling (#421 to #423). README said every skipped type had a decoder in review; only SHAPE (#310) and the VIEWPORT entity header (#311) do, and the rest are twelve custom classes in the BookViewerApp3 drawings with no DXF export yet, now named. STATUS's pending section says its counts are the 2026-08-30 snapshot.
Summary
Stacked on #317, which is stacked on #316, #313 and #303 (it targets main, so the diff includes all four until they land). Decode ACAD_TABLE (§20.4.96) in both its layouts: §20.4.96.1 (until R21) on R14 to R2007 and §20.4.96.2 on R2010 and later, where the entity embeds the table content of §20.4.97 and reuses #317's reader. It had no decoder, so all 14 corpus records (two tables on each of R14 to R2018) were skipped.
Spec reference
§20.4.96.1, §20.4.96.2, with §20.4.99 Value and §20.4.97 TABLECONTENT (tracking #151). Both layouts close on the data-stream boundary of all 14 records, once five readings the spec leaves out or gets wrong are taken from the bits:
TCform on every release, as in TABLESTYLE; read as the one-BSCMCof R14 and R2000 the first colour override leaves the boundary.TVof its own. ATVcosts no data-stream bits there, so the boundary cannot see it, but reading one shifts every later string by a place; AutoCAD's DXF value and format strings settle it.BS, not the spec'sRS(read asRSit is 20801, asBSit is 5, the DXF's group 170).0x40000that carries no data; the DXF writes the whole word as group 91.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,cargo +1.85 check --all-features,cargo run --release --example spec_examplesandpython3 tools/ci/spec_coverage.py --checkall pass on this branch.Shown on real files, no new unit tests:
cargo run --release --example probe_acad_table -- <corpus>over the 52 pinned drawings. It closes on the boundary and compares every decoded value with AutoCAD's DXF export.R2000 to R2007 are walked cell by cell against the entity's own groups (type, edge, merge and autofit flags, merged size, rotation, text, override flags and each override, and on R2007 each cell's value block). R2010 and later are compared against the same legacy groups AutoCAD still writes: insertion point, horizontal direction, counts, widths, heights, each cell's first value and each block cell's scale.
The content an R2010+ entity embeds is a separate encoding from the
TABLECONTENTandTABLEGEOMETRYobjects the file still holds for the table. The probe walks it against the DXF's two objects too and reports the result without counting it: the first table agrees in 2179 values and differs in 2 (one cell holds a content the object does not), the second agrees in 745 and differs in 18 from its second block cell (object: three contents and a block scale of 0.00596; entity: one content and a scale of 1, which is what the entity's own group 144 says). The first table's cell geometry equals theTABLEGEOMETRYobject value for value. Where they differ, the entity's own groups side with the embedded copy.Corpus baseline regenerated: decoded +14, skipped -14, errored unchanged (7 rows).
Tests touched: none.
examples/probe_acad_table.rsis an example;examples/support/cellstyles.rsgained a flag so the shared TABLECONTENT walk can skip cell geometry the DXF object does not hold.The DXF oracle does not score ACAD_TABLE yet.
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:
973628f3…f504b) is explicitly allowed (seeCLEANROOM.md).My contribution is based on:
Developer Certificate of Origin
By submitting this PR, I certify that the contribution complies with the Developer Certificate of Origin 1.1.