Merge branch 'master' of https://gitea.schoenenberger.de/Schoenenberger_Systeme_GmbH/dxfmakros
This commit is contained in:
@@ -126,6 +126,23 @@
|
|||||||
(princ)
|
(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
|
;; SSG_BLOCKEDIT - Kontextmenue-Dispatcher
|
||||||
;; Erkennt den selektierten Blocktyp und ruft den passenden
|
;; Erkennt den selektierten Blocktyp und ruft den passenden
|
||||||
|
|||||||
+58
-9
@@ -45,7 +45,53 @@
|
|||||||
(setq *modul-cache* nil)
|
(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
|
(defun init-bibliothek ( / temp-obj bogen-winkel ks-data ks-ein-pos ks-aus-pos
|
||||||
dx dy dz bogen-name)
|
dx dy dz bogen-name)
|
||||||
@@ -54,10 +100,12 @@
|
|||||||
(princ "\n Standard-Bibliothek bereits initialisiert.")
|
(princ "\n Standard-Bibliothek bereits initialisiert.")
|
||||||
t
|
t
|
||||||
)
|
)
|
||||||
(progn
|
(if (not (vf-check-required-blocks))
|
||||||
(setq *lib-initialized* nil)
|
nil
|
||||||
(setq *ks-cache* nil)
|
(progn
|
||||||
(princ "\n Initialisiere Standard-Bibliothek...")
|
(setq *lib-initialized* nil)
|
||||||
|
(setq *ks-cache* nil)
|
||||||
|
(princ "\n Initialisiere Standard-Bibliothek...")
|
||||||
|
|
||||||
;; AS_90 Masse extrahieren
|
;; AS_90 Masse extrahieren
|
||||||
(princ "\n Extrahiere AUS_Element Masse...")
|
(princ "\n Extrahiere AUS_Element Masse...")
|
||||||
@@ -188,8 +236,9 @@
|
|||||||
(setq *lib-initialized* t)
|
(setq *lib-initialized* t)
|
||||||
(princ "\n Standard-Bibliothek erfolgreich initialisiert.")
|
(princ "\n Standard-Bibliothek erfolgreich initialisiert.")
|
||||||
t
|
t
|
||||||
)
|
) ;; end progn (Initialisierung)
|
||||||
)
|
) ;; end (if not vf-check-required-blocks)
|
||||||
|
) ;; end outer (if and *lib-initialized*)
|
||||||
)
|
)
|
||||||
|
|
||||||
;; ============================================================
|
;; ============================================================
|
||||||
@@ -218,9 +267,9 @@
|
|||||||
winkel mass1 mass2 gueltig
|
winkel mass1 mass2 gueltig
|
||||||
best-winkel best-L_GF best-L_VF)
|
best-winkel best-L_GF best-L_VF)
|
||||||
|
|
||||||
(if (not *lib-initialized*)
|
(if (or (not *lib-initialized*) (null aus-dz) (null ein-dz))
|
||||||
(progn
|
(progn
|
||||||
(alert "Bibliothek nicht initialisiert!")
|
(princ "\n FEHLER: Bibliothek nicht korrekt initialisiert (AUS/EIN-Masse fehlen)!")
|
||||||
(exit)
|
(exit)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -116,12 +116,16 @@
|
|||||||
[Call Python]^C^C(ssg-ensure "export") CALLPYTHON
|
[Call Python]^C^C(ssg-ensure "export") CALLPYTHON
|
||||||
[Export Sivas]^C^C(ssg-ensure "export") EXPORTSIVAS
|
[Export Sivas]^C^C(ssg-ensure "export") EXPORTSIVAS
|
||||||
[<-Export CSV]^C^C(ssg-ensure "export") EXPORTCSV
|
[<-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]
|
[->Tests]
|
||||||
[Alle Tests ausfuehren]^C^C(load (strcat (getenv "DXFMAKRO") "/tests/test_run_all.lsp")) SSG_RUN_ALL_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
|
[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
|
[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
|
[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
|
[<-Omniflo Export]^C^C(load (strcat (getenv "DXFMAKRO") "/tests/test_omniflo.lsp")) TEST_OMNIFLO_EXPORT
|
||||||
|
|
||||||
***DOUBLECLICK
|
***DOUBLECLICK
|
||||||
|
|||||||
+4
-4
@@ -1,6 +1,6 @@
|
|||||||
[
|
[
|
||||||
{ "name": "kreisel", "save": "dxf" },
|
{ "name": "kreisel", "save": "dxf", "module": "KreiselInsert" },
|
||||||
{ "name": "foerderer", "save": "dwg" },
|
{ "name": "foerderer", "save": "dwg", "module": "VarioFoerderer" },
|
||||||
{ "name": "kseinaus", "save": null },
|
{ "name": "kseinaus", "save": null, "module": "VarioFoerderer" },
|
||||||
{ "name": "omniflo", "save": "dxf" }
|
{ "name": "omniflo", "save": "dxf", "module": "OmniModulInsert" }
|
||||||
]
|
]
|
||||||
|
|||||||
+20
-7
@@ -48,7 +48,7 @@
|
|||||||
;; Erwartet ein JSON-Array, je Zeile ein Objekt: { "name": "...", "save": "..." }
|
;; Erwartet ein JSON-Array, je Zeile ein Objekt: { "name": "...", "save": "..." }
|
||||||
;; "save" kann "dxf", "dwg", null oder fehlen (= kein Speichern).
|
;; "save" kann "dxf", "dwg", null oder fehlen (= kein Speichern).
|
||||||
;; Rueckgabe: Liste von Assoc-Listen (("name" . "kreisel") ("save" . "dxf"))
|
;; 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"))
|
(setq json-datei (strcat tests-pfad "/alltests.json"))
|
||||||
(if (not (findfile json-datei))
|
(if (not (findfile json-datei))
|
||||||
(progn
|
(progn
|
||||||
@@ -70,9 +70,10 @@
|
|||||||
(progn
|
(progn
|
||||||
(setq name (alltests:get-str zeile "name"))
|
(setq name (alltests:get-str zeile "name"))
|
||||||
(setq save-fmt (alltests:get-str zeile "save"))
|
(setq save-fmt (alltests:get-str zeile "save"))
|
||||||
|
(setq module (alltests:get-str zeile "module"))
|
||||||
(if name
|
(if name
|
||||||
(setq ergebnis (cons
|
(setq ergebnis (cons
|
||||||
(list (cons "name" name) (cons "save" save-fmt))
|
(list (cons "name" name) (cons "save" save-fmt) (cons "module" module))
|
||||||
ergebnis))
|
ergebnis))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@@ -99,9 +100,9 @@
|
|||||||
|
|
||||||
|
|
||||||
(defun c:SSG_RUN_ALL_TESTS ( / tests-pfad tests-out-dir
|
(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
|
namen befehl datei export-fn
|
||||||
out-path test-result)
|
out-path old-json test-result)
|
||||||
|
|
||||||
(setq tests-pfad (strcat (getenv "DXFMAKRO") "/tests"))
|
(setq tests-pfad (strcat (getenv "DXFMAKRO") "/tests"))
|
||||||
(setq tests-out-dir (strcat tests-pfad "/output"))
|
(setq tests-out-dir (strcat tests-pfad "/output"))
|
||||||
@@ -130,8 +131,9 @@
|
|||||||
;; Testlauf eine eigene saubere Zeichnung erzeugt.
|
;; Testlauf eine eigene saubere Zeichnung erzeugt.
|
||||||
(foreach entry *test-module*
|
(foreach entry *test-module*
|
||||||
(setq idx (1+ idx))
|
(setq idx (1+ idx))
|
||||||
(setq name (cdr (assoc "name" entry)))
|
(setq name (cdr (assoc "name" entry)))
|
||||||
(setq save-fmt (cdr (assoc "save" entry)))
|
(setq save-fmt (cdr (assoc "save" entry)))
|
||||||
|
(setq module (cdr (assoc "module" entry)))
|
||||||
|
|
||||||
;; Namen aus Konvention ableiten
|
;; Namen aus Konvention ableiten
|
||||||
(setq namen (test-module-names name tests-pfad))
|
(setq namen (test-module-names name tests-pfad))
|
||||||
@@ -139,6 +141,17 @@
|
|||||||
(setq befehl (cdr (assoc "befehl" namen)))
|
(setq befehl (cdr (assoc "befehl" namen)))
|
||||||
(setq export-fn (cdr (assoc "export-fn" 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 " <<<"))
|
(princ (strcat "\n\n>>> " (itoa idx) "/" (itoa anz) ": " befehl " <<<"))
|
||||||
(if save-fmt
|
(if save-fmt
|
||||||
(princ (strcat " [save: " save-fmt "]"))
|
(princ (strcat " [save: " save-fmt "]"))
|
||||||
@@ -188,7 +201,7 @@
|
|||||||
(princ (strcat "\n DXF gespeichert: " out-path ".dxf"))
|
(princ (strcat "\n DXF gespeichert: " out-path ".dxf"))
|
||||||
)
|
)
|
||||||
((and save-fmt (= (strcase save-fmt) "DWG"))
|
((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"))
|
(princ (strcat "\n DWG gespeichert: " out-path ".dwg"))
|
||||||
)
|
)
|
||||||
(T
|
(T
|
||||||
|
|||||||
Reference in New Issue
Block a user