Jump to content

Go back to DCL after error


cletero

Recommended Posts

Hi, have been looking around on the concept of error handling, but haven't been able to find if it's possible to go back to showing the DCL dialog box after a user presses "Esc" during object selection, for example, or after any other error occurs during program execution.

 

Program flow would be something like:

- Show DCL

- User inputs DCL data and chooses to start main program

- User is prompted to select objects

- User presses "esc", maybe he realizes at this point his input data was wrong ;)

- DCL is shown again (instead of "function cancelled")

 

From the little I know conceptually, I don't think it's possible, but I'm not an expert so I must ask :)

 

I use the following lines when specifically asking user to complete a command, but I believe it only works with commands, and won't work if any other thing goes wrong:

(command "_.line")
(vl-catch-all-apply '(lambda nil (while (= 1 (logand 1 (getvar 'CMDACTIVE))) (command pause))))

Thanks for any suggestions

Link to comment
Share on other sites

Maybe resorting to SELECT command to perform the selection instead of SSGET? If the selection was succesfull, then call SSGET with Previous parameter to retrieve it.

(ssget "_P")

Link to comment
Share on other sites

Thanks, this seems to work! :)

 

Also, found that using vla-selectOnScreen accepts "Esc" as input, it will just cancel out and the selection set will be "nil", which can then also be filtered out. Just takes longer to set up vl selection sets.

 

Just one problem with both: can't use them to select points (which I forgot to mention, but I only do this in one of my routines). Is there any alternative to selecting points?

 

What I mean, is an alternative to this, again, to avoid going into the error function if "esc" is pressed:

(prompt "Select drilling points")
 (while (setq pt (getpoint))
   (setq pt_list (append pt_list (list pt)))   
 )

 

I'm modifying the rest of my routines with this methods.

 

Have a nice day 8)

Link to comment
Share on other sites

This seems to work with points, in case "Esc" , "Enter" or right-click:

 

;Get points
 (setq pt_check t)
 (while pt_check
   (if (vl-catch-all-error-p (setq pt (vl-catch-all-apply 'vlax-invoke (list (vla-get-Utility thisdrawing) 'GetPoint nil "\nSelect drilling points"))))
     (progn
       (setq pt_check nil)
     )
     (setq pt_list (append pt_list (list pt)))
   )
 )

 

Thanks for your help and hope this helps someone else, CHEERS

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...