; Getvals multi allows multiple line inputs A IMPERIAL VERSION. ; By Alan H Feb 2019 info@alanh.com.au ; ; code examples ; the input box size can be bigger just change the two values tetsed with 145 145 and worked ok. ; (if (not AH:getvalsm)(load "Multi Getvals IMPERIALLISP.lsp")) ; note the values are strings not numbers can be any number including decimal "25.4" ; (setq ans (AH:getvalsmI (list "Enter Values" "Length" "Width" "Depth" "Gap"))) ; note the values are strings so use atof to convert to real number others can be strings ; Answer is like ("1" "2" "13/16" "3" "4" "3/4" "5" "6" "" "7" "8" "1/4") so each value is made up of 3. (defun AH:getvalsmI (dcllst / x y num fo fname keynum key_lst v_lst) (setq num (- (length dcllst) 1)) (setq x 0) (setq y 0) (setq fo (open (setq fname (vl-filename-mktemp "" "" ".dcl")) "w")) (write-line "ddgetvalAHI : dialog {" fo) (write-line (strcat " label =" (chr 34) (nth 0 dcllst) (chr 34) " ;") fo) (write-line " : column {" fo) (write-line " width =25;" fo) (repeat num (write-line "spacer_1 ;" fo) (write-line ": row {" fo) (write-line (strcat " label = " (chr 34) (nth (+ x 1) dcllst) (chr 34) ";") fo) (write-line ": edit_box {" fo) (write-line (strcat " label = " (chr 34) "Feet" (chr 34) ";") fo) (setq keynum (strcat "key" (rtos (setq y (+ Y 1)) 2 0))) (write-line (strcat " key = " (chr 34) keynum (chr 34) ";") fo) (write-line " edit_width = 6 ;" fo) (write-line " edit_limit = 5 ;" fo) (write-line " is_enabled = true ;" fo) (write-line " allow_accept=false ;" fo) (write-line " }" fo) (write-line ": edit_box {" fo) (write-line (strcat " label = " (chr 34) "Inches" (chr 34) ";") fo) (setq keynum (strcat "key" (rtos (setq y (+ Y 1)) 2 0))) (write-line (strcat " key = " (chr 34) keynum (chr 34) ";") fo) (write-line " edit_width = 6 ;" fo) (write-line " edit_limit = 5 ;" fo) (write-line " is_enabled = true ;" fo) (write-line " allow_accept=false ;" fo) (write-line " }" fo) (write-line ": edit_box {" fo) (write-line (strcat " label = " (chr 34) "Fractions" (chr 34) ";") fo) (setq keynum (strcat "key" (rtos (setq y (+ Y 1)) 2 0))) (write-line (strcat " key = " (chr 34) keynum (chr 34) ";") fo) (write-line " edit_width = 7 ;" fo) (write-line " edit_limit = 6 ;" fo) (write-line " is_enabled = true ;" fo) (write-line " allow_accept=false ;" fo) (write-line " }" fo) (write-line " }" fo) (setq x (+ x 1)) ) (write-line " }" fo) (write-line "spacer_1 ;" fo) (write-line "ok_cancel;}" fo) (close fo) (setq dcl_id (load_dialog fname)) (if (not (new_dialog "ddgetvalAHI" dcl_id)) (exit) ) (setq x 0) (setq y 0) (setq v_lst '()) (repeat (* num 3) (setq keynum (strcat "key" (rtos (setq y (+ Y 1)) 2 0))) (setq key_lst (cons keynum key_lst)) ) (mode_tile "key1" 2) (action_tile "accept" "(mapcar '(lambda (x) (setq v_lst (cons (get_tile x) v_lst))) key_lst)(done_dialog)") (action_tile "cancel" "(setq ah:cancel \"Yes\")(done_dialog)") (start_dialog) (unload_dialog dcl_id) (vl-file-delete fname) (setq lst '() x 0) (repeat (/ (length V_LST) 3) (setq ft (* (atof (nth x v_lst)) 12.)) (if (= ft "")(setq ft 0.0)) (setq inch (atof (nth (+ x 1) v_lst))) (if (= inch "")(setq inch 0.0)) (setq frac (nth (+ x 2) v_lst)) (if (= frac "") (setq frac 0.0) (progn (setq pos (vl-string-position 47 frac)) (setq num (atof (substr frac 1 pos))) (setq remd (atof (substr frac (+ 2 pos)))) (setq frac (/ num remd)) ) ) (setq lst (cons (+ ft inch frac) lst)) (setq x (+ x 3)) ) (setq lst (reverse lst)) (princ lst) (princ) )