You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TEXT, MTEXT, ATTDEF, ATTRIB and TOLERANCE error on 199 R14 to R2004 records of the public corpus #226
ACadSharp's saves of one AutoCAD drawing as R14, R2000 and R2004 (DomCR/ACadSharpsamples/ @ c30a97ce, MIT, pinned in tools/corpus/pins.tsv by #225) error on 199 text-family records that the old 19-file corpus never held. The same records decode and close on the R2007 to R2018 saves of the same drawing, so these are pre-R2007 field-list defects, not drawing oddities. One R2018 drawing (export_sample.dwg, AutoCAD 2025) also errors on 4 TEXT records.
Type
R14 sample_AC1014
R2000 sample_AC1015
R2004 sample_AC1018
R2018 export_sample
TEXT (§20.4.3)
29
29
29
4
MTEXT (§20.4.46)
36
0
36
0
ATTDEF (§20.4.5)
5
5
5
0
ATTRIB (§20.4.4)
4
4
4
0
TOLERANCE (§20.4.49)
3
3
3
0
MTEXT closes on R2000 but not on R14 or R2004. Each ACadSharp save but R14 has an AutoCAD ASCII DXF export of the same drawing next to it (sample_AC1015_ascii.dxf and so on), so expected values exist for the R2000 and R2004 records; R14 and export_sample.dwg have no DXF twin.
Evidence: the Measure run on #225, 40297255178 ("Errored records by type and release"); per-file rows in tools/corpus/baseline.tsv.
Reproduce:
python3 -I tools/corpus/fetch.py --dest ../dwg-corpus
cargo run --release --example coverage_report -- ../dwg-corpus/acadsharp
cargo run --release --example probe_decode_errors -- ../dwg-corpus/acadsharp/sample_AC1018.dwg
Done when
Every record above closes on its boundary, the baseline row of each file is updated in the same PR, and docs/spec-coverage.md's rows for these sections say what the PR measured. Family: #140.
The spec's own R14 examples reproduce this and pin the causes (#107: cargo run --release --example spec_examples, rows of tests/fixtures/spec-examples/r14-objects.tsv; every dump's printed CRC verifies, so these are AutoCAD's bytes):
Spec example
The crate
§20.4's own R13-R14 list on the same bytes
§20.4.3.1 TEXT (p109)
data fields end at bit 519, boundary 523 (delta -4)
closes
§20.4.4.1 ATTRIB (p110)
delta -52
closes
§20.4.5.1 ATTDEF (p111)
delta -140
closes
§20.4.46.1 MTEXT (p150)
delta +69
closes
§20.4.49.1 TOLERANCE (p155)
cursor exhausted
closes only with two corrections to the spec (below)
TEXT, and ATTRIB and ATTDEF through it:entities::text::decode has no R13-R14 branch. §20.4.3's R13-14 list is BD elevation, 2RD insertion, 2RD alignment, 3BD extrusion, BD thickness, oblique, rotation, height and width factor, TV, then three BS, with no DataFlags byte; the decoder reads the R2000+ DataFlags layout on R14. Separately, its R2000+ path reads each optional field when its DataFlags bit is set, where §20.4.3 says "present if !(DataFlags & …)"; that may be part of the R2000 and R2004 errors in the table above.
MTEXT: §20.4.46 gives Linespacing Style BS, Linespacing Factor BD and the unknown B to R2000+ only, and read_modern_fields reads them on R14. Their widths on this record (2 + 66 + 1 bits) are exactly the +69 overshoot.
TOLERANCE: the decoder reads the DIMSTYLE handle inside the data fields (let dimstyle_handle = c.read_handle()?), past the R13-R14 RL boundary, where §20.4.49 puts it in the handle refs. And §20.4.49's list does not close on its own example. The record closes, with every value plausible, only when the text string is a TV (§20.4.49 types it BS) and one more BD precedes Height: BD 0.0, height 0.18, dimgap 0.09, insertion (11.777, 3.370, 0), X direction (1, 0, 0), extrusion (0, 0, 1), text {\Fgdt;j}%%v{\Fgdt;n}asdf{\Fgdt;m}%%v%%v%%v%%v. 0.18 and 0.09 are AutoCAD's imperial DIMTXT and DIMGAP defaults. One record cannot name the extra BD; The spec's worked examples as fixtures #107's PR records both as spec errata in ARCHITECTURE.md.
A fix here should flip these rows' expect cells from error #226 to closes; the example fails on any row whose result changes, in either direction.
Activity
DrunkOnJava commentedon Oct 26, 2026
The spec's own R14 examples reproduce this and pin the causes (#107:
cargo run --release --example spec_examples, rows oftests/fixtures/spec-examples/r14-objects.tsv; every dump's printed CRC verifies, so these are AutoCAD's bytes):entities::text::decodehas no R13-R14 branch. §20.4.3's R13-14 list isBDelevation,2RDinsertion,2RDalignment,3BDextrusion,BDthickness, oblique, rotation, height and width factor,TV, then threeBS, with noDataFlagsbyte; the decoder reads the R2000+DataFlagslayout on R14. Separately, its R2000+ path reads each optional field when itsDataFlagsbit is set, where §20.4.3 says "present if !(DataFlags & …)"; that may be part of the R2000 and R2004 errors in the table above.Linespacing Style BS,Linespacing Factor BDand the unknownBto R2000+ only, andread_modern_fieldsreads them on R14. Their widths on this record (2 + 66 + 1 bits) are exactly the +69 overshoot.let dimstyle_handle = c.read_handle()?), past the R13-R14RLboundary, where §20.4.49 puts it in the handle refs. And §20.4.49's list does not close on its own example. The record closes, with every value plausible, only when the text string is aTV(§20.4.49 types itBS) and one moreBDprecedesHeight:BD0.0, height 0.18, dimgap 0.09, insertion (11.777, 3.370, 0), X direction (1, 0, 0), extrusion (0, 0, 1), text{\Fgdt;j}%%v{\Fgdt;n}asdf{\Fgdt;m}%%v%%v%%v%%v. 0.18 and 0.09 are AutoCAD's imperial DIMTXT and DIMGAP defaults. One record cannot name the extraBD; The spec's worked examples as fixtures #107's PR records both as spec errata in ARCHITECTURE.md.A fix here should flip these rows'
expectcells fromerror #226tocloses; the example fails on any row whose result changes, in either direction.test(fixtures): run the specification's own worked examples through t…
test(fixtures): run the specification's own worked examples through t…
test(fixtures): run the specification's own worked examples through t…
test(fixtures): run the specification's own worked examples through t…
fix(entities): read TOLERANCE's §20.4.49 version branch the right way…
fix(entities): read MTEXT's §20.4.46 version branches on R13 to R2004 (…
fix(entities): read TEXT, ATTRIB and ATTDEF as §20.4.3-§20.4.5 print …
feat(dxf): score TOLERANCE in the value oracle (§20.4.49) (#392)