; Multi toggle Dialog box for multi choice ; By Alan H Oct 2019 ; Example code ; (if (not AH:Toggs)(load "Multiple toggles.lsp")) ; (setq ans (ah:toggs '("Yes or No" "Yes" "No"))) ; (if (not AH:Toggs)(load "Multiple toggles.lsp"))) ; (setq ans (ah:toggs '("A B C D" "A" "B" "C" "D"))) ; (if (not AH:Toggs)(load "Multiple toggles.lsp")) ; (setq ans (ah:toggs '("Choose a number" "1" "2" "3" "4" "5" "6" "7" "8" "9" "10"))) (defun mkv_lst ( / ) (setq v_lst '()) (setq x 1) (repeat (- (length ahbutlst) 1) (setq val (strcat "Tb" (rtos x 2 0))) (setq v_lst (cons (get_tile val) v_lst)) (setq x (+ x 1)) ) ) (vl-load-com) (defun AH:Toggs (ahbutlst / fo fname x y keylst keynum v_lst) (setq fo (open (setq fname (vl-filename-mktemp "" "" ".dcl")) "w")) (write-line "AHtoggles : dialog {" fo) (write-line (strcat " label =" (chr 34) (nth 0 ahbutlst) (chr 34) " ;" )fo) (write-line " : column {" fo) (setq x 1) (repeat (- (length ahbutlst) 1) (write-line " : toggle {" fo) (write-line "alignment = left ;" fo) (write-line (strcat "key = " (chr 34) "Tb" (rtos x 2 0) (chr 34) ";") fo) (write-line (strcat "label = " (chr 34) (nth x ahbutlst) (chr 34) ";") fo) (write-line " }" fo) (write-line "spacer_1 ;" fo) (setq x (+ x 1)) ) (write-line "spacer_1 ;" fo) (write-line " ok_cancel;" fo) (write-line " }" fo) (write-line " }" fo) (close fo) (setq dcl_id (load_dialog fname)) (if (not (new_dialog "AHtoggles" dcl_id) ) (exit) ) (setq y 0) (repeat (- (length ahbutlst) 1) (setq keynum (strcat "Tb" (rtos (setq y (+ Y 1)) 2 0))) (set_tile keynum "1") (mode_tile keynum 3) ) (action_tile "accept" "(mkv_lst)(done_dialog)") (action_tile "cancel" "(done_dialog)") (start_dialog) (unload_dialog dcl_id) (vl-file-delete fname) (princ v_lst) )