From 44762cce8f85dafe79f529fd58329c02b8ac254a Mon Sep 17 00:00:00 2001 From: Michael Stangl Date: Thu, 25 Jun 2026 15:33:03 +0200 Subject: [PATCH] =?UTF-8?q?Funktion=20zur=20Pr=C3=BCfung=20der=20Vollst?= =?UTF-8?q?=C3=A4ndigkeit=20der=20ben=C3=B6tigten=20DAteien=20hinzu.=20Tes?= =?UTF-8?q?t=20schl=C3=A4gt=20fehl,=20wenn=20diese=20nicht=20vorhanden=20s?= =?UTF-8?q?ind?= 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) ) )