Skip to content

feat(dxf): write the VISUALSTYLE objects, paired with AutoCAD's export (#66) - #413

Merged
DrunkOnJava merged 53 commits into
mainfrom
feat/dxf-visualstyle
Oct 27, 2026
Merged

DrunkOnJava merged 53 commits into
mainfrom
feat/dxf-visualstyle

Conversation

@DrunkOnJava

Copy link
Copy Markdown
Owner

Summary

Closes #66. dwg-to-dxf now writes the 24 built-in VISUALSTYLE objects of a drawing from the fields acad_visual_style decodes, under the groups AutoCAD's own DXF export gives them, and probe_dxf_objects pairs every record with the export's. The OBJECTS writer put the style names in the ACAD_VISUALSTYLE dictionary only as omitted entries before; they are now written.

Stacked on #373 (feat/dxf-layouts): it adds to dxf_objects, whose OBJECTS writer, ownership closure and probe come from #372 and #373. Rebase onto main after they land.

The export has three layouts by the release the drawing was saved by, and the writer follows the DWG's own (a VISUALSTYLE is written in the layout of its release whatever the output targets, as the LAYOUT is):

  • R2000 to R2007: one group per property (71 to 173), the internal-use flag 291 last, a true colour as its RGB under 421 to 425.
  • R2010: the head 177 and 291, then each property followed by its 176 flag.
  • R2013 and R2018: the head, the property count (70 = 58), then every property as a typed group (90, 40, 290, 62 and 420, 1) with its 176 flag, the 28 named properties and the decoder's 30 extended ones.

Spec reference

ODA v5.4.1 has no prescription for VISUALSTYLE (§20.4 stops at 104; src/objects/acad_visual_style.rs derives the field list from bytes and says so). The group codes and their order are AutoCAD's own DXF exports of the corpus drawings, the same mapping the value oracle scores (#279); the property names are the positional ones the decoder gives (CLEANROOM.md 2026-08-30).

  • src/dxf_objects.rs: visual_style_groups and the VISUALSTYLE kind (kinds, the planner, record).
  • examples/probe_dxf_objects.rs: the VISUALSTYLE relations the export forces (below); examples/probe_dxf_tables.rs: two reason strings reworded.
  • ARCHITECTURE.md 7aw: the three layouts, the evidence table, what is not written and why.

Test plan

kind          written  paired  groups   agree relation  disagree  extra  om.grp
VISUALSTYLE      1008    1008   62208   61944      264         0      0    5468

1,008 is 24 styles in each of 42 drawings, all paired, in AutoCAD's group order. The 264 relations are named: the format version 177 is 3 in the export of an R2013 or R2018 drawing where the DWG stores 2 (240 records), and Realistic's lighting quality (72) is 3 in the export where an R2000 to R2007 DWG stores 2 (24; acad_visual_style documents that style as clamped when saved down). The 5,468 omitted groups are counted with their reasons: extended data (1000, 1001, 1070) on 792 records; three constants of the R2000 to R2007 export, 62 (5), 174 (0) and 45 (0.0), in every style and no decoded field holds them (576 each); and 1,364 nearest-index groups of true colours (62 to 67), which the export derives from the RGB and the DWG stores as 0, with a derivation the corpus cannot settle (white 7, 0x808080 and 0x787878 8, black 18, blue 5), so they are not guessed. The tables, header, entities, BLOCKS, classes and colour probes also exited 0 on that tree.

  • CI: this PR's Test, Clippy, Documentation, Corpus (the objects probe's VISUALSTYLE row and the reference table) and Streaming jobs are the gate for the stacked head; nothing was built locally on it. If the objects probe's numbers differ from the above (the ownership closure can only remove records whose owner chain is not written; the styles hang off ACAD_VISUALSTYLE), the ARCHITECTURE table is updated from the log.
  • python3 tools/maintainer/train/arch.py check, python3 tools/ci/spec_coverage.py --check, cargo fmt --all -- --check.
  • Not measured on the corpus: the nearest index a true colour derives to (above), an RGB intersection or obscured colour (422, 423; the corpus has RGB only for the mono, edge and silhouette colours), R14 (no VISUALSTYLE is written for it), and a VISUALSTYLE written into a DXF of another release than its own.

