Skip to content

feat(tools): scripts and runbook for the AutoCAD trial (#119, #348, #375) - #383

Merged
DrunkOnJava merged 10 commits into
mainfrom
tools/autocad-trial
Oct 28, 2026
Merged

DrunkOnJava merged 10 commits into
mainfrom
tools/autocad-trial

Conversation

@DrunkOnJava

Copy link
Copy Markdown
Owner

Summary

Adds tools/autocad/: a generator for the AutoCAD .scr scripts, AutoLISP builders for the controlled drawings, a checker and a runbook, so a session with AutoCAD for Mac open only executes the trial work list (sections 1 to 4).

Spec reference

None: tooling only, no decoder or encoder change. Refs #119, #323, #345 (section 1, R13 re-save twins), #348, #329, #331, #332, #335, #337, #358, #285, #290 (controlled drawings) and #375 (code-page text, following #370 and #374).

What is in it:

Not run against AutoCAD: nothing here executes it. Every command sequence not confirmed without AutoCAD carries a VERIFY: comment (grep -rn VERIFY tools/autocad). Until #323 lands on main, generate.py --pins must point at that branch's pins.tsv: main has no AC1012 rows.

Test plan

  • cargo fmt, clippy, cargo test, cargo doc: not applicable, no Rust or doc-comment change and no build was run.
  • Generator against feat/r13-reader's pins.tsv and a corpus folder holding the 22 pinned R13 files (SketchUp Cabin and 21 Sovol, Chinese names with spaces): 22 staged, sha256 verified, 380 manifest rows, scripts inspected by eye; also with a work folder whose path has a space, with --sections 4 --char-mode escape, with --resume, with main's pins (prints that section 1 has no rows) and with a missing pins file.
  • Checker against a fake output folder (a wrong magic, an empty DXF, a binary DXF, a DXF short of its record types, a code-page DXF with high bytes and an escape, a .FAILED.dwg), then the folder was deleted: each case reported with the right status and next step.
  • Scratch lint (not committed): every .lsp parses with balanced parentheses, no vl-, vla- or vlax- name, every command call carries _.; plus a dry run of all 31 entry commands in a small AutoLISP evaluator with stubbed command, entmake and getvar, which checks function arity, undefined names, group-code value types and the emitted command sequences.
  • Shown on a real AutoCAD session: pending the trial; the first three commands are in the README.

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. This matters because dwg-rs is Apache-2.0 and must remain compatible.

My contribution is based on:

  • The ODA's freely-redistributable Open Design Specification for .dwg files (v5.4.1);
  • Public reverse-engineering notes, research papers, or blog posts cited inline;
  • Reading algorithm-description comments (not executable code) in permissively-licensed projects (MIT / Apache / BSD) to resolve spec ambiguities — disclose any such reading in this PR body so it can be recorded in CLEANROOM.md.

See CLEANROOM.md for the full allowed/forbidden source list and the honest scope of what "clean-room" means for this project.

Disclosure of one reading, for CLEANROOM.md: to confirm the SAVEAS and DXF prompt sequences, I read samples/sample_base/save_samples.lsp of DomCR/ACadSharp at the pinned commit c30a97ce (MIT) once more. It is the AutoCAD command script that saved the pinned sample_base twins and is already recorded in the 2026-10-26 "Public corpus" entry (it contains no DWG or DXF implementation). It confirmed the SAVEAS keywords 2018 to 2000 and LT98, and the form SAVEAS DXF V <version> 16 <file> including R12; the scripts and builders here are written independently and copy nothing from it. Nothing under ACadSharp's src/ or its test data was opened. The AutoLISP and command vocabulary otherwise comes from Autodesk's public product documentation, recalled.

Developer Certificate of Origin

By submitting this PR, I certify that the contribution complies with the
Developer Certificate of Origin 1.1.
Specifically, I affirm that the contribution is my own work (or rightfully
licensed to me) and that it can be distributed under the project's Apache-2.0
license.

I will sign off commits with git commit -s when asked, which adds a
Signed-off-by trailer to the commit message asserting the DCO.

)

