Dear Alls,I've create dialog box but it can't display,machine said "; error: bad argument type: stringp ("(setq seltyp (get_tile \"typ\"))" "(setq lenbol (get_tile \"len\"))" "(done_dialog)(setq userclick T)")",can someone's suggest to me,thanks a lot Best regards Ade Suharna ;--------------------------------------- LSP File (defun c:m10lsp () (setvar "cmdecho" 0) (vl-load-com) (setq nlist '("M1.6x0.35" "M2x0.4" "M2.5x0.45" "M3x0.5" "M3.5x0.6" "M4x0.7" "M5x0.8" "M6x1" "M8x1.25" "M10x1.5" "M12x1.75" "M14x2" "M16x2" "M20x2.5")) (setq lenbol "35") (setq dcl_id (load_dialog "m10dcl.dcl")) (if (not (new_dialog "m10dcl" dcl_id)) (exit) ) (start_list "dia") (mapcar 'add_list nlist) (end_list) (set_tile "typ" "6") (set_tile "len" "35") (mode_tile "6" 3) (action_tile "met" "(setq seltyp \"typ\") (mode_tile \"len\" 2)") (action_tile "cancel" "(done_dialog)(setq userclick nil)" ) (action_tile "accept" (progn '("(setq seltyp (get_tile \"typ\"))" "(setq lenbol (get_tile \"len\"))" "(done_dialog)(setq userclick T)") ) ) (start_dialog) (unload_dialog dcl_id) (princ) (setvar "cmdecho" 1) (command ".redraw") ) ;------------------------------------------------------ DCL File m10dcl : dialog { label = "BOLT SELECTION"; : list_box { label = "Select Type of Bolt"; key = "typ"; height = 8; allow_accept = true; } : radio_column { label = "Select Metric/Inch :"; : radio_button { label = "Metric Type"; key = "met"; } : radio_button { label = "Inch Type"; key = "inc"; } } : edit_box { label = "Length of Bolt (mm)"; key = "len"; edit_width = 5; allow_accept = true; } ok_cancel ; : text_part { label = "Designed and Created"; } : text_part { label = "by Ade Suharna"; } }
compare this with yours (defun c:m10lsp () (setvar "cmdecho" 0) (vl-load-com) (setq nlist '("M1.6x0.35" "M2x0.4" "M2.5x0.45" "M3x0.5" "M3.5x0.6" "M4x0.7" "M5x0.8" "M6x1" "M8x1.25" "M10x1.5" "M12x1.75" "M14x2" "M16x2" "M20x2.5")) (setq lenbol "35" seltyp "6" met "1") (setq dcl_id (load_dialog "m10dcl.dcl")) (if (not (new_dialog "m10dcl" dcl_id)) (exit) ) (start_list "typ") (mapcar 'add_list nlist) (end_list) (set_tile "met" met) (set_tile "len" lenbol) (set_tile "typ" seltyp) ;;;(mode_tile "6" 3)<== ????? 6 is not a key (action_tile "inc""(setq met \"0\"))(mode_tile \"len\" 2)") (action_tile "met""(setq met $value)(mode_tile \"len\" 2)") (action_tile "len""(setq lenbol $value)") (action_tile "typ""(setq seltyp $value)") (action_tile "cancel""(done_dialog)(setq userclick nil)") (action_tile "accept""(done_dialog)(setq userclick T)") (start_dialog) (unload_dialog dcl_id) (if (eq userclick T) (progn (setq item (nth (atoi seltyp) nlist); item is one of the nlist MetricInc (if (= met "1")"Metric" "Inch")); Metric or Inch (alert (strcat "Bolt--> " item "\nLength--> " lenbol "\nType--> " MetricInc)) )) (setvar "cmdecho" 1) (command ".redraw") (princ) ) good luck Harrie
You probably need to start after the action_tile with "(progn '(........)" otherwise the commands are not recognized. Smarter would be more structure by using subroutines, more like: (action_tile "accept" "(goforit)(done_dialog)") (defun goforit() (progn (setq seltyp (get_tile \"typ\")) (setq lenbol (get_tile \"len\")) (setq userclick T) ); end progn );end defun DID NOT TEST THIS, just typed it as an example. I hope you get the idea. By using more subroutines and structure a program is easyer to comment and maintain. Good luck, Jan error: bad argument type: stringp ("(setq seltyp (get_tile \"typ\"))" "(setq someone's suggest to me,thanks a lot
Hi Harrie,Nice to see as you create,and I learn more detail,how to added step of program,thanks a lot for you