Files
dxfmakros/menu/SSG_LIB.mnl
T
s.ayadi 45044cdcba Add TRO marker editing to SSG_LIB
The TRO markers written by sps_skel (lib/tro_annotate.py) are blocks
TRO_SYM_<type> carrying ID and TYPE as attributes. This wires them into the
existing SSG_LIB mechanisms rather than adding new ones.

The double-click hook and the EATTEDIT override already exist: ***DOUBLECLICK
routes [INSERT] to SSG_BLOCKEDIT, and c:EATTEDIT is undefined and forwarded to
the same dispatcher. So all that was missing was a branch:

  Blockname TRO_*  ->  c:TRO_EDIT (Lisp/Tro_Edit.lsp)  ->  dcl/tro_edit.dcl

Tro_Edit.lsp follows the conventions of the other edit commands: DCL path from
DXFM_DCL, ssg-start/ssg-end around the command, ssg-attrib-read and
ssg-attrib-set-on for the attributes, all user-visible text via ssg-text/
ssg-textf with keys in lang/de_DE.json and en_GB.json. Implied selection is read
before ssg-start, since ssg-start clears it - the same note Gefaellestrecke.lsp
carries.

TYPE is a picklist rather than free text so it cannot drift from the type
catalogue. The list comes from Lisp/tro_types.lsp, generated on the sps_skel side
by "tro_annotate.py --emit-lisp" into DXFM_LISP. If that file is absent the
dialog offers the block's current type and still works.

Loading is lazy: the module is not preloaded in the MNL. The menu macros and the
dispatcher pull it with (ssg-ensure "Tro_Edit") on first use, and the dispatcher
falls back to native EATTEDIT if the module cannot be found. ssg_load.lsp loads
it for the non-menu path.

Menu: SSG_LIB > TRO with "Marker bearbeiten" and "Bearbeiten (Auto)", plus an
entry in the POP501 edit context menu.

The dialog changes attributes only. The marker shape belongs to the block
definition of the type and FB_BLOCK is derived from it, so both follow on the next
tro_annotate.py run; the dialog states this and the command prints a reminder when
the type was changed.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-03 15:41:06 +02:00

