diff --git a/Lisp/tests.lsp b/Lisp/tests.lsp index d20ef85..953b229 100644 --- a/Lisp/tests.lsp +++ b/Lisp/tests.lsp @@ -111,12 +111,80 @@ ) ) -;; --- Hauptfunktion: EXPORTCSV --- +;; --- EXPORTSIVAS: Sivas-spezifischer CSV-Export mit Summierungszeilen --- +(defun c:EXPORTSIVAS ( / ss i ename json-str out-pfad py-skript cmd fh + ergebnis-pfad first-block count) + (princ "\n[EXPORTSIVAS] Sammle alle Bloecke der Zeichnung...") + + ;; Alle INSERT-Entities in der Zeichnung + (setq ss (ssget "X" (list (cons 0 "INSERT")))) + (if (null ss) + (progn + (princ "\n[EXPORTSIVAS] Keine Bloecke in der Zeichnung gefunden.") + (princ) + ) + (progn + (setq count (sslength ss)) + (princ (strcat "\n[EXPORTSIVAS] " (itoa count) " Bloecke gefunden.")) + + ;; JSON-Datei zusammenbauen + (setq out-pfad (strcat (getenv "DXFM_RESULTS") "/export_raw.json")) + (setq fh (open out-pfad "w")) + (if (null fh) + (progn + (princ (strcat "\n[EXPORTSIVAS] FEHLER: Kann Datei nicht oeffnen: " out-pfad)) + (princ) + ) + (progn + (write-line "[" fh) + (setq i 0) + (setq first-block T) + (while (setq ename (ssname ss i)) + (if (not first-block) + (write-line "," fh) + ) + (setq json-str (csv:block-to-json ename)) + (write-line json-str fh) + (setq first-block nil) + (setq i (1+ i)) + ) + (write-line "]" fh) + (close fh) + (princ (strcat "\n[EXPORTSIVAS] JSON geschrieben: " out-pfad)) + + ;; Python-Skript aufrufen + (setq py-skript (strcat (getenv "DXFM_LIB") "/export_sivas.py")) + (if (findfile py-skript) + (progn + (setq ergebnis-pfad (strcat (getenv "DXFM_RESULTS") "/export_sivas.csv")) + (setq cmd (strcat "python \"" py-skript "\"" + " \"" out-pfad "\"" + " \"" (getenv "DXFM_DATA") "\"" + " \"" ergebnis-pfad "\"")) + (princ (strcat "\n[EXPORTSIVAS] Rufe Python auf...")) + (command "_.SHELL" cmd) + (if (findfile ergebnis-pfad) + (princ (strcat "\n[EXPORTSIVAS] CSV erstellt: " ergebnis-pfad)) + (princ "\n[EXPORTSIVAS] WARNUNG: CSV-Datei wurde nicht erzeugt.") + ) + ) + (princ (strcat "\n[EXPORTSIVAS] FEHLER: Python-Skript nicht gefunden: " py-skript)) + ) + ) + ) + ) + ) + (princ) +) + + +;; --- EXPORTCSV: Einfache Item-Liste aller Bloecke (ohne Summierung) --- +;; Nutzt dieselben csv:* Hilfsfunktionen und export_raw.json, +;; ruft export_csv.py auf fuer die einfache CSV-Erzeugung. (defun c:EXPORTCSV ( / ss i ename json-str out-pfad py-skript cmd fh ergebnis-pfad first-block count) (princ "\n[EXPORTCSV] Sammle alle Bloecke der Zeichnung...") - ;; Alle INSERT-Entities in der Zeichnung (setq ss (ssget "X" (list (cons 0 "INSERT")))) (if (null ss) (progn @@ -127,7 +195,6 @@ (setq count (sslength ss)) (princ (strcat "\n[EXPORTCSV] " (itoa count) " Bloecke gefunden.")) - ;; JSON-Datei zusammenbauen (setq out-pfad (strcat (getenv "DXFM_RESULTS") "/export_raw.json")) (setq fh (open out-pfad "w")) (if (null fh) diff --git a/bin/attradd.bat b/bin/attradd.bat new file mode 100644 index 0000000..d754ea0 --- /dev/null +++ b/bin/attradd.bat @@ -0,0 +1,8 @@ +@echo off +REM ================================================================ +REM Fuegt Attribute (ATTDEF) zu Omniflo DXF-Dateien hinzu +REM ================================================================ + +call "%~dp0setenv.bat" + +python "%DXFM_LIB%\attradd.py" %* diff --git a/menu/SSG_LIB.mnu b/menu/SSG_LIB.mnu index 5684915..b357d91 100644 --- a/menu/SSG_LIB.mnu +++ b/menu/SSG_LIB.mnu @@ -74,4 +74,5 @@ [<-KettenFoerderer]^C^COMNI_KettenFoerderer [->External] [Call Python]^C^CCALLPYTHON +[Export Sivas]^C^CEXPORTSIVAS [<-Export CSV]^C^CEXPORTCSV