feat(templates): drawing_template_save on both engines — dwt_write is a declared capability

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
This commit is contained in:
Umut CAN
2026-09-21 22:48:31 +03:00
co-authored by Claude Opus 5
parent 17f7228fd6
commit b458923e19
9 changed files with 322 additions and 20 deletions
+13
View File
@@ -76,6 +76,8 @@ class ToolAliases:
# (page_setup_list vs page_setup_apply).
# PLOT -- one sheet to PDF (drawing_export_pdf) or every sheet in one go
# (batch_plot); a drafter typing it could mean either.
# SAVEAS -- the same command saves a copy (drawing_save_as) or a template
# (drawing_template_save, its "Drawing Template" file type).
#
# Every other AutoCAD command must map to exactly one tool.
SHARED_ACAD_COMMANDS: frozenset[str] = frozenset(
@@ -91,6 +93,7 @@ SHARED_ACAD_COMMANDS: frozenset[str] = frozenset(
"PLINE",
"PLOT",
"QSELECT",
"SAVEAS",
"SETVAR",
"ZOOM",
}
@@ -1462,6 +1465,16 @@ TOOL_ALIASES: dict[str, ToolAliases] = {
"dwt list",
),
),
"drawing_template_save": ToolAliases(
acad=("SAVEAS",),
synonyms=(
"save as template",
"make a dwt",
"template from this drawing",
"save as dwt",
"reuse this sheet setup",
),
),
"page_setup_apply": ToolAliases(
acad=("PAGESETUP",),
synonyms=(