Live AutoCAD writes a real .dwt through SaveAs(path, ac2018_Template = 66) and puts the description into the summary Comments; headlessly a .dxf template is written through drawing_save_as and a .dwt request is refused with capability dwt_write, naming the DXF route and the COM route. drawing_save_as's "dwt" entry was 5 (acR13_dxf): a DWT request wrote an R13 DXF under a .dwt name. Probed live on AutoCAD 2026 (typelib: ac2018_Template = 66, acR13_dxf = 5, acTemplateDwg absent; the saved file starts AC1032, the document is rebound, Comments takes). SECTION 19 is now 6 tools; SAVEAS joins SHARED_ACAD_COMMANDS; templates/README.md documents the two files per template. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01FKFStjEFzpGyLq5bMpWxTd
2.8 KiB
2.8 KiB
Bundled drawing templates
Five templates, built by the server's own tools — never hand-edited — and
listed by drawing_template_list. Start from one with
drawing_new(template="iso_a3_mech").
| name | standard | sheet | layer set | styles | page setup |
|---|---|---|---|---|---|
iso_a3_mech |
ISO | A3 landscape, ISO 5457 frame + ISO 7200 title block | mech | ISO-25 / ISOCP | ISO_A3, monochrome.ctb, 1:1 |
iso_a1_arch |
ISO | A1 landscape | iso13567 | ISO-25 / ISOCP, annotation scale 1:50 | ISO_A1, monochrome.ctb, fit |
iso_a3_pid |
ISO | A3 landscape, ISO 5457 frame + title block | pid | ISO-25 / ISOCP | ISO_A3, monochrome.ctb, 1:1 |
ansi_b_mech |
ANSI (metric) | ANSI B landscape | mech | ANSI / ROMANS | ANSI_B, monochrome.ctb, 1:1 |
ansi_d_arch |
ANSI (metric) | ANSI D landscape | iso13567 | ANSI / ROMANS | ANSI_D, monochrome.ctb, fit |
The two files per template
<name>.dxf— the headless twin. Produced byuv run --frozen python scripts/build_templates.py, which runsdrawing_new → apply_layer_set → styles → drawing_settings → layout rename → titleblock_apply_iso_a3 (A3 sheets) → page_setup_apply → drawing_save_as.scripts/build_templates.py --checkrebuilds into a temporary folder and fails if any committed DXF differs (the save-time stamps$TDCREATE,$TDUPDATE,$FINGERPRINTGUID,$VERSIONGUIDand the twoEZDXF_METAentries are masked; everything else must be byte-identical).tests/test_templates.pyruns the same check.<name>.dwt— the live twin, used bydrawing_new(template=…)on the COM backend. AutoCAD's DWT is a DWG container, which no headless library writes, so these are produced on the live machine byuv run --frozen python scripts/smoke_settings_com.py --build-dwt(Task 24's smoke): it opens each DXF over COM and callsdrawing_template_save(…dwt)(SaveAs(path, ac2018_Template)), then the files are committed once. While a.dwtis missing,resolve_templatefalls back to the DXF and reportssource: "bundled_dxf";drawing_template_listshowsfiles.dwt.present. The live engine does not open that DXF blank:Documents.Addaccepts only a genuine DWT (measured on AutoCAD 2026), so the COMdrawing_newconverts the DXF throughSaveAs(…, ac2018_Template)once, caches the result under the temp folder keyed on path, size and mtime, and reportstemplate_dwt: {path, cached}.
Line endings: ezdxf writes CRLF and .gitattributes pins templates/*.dxf
to CRLF so a checkout on any platform equals a fresh build.
Rebuild after changing anything the build depends on (layer sets, the title block, the dimension presets, the settings facade) and commit the result together with the change — the reproducibility test is the gate.