Skip to content

feat(dxf): write the VIEW table, with its associated UCS (#126) - #357

Merged
DrunkOnJava merged 2 commits into
mainfrom
feat/dxf-view
Oct 27, 2026
Merged

DrunkOnJava merged 2 commits into
mainfrom
feat/dxf-view

Conversation

@DrunkOnJava

Copy link
Copy Markdown
Owner

Summary

dwg-to-dxf now writes the VIEW table from the decoded records, and the tables probe pairs it with AutoCAD's export like the others. Follow-on to #347 (#126), one PR per section; it builds on #284's group 71 for a view's mode.

The decoder read a view's associated UCS and the R2007 camera-plottable flag and dropped them; tables::view now keeps both (ViewEntry::ucs, ViewEntry::camera_plottable). A drawing with no view gets AutoCAD's empty VIEW table.

Spec reference

ODA v5.4.1 §20.4.60 VIEW: BD 40, BD 41, 2RD 10, 3BD 12, 3BD 11, BD 50, BD 42, BD 43, BD 44, the 4-bit view mode (71), R2000+ RC 281, the paper-space B (70 bit 1), R2000+ the associated-UCS B (72) with its origin, axes, elevation and orthographic type (110 to 112, 146, 79), R2007+ B 73, and the handle list (R2007+: background, visual style 348, sun, then the named and base UCS). Group codes and order are AutoCAD's: the corpus holds one view per release (view_custom), six in all.

  • src/dxf_tables.rs: view_groups. A record from R13 or R14, which store neither a render mode nor an associated UCS, gets no 281 or 72 (the source release gates it, the target release gates 73 and 348).
  • src/tables/view.rs: the two kept fields.

Test plan

  • cargo fmt --all -- --check, cargo clippy --all-targets --all-features -- -D warnings, RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features
  • Shown working on real files, no new unit tests: cargo run --release --features dxf-reader --example probe_dxf_tables -- <dwg-corpus> (wired into the Corpus job) now pairs all 6 views with AutoCAD's export, group for group and in AutoCAD's order:
release        table   written  paired  groups  agree  relation  disagree  extra  om.grp
AC1015 (2000)  VIEW          1       1      31     31         0         0      0       0
AC1018 (2004)  VIEW          1       1      31     31         0         0      0       0
AC1021 (2007)  VIEW          1       1      32     32         0         0      0       1
AC1024 (2010)  VIEW          1       1      32     32         0         0      0       1
AC1027 (2013)  VIEW          1       1      32     32         0         0      0       1
AC1032 (2018)  VIEW          1       1      32     32         0         0      0       1

The one omission per R2007+ view is group 348, the visual style, which OBJECTS still writes as an untyped record (the probe states that reason, as for VPORT and LAYER). The whole tables probe: exit 0, 0 disagree, 0 extra.

  • The R13 and R14 gate (no 281 or 72 from a source that stores neither) is not measured on the corpus: AC1014 drawings are skipped by the probe, since R12 and R14 targets keep the default layer.
  • cargo test --release --all-features runs in CI; I did not run it locally on this head (every cargo job on this Mac is waiting on a governor lease).

Existing tests and code changed

None of the existing tests changed. ViewEntry gains two fields (nothing in the crate builds one but the two decoders).

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) is the source for §20.4.60.
  • No GPL-licensed DWG implementation source (LibreDWG, etc.) was consulted or imported.

The only other inputs are the public corpus and AutoCAD's own DXF exports of its drawings. No algorithm-description comments in other projects were read.

Developer Certificate of Origin

I affirm the contribution is my own work and may be distributed under the project's Apache-2.0 license.

tables::view now surfaces the associated UCS block and the R2007 camera-plottable
flag its decoders read and dropped. dwg-to-dxf writes the VIEW table (name, flags,
the view as VPORT's, 72 and the UCS groups, 73 and the visual style from R2007) and
an empty one when the drawing has no view, as AutoCAD does. The tables probe pairs
all 6 views of the corpus with AutoCAD's export: 190 groups agree, none disagree,
the one omission per R2007+ view (the visual style handle) has its stated reason.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 27, 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-27T02:13:15.146452Z 67d0933 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.

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