Skip to content

fix(objects): MLEADERSTYLE stores the annotative flag before the overwrite flag (departs from §20.4.87) - #253

Merged
DrunkOnJava merged 3 commits into
mainfrom
fix/mleaderstyle-flags
Oct 26, 2026
Merged

DrunkOnJava merged 3 commits into
mainfrom
fix/mleaderstyle-flags

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

Summary

MLEADERSTYLE's two flags after scale are read in the order AutoCAD stores them, is_annotative (296) first and overwrite_property_value (295) second, departing from §20.4.87, which lists them the other way round.

Spec reference

§20.4.87 MLEADERSTYLE lists B 295 (property changed, "meaning not totally clear") before B 296 (is annotative), and the decoder followed it. Both orders consume the same two bits, so the boundary cannot tell them apart. AutoCAD's DXF export can: it writes the overwrite flag in 295 and the annotative flag in 296, and on every MLEADERSTYLE where the two differ (14 of 49 records) the decoded values are swapped.

CLEANROOM.md gets a dated correction to its 2026-08-30 entry, which said v5.4.1 has no MLEADERSTYLE prescription: §20.4.87 is one, and this PR departs from it on the flag order on the export's evidence.

Test plan

cargo run --release --features dxf-reader --example dxf_oracle -- <corpus-dir>

Before (main):

  field                                    group            R14   R2000   R2004   R2007   R2010   R2013   R2018   total
  is_annotative                            296                     ≠1/9    ≠1/9    ≠1/9    ≠1/9    ≠8/9    ≠2/4   35/0/14/0
  overwrite_property_value                 295                     ≠1/9    ≠1/9    ≠1/9    ≠1/9    ≠8/9    ≠2/4   35/0/14/0
  sample_AC1027.dwg           E5 MLEADERSTYLE   overwrite_property_value           295        DWG 1  DXF 0
  sample_AC1027.dwg           E5 MLEADERSTYLE   is_annotative                      296        DWG 0  DXF 1
  line_2013.dwg               67 MLEADERSTYLE   overwrite_property_value           295        DWG 0  DXF 1
  line_2013.dwg               67 MLEADERSTYLE   is_annotative                      296        DWG 1  DXF 0
  polyline2d_line_2013.dwg    67 MLEADERSTYLE   overwrite_property_value           295        DWG 0  DXF 1
  polyline2d_line_2013.dwg    67 MLEADERSTYLE   is_annotative                      296        DWG 1  DXF 0

After (this branch):

  field                                    group            R14   R2000   R2004   R2007   R2010   R2013   R2018   total
  is_annotative                            296                        =       =       =       =       =       =   49/0/0/0
  overwrite_property_value                 295                        =       =       =       =       =       =   49/0/0/0

All other MLEADERSTYLE fields agree with the export on all 49 records once the scorer maps the pre-R2004 bare colour index to the word the export writes; text_attachment_direction and its two siblings exist from R2010 only.

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 the corpus bytes and AutoCAD's own DXF exports in nextgis/dwg_samples and the ACadSharp samples/ directory, read as data; the DXF group codes are the public DXF Reference's. No permissively-licensed project's code or comments were read.

Developer Certificate of Origin

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

Refs #99

@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-26T10:32:23.436864Z 498c09d 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.

…write flag

§20.4.87 lists B 295 (property changed, "meaning not totally clear")
before B 296 (is annotative), and the decoder read them in that order.
AutoCAD's DXF export of the same drawings shows the stored order is the
reverse: on every MLEADERSTYLE where the two differ (14 of 49 records,
R2000 to R2018, nextgis and ACadSharp) the first bit is the export's
296 and the second its 295. The fields are read in that order now and
both agree with the export on all 49 records; every other MLEADERSTYLE
field agrees under its own group. Coverage is unchanged (same bits).

Refs #99
@DrunkOnJava DrunkOnJava changed the title fix(objects): MLEADERSTYLE's annotative and overwrite flags are stored in the other order fix(objects): MLEADERSTYLE stores the annotative flag before the overwrite flag (departs from §20.4.87) Oct 26, 2026
@DrunkOnJava
DrunkOnJava force-pushed the fix/mleaderstyle-flags branch from 67399f9 to 17ea3d7 Compare October 26, 2026 10:14
@DrunkOnJava
DrunkOnJava enabled auto-merge (squash) October 26, 2026 10:31
@DrunkOnJava
DrunkOnJava merged commit da9bf1c into main Oct 26, 2026
25 checks passed
@DrunkOnJava
DrunkOnJava deleted the fix/mleaderstyle-flags branch October 26, 2026 10:49
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 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
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
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