svorgodne Posted April 28, 2011 Posted April 28, 2011 I was wondering if it would be possible to invoke a command in a dcl file, and if so... does it have to be invoke through a lisp file? Thanks again Sergio Quote
JohnM Posted April 28, 2011 Posted April 28, 2011 yes you can if you set up the dcl to loop for user input could you post your dcl file Quote
svorgodne Posted April 28, 2011 Author Posted April 28, 2011 Here it is, thanks JohnM UNO : dialog { label = "Primera ventana";//Titulo de la ventana spacer;//espacio entre renglones : row { alignment = centered; fixed_width = true; : image_button { key = "LINE"; width = 20; height = 10; color = -2; } : image_button { key = ""; width = 20; height = 10; color = -2; } : image_button { key = ""; width = 20; height = 10; color = -2; } : image_button { key = ""; width = 20; height = 10; color = -2; } : image_button { key = ""; width = 20; height = 10; color = -2; } } : row { fixed_width = true; alignment = left; : ok_button { width = 11; } : cancel_button { width = 11; } } } Quote
JohnM Posted April 28, 2011 Posted April 28, 2011 The loop is created in the lisp that calls the dcl dialog box In the example below is one of my calling lisps Look at the structure of the lisp Look at and follow the what_next loop In this case when the user clicks the button on the dialog the following action tile is called (action_tile "qdx_wld" "(done_dialog 4)") The done_dialog 4 then calls the cond section of code at the bottom and it then calls my command. (cond ((= what_next 4) (command "ucs" "world")) (defun qdx:DialogInput (/ dcl_id dialogloaded dialogshow dr_file dr_set qdx_depth qdx_hwos qdx_matt qdx_sing result userclick what_next ) (setq dialogLoaded T dialogShow T) (if (= -1 (setq dcl_id (load_dialog "qdx.DCL"))) (progn (princ "\nERROR: Cannot load qdx.dcl") (setq dialogLoaded nil) ) ;_ end of progn ) ;_ end of if (setq what_next 2) (while (>= what_next 2) (if (and (not (new_dialog "qdx_maindlg" dcl_id)) dialogLoaded ) ;_ end of and (progn (princ "\nERROR: Cannot show dialog qdxdlg") (setq dialogShow nil) ) ;_ end of progn ) ;_ end of if (if (and dialogLoaded dialogShow) (progn (setq qdxff (findfile "c:/program files/quick draw/qdxlu.jdb")) (if qdxff (progn (setq dr_file (open qdxff "r")) (setq retval (read(read-line dr_file))) (close dr_file) (set_tile "qdx_hwo" (cdr(assoc 2 retval)));_hardware offset (set_tile "qdx_mtk" (cdr(assoc 1 retval)));_material thick (if (= (cdr(assoc 3 retval)) "1") (progn (set_tile "qdx_sin" "1");_single (set_tile "qdx_dbl" "0");_double );_progn (progn (set_tile "qdx_sin" "0");_single (set_tile "qdx_dbl" "1");_double );_progn );_if (set_tile "qdx_dpt" (cdr(assoc 4 retval)));_depth (mode_tile "qdx_dpt" 2) );_progn (progn (set_tile "qdx_hwo" "0.5313");_hardware offset (set_tile "qdx_mtk" "0.75");_material thick (set_tile "qdx_sin" "1");_single (set_tile "qdx_dbl" "0");_double (set_tile "qdx_dpt" "20.00");_depth (mode_tile "qdx_dpt" 2) );_progn );_if (action_tile "qdx_sin" "(set_tile \"qdx_dbl\" \"0\")") (action_tile "qdx_dbl" "(set_tile \"qdx_sin\" \"0\")") (action_tile "qdx_wld" "(done_dialog 4)") (action_tile "qdx_obj" "(done_dialog 5)") (action_tile "qdxhlp" "(help \"QD50.HLP\" \"Topic13\")") (action_tile "cancel" "(done_dialog)(setq UserClick nil) ") (action_tile "accept" (strcat "(progn" "(setq qdx_sing (get_tile \"qdx_sin\"))" "(setq qdx_depth (get_tile \"qdx_dpt\"))" "(setq qdx_matt (get_tile \"qdx_mtk\"))" "(setq qdx_hwos (get_tile \"qdx_hwo\"))" "(if (> (atof(get_tile \"qdx_dpt\")) 0.00)(progn (done_dialog)(setq UserClick T))" "(alert \" Enter a box depth.\")))" ) ;_end strcat ) ;_ end of action_tile (setq what_next (start_dialog)) (if UserClick ; User clicked Ok ;; Build the resulting data (progn (setq result (list (cons 3 qdx_sing);single or double (cons 4 qdx_depth);_depth (cons 1 qdx_matt);_material thickness (cons 2 qdx_hwos);_hardware offset ) ;_ end of list );_setq (qdx_wt_fl (vl-prin1-to-string result));_write last used to file );_progn ) ;_ end of if ) ;_ end of progn ) ;_ end of if (cond ((= what_next 4) (command "ucs" "world")) ((= what_next 5) (qdx_obsel)) );_end cond );_end while (unload_dialog dcl_id) result ) ;_ end of defun 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.