I am trying to call a script file from a button in a dialog box. If I write a simple lisp that calls the script only, it works fine. However, when I add the dcl programming, the lisp just hangs AutoCad. Any ideas? Thank you in advance. Can't seem to attach a file so the lsp, dcl, and scr code is below:
Lisp FIle:
DCL File:Code:(defun C:test( / id i ok) (setq id (load_dialog "test.DCL")) ;load DCL (if (new_dialog "dcl_test" id) (progn (setq i 1) (repeat 6 (init_image i) ;assign an action to the image_button ;(action_image i) (setq i (1+ I)) ) (action_tile "C1" "(action_command 1)") ;assign an action to the button 1 (action_tile "C2" "(action_command 2)") ;assign an action to the button 2 (action_tile "C3" "(action_command 3)") ;assign an action to the button 3 (action_tile "C4" "(action_command 4)") ;assign an action to the button 4 (action_tile "C5" "(action_command 5)") ;assign an action to the button 5 (action_tile "C6" "(action_command 6)") ;assign an action to the button 6 ;;of course ,you can do it by (repeat) (setq ok (start_dialog)) ) (alert "Can't load the dialoag!") ) (unload_dialog ID) (princ) ) ;;; initializate the image_button. ;;; and assign an action to an image_button (defun init_image (key / k tile) (setq k (itoa key)) (setq tile (strcat "I" k)) ;tile (start_image tile) (fill_image 0 0 (dimx_tile tile) (dimy_tile tile) key ) (end_image) ;fill tile with different color (set_tile tile (strcat "Fun" k)) ;set the text of tile (action_tile tile (strcat "(action_command " k ")")) ;action ) ;;; assign an action to a command_button (defun action_command (key) (cond ((= key 1) ;;(alert "Please enter your command1:") ;;add your code in here (command "script" "sl1.scr") ) ((= key 2) (alert "Please enter your command2:") ;;add your code in here ) ((= key 3) (alert "Please enter your command3:") ;;add your code in here ) ((= key 4) (alert "Please enter your command4:") ;;add your code in here ) ((= key 5) (alert "Please enter your command5:") ;;add your code in here ) ((= key 6) (alert "Please enter your command6:") ;;add your code in here ) ) )
Script File:Code:dcl_test : dialog { key = "Title"; label = "Test commands dialog"; spacer; : column { : button { key = "C1"; label = "SL1"; } spacer; : button { key = "C2"; label = "Command2"; } spacer; : button { key = "C3"; label = "Command3"; } spacer; : button { key = "C4"; label = "Command4"; } spacer; : button { key = "C5"; label = "Command5"; } } spacer; ok_only; }//Testap
Code:-LAYER ON AV-SHBD-VIEW mview lock off .291,.297 mspace zoom W 0,77.6 27.8,56 pspace mview lock on .291,.297 -layer off AV-SHBD-VIEW


Reply With Quote

