AutoLISP: Eraser

WARNING!! WARNING!!

This is yet another erasing routine but there is a warning that goes along with it. You don’t actually select anything. Instead, whatever your cursor hovers over gets erased. So if you don’t have a steady hand, then this routine will be dangerous for you… HAHA!!

Written by the CAB

~enjoy

;; modified by CAB 05.08.07

(defun C:ERASER (/ *error* pt ent usrpb)

(defun *error* (msg)

(if (not

(member msg '("console break" "Function cancelled" "quit / exit abort" "" nil)))

(princ (strcat "\nError: " msg))

) ; if

(and usrpb (setvar "pickbox" usrpb))

(princ)

) ; end error function

(setq usrpb (getvar "pickbox"))

(setvar "pickbox" 3)

(command "_.undo" "_begin")

(while (listp (setq pt (cadr (grread T 4 2))))

(if (setq ent (car (nentselp pt)))

(progn

(if (= (cdr(assoc 0 (entget ent))) "VERTEX")

(setq ent (cdr(assoc 330 (entget ent)))

))

(print)

(princ (entdel ent))

)

)

) ; while

(command "_.undo" "_end")

(*error* nil)

(princ)

)
Advertisements

About AutoCAD Tips

This blog serves as a knowledge base for myself (and anyone else) so that I can reference tips & tricks that I have learned and also refer others to it as well. I hope that this blog helps you learn at least one tip to make your drafting/design experience better.
This entry was posted in AutoLISP, Modifying, TIPS. Bookmark the permalink.

One Response to AutoLISP: Eraser

  1. John says:

    instead of erase objects can you create a AutoLISP that will hide objects that you hover over.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s