cletero Posted October 22, 2014 Share Posted October 22, 2014 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 Quote Link to comment Share on other sites More sharing options...
MSasu Posted October 23, 2014 Share Posted October 23, 2014 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") Quote Link to comment Share on other sites More sharing options...
cletero Posted October 23, 2014 Author Share Posted October 23, 2014 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 Quote Link to comment Share on other sites More sharing options...
cletero Posted October 23, 2014 Author Share Posted October 23, 2014 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 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.