Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Any way to delete *everything* on a drawing via AutoLISP ?

3 REPLIES 3
Reply
Message 1 of 4
msingh_autocad
331 Views, 3 Replies

Any way to delete *everything* on a drawing via AutoLISP ?

I am debugging a script that uses EXTMAX to determine where the next patterns should go.

 

Problem is that if I run the script without deleting everything via the layer list, save, close file and reopen, the stale values of EXTMAX mess up the next run.

 

Is there an easy way to delete everything on a drawing and set EXTMAX to 0,0 ? I have tried doing the latter via a lisp command but autocad (perfectly reasonably) rejects this attempt to trick it.

------------------------------------------------------------------------


AutoCAD 2011 on Mac OSX 10.6.7.
3 REPLIES 3
Message 2 of 4
wkiernan
in reply to: msingh_autocad

I don't know what version you're using but

 

(command "mspace")

(command "erase" (ssget "x")  "")

(command "regen")

 

used to reset EXTMIN and EXTMAX for me.

Message 3 of 4

The values in the EXTMIN & EXTMAX System Variables are enlarged immediately whenever you add something to the drawing that is outside the previous extents.  But the values are not shrunk back, when you remove something and make the extents smaller, until a REGENeration.  It isn't necessary to close the drawing and get back in, but only to Regenerate as in wkiernan's suggestion.  [The descriptions in Help say that they're only shrunk with Zoom All or Zoom Extents, but in fact, anything that Regenerates the drawing will do it.]

Kent Cooper, AIA
Message 4 of 4
msingh_autocad
in reply to: wkiernan

Thanks for the response.

 

That definitely gets rid of all the entities on the drawing, but it does not reset EXTMAX for me.

 

I had to run a zoom extents command to get this initialization code to work.

------------------------------------------------------------------------


AutoCAD 2011 on Mac OSX 10.6.7.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost