Skip to content

fix(tables): read the pre-R2007 VIEW record as §20.4.60 gives it - #263

Merged
DrunkOnJava merged 2 commits into
mainfrom
fix/view-pre2007
Oct 26, 2026
Merged

DrunkOnJava merged 2 commits into
mainfrom
fix/view-pre2007

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

Summary

The pre-R2007 VIEW record is read as §20.4.60 gives it. The ACadSharp R14, R2000 and R2004 VIEW records, which errored, now close on their boundary, and every field the decoder surfaces equals AutoCAD's export.

Spec reference

§20.4.60 VIEW: BD 40, BD 41, 2RD 10 (view centre, "not bit-pair coded"), 3BD 12, 3BD 11, BD 50, BD 42, BD 43, BD 44, the 4-bit view mode (71), R2000+ RC 281 render mode, the paper-space B (70 bit 1), and R2000+ the associated-UCS B (72) followed, when set, by 3BD origin, 3BD x and y directions, BD 146 elevation and BS 79 orthographic type. The pre-R2007 decoder read the centre as two BDs, the view mode as a BS and no UCS block; the R2007+ split-stream decoder already followed the spec.

The view mode stays the four stored bits, as on R2007+; surfacing it as group 71 for VIEW and VPORT alike follows #238. The pre-R2007 synthetic test is rewritten to the spec's layout (its assertions are unchanged); no test added.

Test plan

  • cargo fmt --all -- --check, cargo clippy --all-targets --all-features -- -D warnings, RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features
  • cargo test --release --all-features with ../../samples present: all pass
  • Coverage on the pinned corpus of ci(corpus): measure the reader on public drawings fetched by pinned hash #225 (tools/corpus/fetch.py tree): ACadSharp errors 308 → 305 and decoded 6438 → 6441 (the three VIEW records); nextgis unchanged (no VIEW there):
cargo run --release --example coverage_report -- <corpus>/acadsharp
VIEW (§20.4.60) records per release: 0 1 1 1 1 1 1
  field                                    group            R14   R2000   R2004   R2007   R2010   R2013   R2018   total
  back_clip                                44                         =       =       =       =       =       =   6/0/0/0
  flag_64 (the export never writes bit 64) -                          -       -       -       -       -       -   0/0/0/6
  front_clip                               43                         =       =       =       =       =       =   6/0/0/0
  is_associated_ucs                        72                         =       =       =       =       =       =   6/0/0/0
  is_paperspace                            70&1                       =       =       =       =       =       =   6/0/0/0
  is_xref_dependent (Xdep)                 70&16                      =       =       =       =    ≠1/1    ≠1/1   4/0/2/0
  lens_length                              42                         =       =       =       =       =       =   6/0/0/0
  name                                     2                          =       =       =       =       =       =   6/0/0/0
  render_mode                              281                        =       =       =       =       =       =   6/0/0/0
  target.x                                 12                         =       =       =       =       =       =   6/0/0/0
  target.y                                 22                         =       =       =       =       =       =   6/0/0/0
  target.z                                 32                         =       =       =       =       =       =   6/0/0/0
  twist_angle                              50                         =       =       =       =       =       =   6/0/0/0
  view_center.x                            10                         =       =       =       =       =       =   6/0/0/0
  view_center.y                            20                         =       =       =       =       =       =   6/0/0/0
  view_direction.x                         11                         =       =       =       =       =       =   6/0/0/0
  view_direction.y                         21                         =       =       =       =       =       =   6/0/0/0
  view_direction.z                         31                         =       =       =       =       =       =   6/0/0/0
  view_height                              40                         =       =       =       =       =       =   6/0/0/0
  view_mode (stored bits, as group 71)     71                         =       =       =       =       =       =   6/0/0/0
  view_width                               41                         =       =       =       =       =       =   6/0/0/0
  xref_index_plus_1                        -                          -       -       -       -       -       -   0/0/0/6

R2000 and R2004 were decode error before. The one remaining difference, Xdep on the R2013 and R2018 VIEW, is the entry-header question of #235 (VIEW's single record on each of those releases carries the clear bit first, as R2007 and R2010 do, unlike every other table type there); it is noted on #256 and not changed here.

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

Based on ODA spec v5.4.1 §20.4.60 and AutoCAD's own DXF exports of the ACadSharp samples/ drawings, read as data.

Developer Certificate of Origin

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

Refs #256

@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-26T11:18:22.346846Z 66f520d 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.

