Skip to content

feat(objects): decode TABLECONTENT from §20.4.97 (#151) - #317

Merged
DrunkOnJava merged 21 commits into
mainfrom
obj/table-content
Oct 28, 2026
Merged

DrunkOnJava merged 21 commits into
mainfrom
obj/table-content

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

Summary

Stacked on #316, which is stacked on #313 and #303 (it targets main, so the diff includes all three until they land). Decode TABLECONTENT (§20.4.97): the cells of a table and what they hold, as one data stream through the four inherited classes (AcDbLinkedData, AcDbLinkedTableData, AcDbFormattedTableData, AcDbTableContent). It had no decoder, so all 14 corpus records (two tables on each of R14 to R2018) were skipped. This is also the body ACAD_TABLE embeds from R2010, so the next PR (#319) reuses read_content_body. §20.4.98 (cell content geometry), §20.4.99 (value) and §20.4.100 (custom data collection) are decoded here as parts of the record, so their coverage rows close with it.

Spec reference

§20.4.97 TABLECONTENT, with §20.4.99 Value and §20.4.100 Custom data collection (tracking #151). The field list closes on the data-stream boundary of all 14 records, once two readings the spec does not print are taken from the bits:

  • From R2007 a string value is a BL byte count and that many bytes of UTF-16LE in the data stream. The spec types it TV, and a TV reads from the string stream, which holds nothing of it.
  • A value whose flags have bit 1 set (Flags & 0x01, the spec's "kGeneral") keeps its data type but has no data. The empty cells of the corpus carry flags 7, a data type of 0 and nothing between the type and the unit type.

Data types 128 and 256 are not described and are refused as unsupported. The object, field and style handles are in the handle stream and are not read.

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_examples and python3 tools/ci/spec_coverage.py --check all pass on this branch.

  • Shown on real files, no new unit tests: cargo run --release --example probe_tablecontent -- <corpus> over the 52 pinned drawings. It closes on the boundary and compares every decoded value with AutoCAD's DXF export, walking the groups in the order the spec prints the fields.

    Release Records Close Values compared with the DXF Differ
    R14 2 2 no twin (boundary only)
    R2000, R2004 4 4 8454 (4227 each) 0
    R2007 to R2018 (4 releases) 8 8 18240 (4560 each) 0

    The first table's object has the same handle in the DWG and the DXF. The second table's was created while saving and has another handle in the DXF, so a DWG record that finds no DXF record of its handle is paired with the next unpaired DXF record of the type, in file order (Pairing::HandleThenOrder). 1038 DXF values are handles (groups 340 and 330) the probe omits.

  • Corpus baseline regenerated: decoded +14, skipped -14, errored unchanged (14 rows, two per drawing from R14 to R2018 on the ACadSharp sample set).

  • Tests touched: none. examples/probe_tablecontent.rs is an example, and examples/support/cellstyles.rs now holds the TABLECONTENT walk (compare_content), shared with the ACAD_TABLE probe of feat(entities): decode ACAD_TABLE from §20.4.96 (#151) #319.

  • The DXF oracle does not score TABLECONTENT 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:

  • 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, sha256 973628f3…f504b) is explicitly allowed (see CLEANROOM.md).
  • No GPL-licensed DWG implementation source (LibreDWG, etc.) was consulted or imported.

My contribution is based on:

  • The ODA's freely-redistributable Open Design Specification for .dwg files (v5.4.1);
  • The corpus bytes and AutoCAD's own DXF exports of the pinned drawings (the oracle);
  • No reading of comments or code in any other project.

Developer Certificate of Origin

By submitting this PR, I certify that the contribution complies with the Developer Certificate of Origin 1.1.

§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.
….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.
@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-28T01:40:10.803218Z 8409072 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: b34b404048

ℹ️ 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/table_content.rs Resolved
Comment thread examples/probe_tablecontent.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: 714b7f84d2

ℹ️ 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/support/cellstyles.rs Resolved
… 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.
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.
DrunkOnJava added a commit that referenced this pull request Oct 27, 2026
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.
…tack (#151)

Regenerated with measure.py baseline from the corpus-measurement artifact of the
Corpus (public DWG) job on 9dd3a50. Against main: decoded +66, skipped -66,
errored and every other column unchanged (+52 from the TABLESTYLE R2010 and
CELLSTYLEMAP lane below, +14 TABLEGEOMETRY).
…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).
DrunkOnJava added a commit that referenced this pull request Oct 27, 2026
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).
@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
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.
DrunkOnJava added a commit that referenced this pull request Oct 28, 2026
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.

@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: 3fc1a9ca51

ℹ️ 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 enabled auto-merge (squash) October 28, 2026 01:44
@DrunkOnJava
DrunkOnJava merged commit bde3337 into main Oct 28, 2026
26 checks passed
@DrunkOnJava
DrunkOnJava deleted the obj/table-content branch October 28, 2026 02:00
DrunkOnJava added a commit that referenced this pull request Oct 28, 2026
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.
DrunkOnJava added a commit that referenced this pull request Oct 28, 2026
* feat(objects): decode TABLESTYLE on R14 to R2007 from §20.4.101.1 (#151)

§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.

* fix(examples): a probe with no DXF counterpart checks its boundary alone

* fix(examples): carry the one harness file every probe of this lane shares, so the copies merge in any order

* feat(objects): decode TABLESTYLE from R2010 and CELLSTYLEMAP from §20.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.

* feat(objects): decode TABLEGEOMETRY from §20.4.103 (#151)

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.

* fix(objects): do not link a private function from the TABLESTYLE module doc (#151)

* feat(objects): decode TABLECONTENT from §20.4.97 (#151)

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.

* refactor(examples): the TABLECONTENT walk lives with the cell style walk so a table's embedded copy can use it

* docs(spec): §20.4.98 to §20.4.100 close with TABLECONTENT, which decodes them (#151)

* fix(objects): keep a long table value signed and walk a content's attributes in the probe (#151)

* feat(entities): decode ACAD_TABLE from §20.4.96 (#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.

* fix(objects): skip the field reference handles after a TABLECONTENT's 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.

* fix(entities): check a legacy ACAD_TABLE's cell count for overflow before 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.

* chore(corpus): record the baseline the Corpus job measured for this stack (#151)

Regenerated with measure.py baseline from the corpus-measurement artifact of the
Corpus (public DWG) job on 9dd3a50. Against main: decoded +66, skipped -66,
errored and every other column unchanged (+52 from the TABLESTYLE R2010 and
CELLSTYLEMAP lane below, +14 TABLEGEOMETRY).

* docs(architecture): renumber the new section (7bg->7bh) after the sections main added

* chore(corpus): commit the baselines CI run 40624141227 measured

* fix(examples): compare an ACAD_TABLE's insertion rotation in degrees (#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.
DrunkOnJava added a commit that referenced this pull request Oct 28, 2026
…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.
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