BrianTFC Posted March 22, 2018 Posted March 22, 2018 All, Can someone help me with getting rid of the "ERROR" that happens when i hit enter or return to end the routine. Basically this give me the chance to reset my titleblocks so they print in order. (defun c:TRESET() (vl-load-com) (while (and(vl-cmdf "_.copybase" pause (ssget "_:S") "") (vl-cmdf "_.pasteclip"(getvar "LASTPOINT")) (vl-cmdf "_.erase" "_p" "")) ) (princ) ); end of c:TRESET Thanks, Brian Quote
rlx Posted March 22, 2018 Posted March 22, 2018 not tested but maybe as simple as : (while (setq ss (ssget "_:S")) (command "_.draworder" ss "" "_front")) Quote
ronjonp Posted March 22, 2018 Posted March 22, 2018 (edited) And here's something without command calls: (defun c:treset (/ _entsel e o) (defun _entsel (msg / p r) (setvar "ErrNo" 0) (while (not (cond ((and (null (setq p (entsel (strcat "\n" msg)))) (/= 52 (getvar 'errno))) (prompt "\nOops! Selection missed. Try again...") ) ((null p) t) ((setq r p)) ) ) ) r ) (while (setq e (car (_entsel "Select an object: "))) (cond ((vlax-write-enabled-p (setq o (vlax-ename->vla-object e))) (vla-copy o) (print (strcat (cdr (assoc 0 (entget e))) " copied...")) (entdel e) ) ) ) (princ) ) (vl-load-com) Edited March 23, 2018 by ronjonp Quote
BrianTFC Posted March 23, 2018 Author Posted March 23, 2018 Ronjonp, Rlx, Thanks for your help guys. Works great ronjonp thanks for the rewrite its a lot smoother. Thanks, Brian Quote
BrianTFC Posted March 23, 2018 Author Posted March 23, 2018 ronjonp, I have a question after running it I found out that if you miss the title block it ends the command is there a way to incorporate and error to say you missed and to try again like the following, (while (progn (setvar 'ERRNO 0) (setq ent (meth (cond (msg) ("\nSelect object: ") ) ) ) (cond ((eq (getvar 'ERRNO) 7) (princ "\nMissed, try again.")) ((eq (type (car ent)) 'ENAME) (if (and fnc (not (fnc ent))) (princ "\nInvalid object!") ) ) ) ) ) ent ) Thanks, Brian Quote
BrianTFC Posted March 23, 2018 Author Posted March 23, 2018 ronjonp, Thank you so much for your help :D BTW where in Colorado are you located? i used to live in Colorado Springs. i loved it out there... Thanks, Brian Quote
ronjonp Posted March 23, 2018 Posted March 23, 2018 Glad to help .. I'm in the Fort Collins area. Quote
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.