Visual LISP, AutoLISP and General Customization

Reply
Valued Contributor
Posts: 90
Registered: ‎11-15-2005
Message 1 of 5 (201 Views)

Updating Thousands of Blocks in mutliple subfolders - looking for easy routine

201 Views, 4 Replies
02-04-2013 07:32 PM

Good evening all,

 

I have to update a block in literally thousands of cad files. I have the book "AutoCAD Secrets Every User Should Know About" and the author gives examples of this by using a Batch File, Script File, and then Lisp Routine. I was wondering if anyone had an easier way to do the following:

 

Insert "Gennnotes=" (updating the block) into any drawing that has this block in the drawing already, if not Quit.

 

Typically to do this I would open the drawing "insert" "gennotes=", then cancel the command and save the drawing.

 

I have a lot of subfolders that also hold drawings so the command would have to search through each subfolder for dwgs.

 

Like I mentioned above, I tried to use the Batch File/Script Method but my batch file failed. It could find the folder Autocad 2012 - English. For some reason it was not seeing the spaces in between. Not sure. Here's the batch file portion of the routine:

 

Batch file:

 

For /r C:\Sybex\ %%f in (c:\sybex\*.dwg) do start /wait
C:\ACAD2012\Autocad 2012 - English\acad.exe "%%f" /b
C:\gennotesupdate.scr

 

Any help would be appreciated.

 

John W.

*Expert Elite*
Posts: 2,387
Registered: ‎12-17-2004
Message 2 of 5 (172 Views)

Re: Updating Thousands of Blocks in mutliple subfolders - looking for easy routi

02-05-2013 01:48 AM in reply to: johnw

johnw,
the line C:\ACAD2012\Autocad 2012 - English\acad.exe does not work in a batch file, because it contains empty spaces,
You need to put double quotes around the path that has spaces like this:

 

"C:\ACAD2012\Autocad 2012 - English\acad.exe"


Hope that helps

Henrique

Valued Contributor
Posts: 90
Registered: ‎11-15-2005
Message 3 of 5 (139 Views)

Re: Updating Thousands of Blocks in mutliple subfolders - looking for easy routi

02-07-2013 04:49 PM in reply to: hmsilva

I was able to get Autocad to open using the batch file modifcation per your instructions:


FOR /r %%f in (c:\sybex\dwg\*.dwg) DO START /WAIT
C:\"ACAD2012"\"Autocad 2012 - English"\acad.exe "%%f" /b C:\sybex\wbout.scr

 

Except when Autocad loads it says "File cannot be found" so something is wrong with my wildcard reference and I can't see what's wrong.

 

Any suggestions?

*Expert Elite*
Posts: 2,387
Registered: ‎12-17-2004
Message 4 of 5 (125 Views)

Re: Updating Thousands of Blocks in mutliple subfolders - looking for easy routi

02-08-2013 01:36 AM in reply to: johnw

johnw,
write batch file this way

 

FOR /r c:\sybex\dwg\ %%f in (*.dwg) DO START /WAIT
"C:\ACAD2012\Autocad 2012 - English\acad.exe" "%%f" /b
C:\sybex\wbout.scr


Henrique

*Expert Elite*
Posts: 2,369
Registered: ‎11-24-2009
Message 5 of 5 (121 Views)

Re: Updating Thousands of Blocks in mutliple subfolders - looking for easy routi

02-08-2013 01:51 AM in reply to: johnw

johnw wrote:

Good evening all,

 

Insert "Gennnotes=" (updating the block) into any drawing that has this block in the drawing already, if not Quit.

 

Typically to do this I would open the drawing "insert" "gennotes=", then cancel the command and save the drawing.

 

 John W.


Just a heads up, invoking a cancel would also terminate the script.

 

Also i would sugest you use ODBX for faster processing, but you need to throw  Insert "Gennnotes=" approach out the window. try and search this forum for REDEFINE block and look for one that doesnt use the insert command approach. i wrote one before but i cant seem to find it myself. :smileyvery-happy:

 

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Welcome to the new Autodesk Community!
If this is your first visit, click here to get started and make the most of the Community. Let us know what you think of the new experience in the Community Feedback Forum.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community