From 44762cce8f85dafe79f529fd58329c02b8ac254a Mon Sep 17 00:00:00 2001 From: Michael Stangl Date: Thu, 25 Jun 2026 15:33:03 +0200 Subject: [PATCH 1/2] =?UTF-8?q?Funktion=20zur=20Pr=C3=BCfung=20der=20Volls?= =?UTF-8?q?t=C3=A4ndigkeit=20der=20ben=C3=B6tigten=20DAteien=20hinzu.=20Te?= =?UTF-8?q?st=20schl=C3=A4gt=20fehl,=20wenn=20diese=20nicht=20vorhanden=20?= =?UTF-8?q?sind?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Lisp/vf_standard.lsp | 67 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 58 insertions(+), 9 deletions(-) diff --git a/Lisp/vf_standard.lsp b/Lisp/vf_standard.lsp index 19351bf..28919ad 100644 --- a/Lisp/vf_standard.lsp +++ b/Lisp/vf_standard.lsp @@ -34,7 +34,53 @@ (setq *modul-cache* nil) ;; ============================================================ -;; TEIL 2: BIBLIOTHEK INITIALISIEREN +;; TEIL 2: BLOCK-DATEI-PRUEFUNG +;; ============================================================ +;; Prueft ob alle benoetigten Block-Dateien vorhanden sind. +;; Gibt t zurueck wenn OK (oder Library-DXF vorhanden), nil wenn Einzeldateien fehlen. +(defun vf-check-required-blocks ( / lib-datei bogen-winkel required-blocks missing bname datei) + (setq lib-datei + (strcat (vl-string-translate "\\" "/" (getenv "DXFM_DATA")) + "/block_libraries/ils_library.dxf")) + (if (findfile lib-datei) + t ;; Library-Datei vorhanden: alle Bloecke darin verfuegbar + (progn + (setq bogen-winkel (ssg-cfg-or "vario" "bogen_winkel" + '(3 6 9 12 15 18 21 27 33 39 45 51))) + (setq required-blocks + (append + (list "_3D_AS_90_links" "_3D_AS_90_rechts" + "_3D_ES_90_links" "_3D_ES_90_rechts" + "Staustrecke_SP_1000_mm" "Staustrecke_Separator_SP_300_mm" + "Vario_Umlenkstation_500mm" "Vario_Motorstation_500mm") + (mapcar (function (lambda (w) (strcat "Vario_Bogen_auf_" (itoa w) grad-zeichen))) bogen-winkel) + (mapcar (function (lambda (w) (strcat "Vario_Bogen_ab_" (itoa w) grad-zeichen))) bogen-winkel) + ) + ) + (setq missing '()) + (foreach bname required-blocks + (setq datei (strcat block-pfad bname ".dxf")) + (if (not (findfile datei)) + (setq missing (cons datei missing)) + ) + ) + (if missing + (progn + (princ (strcat "\n FEHLER: DXFM_BLOCKS = " block-pfad)) + (princ "\n Folgende Block-Dateien fehlen:") + (foreach f (reverse missing) + (princ (strcat "\n - " f)) + ) + nil + ) + t + ) + ) + ) +) + +;; ============================================================ +;; TEIL 3: BIBLIOTHEK INITIALISIEREN ;; ============================================================ (defun init-bibliothek ( / temp-obj bogen-winkel ks-data ks-ein-pos ks-aus-pos dx dy dz bogen-name) @@ -43,10 +89,12 @@ (princ "\n Standard-Bibliothek bereits initialisiert.") t ) - (progn - (setq *lib-initialized* nil) - (setq *ks-cache* nil) - (princ "\n Initialisiere Standard-Bibliothek...") + (if (not (vf-check-required-blocks)) + nil + (progn + (setq *lib-initialized* nil) + (setq *ks-cache* nil) + (princ "\n Initialisiere Standard-Bibliothek...") ;; AS_90 Masse extrahieren (princ "\n Extrahiere AUS_Element Masse...") @@ -177,8 +225,9 @@ (setq *lib-initialized* t) (princ "\n Standard-Bibliothek erfolgreich initialisiert.") t - ) - ) + ) ;; end progn (Initialisierung) + ) ;; end (if not vf-check-required-blocks) + ) ;; end outer (if and *lib-initialized*) ) ;; ============================================================ @@ -207,9 +256,9 @@ winkel mass1 mass2 gueltig best-winkel best-L_GF best-L_VF) - (if (not *lib-initialized*) + (if (or (not *lib-initialized*) (null aus-dz) (null ein-dz)) (progn - (alert "Bibliothek nicht initialisiert!") + (princ "\n FEHLER: Bibliothek nicht korrekt initialisiert (AUS/EIN-Masse fehlen)!") (exit) ) ) From d408f3eea747424fba3dc8ab773597f40f121c36 Mon Sep 17 00:00:00 2001 From: Michael Stangl Date: Thu, 25 Jun 2026 15:36:14 +0200 Subject: [PATCH 2/2] =?UTF-8?q?Testrunner=20ge=C3=A4ndert.=20Bei=20fehlges?= =?UTF-8?q?chlagendem=20Test=20fehlt=20eine=20.json=20im=20test/Output=20O?= =?UTF-8?q?rdner?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Lisp/SSG_LIB_Commands.lsp | 17 +++++++++++++++++ menu/SSG_LIB.mnu | 4 ++++ tests/alltests.json | 8 ++++---- tests/test_run_all.lsp | 27 ++++++++++++++++++++------- 4 files changed, 45 insertions(+), 11 deletions(-) diff --git a/Lisp/SSG_LIB_Commands.lsp b/Lisp/SSG_LIB_Commands.lsp index ecf692c..5aee241 100644 --- a/Lisp/SSG_LIB_Commands.lsp +++ b/Lisp/SSG_LIB_Commands.lsp @@ -126,6 +126,23 @@ (princ) ) +;; ============================================================ +;; SSG_DIM_SWITCH - Umschalten zwischen 2D und 3D Bloecken +;; Setzt DXFM_DIM, DXFM_BLOCKS und DXFM_OMNIFLO neu +;; ============================================================ + +(defun c:SSG_DIM_SWITCH ( / dim-neu basis) + (setq dim-neu (if (equal (strcase (getenv "DXFM_DIM")) "3D") "2D" "3D")) + (setq basis (getenv "DXFMAKRO")) + (setenv "DXFM_DIM" dim-neu) + (setenv "DXFM_BLOCKS" (strcat basis "\\data\\ils\\" dim-neu)) + (setenv "DXFM_OMNIFLO" (strcat basis "\\data\\omniflo\\" dim-neu)) + (princ (strcat "\nModus umgeschaltet auf: " dim-neu)) + (princ (strcat "\n DXFM_BLOCKS = " (getenv "DXFM_BLOCKS"))) + (princ (strcat "\n DXFM_OMNIFLO = " (getenv "DXFM_OMNIFLO"))) + (princ) +) + ;; ============================================================ ;; SSG_BLOCKEDIT - Kontextmenue-Dispatcher ;; Erkennt den selektierten Blocktyp und ruft den passenden diff --git a/menu/SSG_LIB.mnu b/menu/SSG_LIB.mnu index 1c2fb4c..cfa8714 100644 --- a/menu/SSG_LIB.mnu +++ b/menu/SSG_LIB.mnu @@ -116,12 +116,16 @@ [Call Python]^C^C(ssg-ensure "export") CALLPYTHON [Export Sivas]^C^C(ssg-ensure "export") EXPORTSIVAS [<-Export CSV]^C^C(ssg-ensure "export") EXPORTCSV +[->Konfiguration] +[Umschalten 2D und 3D]^C^C(ssg-ensure "SSG_LIB_Commands") SSG_DIM_SWITCH +[<-Konfiguration Schliessen]^C^C [->Tests] [Alle Tests ausfuehren]^C^C(load (strcat (getenv "DXFMAKRO") "/tests/test_run_all.lsp")) SSG_RUN_ALL_TESTS [--] [Kreisel]^C^C(load (strcat (getenv "DXFMAKRO") "/tests/test_kreisel.lsp")) TEST_KREISEL [Foerderer]^C^C(load (strcat (getenv "DXFMAKRO") "/tests/test_foerderer.lsp")) TEST_FOERDERER [KS EIN/AUS]^C^C(load (strcat (getenv "DXFMAKRO") "/tests/test_ks.lsp")) TEST_KSEINAUS +[Omniflo]^C^C(load (strcat (getenv "DXFMAKRO") "/tests/test_omniflo.lsp")) TEST_OMNIFLO [<-Omniflo Export]^C^C(load (strcat (getenv "DXFMAKRO") "/tests/test_omniflo.lsp")) TEST_OMNIFLO_EXPORT ***DOUBLECLICK diff --git a/tests/alltests.json b/tests/alltests.json index e355e42..8e7355e 100644 --- a/tests/alltests.json +++ b/tests/alltests.json @@ -1,6 +1,6 @@ [ - { "name": "kreisel", "save": "dxf" }, - { "name": "foerderer", "save": "dwg" }, - { "name": "kseinaus", "save": null }, - { "name": "omniflo", "save": "dxf" } + { "name": "kreisel", "save": "dxf", "module": "KreiselInsert" }, + { "name": "foerderer", "save": "dwg", "module": "VarioFoerderer" }, + { "name": "kseinaus", "save": null, "module": "VarioFoerderer" }, + { "name": "omniflo", "save": "dxf", "module": "OmniModulInsert" } ] diff --git a/tests/test_run_all.lsp b/tests/test_run_all.lsp index cf39936..9ad25cf 100644 --- a/tests/test_run_all.lsp +++ b/tests/test_run_all.lsp @@ -48,7 +48,7 @@ ;; Erwartet ein JSON-Array, je Zeile ein Objekt: { "name": "...", "save": "..." } ;; "save" kann "dxf", "dwg", null oder fehlen (= kein Speichern). ;; Rueckgabe: Liste von Assoc-Listen (("name" . "kreisel") ("save" . "dxf")) -(defun alltests:load (tests-pfad / json-datei f zeile ergebnis name save-fmt) +(defun alltests:load (tests-pfad / json-datei f zeile ergebnis name save-fmt module) (setq json-datei (strcat tests-pfad "/alltests.json")) (if (not (findfile json-datei)) (progn @@ -70,9 +70,10 @@ (progn (setq name (alltests:get-str zeile "name")) (setq save-fmt (alltests:get-str zeile "save")) + (setq module (alltests:get-str zeile "module")) (if name (setq ergebnis (cons - (list (cons "name" name) (cons "save" save-fmt)) + (list (cons "name" name) (cons "save" save-fmt) (cons "module" module)) ergebnis)) ) ) @@ -99,9 +100,9 @@ (defun c:SSG_RUN_ALL_TESTS ( / tests-pfad tests-out-dir - idx anz entry name save-fmt + idx anz entry name save-fmt module namen befehl datei export-fn - out-path test-result) + out-path old-json test-result) (setq tests-pfad (strcat (getenv "DXFMAKRO") "/tests")) (setq tests-out-dir (strcat tests-pfad "/output")) @@ -130,8 +131,9 @@ ;; Testlauf eine eigene saubere Zeichnung erzeugt. (foreach entry *test-module* (setq idx (1+ idx)) - (setq name (cdr (assoc "name" entry))) - (setq save-fmt (cdr (assoc "save" entry))) + (setq name (cdr (assoc "name" entry))) + (setq save-fmt (cdr (assoc "save" entry))) + (setq module (cdr (assoc "module" entry))) ;; Namen aus Konvention ableiten (setq namen (test-module-names name tests-pfad)) @@ -139,6 +141,17 @@ (setq befehl (cdr (assoc "befehl" namen))) (setq export-fn (cdr (assoc "export-fn" namen))) + ;; Benoetigtes LISP-Modul laden (falls noch nicht geschehen) + (if module + (ssg-ensure module) + ) + + ;; Alte Ergebnis-JSON loeschen: fehlgeschlagene Tests sind am Fehlen der Datei erkennbar + (setq old-json (strcat tests-out-dir "/" name "_results.json")) + (if (findfile old-json) + (vl-file-delete old-json) + ) + (princ (strcat "\n\n>>> " (itoa idx) "/" (itoa anz) ": " befehl " <<<")) (if save-fmt (princ (strcat " [save: " save-fmt "]")) @@ -188,7 +201,7 @@ (princ (strcat "\n DXF gespeichert: " out-path ".dxf")) ) ((and save-fmt (= (strcase save-fmt) "DWG")) - (command "_.-SAVEAS" "2013" (strcat out-path ".dwg")) + (command "_.-SAVEAS" "R2013" (strcat out-path ".dwg")) (princ (strcat "\n DWG gespeichert: " out-path ".dwg")) ) (T