[Search tip detail and code files using keywords, tip number, author name, etc ]
 
    For tip to function correctly, you must ensure that the downloaded file name matches the file name
    displayed in the Rename File To field. Please rename downloaded files when necessary.
Tip 2260: Process All Drawings in a Folder
Tip# 2260 By Bill Kramer On 01-Dec-2007
3
Rated By 1 users Downloaded : 644
Categories : Drawing Properties, File Data, Misc. User Tools
Software type : AutoCAD
Rename File To : Tip 2260: RUNFOLDER.BAS*
RUNFOLDER.BAS: Use this code in VBA programs to apply a given function to all drawings in a folder. Requires presence of code from Tip 2261.

Tip 2260: Process All Drawings in a Folder
Just as you can apply commands to every open drawing using a routine like the one above, you also can apply commands to every drawing in a folder, except in this latter case the routine actually opens drawings rather than just accessing them. This tip, supplied for import as the module file RUNFOLDER.BAS, requires the presence of the next tip (Pick a Folder Dialog Box) in the same project. The concept is to use the DIR function of VBA to loop through a selected folder of drawings. Each drawing is opened, and a series of commands is applied (in this case, just a simple zoom) before the drawing is closed with a save back to the disk. If you have folders full of drawings and need to run a set of AutoCAD commands against each, then this code may be just the answer in terms of a basic template. Once again, the SendCommand method of the drawing object is used to manipulate the drawing. With the drawing open, VBA routines can accomplish much more, such as directly manipulating objects, cleaning up tables, and revising references.

 

 

Average Rating:
3


User comments


Log In