(defun LAYERDLG(VORGABE / WRITE-DCL DLG-CHECK DLG-RUN DLG FLAGS) (defun WRITE-DCL(/ DIR FILE) (if(and(setq DIR(vl-filename-mktemp "LAYDLG.DCL")) (setq FILE (open DIR "w")) ) (progn (mapcar '(lambda (X)(princ (strcat X "\n") FILE)) '( "LAYDLG" ": dialog" " { key = DLGTITEL;" " : boxed_row" " {" " : radio_column" " { label = \"Layergruppen:\";" " width = 35;" " fixed_width = true;" " children_alignment = right;" " : radio_button" " { label = \"Stahlbau\";" " key = \"LAYGRP1\";" " alignment = centered;" " }" " : radio_button" " { label = \"Maschinenbau\";" " key = \"LAYGRP2\";" " alignment = centered;" " } " " : radio_button" " { label = \"Straßenbau\";" " key = \"LAYGRP3\";" " alignment = centered;" " } " " }" " }" " : row" " {" " : button" " { label=\"OK\";" " key=\"OK\";" " fixed_width=true;" " width=11;" " alignment=centered;" " mnemonic =\"O\";" " is_default = true;" " }" " : cancel_button" " { label = \"Abbruch\";" " key = \"CANCEL\";" " fixed_width = true;" " width = 11;" " alignment = centered;" " mnemonic =\"A\";" " is_cancel = true;" " }" " : button" " { label = \"Info\";" " key = \"INFO\";" " fixed_width = true;" " width = 11;" " alignment = centered;" " mnemonic =\"I\";" " }" " }" " }" ) ) (close FILE) DIR ) ) ) (defun DLG-CHECK( / FLAGS ) (list (atoi(get_tile "LAYGRP1"))(atoi(get_tile "LAYGRP2"))(atoi(get_tile "LAYGRP3"))) ) (defun DLG-RUN(DIR / DLGINDEX FLAGS NAME ITEM) (if(and(setq DIR(findfile DIR)) (>(setq DLGINDEX (load_dialog DIR))0)) (if(new_dialog "LAYDLG" DLGINDEX) (progn (set_tile "DLGTITEL" "Layergruppenwahl") (cond ((= VORGABE 1) (set_tile "LAYGRP1" "1")(set_tile "LAYGRP2" "0")(set_tile "LAYGRP3" "0")) ((= VORGABE 2) (set_tile "LAYGRP1" "0")(set_tile "LAYGRP2" "1")(set_tile "LAYGRP3" "0")) ((= VORGABE 3) (set_tile "LAYGRP1" "0")(set_tile "LAYGRP2" "0")(set_tile "LAYGRP3" "1")) ('T (set_tile "LAYGRP1" "1")(set_tile "LAYGRP2" "0")(set_tile "LAYGRP3" "0")) ) (action_tile "OK" "(if(setq FLAGS (DLG-CHECK))(done_dialog 1))") (action_tile "CANCEL" "(setq FLAGS nil)(done_dialog 0)") (action_tile "INFO" "(alert(strcat \"======= LAYDLG =======\n\n\" \" Igrendwie.Irgendwas\n\" \" © Meinereiner 2015 (www.cad.de)\n\" ) )" ) (start_dialog) (unload_dialog DLGINDEX) ) (alert "Dialog nicht gefunden") ) (alert "Dialog nicht gefunden") ) FLAGS ) (if(setq DLG(WRITE-DCL)) (progn (setq FLAGS(DLG-RUN DLG)) (vl-file-delete DLG) FLAGS ) ) ) (defun c:Machwas(/ FLAGS) (defun LAYMAKE( name colour linetype lineweight plot ) (if (null (tblsearch "LAYER" name)) (entmake (list '(0 . "LAYER") '(100 . "AcDbSymbolTableRecord") '(100 . "AcDbLayerTableRecord") '(70 . 0) (cons 2 name) (cons 6 (if (tblsearch "LTYPE" linetype) linetype "Continuous" ) ) (cons 62 colour) (cons 290 plot) (cons 370 lineweight ) ) ) ) ) (setq LISTE1 '(("A_Boeschung" 3 "Continuous" -3 1) ("A_Boeschungsschraffur" 253 "Continuous" -3 1) ("A_Fahrbahn" 3 "Continuous" 3 1) ) ) (setq LISTE2 '(("B_Boeschung" 5 "Continuous" -3 1) ("B_Boeschungsschraffur" 153 "Continuous" -3 1) ("B_Fahrbahn" 5 "Continuous" 3 1) ) ) (setq LISTE3 '(("C_Boeschung" 7 "Continuous" -3 1) ("C_Boeschungsschraffur" 73 "Continuous" -3 1) ("C_Fahrbahn" 5 "Continuous" 3 1) ) ) (if(and(setq FLAGS(LAYERDLG 2)) (setq LISTE(cond ((=(car FLAGS)1) (setq LISTE LISTE1)) ((=(cadr FLAGS)1) ) ((=(caddr FLAGS)1) ) ) ) ) (mapcar '(lambda(X)(LAYMAKE (nth 0 X)(nth 1 X)(nth 2 X)(nth 3 X)(nth 4 X))) LISTE ) ) (princ) )