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