The pre-R2007 VIEW decoder read the view centre as two BDs, the view
mode as a BS and stopped after the associated-UCS bit. §20.4.60 gives a
2RD centre ("not bit-pair coded"), a 4-bit view mode (the encoding
VPORT uses), an RC render mode from R2000, the paper-space bit, and
from R2000 the associated-UCS bit followed, when set, by the UCS origin,
axes, elevation and orthographic type. The three ACadSharp VIEW records
of the R14, R2000 and R2004 saves errored on a reserved BD code; with
the spec's list all three close on their boundary (ACadSharp errors
308 -> 305, decoded 6438 -> 6441; nextgis unchanged, it has no VIEW).

The view mode stays the stored four bits, as on R2007+; surfacing it as
group 71 for VIEW and VPORT alike follows #238. The pre-R2007 synthetic
test writes the spec's layout.

Refs #256
sample_AC1014, sample_AC1015 and sample_AC1018 each decode one more
record (their VIEW) and error one fewer; measure.py check passes.
@DrunkOnJava
DrunkOnJava enabled auto-merge (squash) October 26, 2026 11:18
DrunkOnJava added a commit that referenced this pull request Oct 26, 2026
Three more types are compared field by field with AutoCAD's export:
MLEADERSTYLE (§20.4.87) and VIEW (§20.4.60) against their spec's DXF
column, and VISUALSTYLE, which v5.4.1 does not prescribe, against the
DXF Reference's group for each named property.