196 lines
6.8 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
;; ============================================================
;; SSG_LIB.mnl - Automatisch geladen beim MENULOAD von SSG_LIB.mnu
;;
;; Definiert den Lazy-Loader (ssg-ensure) und laedt alle Module.
;; Kern-Module: ssg_core, ssg_lang, ssg_dbg, ssg_dialog, ssg_layer, ssg_id
;; Feature-Module: KreiselInsert, Gefaellestrecke, VarioFoerderer, ...
;; ============================================================
;; Globale Variable: Pfad zu den LISP-Dateien
;; Zuerst Umgebungsvariable, dann Heuristik aus MNL-Datei-Pfad
(setq *ssg-lisp-pfad* (getenv "DXFM_LISP"))
(if *ssg-lisp-pfad*
(setq *ssg-lisp-pfad* (vl-string-translate "\\" "/" *ssg-lisp-pfad*))
;; Fallback: Pfad aus MNL-Datei ableiten menu/SSG_LIB.mnl → Lisp/
(progn
(setq *ssg-mnl-datei* (findfile "SSG_LIB.mnl"))
(if *ssg-mnl-datei*
(progn
(setq *ssg-mnl-datei* (vl-string-translate "\\" "/" *ssg-mnl-datei*))
(setq *ssg-menu-pos* (vl-string-search "/menu/" *ssg-mnl-datei*))
(if *ssg-menu-pos*
(progn
(setq *ssg-lisp-pfad*
(strcat (substr *ssg-mnl-datei* 1 *ssg-menu-pos*) "/Lisp"))
(if (not (findfile (strcat *ssg-lisp-pfad* "/ssg_core.lsp")))
(progn
(setq *ssg-lisp-pfad* nil)
(princ "\n[SSG_LIB] Heuristik fehlgeschlagen: ssg_core.lsp nicht gefunden.")
)
)
)
)
)
)
)
)
;; ------------------------------------------------------------
;; ssg-ensure - Lazy-Loader fuer SSG_LIB Module
;;
;; Laedt ein Modul einmalig. Setzt Flag *ssg-<modul>-loaded*.
;; Laedt Kern-Abhaengigkeiten (core/dbg/dialog/layer) automatisch.
;; ------------------------------------------------------------
(defun ssg-ensure (modul / flag-sym)
(setq flag-sym (read (strcat "*ssg-" modul "-loaded*")))
(if (not (eval flag-sym))
(progn
;; Pfad nachschlagen falls noch nicht gesetzt
(if (null *ssg-lisp-pfad*)
(progn
(setq *ssg-lisp-pfad* (getenv "DXFM_LISP"))
(if *ssg-lisp-pfad*
(setq *ssg-lisp-pfad* (vl-string-translate "\\" "/" *ssg-lisp-pfad*))
)
)
)
(if (null *ssg-lisp-pfad*)
(progn
(alert "SSG_LIB: DXFM_LISP nicht gesetzt!\nBitte zuerst setenv.bat ausfuehren.")
(princ "\n[SSG_LIB] FEHLER: DXFM_LISP nicht gesetzt!")
)
(progn
;; Kern-Module als Abhaengigkeit laden (je nur einmal)
;; WICHTIG: auch den modul-spezifischen Flag setzen, sonst Doppelladen
(if (not *ssg-core-loaded*)
(progn
(ssg-ensure-load "ssg_core")
(set '*ssg-core-loaded* t)
(set '*ssg-ssg_core-loaded* t)
(ssg-load-config)
)
)
(if (not *ssg-lang-loaded*)
(progn
(ssg-ensure-load "ssg_lang")
(set '*ssg-lang-loaded* t)
(set '*ssg-ssg_lang-loaded* t)
)
)
(if (not *ssg-dbg-loaded*)
(progn
(ssg-ensure-load "ssg_dbg")
(set '*ssg-dbg-loaded* t)
(set '*ssg-ssg_dbg-loaded* t)
(if (and (atoms-family 1 '("DBGOPEN")) (getenv "DXFM_LOG"))
(dbgopen "debugfile.dbg" "DXFM_LOG")
)
)
)
(if (not *ssg-dialog-loaded*)
(progn
(ssg-ensure-load "ssg_dialog")
(set '*ssg-dialog-loaded* t)
(set '*ssg-ssg_dialog-loaded* t)
)
)
(if (not *ssg-layer-loaded*)
(progn
(ssg-ensure-load "ssg_layer")
(set '*ssg-layer-loaded* t)
(set '*ssg-ssg_layer-loaded* t)
)
)
;; Angefordertes Feature-Modul laden (falls noch nicht via Kern-Flags gesetzt)
(if (not (eval flag-sym))
(progn
(ssg-ensure-load modul)
(set flag-sym t)
)
)
)
)
)
)
(princ)
)
;; Hilfsfunktion: Datei laden mit Fehlerbehandlung (ohne eigene Lademeldung)
(defun ssg-ensure-load (modul / datei result)
(setq datei (strcat *ssg-lisp-pfad* "/" modul ".lsp"))
(if (findfile datei)
(progn
(setq result (vl-catch-all-apply 'load (list datei)))
(if (vl-catch-all-error-p result)
(princ (strcat "\n[SSG_LIB] FEHLER beim Laden von " modul ": "
(vl-catch-all-error-message result)))
)
)
(princ (strcat "\n[SSG_LIB] WARNUNG: " datei " nicht gefunden!"))
)
)
;; ------------------------------------------------------------
;; Beim MNL-Laden: Kern-Module + Feature-Module laden
;; ------------------------------------------------------------
(if *ssg-lisp-pfad*
(progn
;; 1) Kern-Module (Core)
(ssg-ensure "ssg_core")
(ssg-ensure "ssg_lang")
(ssg-ensure "ssg_dbg")
(ssg-ensure "ssg_dialog")
(ssg-ensure "ssg_layer")
(ssg-ensure "ssg_id")
;; Allgemein-Zusammenfassung
(princ "\n=========================================")
(princ "\n[SSG_LIB] Core-Module geladen:")
(princ "\n ssg_core, ssg_lang, ssg_dbg, ssg_dialog, ssg_layer, ssg_id")
(princ (strcat "\n Pfad: " *ssg-lisp-pfad*))
(princ "\n=========================================")
;; 2) Feature-Module in Anzeigereihenfolge
(ssg-ensure "KreiselInsert")
(ssg-ensure "Gefaellestrecke")
(ssg-ensure "VarioFoerderer")
(ssg-ensure "EtageVarioFoerderer")
(ssg-ensure "export")
(ssg-ensure "external_call")
(ssg-ensure "OmniModulInsert")
;; Tro_Edit wird nicht vorgeladen - der Dispatcher SSG_BLOCKEDIT und die
;; Menuemakros holen es per (ssg-ensure "Tro_Edit") bei Bedarf nach.
(ssg-ensure "SSG_LIB_Commands")
;; Menue einhaengen
(menucmd "P13=+SSG_LIB.POP1")
(setvar "DBLCLKEDIT" 1)
(princ "\n[SSG_LIB] Alle Module geladen. Menue aktiv.")
;; Beim Start immer auf globalen Default 3D zuruecksetzen.
;; Hintergrund: AutoLISP-setenv schreibt in die BricsCAD-Profilregistry.
;; Ohne diesen Reset wuerde ein alter SSG_DIM_SWITCH-Wert aus der Vorsitzung
;; ueber setenv.bat gewinnen - unabhaengig davon, wie BricsCAD gestartet wurde.
(setenv "DXFM_DIM" "3D")
(princ (strcat "\n[SSG_LIB] Einfuege-Modus: 3D"
" (Umschalten global: SSG_DIM_SWITCH im Menue)"))
)
(princ "\n[SSG_LIB] WARNUNG: DXFM_LISP nicht gesetzt - Befehle nicht verfuegbar.")
)
;; S:STARTUP: wird von BricsCAD nach vollstaendiger Dokument-Initialisierung
;; aufgerufen - also NACH allen anderen Lade-Meldungen und Duplikaten.
;; defun-q haengt an eine bestehende S:STARTUP-Definition an (kein Ueberschreiben).
(defun-q S:STARTUP ()
(if (car (atoms-family 1 '("SSG-ILS-DIM-AKTUELL")))
(progn
(princ (strcat "\n[SSG_LIB] Einfuege-Modus: " (ssg-ils-dim-aktuell)
" (Umschalten global: SSG_DIM_SWITCH im Menue)"))
(princ)
)
)
)
(princ)