Existing tests and code changed

No existing test changed. dxf_objects::kinds gains VISUALSTYLE; the tables probe's two reasons for an omitted 348 handle no longer say "not written to OBJECTS yet".

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) has no prescription for this object.
  • No GPL-licensed DWG implementation source (LibreDWG, etc.) was consulted or imported.

The only inputs are the public corpus and AutoCAD's own DXF exports of its drawings (the group codes), and the oracle's mapping already in the tree. 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.

# Conflicts:
#	.github/workflows/ci.yml
#	src/lib.rs
…ECORD string in a code page not decoded, compare the 330 groups of objects (#126)
…output defines them, and take the kinds by the drawing's release (#126)
# Conflicts:
#	.github/workflows/ci.yml
#	ARCHITECTURE.md
#	src/dxf_convert.rs
# Conflicts:
#	examples/probe_dxf_objects.rs
# Conflicts:
#	examples/probe_dxf_objects.rs
#	src/dxf_objects.rs
@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-27T23:10:40.758053Z a195ddf 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.

Main's OBJECTS section text (7aw) and code stand word for word; the LAYOUT, GROUP and
MLINESTYLE section is renumbered 7ax and the three files it changes sit on main's
version of the OBJECTS writer and probe.
The base is now d00a65b (main's OBJECTS text and the LAYOUT section renumbered 7ax), and the
VISUALSTYLE section follows as 7ay.
Base automatically changed from feat/dxf-layouts to main October 27, 2026 23:07
#373 landed, so main holds the LAYOUT, GROUP and MLINESTYLE section as 7az and the OBJECTS
and LAYOUT code with its later fixes; the VISUALSTYLE section follows as 7ba and the three
files it changes sit on main's version of them.
@DrunkOnJava
DrunkOnJava enabled auto-merge (squash) October 27, 2026 23:17
@DrunkOnJava
DrunkOnJava merged commit 90688c4 into main Oct 27, 2026
25 checks passed
@DrunkOnJava
DrunkOnJava deleted the feat/dxf-visualstyle branch October 27, 2026 23:19
DrunkOnJava added a commit that referenced this pull request Oct 27, 2026
DrunkOnJava added a commit that referenced this pull request Oct 28, 2026
…10-27 (#416)

* docs: bring README, ROADMAP and CHANGELOG up to the landings of 2026-10-27

README's code-page and DXF writer text named work in review that has landed
(#371, #380, #382, #384); jev_review.py prose ranked those sentences 0.72 to
0.96. ROADMAP's "where it stands" table was a 2026-10-21 snapshot whose
numbers, CI row and release row were all out of date; it now points to the
rendered numbers instead of repeating them. CHANGELOG gains #371, #380, #382,
#384, #385 and #404.

* docs(changelog): record the CI-only merge train (#408)

* docs: OBJECTS landed (#372): README, ROADMAP and CHANGELOG

* docs: LAYOUT, GROUP and MLINESTYLE (#373), the class map writer (#405) and the double-byte round trip (#414) landed

* docs: VISUALSTYLE landed (#413)

* docs(readme): name the skipped types still in review without per-type counts; MATERIAL landed (#325)

* docs(readme): point to the open decoder PRs instead of a list that each landing makes stale
DrunkOnJava added a commit that referenced this pull request Oct 28, 2026
…ts (#66) (#420)

Section 7ba said its counts were measured before the ownership closure joined the stack.
CI run 40600119327 ran on the head that landed, with the closure in place, and its
probe_dxf_objects VISUALSTYLE row is the table's: 1,008 written and paired, 62,208 groups,
61,944 agree, 264 relation, 0 disagree, 0 extra, 5,468 groups omitted. The sentence now cites
that run.
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.

DXF writer: surface the newly decoded VISUALSTYLE fields (DecodedObject::AcadVisualStyle carries only the description)

1 participant