taybac213 Posted July 28, 2023 Posted July 28, 2023 (edited) I have collected this lisp. I'm new to learning and learning about lisp programming language. I don't know why the above lisp works but I can't call the command from the button in the dialog box. Hope everyone can help me to fix it. fix the code for lisp to work .ThanksTSM.lsp (defun $TsmError (msg) (if (and (/= msg "Function cancelled")(/= msg "quit / exit abort"))(princ (strcat "\nError: " msg))) ($TsmModer) (setq *error* OldErr) ) (defun $TsmModes (a) (setq MLST '()) (repeat (length a)(setq MLST (append MLST (list (list (car a) (getvar (car a))))))(setq a (cdr a))) ) (defun $TsmModer () (repeat (length MLST)(setvar (caar MLST) (cadar MLST))(setq MLST (cdr MLST))) ) (defun c:TSM (/ @TsmDcl @LoadDialog_Tsm @FindLoad @DclMain @Purge @RunExtSub DclTemp PurgeLst KeyLst KeyNo TsmValPuLst Flag ) (defun @TsmDcl (/ @@wfil sLst $acv DclTemp) (defun @@wfil (File Flist / i FileDes) (setq FileDes(open File "w")i 0) (repeat (length Flist)(write-line (nth i Flist) FileDes)(setq i (1+ i))) (close FileDes) ) (setq sLst (list "start : dialog {" " label = \"Start menu Twist engineering\";" " : row {" " children_alignment = top;" " :column {" " : boxed_column {label = \"Instellingen\";" " : button {key = \"retab\";label = \"Tab herstel\";}" " : button {key = \"filedia\";label = \"Filedia herstel\";}" " : button {key = \"steal\";label = \"Instelling overname\";}}" " : boxed_column {label = \"Tekst tools\";" " : button {key = \"tekst\";label = \"Standaard teksten\";}" " : button {key = \"tekstbox\";label = \"Tekstbox maken\";}" " : button {key = \"tekstom\";label = \"Tekst omkaderen\";}" " : button {key = \"tekstlijn\";label = \"Tekst uitlijnen\";}" " : button {key = \"tekstdm\";label = \"D-tekst > M-tekst\";}" " : button {key = \"tekstover\";label = \"Tekst overlapping\";}" " : button {key = \"tekstboog\";label = \"Tekst lang boog\";}" " : button {key = \"tekststrip\";label = \"Tekst stripper\";}}" " : boxed_column {label = \"ISO tools\";" " : button {key = \"isocirkel\";label = \"ISO cirkel\";}" " : button {key = \"isotekst\";label = \"ISO teksten\";}" " : button {key = \"isoblock\";label = \"ISO block maken\";}}" " : boxed_column {label = \"Aanwijs tool\";" " : button {key = \"aanwijs\";label = \"Aanwijs pijl\";}" " : button {key = \"aantext\";label = \"Aanwijs pijl met tekst\";}}}" " " " :column {" " : boxed_column {label = \"Dynamic tools\";" " : button {key = \"dynoff\";label = \"Dynamisch offset\";}" " : button {key = \"dynpijl\";label = \"Dynamische pijl\";}" " : button {key = \"dynboog\";label = \"Dynamische boog\";}" " : button {key = \"dyngrid\";label = \"Dynamisch grid\";}}" " : boxed_column {label = \"Draad/Tap/Boor\";" " : button {key = \"tapgat\";label = \"Tapgat menu\";}" " : button {key = \"vergat\";label = \"Verzonken gat menu\";}" " : button {key = \"sleuf\";label = \"Sleufgaat maken\";}" " : button {key = \"boorzij\";label = \"Boorgat zijaanzicht\";}" " : button {key = \"boorboven\";label = \"Boorgat bovenaanzicht\";}" " : button {key = \"boorover\";label = \"Boorgat overzetten\";}" " : button {key = \"boorim\";label = \"Boorgat imbusbout\";}" " : button {key = \"boorsch\";label = \"Boorgat schroefbout\";}" " : button {key = \"draadzij\";label = \"Draadgat zijaanzicht\";}" " : button {key = \"draadboven\";label = \"Draadgat bovenaanzicht\";}" " : button {key = \"draaddoor\";label = \"Draadgat doorlopend\";}}}" " " " :column {" " : boxed_column {label = \"Block tool\";" " : button {key = \"blocktel\";label = \"Block teller \";}" " : button {key = \"blockboog\";label = \"Block langs boog\";}" " : button {key = \"blockbreek\";label = \"Block breeker\";}}" " " " : boxed_column {label = \"Cirkel tools\";" " : button {key = \"hart\";label = \"Centre kruis\";}" " : button {key = \"cirmaat\";label = \"Cirkel maat wijzigen\";}" " : button {key = \"cirbreek\";label = \"Cirkel breeker\";}}" " " " : boxed_column {label = \"Pipe tools\";" " : button {key = \"pijpinst\";label = \"Pijp teken menu\";}" " : button {key = \"pijpver\";label = \"Pijp verloop tekenen\";}" " : button {key = \"pijpeen\";label = \"Pijp menu eenvoudig\";}" " : button {key = \"pijpeind\";label = \"Pijp eind maken\";}" " : button {key = \"pijpverloop\";label = \"Pijp verloop\";}}" " : boxed_column {label = \"Nummering tools\";" " : button {key = \"numauto\";label = \"Auto nummering\";}" " : button {key = \"numspec\";label = \"Nummering speciaal\";}}}" " " " :column {" " : boxed_column {label = \"Reken tools\";" " : button {key = \"calc\";label = \"Calulator\";}" " : button {key = \"optelA\";label = \"Optel tool AAN\";}" " : button {key = \"optelU\";label = \"Optel tool UIT\";}" " : button {key = \"opper\";label = \"Opervlakte\";}}" " : boxed_column {label = \"Purge keuze\";" " : toggle {key = \"puD\";label = \"Dimstyles \";}" " spacer_0;" " : toggle {key = \"puB\";label = \"Blocks\";}" " : toggle {key = \"puLA\";label = \"Layers\";}" " : toggle {key = \"puLT\";label = \"Linetypes\";}" " : toggle {key = \"puMA\";label = \"Materials\";}" " : toggle {key = \"puSH\";label = \"Shapes\";}" " : toggle {key = \"puST\";label = \"Textstyles\";}" " :toggle {key = \"puM\";label = \"M-linestyles\";}" " : toggle {key = \"puT\";label = \"Tablestyles\";}" " : toggle {key = \"puV\";label = \"Visualstyles\";}" " : toggle {key = \"puR\";label = \"Regapps\";}" " : toggle {key = \"puP\";label = \"Plotstyle\";}" " :toggle {key = \"puALL\";label = \"Purge alles\";}" " : button {key = \"puUIT\";label = \"Uitvoeren\";}}}" "" ": column {" " : boxed_column {label = \"Keuze menu.\";" " : button {key = \"tablemenu\";label = \"Table menu\"; width = 6;height= 3;}" " : button {key = \"layermenu\";label = \"Layer menu\";width = 6;height= 3;}" " : button {key = \"staalmenu\";label = \"Staalprofiel menu\";width = 6;height= 3;}" " : button {key = \"blockmenu\";label = \"Block library \";width = 6;height= 3;}" " : button {key = \"boutmenu\";label = \"Bout en moer menu \";width = 6;height= 3;}" " : button {key = \"symbol\";label = \"Symbol menu \";width = 6;height= 3;}}" " : boxed_column {label = \"Diversen.\";" " : button {key = \"invoeg\";label = \"Block insert wijzigen \";}" " : button {key = \"sloop\";label = \"Sloop gebied maken \";}" " : button {key = \"breeklijn\";label = \"Breek de lijn \";}" " : button {key = \"geheel\";label = \"Maak als een geheel \";}}}}" " :row {fixed_width = true;alignment = centered;" " : button {label = \"Cancel\";key = \"cancel\";width = 12;fixed_width = true; mnemonic = \"C\";is_cancel = true;}}" " }" ) ) (setq $acv (atoi (substr (getvar "ACADVER") 1 2))) (if (> $acv 14) (progn (setq DclTemp (vl-filename-mktemp nil nil ".dcl"))(@@wfil DclTemp slst)) (progn (setq DclTemp "TsmDcl.dcl")(@@wfil DclTemp slst)) ) (findfile DclTemp) ) (defun @LoadDialog_Tsm (/ @@init_handler @@set_data @@chkToggle @@get_data ) (defun @@init_handler ()(princ)) (defun @@set_data (PuLst0 / i KeyPuLst) (setq i 0) (if (or (= TsmValPuLst nil) (/= (length TsmValPuLst) 13))(progn (setq TsmValPuLst '("0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0")))) (repeat (length PuLst0)(set_tile (stcat "pu" (nth i PuLst0)) (nth i TsmValPuLst))(setq i (1+ i))) (princ) ) (defun @@DoButton (a) (if (/= a nil)(progn (setq KeyNo a) (setq Flag (done_dialog 1)))) ) (defun @@chkToggle (/ i key) (setq i 0 KeyLst '("retab" "filedia" "steal" "tekst" "tekstbox" "tekstom" "tekstlijn" "tekstdm" "tekstover" "tekstboog" "tekststrip" "isocirkel" "isotekst" "isoblock" "aanwijs" "aantext" "dynoff" "dynpijl" "dynboog" "dyngrid" "tapgat" "vergat" "sleuf" "boorzij" "boorboven" "boorover" "boorim" "boorsch" "draadzij" "draadboven" "draaddoor" "blocktel" "blockboog" "blockbreek" "hart" "cirmaat" "cirbreek" "pijpinst" "pijpver" "pijpeen" "pijpeind" "pijpverloop" "numauto" "numspec" "calc" "optelA" "optelU" "opper" "tablemenu" "layermenu" "staalmenu" "blockmenu" "boutmenu" "symbol" "invoeg" "sloop" "breeklijn" "geheel" ) ) (repeat (length KeyLst) (setq Key (nth i KeyLst)) (action_tile Key (eval (strcat "(@@DoButton " (itoa i) ")"))) (setq i (1+ i)) ) (princ) ) (defun @@get_data (PuLst0 / i) (setq TsmValPuLst '() i 0 ) (repeat (length PuLst0) (setq TsmValPuLst (append TsmValPuLst (list (get_tile (strcat "pu" (nth i PuLst0))))))(setq i (1+ i))) (setq i 0 PurgeLst '()) (repeat (length TsmValPuLst)(if (= (nth i TsmValPuLst) "1")(setq PurgeLst(append PurgeLst(list (strcat "_" (nth i PuLst0))))))(setq i (1+ i))) (princ) ) (defun @DclMMain (DclTemp / PuLst0 dcl_id Flag) (setq PuLst0 '("B" "D" "LA" "LT" "MA" "M" "P" "SH" "ST" "T" "V""R" "ALL")) (setq dcl_id (load_dialog DclTemp) Flag 5) (while (< 1 Flag) (if (not (new_dialog "start" dcl_id))(progn (princ (strcat "\nWarning: No start in " DclTemp))(exit))) ;;(@@init_handler) ;;(@@set_data PuLst0) ;;set old purge settings (@@chkToggle) (action_tile "puUIT" "(@@get_data PuLst0)(done_dialog 2)") (action_tile "cancel" "(done_dialog 0)") ;;(action_tile "accept" "(@@get_data PuLst0)(done_dialog 1)") (setq Flag (start_dialog)) (cond ((= Flag 1));;(progn (@Purge PurgeLst) (@RunExtSub KeyNo KeyLst))(progn (@RunExtSub KeyNo KeyLst)) ((= Flag 2)(progn (@Purge PurgeLst))) ) ) (unload_dialog dcl_id) (vl-file-delete DclTemp) ) (@DclMMain DclTemp) ) (defun @FindLoad (File / Dir Warn) (setq Dir (findfile File)) (if Dir(load Dir)(progn(setq Warn (strcat "\nFile " File " does not exist!"))(alert warn)(princ warn))) Dir ) (defun @Purge (PurgeLst / i LenPurgeLst) (setq i 0 LenPurgeLST(length PurgeLst)) (if (> LenPurgeLST 0) (progn (princ "\nPURGING:\n") (if (= (nth (- LenPurgeLst 1) PurgeLst) "_ALL") (command "_.-PURGE" "_ALL" "*" "_N") (repeat LenPurgeLST (command "_.-PURGE" (nth i PurgeLst) "*" "_N")(setq i (1+ i))) ) (textpage) (getstring "\nGive Enter") ) ) ) (defun @RunExtSub (KeyNo KeyLst / op warn) (if KeyNo(setq op (nth KeyNo KeyLst))) (cond ((= op "retab")(c:retab)) ((= op "filedia")(progn(command "_filedia" "1" "_osmode" "1023" "_pdmode" "0")(princ "\nReset AutoCAD variables: Filedia, Osmode and Pdmode."))) ((= op "steal")(if (@FindLoad "steal.lsp")(c:steal))) ((= op "tekst")(if (null c:tins)(progn (setq Warn "\nWarning: Command TINS is not possible. Load the necessary file.")(alert Warn)(princ Warn))(c:tins))) ((= op "tekstlijn") (if (@FindLoad "uitlijn.lsp") (c:uitlijn))) ((= op "tekstbox") (if (@FindLoad "tbox.lsp") (c:tbox))) ((= op "tekstom") (if (@FindLoad "txb.lsp") (c:txb))) ((= op "tekstdm") (if (@FindLoad "t2m.lsp") (c:t2m))) ((= op "tekstover") (if (@FindLoad "overlap.lsp") (c:overlap))) ((= op "tekstboog") (if (@FindLoad "dtcurve.lsp") (c:dtcurve))) ((= op "tekststrip") (if (@FindLoad "strip.lsp") (c:strip))) ((= op "isocirkel") (if (@FindLoad "iso.lsp") (c:iso))) ((= op "isotekst") (if (@FindLoad "text_iso.lsp") (c:isotext))) ((= op "isoblock") (if (@FindLoad "isoblock.lsp") (c:isoblock))) ((= op "dynoff") (if (@FindLoad "doff.lsp") (c:doff))) ((= op "dynpijl") (if (@FindLoad "dil.lsp") (c:dil))) ((= op "dynboog") (if (@FindLoad "dyf.lsp") (c:dyf))) ((= op "dyngrid") (if (@FindLoad "dyngrid.lsp") (c:dyngrid))) ((= op "tapgat") (if (@FindLoad "gew.lsp") (c:gew))) ((= op "vergat") (if (@FindLoad "senk.lsp") (c:senk))) ((= op "sleuf") (if (@FindLoad "hole.lsp") (c:slottedhole))) ((= op "boorzij") (if (@FindLoad "hole.lsp") (c:holes))) ((= op "boorboven") (if (@FindLoad "hole.lsp") (c:holet))) ((= op "boorover") (if (@FindLoad "hole.lsp") (c:mholes))) ((= op "boorim") (if (@FindLoad "hole.lsp") (c:counterbored))) ((= op "boorsch") (if (@FindLoad "hole.lsp") (c:countersunc))) ((= op "draadzij") (if (@FindLoad "hole.lsp") (c:threadb))) ((= op "draadboven") (if (@FindLoad "hole.lsp") (c:threadt))) ((= op "draaddoor") (if (@FindLoad "hole.lsp") (c:threads))) ((= op "blocktel") (if (@FindLoad "bnum.lsp") (c:bnum))) ((= op "blockboog") (if (@FindLoad "ba.lsp") (c:ba))) ((= op "blockbreek") (if (@FindLoad "abb.lsp") (c:abb))) ((= op "tablemenu") (if (@FindLoad "table.lsp") (c:tab))) ((= op "layermenu") (if (@FindLoad "layer_creator.lsp") (c:lc))) ((= op "staalmenu") (if (@FindLoad "profil.lsp") (c:profil))) ((= op "blockmenu") (if(and(@FindLoad "KDUB_BlockInserter_07.lsp")(@FindLoad "kdub_LibraryStufff.LSP"))(c:kdub_BlockInserter))) ((= op "boutmenu") (if (@FindLoad "fast") (c:fast))) ((= op "symbol") (if (@FindLoad "brksym.lsp") (c:brksymdcl))) ((= op "breeklijn") (if (@FindLoad "breek.lsp") (c:breek))) ((= op "geheel") (if (@FindLoad "eco.lsp") (c:eco))) ((= op "invoeg") (if (@FindLoad "cbi.lsp") (c:cbi))) ((= op "sloop") (if (@FindLoad "sloop.lsp") (c:sloop))) ((= op "hart") (if (@FindLoad "cl.lsp") (c:cl))) ((= op "cirmaat") (if (@FindLoad "ch_cc.lsp") (c:ch_cc))) ((= op "cirbreek") (if (@FindLoad "circelbreek.lsp") (c:cbrk))) ((= op "pijpinst") (if (@FindLoad "pipe.lsp") (c:pfdraw))) ((= op "pijpver") (if (@FindLoad "duct.lsp") (c:duct))) ((= op "pijpeen") (if (@FindLoad "rmd_V6.lsp") (c:rmd))) ((= op "pijpeind") (if (@FindLoad "epijp.lsp") (c:epijp))) ((= op "pijpverloop") (if (@FindLoad "wpipe.lsp") (c:wpipe))) ((= op "numauto") (if (@FindLoad "autonum.lsp") (c:autonum))) ((= op "numsoec") (if (@FindLoad "num.lsp") (c:num))) ((= op "calc") (if (@FindLoad "tc.lsp") (c:tc))) ((= op "optelA") (if (@FindLoad "optel.lsp") (c:optel))) ((= op "optelU") (if (null c:optel-r)(progn (setq warn "\nWarning: Command OPTEL-R is not possible. Load the necessary file.")(alert warn)(princ warn))(c:optel-r) ) ) ((= op "opper") (if (@FindLoad "opper.lsp") (c:opper))) ((= op "aanwijs") (if (@FindLoad "pijl.lsp") (c:pijl))) ((= op "aantext") (if (@FindLoad "ld.lsp") (c:ld)) ) ) ) ;;;*******************************Main program Tsm*******************************;;; (setq DclTemp (@TsmDcl)) ($TsmModes '("CMDECHO")) (setq OldErr *error* *error* $TsmError) (setvar "CMDECHO" 0) (@LoadDialog_Tsm) ($TsmModer) (setq *error* OldErr) (princ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Volgende lisp ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;******************Reload MdiTab##.arx to reset the drawing tabs******************;;; (defun c:Retab (/ App Dir) (setq App (strcat "mditab" (substr (getvar "ACADVER") 1 2)) Dir "D:\\LONG" ) (arxunload app (princ (strcat "\n" App " is unloaded."))) (setq App (strcat Dir App)) (if (findfile (strcat App ".arx")) (progn (arxload App) (princ "\nThe drawingtabs are reloaded.") ) (progn (alert (strcat " Application error: \n" App ".arx" " does not exist!" ) ) (princ (strcat "\nWarning: File " (strcat App ".arx") " does not exist!" ) ) ) ) (princ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Volgende lisp ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (princ (strcat "\nTsm.lsp loaded. Type TSM to run the dialog." "\nType RETAB to reload MdiTab" (substr (getvar "ACADVER") 1 2) ".arx." ) ) (princ) ;|«Visual LISP© Format Options» (72 2 40 2 nil "end of " 60 6 0 0 0 T T nil T) ;*** DO NOT add text below the comment! ***|; Edited July 29, 2023 by SLW210 Added Code Tags! Quote
BIGAL Posted July 28, 2023 Posted July 28, 2023 (edited) Have you thought about using a pop menu much easier to write a mnu file than a dcl. can have more items than fit in default display as it has a Next button. Or even go down the toolbar.mnu option, again make your own using notepad. This is just to show how it would look. yeah I know pipes selected but pits shown 2 images joined. Edited July 28, 2023 by BIGAL 1 Quote
mhupp Posted July 29, 2023 Posted July 29, 2023 Welcome to the forums but use this when posting code While this lisp is quite long it all it is a menu to call other lisp's first thing is to make sure you have those in your system. Then depending on what button you push in the menu it sets the "KeyNo" variable to a #. What it is failing to do is pass that number and list to the @RunExtSub function. this needs to be called after the @LoadDialog_Tsm function. Starting at line 294 ;;;*******************************Main program Tsm*******************************;;; (setq DclTemp (@TsmDcl)) ($TsmModes '("CMDECHO")) (setq OldErr *error* *error* $TsmError) (setvar "CMDECHO" 0) (@LoadDialog_Tsm) (@RunExtSub KeyNo KeyLst) ;added line ($TsmModer) (setq *error* OldErr) (princ) ) Also the @RunExtSub why not just pass KeyNo only and rewrite all the cond. (defun @RunExtSub (KeyNo / op warn) (setq op KeyNo) (cond ((= op 1)(c:retab)) ((= op 2)(progn(command "_filedia" "1" "_osmode" "1023" "_pdmode" "0")(princ "\nReset AutoCAD variables: Filedia, Osmode and Pdmode."))) ((= op 3)(if (@FindLoad "steal.lsp")(c:steal))) .... 1 Quote
BIGAL Posted July 29, 2023 Posted July 29, 2023 Like Mhupp why are you trying to jam everything into 1 dcl ? Autocad made toolbars for this idea you can have each of the dcl "radio button column" as a toolbar. No Cond required as the pick an icon there is a matching do something. Anyway here is an example of using radio buttons which are named RB1 RB2 etc auto created I have a 3 column as well need to test it again.Its a global program use in any code Multi radio buttons 2col.lsp Look at example code in Multi radio buttons 2 col. It returns the item number in the description list. AH:2col & AH:2col2 This is a tool bar I just made for some one. Put horizontal or vertical on edge of screen left and right. "steal.lsp" Look at image above post 2 and how many options are in the menu, the > means another menu, can have sub sub menu's. 1 Quote
taybac213 Posted July 29, 2023 Author Posted July 29, 2023 Thanks for everyone's help! I just started learning lisp programming. I am trying to learn. Can you fix the above lisp code for me? Thank for all! Quote
marko_ribar Posted July 29, 2023 Posted July 29, 2023 Not sure, but this works on my end; it just needs external *.lsp files to make it fully operational... It would be nice and kind if you could provide all those functions in one project and put it for downloading if you want to share your contribution... (defun $TsmError (msg) (if (and (/= msg "Function cancelled")(/= msg "quit / exit abort"))(princ (strcat "\nError: " msg))) ($TsmModer) (setq *error* OldErr) ) (defun $TsmModes (a) (setq MLST '()) (repeat (length a)(setq MLST (append MLST (list (list (car a) (getvar (car a))))))(setq a (cdr a))) ) (defun $TsmModer () (repeat (length MLST)(setvar (caar MLST) (cadar MLST))(setq MLST (cdr MLST))) ) (defun c:TSM (/ @TsmDcl @LoadDialog_Tsm @FindLoad @DclMain @Purge @RunExtSub DclTemp PurgeLst KeyLst KeyNo TsmValPuLst Flag ) (defun @TsmDcl (/ @@wfil sLst $acv DclTemp) (defun @@wfil (File Flist / i FileDes) (setq FileDes(open File "w")i 0) (repeat (length Flist)(write-line (nth i Flist) FileDes)(setq i (1+ i))) (close FileDes) ) (setq sLst (list "start : dialog {" " label = \"Start menu Twist engineering\";" " : row {" " children_alignment = top;" " :column {" " : boxed_column {label = \"Instellingen\";" " : button {key = \"retab\";label = \"Tab herstel\";}" " : button {key = \"filedia\";label = \"Filedia herstel\";}" " : button {key = \"steal\";label = \"Instelling overname\";}}" " : boxed_column {label = \"Tekst tools\";" " : button {key = \"tekst\";label = \"Standaard teksten\";}" " : button {key = \"tekstbox\";label = \"Tekstbox maken\";}" " : button {key = \"tekstom\";label = \"Tekst omkaderen\";}" " : button {key = \"tekstlijn\";label = \"Tekst uitlijnen\";}" " : button {key = \"tekstdm\";label = \"D-tekst > M-tekst\";}" " : button {key = \"tekstover\";label = \"Tekst overlapping\";}" " : button {key = \"tekstboog\";label = \"Tekst lang boog\";}" " : button {key = \"tekststrip\";label = \"Tekst stripper\";}}" " : boxed_column {label = \"ISO tools\";" " : button {key = \"isocirkel\";label = \"ISO cirkel\";}" " : button {key = \"isotekst\";label = \"ISO teksten\";}" " : button {key = \"isoblock\";label = \"ISO block maken\";}}" " : boxed_column {label = \"Aanwijs tool\";" " : button {key = \"aanwijs\";label = \"Aanwijs pijl\";}" " : button {key = \"aantext\";label = \"Aanwijs pijl met tekst\";}}}" " " " :column {" " : boxed_column {label = \"Dynamic tools\";" " : button {key = \"dynoff\";label = \"Dynamisch offset\";}" " : button {key = \"dynpijl\";label = \"Dynamische pijl\";}" " : button {key = \"dynboog\";label = \"Dynamische boog\";}" " : button {key = \"dyngrid\";label = \"Dynamisch grid\";}}" " : boxed_column {label = \"Draad/Tap/Boor\";" " : button {key = \"tapgat\";label = \"Tapgat menu\";}" " : button {key = \"vergat\";label = \"Verzonken gat menu\";}" " : button {key = \"sleuf\";label = \"Sleufgaat maken\";}" " : button {key = \"boorzij\";label = \"Boorgat zijaanzicht\";}" " : button {key = \"boorboven\";label = \"Boorgat bovenaanzicht\";}" " : button {key = \"boorover\";label = \"Boorgat overzetten\";}" " : button {key = \"boorim\";label = \"Boorgat imbusbout\";}" " : button {key = \"boorsch\";label = \"Boorgat schroefbout\";}" " : button {key = \"draadzij\";label = \"Draadgat zijaanzicht\";}" " : button {key = \"draadboven\";label = \"Draadgat bovenaanzicht\";}" " : button {key = \"draaddoor\";label = \"Draadgat doorlopend\";}}}" " " " :column {" " : boxed_column {label = \"Block tool\";" " : button {key = \"blocktel\";label = \"Block teller \";}" " : button {key = \"blockboog\";label = \"Block langs boog\";}" " : button {key = \"blockbreek\";label = \"Block breeker\";}}" " " " : boxed_column {label = \"Cirkel tools\";" " : button {key = \"hart\";label = \"Centre kruis\";}" " : button {key = \"cirmaat\";label = \"Cirkel maat wijzigen\";}" " : button {key = \"cirbreek\";label = \"Cirkel breeker\";}}" " " " : boxed_column {label = \"Pipe tools\";" " : button {key = \"pijpinst\";label = \"Pijp teken menu\";}" " : button {key = \"pijpver\";label = \"Pijp verloop tekenen\";}" " : button {key = \"pijpeen\";label = \"Pijp menu eenvoudig\";}" " : button {key = \"pijpeind\";label = \"Pijp eind maken\";}" " : button {key = \"pijpverloop\";label = \"Pijp verloop\";}}" " : boxed_column {label = \"Nummering tools\";" " : button {key = \"numauto\";label = \"Auto nummering\";}" " : button {key = \"numspec\";label = \"Nummering speciaal\";}}}" " " " :column {" " : boxed_column {label = \"Reken tools\";" " : button {key = \"calc\";label = \"Calulator\";}" " : button {key = \"optelA\";label = \"Optel tool AAN\";}" " : button {key = \"optelU\";label = \"Optel tool UIT\";}" " : button {key = \"opper\";label = \"Opervlakte\";}}" " : boxed_column {label = \"Purge keuze\";" " : toggle {key = \"puD\";label = \"Dimstyles \";}" " spacer_0;" " : toggle {key = \"puB\";label = \"Blocks\";}" " : toggle {key = \"puLA\";label = \"Layers\";}" " : toggle {key = \"puLT\";label = \"Linetypes\";}" " : toggle {key = \"puMA\";label = \"Materials\";}" " : toggle {key = \"puSH\";label = \"Shapes\";}" " : toggle {key = \"puST\";label = \"Textstyles\";}" " :toggle {key = \"puM\";label = \"M-linestyles\";}" " : toggle {key = \"puT\";label = \"Tablestyles\";}" " : toggle {key = \"puV\";label = \"Visualstyles\";}" " : toggle {key = \"puR\";label = \"Regapps\";}" " : toggle {key = \"puP\";label = \"Plotstyle\";}" " :toggle {key = \"puALL\";label = \"Purge alles\";}" " : button {key = \"puUIT\";label = \"Uitvoeren\";}}}" "" ": column {" " : boxed_column {label = \"Keuze menu.\";" " : button {key = \"tablemenu\";label = \"Table menu\"; width = 6;height= 3;}" " : button {key = \"layermenu\";label = \"Layer menu\";width = 6;height= 3;}" " : button {key = \"staalmenu\";label = \"Staalprofiel menu\";width = 6;height= 3;}" " : button {key = \"blockmenu\";label = \"Block library \";width = 6;height= 3;}" " : button {key = \"boutmenu\";label = \"Bout en moer menu \";width = 6;height= 3;}" " : button {key = \"symbol\";label = \"Symbol menu \";width = 6;height= 3;}}" " : boxed_column {label = \"Diversen.\";" " : button {key = \"invoeg\";label = \"Block insert wijzigen \";}" " : button {key = \"sloop\";label = \"Sloop gebied maken \";}" " : button {key = \"breeklijn\";label = \"Breek de lijn \";}" " : button {key = \"geheel\";label = \"Maak als een geheel \";}}}}" " :row {fixed_width = true;alignment = centered;" " : button {label = \"Cancel\";key = \"cancel\";width = 12;fixed_width = true; mnemonic = \"C\";is_cancel = true;}}" " }" ) ) (setq $acv (atoi (substr (getvar "ACADVER") 1 2))) (if (> $acv 14) (progn (setq DclTemp (vl-filename-mktemp nil nil ".dcl"))(@@wfil DclTemp slst)) (progn (setq DclTemp "TsmDcl.dcl")(@@wfil DclTemp slst)) ) (findfile DclTemp) ) (defun @LoadDialog_Tsm (/ @@init_handler @@set_data @@chkToggle @@get_data ) (defun @@init_handler ()(princ)) (defun @@set_data (PuLst0 / i KeyPuLst) (setq i 0) (if (or (= TsmValPuLst nil) (/= (length TsmValPuLst) 13))(progn (setq TsmValPuLst '("0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0" "0")))) (repeat (length PuLst0)(set_tile (stcat "pu" (nth i PuLst0)) (nth i TsmValPuLst))(setq i (1+ i))) (princ) ) (defun @@DoButton (a) (if (/= a nil)(progn (setq KeyNo a) (setq Flag (done_dialog 1)))) ) (defun @@chkToggle (/ i key) (setq i 0 KeyLst '("retab" "filedia" "steal" "tekst" "tekstbox" "tekstom" "tekstlijn" "tekstdm" "tekstover" "tekstboog" "tekststrip" "isocirkel" "isotekst" "isoblock" "aanwijs" "aantext" "dynoff" "dynpijl" "dynboog" "dyngrid" "tapgat" "vergat" "sleuf" "boorzij" "boorboven" "boorover" "boorim" "boorsch" "draadzij" "draadboven" "draaddoor" "blocktel" "blockboog" "blockbreek" "hart" "cirmaat" "cirbreek" "pijpinst" "pijpver" "pijpeen" "pijpeind" "pijpverloop" "numauto" "numspec" "calc" "optelA" "optelU" "opper" "tablemenu" "layermenu" "staalmenu" "blockmenu" "boutmenu" "symbol" "invoeg" "sloop" "breeklijn" "geheel" ) ) (repeat (length KeyLst) (setq Key (nth i KeyLst)) (action_tile Key (eval (strcat "(@@DoButton " (itoa i) ")"))) (setq i (1+ i)) ) (princ) ) (defun @@get_data (PuLst0 / i) (setq TsmValPuLst '() i 0 ) (repeat (length PuLst0) (setq TsmValPuLst (append TsmValPuLst (list (get_tile (strcat "pu" (nth i PuLst0))))))(setq i (1+ i))) (setq i 0 PurgeLst '()) (repeat (length TsmValPuLst)(if (= (nth i TsmValPuLst) "1")(setq PurgeLst(append PurgeLst(list (strcat "_" (nth i PuLst0))))))(setq i (1+ i))) (princ) ) (defun @DclMMain (DclTemp / PuLst0 dcl_id Flag) (setq PuLst0 '("B" "D" "LA" "LT" "MA" "M" "P" "SH" "ST" "T" "V""R" "ALL")) (setq dcl_id (load_dialog DclTemp) Flag 5) (while (< 1 Flag) (if (not (new_dialog "start" dcl_id))(progn (princ (strcat "\nWarning: No start in " DclTemp))(exit))) ;;(@@init_handler) ;;(@@set_data PuLst0) ;;set old purge settings (@@chkToggle) (action_tile "puUIT" "(@@get_data PuLst0)(done_dialog 2)") (action_tile "cancel" "(done_dialog 0)") (action_tile "accept" "(@@get_data PuLst0)(done_dialog 1)") (setq Flag (start_dialog)) (cond ((= Flag 1)(progn (@Purge PurgeLst) (@RunExtSub KeyNo KeyLst))) ((= Flag 2)(progn (@Purge PurgeLst))) ) ) (unload_dialog dcl_id) (vl-file-delete DclTemp) ) (@DclMMain DclTemp) ) (defun @FindLoad (File / Dir Warn) (setq Dir (findfile File)) (if Dir(load Dir)(progn(setq Warn (strcat "\nFile " File " does not exist!"))(alert warn)(princ warn))) Dir ) (defun @Purge (PurgeLst / i LenPurgeLst) (setq i 0 LenPurgeLST(length PurgeLst)) (if (> LenPurgeLST 0) (progn (princ "\nPURGING:\n") (if (= (nth (- LenPurgeLst 1) PurgeLst) "_ALL") (command "_.-PURGE" "_ALL" "*" "_N") (repeat LenPurgeLST (command "_.-PURGE" (nth i PurgeLst) "*" "_N")(setq i (1+ i))) ) (textpage) (getstring "\nGive Enter") ) ) ) (defun @RunExtSub (KeyNo KeyLst / op warn) (if KeyNo(setq op (nth KeyNo KeyLst))) (cond ((= op "retab")(c:retab)) ((= op "filedia")(progn(command "_filedia" "1" "_osmode" "1023" "_pdmode" "0")(princ "\nReset AutoCAD variables: Filedia, Osmode and Pdmode."))) ((= op "steal")(if (@FindLoad "steal.lsp")(c:steal))) ((= op "tekst")(if (null c:tins)(progn (setq Warn "\nWarning: Command TINS is not possible. Load the necessary file.")(alert Warn)(princ Warn))(c:tins))) ((= op "tekstlijn") (if (@FindLoad "uitlijn.lsp") (c:uitlijn))) ((= op "tekstbox") (if (@FindLoad "tbox.lsp") (c:tbox))) ((= op "tekstom") (if (@FindLoad "txb.lsp") (c:txb))) ((= op "tekstdm") (if (@FindLoad "t2m.lsp") (c:t2m))) ((= op "tekstover") (if (@FindLoad "overlap.lsp") (c:overlap))) ((= op "tekstboog") (if (@FindLoad "dtcurve.lsp") (c:dtcurve))) ((= op "tekststrip") (if (@FindLoad "strip.lsp") (c:strip))) ((= op "isocirkel") (if (@FindLoad "iso.lsp") (c:iso))) ((= op "isotekst") (if (@FindLoad "text_iso.lsp") (c:isotext))) ((= op "isoblock") (if (@FindLoad "isoblock.lsp") (c:isoblock))) ((= op "dynoff") (if (@FindLoad "doff.lsp") (c:doff))) ((= op "dynpijl") (if (@FindLoad "dil.lsp") (c:dil))) ((= op "dynboog") (if (@FindLoad "dyf.lsp") (c:dyf))) ((= op "dyngrid") (if (@FindLoad "dyngrid.lsp") (c:dyngrid))) ((= op "tapgat") (if (@FindLoad "gew.lsp") (c:gew))) ((= op "vergat") (if (@FindLoad "senk.lsp") (c:senk))) ((= op "sleuf") (if (@FindLoad "hole.lsp") (c:slottedhole))) ((= op "boorzij") (if (@FindLoad "hole.lsp") (c:holes))) ((= op "boorboven") (if (@FindLoad "hole.lsp") (c:holet))) ((= op "boorover") (if (@FindLoad "hole.lsp") (c:mholes))) ((= op "boorim") (if (@FindLoad "hole.lsp") (c:counterbored))) ((= op "boorsch") (if (@FindLoad "hole.lsp") (c:countersunc))) ((= op "draadzij") (if (@FindLoad "hole.lsp") (c:threadb))) ((= op "draadboven") (if (@FindLoad "hole.lsp") (c:threadt))) ((= op "draaddoor") (if (@FindLoad "hole.lsp") (c:threads))) ((= op "blocktel") (if (@FindLoad "bnum.lsp") (c:bnum))) ((= op "blockboog") (if (@FindLoad "ba.lsp") (c:ba))) ((= op "blockbreek") (if (@FindLoad "abb.lsp") (c:abb))) ((= op "tablemenu") (if (@FindLoad "table.lsp") (c:tab))) ((= op "layermenu") (if (@FindLoad "layer_creator.lsp") (c:lc))) ((= op "staalmenu") (if (@FindLoad "profil.lsp") (c:profil))) ((= op "blockmenu") (if(and(@FindLoad "KDUB_BlockInserter_07.lsp")(@FindLoad "kdub_LibraryStufff.LSP"))(c:kdub_BlockInserter))) ((= op "boutmenu") (if (@FindLoad "fast") (c:fast))) ((= op "symbol") (if (@FindLoad "brksym.lsp") (c:brksymdcl))) ((= op "breeklijn") (if (@FindLoad "breek.lsp") (c:breek))) ((= op "geheel") (if (@FindLoad "eco.lsp") (c:eco))) ((= op "invoeg") (if (@FindLoad "cbi.lsp") (c:cbi))) ((= op "sloop") (if (@FindLoad "sloop.lsp") (c:sloop))) ((= op "hart") (if (@FindLoad "cl.lsp") (c:cl))) ((= op "cirmaat") (if (@FindLoad "ch_cc.lsp") (c:ch_cc))) ((= op "cirbreek") (if (@FindLoad "circelbreek.lsp") (c:cbrk))) ((= op "pijpinst") (if (@FindLoad "pipe.lsp") (c:pfdraw))) ((= op "pijpver") (if (@FindLoad "duct.lsp") (c:duct))) ((= op "pijpeen") (if (@FindLoad "rmd_V6.lsp") (c:rmd))) ((= op "pijpeind") (if (@FindLoad "epijp.lsp") (c:epijp))) ((= op "pijpverloop") (if (@FindLoad "wpipe.lsp") (c:wpipe))) ((= op "numauto") (if (@FindLoad "autonum.lsp") (c:autonum))) ((= op "numsoec") (if (@FindLoad "num.lsp") (c:num))) ((= op "calc") (if (@FindLoad "tc.lsp") (c:tc))) ((= op "optelA") (if (@FindLoad "optel.lsp") (c:optel))) ((= op "optelU") (if (null c:optel-r)(progn (setq warn "\nWarning: Command OPTEL-R is not possible. Load the necessary file.")(alert warn)(princ warn))(c:optel-r) ) ) ((= op "opper") (if (@FindLoad "opper.lsp") (c:opper))) ((= op "aanwijs") (if (@FindLoad "pijl.lsp") (c:pijl))) ((= op "aantext") (if (@FindLoad "ld.lsp") (c:ld)) ) ) ) ;;;*******************************Main program Tsm*******************************;;; (setq DclTemp (@TsmDcl)) ($TsmModes '("CMDECHO")) (setq OldErr *error* *error* $TsmError) (setvar "CMDECHO" 0) (@LoadDialog_Tsm) ($TsmModer) (setq *error* OldErr) (princ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Volgende lisp ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;******************Reload MdiTab##.arx to reset the drawing tabs******************;;; (defun c:Retab (/ App Dir) (setq App (strcat "mditab" (substr (getvar "ACADVER") 1 2)) Dir "D:\\LONG" ) (arxunload app (princ (strcat "\n" App " is unloaded."))) (setq App (strcat Dir App)) (if (findfile (strcat App ".arx")) (progn (arxload App) (princ "\nThe drawingtabs are reloaded.") ) (progn (alert (strcat " Application error: \n" App ".arx" " does not exist!" ) ) (princ (strcat "\nWarning: File " (strcat App ".arx") " does not exist!" ) ) ) ) (princ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Volgende lisp ;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (princ (strcat "\nTsm.lsp loaded. Type TSM to run the dialog." "\nType RETAB to reload MdiTab" (substr (getvar "ACADVER") 1 2) ".arx." ) ) (princ) Quote
BIGAL Posted July 30, 2023 Posted July 30, 2023 (edited) Ran code, I still think way to cluttered. This shows the main menu looking at your dcl would have 14 main options then go to correct sub menu. ? add more. This is a custom menu way easier to make than a dcl. This is an alternative dcl method pick the type then a child dcl opens. This shows a child DCL over the main dcl menu choice "Size" Edited July 30, 2023 by BIGAL 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.