Skip to content

feat(objects): decode TABLESTYLE from R2010 and CELLSTYLEMAP (§20.4.101.2, §20.4.102, #151) - #313

Merged
DrunkOnJava merged 11 commits into
mainfrom
obj/tablestyle-r2010
Oct 28, 2026
Merged

DrunkOnJava merged 11 commits into
mainfrom
obj/tablestyle-r2010

Conversation

@DrunkOnJava

Copy link
Copy Markdown
Owner

Summary

Stacked on #303 (its base branch is obj/tablestyle; it targets main so the diff below includes #303's commits until that lands). Decode TABLESTYLE from R2010 (§20.4.101.2) and CELLSTYLEMAP (§20.4.102). Both are sequences of cell styles (§20.4.101.4, with the content format of §20.4.101.3 inside them), read by one shared reader src/objects/table_cell_style.rs. All 20 R2010 to R2018 TABLESTYLE records and all 32 R14 to R2007 CELLSTYLEMAP records were skipped.

Spec reference

§20.4.101.2 TABLESTYLE (R24 format), §20.4.101.3 content format, §20.4.101.4 cell style, §20.4.102 CELLSTYLEMAP (tracking #151). Three readings come from the bits (ARCHITECTURE.md §7x has the evidence):

  • the repeated cell styles are title, header, data (ids 1, 2, 3), not "data, title, header";
  • each of them is led by one BL equal to its id, which the spec's table does not list;
  • the two BLs after the description are 0 and 101 (the first custom cell style id).

Test plan

  • cargo fmt --all -- --check and cargo clippy --all-targets --all-features -- -D warnings pass on this branch. cargo test, cargo doc and the 1.85 MSRV check run once on a merge of this lane's open branches instead of per branch (the machine is at memory pressure red); the result goes in a comment.

  • Shown on real files, no new unit tests: cargo run --release --example probe_tablestyle -- <corpus> and cargo run --release --example probe_cellstylemap -- <corpus> over the 52 pinned drawings. Each closes on the boundary and compares every decoded value with AutoCAD's DXF export, walking its groups in the order the spec prints the fields, so a field in the wrong place shows as the wrong group.

    Release TABLESTYLE close Values compared CELLSTYLEMAP close Values compared Differ
    R14 8 / 8 no twin 8 / 8 no twin
    R2000 8 / 8 608 8 / 8 2360 0
    R2004 8 / 8 608 8 / 8 2360 0
    R2007 8 / 8 680 8 / 8 2360 0
    R2010 8 / 8 (new) 2368 none in the DWG 0
    R2013 8 / 8 (new) 2368 none in the DWG 0
    R2018 4 / 4 (new) 592 none in the DWG 0

    AutoCAD writes the CELLSTYLEMAP afresh on every save, so the DWG's and the DXF's never share a handle: each DWG record is paired with the only CELLSTYLEMAP in its twin. From R2010 the cell styles of the TABLESTYLE record are compared with that same twin object; the table's own cell style (id 4) and the text style and line type handles have no DXF value and are not compared.

  • Corpus baseline regenerated: decoded +52, skipped -52, errored unchanged (52 rows).

  • Tests touched: none. examples/probe_cellstylemap.rs, examples/support/cellstyles.rs and the harness additions in examples/support/twin.rs are new or extended examples, not tests.

  • The DXF oracle does not score these types 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.
@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-28T00:15:11.510375Z be8264e 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.

….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.
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.
DrunkOnJava added a commit that referenced this pull request Oct 27, 2026
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.
DrunkOnJava added a commit that referenced this pull request Oct 27, 2026
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.

@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: 72300c3666

ℹ️ 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 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
@DrunkOnJava
DrunkOnJava enabled auto-merge (squash) October 28, 2026 00:29
@DrunkOnJava
DrunkOnJava merged commit 5545572 into main Oct 28, 2026
26 checks passed
@DrunkOnJava
DrunkOnJava deleted the obj/tablestyle-r2010 branch October 28, 2026 00:38
DrunkOnJava added a commit that referenced this pull request Oct 28, 2026
Merged three-way against 6d9c59f, the #313 head this branch carried, so #313's
parts are main's squash (5545572) and this branch's TABLEGEOMETRY decoder, probe,
dispatch arm and spec-coverage row stay. Its ARCHITECTURE section is renumbered
7bd after main's 7bc. 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 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.
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