(defun JB_test:Praefix (str /) (while (< (strlen str) 5) (setq str (strcat "0" str)) ) str ) (defun test () (princ "Test") ) (defun lst_A () (if (= (substr LayerName 10 1) "0") (setq Liste_0 (cons LayerName Liste_1))) (if (= (substr LayerName 10 1) "1") (setq Liste_1 (cons LayerName Liste_1))) (if (= (substr LayerName 10 1) "2") (setq Liste_2 (cons LayerName Liste_2))) (if (= (substr LayerName 10 1) "3") (setq Liste_3 (cons LayerName Liste_3))) (if (= (substr LayerName 10 1) "4") (setq Liste_4 (cons LayerName Liste_4))) (if (= (substr LayerName 10 1) "5") (setq Liste_5 (cons LayerName Liste_5))) (if (= (substr LayerName 10 1) "6") (setq Liste_6 (cons LayerName Liste_6))) ) (defun lst_B () (setq Liste_test (cons LayerName Liste_test)) ) (defun c:LfM () (Layerstruktur_für_MegaCAD)) (defun Layerstruktur_für_MegaCAD (/ m f row) (setq Liste_0 (list "00100: 0_GB_Gebäude") Liste_1 (list "00101: 1_RA_Rohstoffannahme") Liste_2 (list "00102: 2_ED_Einlagern und Dosieren") Liste_3 (list "00103: 3_") Liste_4 (list "00104: 4_MM_Mahlen und Mischen") Liste_5 (list "00105: 5_PE_Pelletieren") Liste_6 (list "00106: 6_VL_Verladen") Liste_test (list "00109: 9_Allgemeine Layer") ) (setq f 1 m -1 ) (while (setq row (tblnext "LAYER" f)) (setq f nil) (setq LayerName (strcat (JB_test:Praefix (itoa (setq m (+ m 1)))) ": | " (cdr (assoc 2 row)))) (princ (strcat "\n Layer noch nicht gruppiert\t\t" LayerName)) (if (= (substr LayerName 11 1) "_") (lst_A) (lst_B)) ) ; end while (setq dirname (strcat (getvar "dwgprefix") "Layer-Struktur_für MegaCAD.txt")) (setq file (open dirname "w")) (setq ls (reverse (append liste_0 liste_1 liste_2 liste_3 liste_4 liste_5 liste_6 Liste_test))) ;;; (write-line ... .... ....) (close file) (princ) ) ; end defun (princ "Routine 'Layerstruktur für MegaCAD' geladen\n Aufruf durch 'LFM'\n")