On the 49 drawing pairs: MLEADERSTYLE's 49 records R2000-R2018 agree on
every decoded value (1914 equal, 36 by the DXF default). VISUALSTYLE's
1,008 records agree on 58,104 values and disagree on 264, all filed on
#250: format_version on R2013 and R2018 (DWG 2, export 3) and Realistic's
face lighting quality on R2000-R2007 (DWG 2, export 3). VIEW's 6 records
agree on 118 values; the R2013 and R2018 Xdep bit disagrees (#256).
Before #251 and #253 these scorers found 1,440 VISUALSTYLE values and
MLEADERSTYLE's two swapped flags wrong.

tools/oracle/baseline.tsv gains the 789 new rows; VIEW and MLEADERSTYLE
in docs/spec-coverage.md say what was measured, and VIEW no longer lists
the pre-R2007 errors #263 fixed. CLEANROOM records the scorers' sources.

Refs #99, #102, #250, #256
DrunkOnJava added a commit that referenced this pull request Oct 26, 2026
Three more types are compared field by field with AutoCAD's export:
MLEADERSTYLE (§20.4.87) and VIEW (§20.4.60) against their spec's DXF
column, and VISUALSTYLE, which v5.4.1 does not prescribe, against the
DXF Reference's group for each named property.

On the 49 drawing pairs: MLEADERSTYLE's 49 records R2000-R2018 agree on
every decoded value (1914 equal, 36 by the DXF default). VISUALSTYLE's
1,008 records agree on 58,104 values and disagree on 264, all filed on
#250: format_version on R2013 and R2018 (DWG 2, export 3) and Realistic's
face lighting quality on R2000-R2007 (DWG 2, export 3). VIEW's 6 records
agree on 118 values; the R2013 and R2018 Xdep bit disagrees (#256).
Before #251 and #253 these scorers found 1,440 VISUALSTYLE values and
MLEADERSTYLE's two swapped flags wrong.

tools/oracle/baseline.tsv gains the 789 new rows; VIEW and MLEADERSTYLE
in docs/spec-coverage.md say what was measured, and VIEW no longer lists
the pre-R2007 errors #263 fixed. CLEANROOM records the scorers' sources.

Refs #99, #102, #250, #256
@DrunkOnJava
DrunkOnJava merged commit 507256e into main Oct 26, 2026
26 checks passed
@DrunkOnJava
DrunkOnJava deleted the fix/view-pre2007 branch October 26, 2026 11:43
DrunkOnJava added a commit that referenced this pull request Oct 26, 2026
Three more types are compared field by field with AutoCAD's export:
MLEADERSTYLE (§20.4.87) and VIEW (§20.4.60) against their spec's DXF
column, and VISUALSTYLE, which v5.4.1 does not prescribe, against the
DXF Reference's group for each named property.

On the 49 drawing pairs: MLEADERSTYLE's 49 records R2000-R2018 agree on
every decoded value (1914 equal, 36 by the DXF default). VISUALSTYLE's
1,008 records agree on 58,104 values and disagree on 264, all filed on
#250: format_version on R2013 and R2018 (DWG 2, export 3) and Realistic's
face lighting quality on R2000-R2007 (DWG 2, export 3). VIEW's 6 records
agree on 118 values; the R2013 and R2018 Xdep bit disagrees (#256).
Before #251 and #253 these scorers found 1,440 VISUALSTYLE values and
MLEADERSTYLE's two swapped flags wrong.

tools/oracle/baseline.tsv gains the 789 new rows; VIEW and MLEADERSTYLE
in docs/spec-coverage.md say what was measured, and VIEW no longer lists
the pre-R2007 errors #263 fixed. CLEANROOM records the scorers' sources.

Refs #99, #102, #250, #256
DrunkOnJava added a commit that referenced this pull request Oct 26, 2026
…he crate (#107) (#280)

* test(fixtures): run the specification's own worked examples through the crate (#107)

examples/spec_examples.rs runs every worked example and printed table of ODA spec v5.4.1 through the crate's public code: the §2 bit streams, the §2.14 CRC tables, §3.2.6, §4.1, §4.7, §5.10.1, the §9 R14 header dump and the 78 §20.4 R13/R14 object dumps. The fixtures quote the PDF verbatim with page numbers; tools/spec/extract_examples.py regenerates and audits them. CI's Test job runs it, and r14-objects.tsv's expect column fails the run when any outcome moves.

Five spec errata are recorded in ARCHITECTURE.md §7k; the crate disagreements are tracked in #71, #226, #227, #256, #272, #273 and #274.

* test(fixtures): spec_examples --update records moved outcomes and their coverage notes (#107)

* test(fixtures): record §20.4.60 VIEW closing after #263 (#107)
DrunkOnJava added a commit that referenced this pull request Oct 26, 2026
Three more types are compared field by field with AutoCAD's export:
MLEADERSTYLE (§20.4.87) and VIEW (§20.4.60) against their spec's DXF
column, and VISUALSTYLE, which v5.4.1 does not prescribe, against the
DXF Reference's group for each named property.

On the 49 drawing pairs: MLEADERSTYLE's 49 records R2000-R2018 agree on
every decoded value (1914 equal, 36 by the DXF default). VISUALSTYLE's
1,008 records agree on 58,104 values and disagree on 264, all filed on
issue 250: format_version on R2013 and R2018 (DWG 2, export 3) and
Realistic's face lighting quality on R2000-R2007 (DWG 2, export 3).
VIEW's 6 records agree on every decoded value (120 equal), the R2013 and
R2018 Xdep bit included since #293. Before #251 and #253 these scorers
found 1,440 VISUALSTYLE values and MLEADERSTYLE's two swapped flags
wrong.

tools/oracle/baseline.tsv gains the 789 new rows; VIEW and MLEADERSTYLE
in docs/spec-coverage.md say what was measured, and VIEW no longer lists
the pre-R2007 errors #263 fixed. CLEANROOM records the scorers' sources.

Refs #99, #102, #250, #256
DrunkOnJava added a commit that referenced this pull request Oct 26, 2026
…le (#279)

Three more types are compared field by field with AutoCAD's export:
MLEADERSTYLE (§20.4.87) and VIEW (§20.4.60) against their spec's DXF
column, and VISUALSTYLE, which v5.4.1 does not prescribe, against the
DXF Reference's group for each named property.

On the 49 drawing pairs: MLEADERSTYLE's 49 records R2000-R2018 agree on
every decoded value (1914 equal, 36 by the DXF default). VISUALSTYLE's
1,008 records agree on 58,104 values and disagree on 264, all filed on
issue 250: format_version on R2013 and R2018 (DWG 2, export 3) and
Realistic's face lighting quality on R2000-R2007 (DWG 2, export 3).
VIEW's 6 records agree on every decoded value (120 equal), the R2013 and
R2018 Xdep bit included since #293. Before #251 and #253 these scorers
found 1,440 VISUALSTYLE values and MLEADERSTYLE's two swapped flags
wrong.

tools/oracle/baseline.tsv gains the 789 new rows; VIEW and MLEADERSTYLE
in docs/spec-coverage.md say what was measured, and VIEW no longer lists
the pre-R2007 errors #263 fixed. CLEANROOM records the scorers' sources.

Refs #99, #102, #250, #256
DrunkOnJava added a commit that referenced this pull request Oct 26, 2026
§20.4.60 stores VIEW's view mode as four bits, "0: 71's bit 0 (1), 1:
71's bit 1 (2), 2: 71's bit 2 (4), 3: OPPOSITE of 71's bit 4 (16)", and
notes that bit 3 (8) of group 71 "can not be specified". Both VIEW paths
surfaced the raw bits; they now surface the group-71 value through the
conversion VPORT uses (§20.4.64, #238), with no UCSFOLLOW bit.

The DXF value oracle compares ViewEntry::view_mode with group 71
directly now, instead of converting the stored bits in its scorer: equal
on all 6 VIEW records, R2000 to R2018. Its baseline row is renamed from
"view_mode (stored bits, as group 71)" to "view_mode". The two VIEW
round-trip tests write the bits 0001, whose group-71 value is 0.

Closes #256 (with #263, #279 and #293, every decoded VIEW value now equals the export).
DrunkOnJava added a commit that referenced this pull request Oct 26, 2026
§20.4.60 stores VIEW's view mode as four bits, "0: 71's bit 0 (1), 1:
71's bit 1 (2), 2: 71's bit 2 (4), 3: OPPOSITE of 71's bit 4 (16)", and
notes that bit 3 (8) of group 71 "can not be specified". Both VIEW paths
surfaced the raw bits; they now surface the group-71 value through the
conversion VPORT uses (§20.4.64, #238), with no UCSFOLLOW bit.

The DXF value oracle compares ViewEntry::view_mode with group 71
directly now, instead of converting the stored bits in its scorer: equal
on all 6 VIEW records, R2000 to R2018. Its baseline row is renamed from
"view_mode (stored bits, as group 71)" to "view_mode". The two VIEW
round-trip tests write the bits 0001, whose group-71 value is 0.

Closes #256 (with #263, #279 and #293, every decoded VIEW value now equals the export).
DrunkOnJava added a commit that referenced this pull request Oct 28, 2026
…d say what measured them (#140, #147, #148, #133, #127) (#398)

Seven rows leave partial for closes because no record of any kind errors on the
52 drawings of run 40532346172 and the errors their notes still quote were
fixed: TEXT, ATTRIB, ATTDEF (#258), MTEXT (#261), VIEW (#263, #284), DIMSTYLE
(#293) and HATCH (#264, the R14 records routed). §22 AcDb:Template goes from
missing to partial: dxf_header reads $MEASUREMENT from it (#320). §9 stays
closes, now tracked by #127 (R13) and carrying the per-release evidence behind
closing #128, #129 and #130. The page's Last measured line and the paragraph
that said closes came from a local 19-file corpus are updated.
DrunkOnJava added a commit that referenced this pull request Oct 28, 2026
…ain run (#195) (#401)

* docs(spec-coverage): move the rows the 2026-10-27 main run proves, and say what measured them (#140, #147, #148, #133, #127)

Seven rows leave partial for closes because no record of any kind errors on the
52 drawings of run 40532346172 and the errors their notes still quote were
fixed: TEXT, ATTRIB, ATTDEF (#258), MTEXT (#261), VIEW (#263, #284), DIMSTYLE
(#293) and HATCH (#264, the R14 records routed). §22 AcDb:Template goes from
missing to partial: dxf_header reads $MEASUREMENT from it (#320). §9 stays
closes, now tracked by #127 (R13) and carrying the per-release evidence behind
closing #128, #129 and #130. The page's Last measured line and the paragraph
that said closes came from a local 19-file corpus are updated.

* docs(criteria): re-measure the 1.0 requirements from the 2026-10-27 main run (#195)

Header, R2, R3, R4, R8, X1 and S3 now carry what run 40542129639 (main 61255e9)
and docs/data/spec-coverage.tsv say: 52 drawings with 0 errored records and 533
skipped, 53 sections scored by the DXF oracle with 22 values disagreeing, 90
closes, 13 partial, 6 decoder and 29 missing rows, a wasm32 compile of the
library in the Clippy job. X1 (DXF) moves from not measured to failed: the HEADER,
TABLES, ENTITIES and BLOCKS probes pair the written records with AutoCAD's export
and find 0 groups disagreeing, and 342 entity records of 18 kinds and the OBJECTS
section are not written. No other status changes.

* docs(criteria): R3 counts the rows #398 moves: 97 closes, 7 partial, 6 decoder, 28 missing (#195)

The counts are those of docs/data/spec-coverage.tsv with #398, whose moves run
40532346172 proves.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant