Move the CAD dialog to dxfmakros and target DXFM_LISP

The TRO edit dialog belongs with the other SSG_LIB edit commands, so
cad/tro_edit.lsp and cad/tro_edit.dcl move to dxfmakros (Lisp/Tro_Edit.lsp,
dcl/tro_edit.dcl) where they use the ssg_* helpers, the DXFM_DCL path and the
existing SSG_BLOCKEDIT dispatcher instead of standing on their own. Keeping a
second copy here would only let the two drift apart before the repos are merged.

--emit-lisp now writes the generated type list to DXFM_LISP when that variable is
set, so it lands next to the SSG_LIB modules that read it. Without the variable it
still writes to cad/ and says where the file actually belongs.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-03 12:06:55 +02:00
parent 0f02fd83aa
commit ecc9c8fb53
3 changed files with 22 additions and 199 deletions
+22 -4
View File
@@ -61,6 +61,7 @@ import collections
import csv as csv_module
import json
import math
import os
import sys
from pathlib import Path
@@ -101,13 +102,27 @@ def hex_to_rgb(value: str) -> tuple[int, int, int]:
return (int(text[0:2], 16), int(text[2:4], 16), int(text[4:6], 16))
def lisp_dir() -> Path:
"""
Zielordner fuer die erzeugte LISP-Typliste.
Bevorzugt DXFM_LISP - dort liegen die SSG_LIB-Module in dxfmakros, die den
Dialog TRO_EDIT bereitstellen. Ohne die Variable landet die Datei in
<SPS_SKEL>/cad, damit der Lauf auch ohne dxfmakros funktioniert.
"""
env = os.environ.get("DXFM_LISP")
if env:
return Path(env)
return Path(__file__).resolve().parent.parent / "cad"
def emit_lisp(cad_dir: Path) -> Path:
"""
Typliste fuer den DCL-Dialog schreiben.
Der Dialog TROEDIT bietet TYPE als Auswahlliste an. Damit sie nicht von der
Typdefinition abweicht, wird sie hier aus TRO_CATALOG erzeugt statt in der
LISP-Datei gepflegt.
Der Dialog TRO_EDIT (dxfmakros/Lisp/Tro_Edit.lsp) bietet TYPE als
Auswahlliste an. Damit sie nicht von der Typdefinition abweicht, wird sie
hier aus TRO_CATALOG erzeugt statt in der LISP-Datei gepflegt.
"""
cad_dir.mkdir(parents=True, exist_ok=True)
path = cad_dir / "tro_types.lsp"
@@ -546,8 +561,11 @@ def main(argv: list[str] | None = None) -> int:
warnings: list[str] = []
if args.emit_lisp:
path = emit_lisp(Path(__file__).resolve().parent.parent / "cad")
path = emit_lisp(lisp_dir())
print(f"Typliste geschrieben: {path} ({len(TRO_CATALOG)} Typen)")
if not os.environ.get("DXFM_LISP"):
print("HINWEIS: DXFM_LISP nicht gesetzt - die Datei gehoert neben die "
"SSG_LIB-Module (dxfmakros/Lisp), damit TRO_EDIT sie findet.")
return 0
if not args.dxf: