ketxu Posted December 17, 2011 Share Posted December 17, 2011 Hi all. Please help me findout what happened in this case : 1- I have a simple defun setvar (defun setvars()(setvar "pickfirst" 1)) => Tested in command, or from other defun call are OK both 2 - I put it into action when press a button : (defun c:Test (/ fl ret dcl_id) (vl-load-com) (setq fl (vl-filename-mktemp "mip" nil ".dcl")) (setq ret (open fl "w")) (mapcar '(lambda (x) (write-line x ret)) (list "test_DCL : dialog {label=\"Test\"; width = 40;fixed_width = true;" ":button {label = \"Exit\"; is_cancel = true;fixed_width = true;width = 1;}" ":button {label = \"Setvar Test\";fixed_width = true;width = 1;key = \"kTest\";}" "}" ) ) (setq ret (close ret)) (if (and (not (minusp (setq dcl_id (load_dialog fl)))) (new_dialog "test_DCL" dcl_id) ) (progn [color=blue](action_tile "kTest" "(setvars)") ;This is[/color] (setq dlg_Exit (start_dialog)) ) ;_ end of progn ) ;_ end of if (unload_dialog dcl_id) (vl-file-delete fl) ret ) => Run : ; error: AutoCAD variable setting rejected: "Pickfirst" 1 3- Change a little in Defun setvar : (defun setvars()(setvar "pickadd" 1)) => Test defun again from command, other defun, Test defun are OK now ???? 4-Continuous put setvar directly in Test defun code : Change : (action_tile "kTest" "(setvars)") By : (action_tile "kTest" "(setvar \"Pickfirst\" 1)") => Run : failed with the same reason 5 - Change Pickfirst with other system variable : Change : (action_tile "kTest" "(setvar \"Pickfirst\" 1)") By : (action_tile "kTest" "(setvar \"Snapang\" 1)") => Run : OK ==>???? so what happend ? Or i'm wrong in type Pickfirst ? Quote Link to comment Share on other sites More sharing options...
ketxu Posted December 18, 2011 Author Share Posted December 18, 2011 Please don't mind, i've answer and solved for this case ^^ Thank all for reading Quote Link to comment Share on other sites More sharing options...
pBe Posted December 18, 2011 Share Posted December 18, 2011 Please don't mind, i've answer and solved for this case ^^Thank all for reading I dont mind.. what i am now is curious ... so what happen? Quote Link to comment Share on other sites More sharing options...
ketxu Posted December 18, 2011 Author Share Posted December 18, 2011 I guess I have violated this thing : Functions Restricted When a Dialog Box Is OpenWhile a dialog box is active—that is, during the start_dialog call—youcannot call any function that requires user input on the AutoCAD command line, or affects the display outside the dialog box (for example, in the AutoCAD graphics window). This restriction includes functions that write text, such as print, princ, and prin1. You can issue ssget calls, as long as you do not use any options that require user input. If your program calls one of the restricted functions between the start_dialog and done_dialog calls, AutoCAD terminates all dialog boxes and displays the following error message:AutoCAD rejected function Or sth similar. So i have to put this function execute in Donedialog event, mean after Dialog disappear, and it Works now Quote Link to comment Share on other sites More sharing options...
pBe Posted December 18, 2011 Share Posted December 18, 2011 I guess I have violated this thing :Or sth similar. So i have to put this function execute in Donedialog event, mean after Dialog disappear, and it Works now Right on Thank you for the info ketxu Quote Link to comment Share on other sites More sharing options...
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.