Jump to content

[Help] What happened with action or with Pickfirst ?


ketxu

Recommended Posts

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 ?

Link to comment
Share on other sites

I guess I have violated this thing :

Functions Restricted When a Dialog Box Is Open

While 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
Link to comment
Share on other sites

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 :thumbsup:

 

Thank you for the info ketxu

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...