A generator for the SAVEAS and DXF scripts of the 22 R13 re-save twins and of the controlled drawings, AutoLISP builders for the drawings of AUTOCAD-TODO sections 2 to 4, a checker that reads each DWG magic and DXF version and code page against a manifest, and a runbook with a manual checklist for what AutoLISP cannot create.
@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-28T05:51:31.660560Z 39680f3 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 11c1e2950b

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tools/autocad/check.py Resolved
Comment thread tools/autocad/check.py Resolved
Comment thread tools/autocad/generate.py Resolved
Comment thread tools/autocad/check.py Resolved
…me, keep --work (#383)

check.py counted ASCII bytes as high bytes; a stale .FAILED.dwg kept the checker failing and was picked up as a drawing; --resume treated empty or wrong outputs as done; the recovery command dropped --work. The generator now saves its options in session.json for --resume, and gains --scripted-only and --keyword-prefix. The runbook has the Russian and Japanese code-page run.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 31ad45470a

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tools/autocad/generate.py Resolved
Comment thread tools/autocad/lisp/dwgrs-lib.lsp Resolved
Comment thread tools/autocad/lisp/dwgrs-annotation.lsp Resolved
An export older than the master or staged input it came from is STALE in the checker and is saved again by --resume (a source column in the manifest). The builders' error handler saves the failed drawing through *push-error-using-command* and *pop-error-mode*, with command-s when they are missing. The annotative text style carries its AcadAnnotative payload under the -3 sentinel.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a9fd4f0d80

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tools/autocad/check.py Resolved
DrunkOnJava added a commit that referenced this pull request Oct 28, 2026
…branch holds

The landed PR's head and the stacked branch can have several merge bases, a commit of the landed
PR and a main commit, and `git merge-base` returns one. When the branch merged main after taking the
landed PR's commits, merging against that PR's commit drops the main history the branch already
holds, and a change main later reverted comes back. refresh.sh now considers every merge base, and
takes one only when each of the branch's ordinary merge bases with main is its ancestor; otherwise
the branch merges as it always has. Reproduced in a scratch repository: with the landed PR's commit
as base the merge kept the reverted f=1, the new rule rejects that base and git merge gives f=0;
a plain stack still takes the PR's commit and merges cleanly where git merge conflicts. On the real
branches #331, #332 and #341 still take a47e1bf (#330), and #383 takes none.
… written yet

generate.py writes items/save-<item>.scr only for a master that exists when it runs, so with one
to three masters built since the last run check.py recommended scripts that did not exist. It now
lists `generate.py --resume` first, naming the scripts it will write, whenever one it recommends is
missing. Reproduced with a scripted-only section 4 session and an s4-latin1 master added after
generation: the checker named save-s4-latin1.scr, which did not exist; it now lists the --resume run
first, and after that run the script exists and the step is gone.
DrunkOnJava added a commit that referenced this pull request Oct 28, 2026
… landed PR below it (#422)

* fix(ci): merge a stacked PR against the newest commit it holds of the landed PR below it

Every time a PR of a stack landed, the train refused every PR above it: their merge base was an
old main commit, so the train's own commits on the landed PR (its merges of main, the renumbered
section, the measured baselines) conflicted with the stacked copies of the same lines. After #329
landed, #330 to #341 all refused on examples/probe_dim_assoc.rs, and a lane hand-merged each with
`git merge-tree --merge-base=<newest commit of the landed PR it holds>`. refresh.sh now finds that
base itself (the head of each PR main squashed since the merge base, its merge base with the
branch, the nearest one main does not hold), merges against it with git merge-recursive and the
usual conflict handling, and writes it to merge-base.sha for the oracle comparison. A PR that is not
stacked merges exactly as before. arch.py renumber also rewrites references in the PR's lines to a
section main renumbered when the PR below landed, matched by title.

* fix(ci): report a section move only when it rewrote a line

arch.py renumber printed every section main had renumbered under a stacked PR's base, even when
none of the PR's lines cited one; refresh.sh then ran `git commit -qam` with nothing to commit and
refused a mergeable PR. It now prints only the moves that rewrote a line, nothing when none did, and
refresh.sh commits the renumber only when the tree changed. Checked at a47e1bf against main: the
old script printed "§7bh->§7bi §7bi->§7bj" with no change, the new one prints nothing; at #331's
head it prints only 7bj->7bk, at #332's 7bj->7bk 7bk->7bl §7bi->§7bj.

* fix(ci): use a stacked base only when it holds every main commit the branch holds

The landed PR's head and the stacked branch can have several merge bases, a commit of the landed
PR and a main commit, and `git merge-base` returns one. When the branch merged main after taking the
landed PR's commits, merging against that PR's commit drops the main history the branch already
holds, and a change main later reverted comes back. refresh.sh now considers every merge base, and
takes one only when each of the branch's ordinary merge bases with main is its ancestor; otherwise
the branch merges as it always has. Reproduced in a scratch repository: with the landed PR's commit
as base the merge kept the reverted f=1, the new rule rejects that base and git merge gives f=0;
a plain stack still takes the PR's commit and merges cleanly where git merge conflicts. On the real
branches #331, #332 and #341 still take a47e1bf (#330), and #383 takes none.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 593533018e

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tools/autocad/lisp/dwgrs-lib.lsp Resolved
Autodesk documents CMDACTIVE as a bitmask: 1 an ordinary command, 2 a transparent one, 4 a script.
Under a build script bit 4 stays set, so dwgrs:finish kept sending Enter after TEXT ended, which can
start TEXT again and hand the builder's next arguments to the wrong prompt, and dwgrs:cancel-all
kept cancelling. Both now test the low two bits through dwgrs:command-p. Not run: this changes what
the builders send inside AutoCAD, which the trial session will be the first to exercise.
@DrunkOnJava
DrunkOnJava enabled auto-merge (squash) October 28, 2026 05:55
@DrunkOnJava
DrunkOnJava merged commit ae3b538 into main Oct 28, 2026
24 checks passed
@DrunkOnJava
DrunkOnJava deleted the tools/autocad-trial branch October 28, 2026 06:03
DrunkOnJava added a commit that referenced this pull request Oct 28, 2026
…till skipped (#424)

CHANGELOG gains the table objects (#313, #316, #317, #319), the nineteen classes derived from
AutoCAD's output (#326 to #341), the DIMENSION scorer (#387), the BLOCK fixtures (#407), the
maintainer tools (#406, #383) and the merge train's stack handling (#421 to #423). README said every
skipped type had a decoder in review; only SHAPE (#310) and the VIEWPORT entity header (#311) do,
and the rest are twelve custom classes in the BookViewerApp3 drawings with no DXF export yet, now
named. STATUS's pending section says its counts are the 2026-08-30 snapshot.
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