Funktion zur Prüfung der Vollständigkeit der benötigten DAteien hinzu. Test schlägt fehl, wenn diese nicht vorhanden sind
This commit is contained in:
+58
-9
@@ -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)
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user