Skip to content

DWG reader: a seeded Standard dimension style points at the file's text style - #650

Merged
HakanSeven12 merged 2 commits into
hakanaktt:mainfrom
ohagmann:fix/dwg-seeded-dimstyle-text-style
Nov 24, 2026
Merged

HakanSeven12 merged 2 commits into
hakanaktt:mainfrom
ohagmann:fix/dwg-seeded-dimstyle-text-style

Conversation

@ohagmann

@ohagmann ohagmann commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Closes #649

Commits

  1. d3d4b93c — red tests only (tests/dwg_seeded_dimstyle_text_style.rs). A DWG with the Standard text style at
    #11, the ByBlock linetype at #14 and ISO-25 as its only dimension style:

    • a_seeded_standard_dim_style_points_at_the_files_text_style: after the read, the surviving seeded Standard
      dimension style names a text style, the file's Standard one;
    • a_dwg_written_again_names_a_text_style_in_every_dim_style: read and written again, every dimension style's
      DIMTXSTY is a text style, and ISO-25 keeps its own.

    Both fail on this commit for the reason in the issue, locally and in CI (Test (ubuntu-latest), run 45397759800):

    dimension style Standard names Handle(20) as its text style, which is no text style (ByBlock linetype = Some(Handle(20)))
    
  2. 8234fd23 — the fix: the DWG document builder runs rewire_stale_text_style_references, the
    repair the DXF reader has since DXF round-trip writes a ByBlock linetype handle as the DIMSTYLE text style #64, once the handle-collision repair is done; the function becomes pub(crate)
    and is re-exported from io::dxf. A guard test (a_files_own_standard_dim_style_keeps_its_text_style) checks
    that a file's own Standard dimension style keeps the text style it names.

Verification

  • On the fix commit: cargo test 3267 passed, cargo test --no-default-features 3267 passed,
    cargo test --all-features 3363 passed, 0 failed each; tests/issue64.rs still green.
  • CI on the fix commit: Test (ubuntu-latest) and Test (windows-latest) pass, FreeBSD and WebAssembly checks pass;
    on macos-latest the default and sequential test steps pass and the all-features step was cancelled at the job's time
    limit (30 min), as in the macOS run main retriggered today.
  • Real drawings: Open CAD Studio built against this fix (on the revision it pins) saved five of the drawings from the
    issue again. The Standard DIMSTYLE's 340 now points at the STYLE record, and the reference application's AUDIT
    reports 0 errors where it reported 1 before (one drawing keeps the one error it already had in the original).

…e ByBlock linetype as its text style

A drawing whose only dimension style is ISO-25, with the Standard text style
at hakanaktt#11 and the ByBlock linetype at hakanaktt#14 as other CAD programs save it: the
Standard dimension style the DWG reader seeds survives with DIMTXSTY hakanaktt#14,
and the drawing written again carries it. Both tests fail on this commit.
…xt style

The DWG reader seeds a Standard dimension style before it reads the file; a
drawing with none of its own keeps it. Its DIMTXSTY still named the seeded
Standard text style's handle, which the file may have given to a record of
another table - hakanaktt#14, the ByBlock linetype, in drawings other CAD programs
save. Written again, the Standard dimension style named a linetype as its
text style, and the reference application's AUDIT reported an error in
every such drawing.

The DXF reader repairs this since hakanaktt#64 (rewire_stale_text_style_references);
the DWG builder now runs the same repair once the file's records hold their
handles. A guard test checks that a file's own Standard dimension style
keeps the text style it names.
@ohagmann
ohagmann marked this pull request as ready for review November 24, 2026 13:40
@HakanSeven12
HakanSeven12 merged commit cb7f83e into hakanaktt:main Nov 24, 2026
5 of 6 checks passed
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.

DWG reader: a seeded Standard dimension style names the ByBlock linetype as its text style

2 participants