PDA

View Full Version : Needed - Autolisp - loop through files in a directory then zoom extents



dave
06-04-2010, 03:44 PM
Does anyone have this to share? Thanks!

awerning
06-05-2010, 02:45 AM
You would actually need to use a script (.scr) file rather than a LISP routine, as a LISP can only run on a single file.

Here is what you do:
1) Make a .scr file with these 2 lines:

ZOOM
E

Note: Make sure there is only 1 return after the "E". Your cursor should be blinking on the row directly beneath it with NO MORE rows after that. This is EXTREMELY important.

2) Download the free tool form Autodesk called script pro and use it to select all the drawings you want to run this file on.

Should be pretty self-explanatory at that point, but let me know if its not.

Rijkwerd
06-07-2010, 02:20 AM
Hello Aaron,

I have no experience with scr files but shouldn't there be a save & close command somewhere or does 'script pro' this automatically?

dave
06-07-2010, 08:51 AM
thanks awerning!

Good point Rij, does it save automatically?

Packin31
06-07-2010, 09:18 AM
Yes it will

Here is a sample of script I wrote to erase a block then saving the file

ZOOM
E
ERASE
(setq ss (ssget "x" '((2 . "man*"))))

-purge
B
man
N
QSAVE

awerning
06-07-2010, 10:12 AM
You can put the "qsave" in your script if you wish (just to be redundant\safe), but I believe that script pro has a check box for "Save after running script". As long as you check that before you hit the "run" button, each drawing will be saved. By nature of what script pro is, it will obviously then close each drawing as it moves on to the next one.

dave
01-26-2012, 10:44 AM
Thanks for this, guys! How would I remove all xrefs?

awerning
01-26-2012, 12:15 PM
http://www.davetyner.com/forum/showthread.php?8184-Script-for-Binding-Xrefs&highlight=xrefs
See Post #5
(change the word "BIND" to "DETACH")