Jump to content

Recommended Posts

Posted

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

Posted

not tested but maybe as simple as :

 

 (while (setq ss (ssget "_:S")) (command "_.draworder" ss "" "_front")) 

Posted (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 by ronjonp
Posted

Ronjonp, Rlx,

 

Thanks for your help guys. Works great ronjonp thanks for the rewrite its a lot smoother.

 

Thanks,

Brian

Posted

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

Posted

ronjonp,

 

Thank you so much for your help :D:D BTW where in Colorado are you located? i used to live in Colorado Springs. i loved it out there...

 

Thanks,

Brian

Posted

Glad to help :) .. I'm in the Fort Collins area.

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