Erase Single Macro

I wonder how many people are familiar with this macro? I am pretty sure it used to be in the stock OOTB AutoCAD menus a long time ago, maybe on the screen menu?

The macro I'm talking about is one that executes the ERASE command with the single object selection, and then repeats. This can be very useful if you are working in a congested area and you need to erase some objects, and where a window or crossing selection is too risky because you might erase something by mistake.

The macro itself is *^C^Cerase single - and it is documented in the AutoCAD documentation.

The leading asterisk causes the macro to repeat, and the single option after the erase command starts means that it will let you select one object and immediately delete it. This should work in both AutoCAD and AutoCAD LT. Give it a try.

Animation of Erase>Single in action

Comments

I really like this idea but didn't feel like messin' with my menus/toolbars so I whipped this up:

;;erase single
(defun c:es (/ ent ecnt eprompt)
  (setvar "ERRNO" 0)
  (setq	eprompt	"\nSelect object: "
	ecnt	0
  )
  (while (or (setq ent (entsel eprompt))
	     (eq 7 (getvar "errno"))
	 )
    (cond
      ((= ent "Undo")
       (command "u")
       (setq ecnt (1- ecnt))
      )
      ((= (type ent) 'list)
       (command "erase" ent "")
       (setq ecnt (1+ ecnt))
      )
      (t nil)
    )
    (setvar "ERRNO" 0)
    (if	(not (zerop ecnt))
      (progn
	(setq eprompt "\nUndo/<Select object>: ")
	(initget "Undo")
      )
      (setq eprompt "\nSelect object: ")
    )
  )
  (princ)
)

Does the same thing as the menu macro plus allows single Undos and keeps track of the Undos so that you keep 'em maintained within the routine. I know this comment kind of skirts the whole intent of macro method but still...it's nifty.

Thanks. Once again, more than one way to do something in AutoCAD. LT users will have to stick with the macro, but I like your thinking. Thanks.

Could you whip together a version of this that allows for Window, Crossing & Single pick (ssget) and can handle multiple objects that may be selected if a window/crossing method is used? After using SketchUP's erase command, I wish that AutoCAD had the same thing and your routine is the closest to it that I have some across.

Thanks

 


All content is copyright © CAD PANACEA 2005-2013 unless otherwise noted and may not be reproduced. All comments posted to this blog are the sole responsibility of the person making the comment.

Google, as a third party vendor, uses cookies to serve ads on this site. Google's use of their cookies enables it to serve ads to users based on their visit to your sites and other sites on the Internet. You may opt out of the use of these cookies by visiting the Google ad and content network privacy policy.

Powered by Drupal