Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Valued Contributor
johnw
Posts: 98
Registered: ‎11-15-2005
Message 1 of 5 (216 Views)

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

216 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*
hmsilva
Posts: 3,357
Registered: ‎12-17-2004
Message 2 of 5 (187 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
johnw
Posts: 98
Registered: ‎11-15-2005
Message 3 of 5 (154 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*
hmsilva
Posts: 3,357
Registered: ‎12-17-2004
Message 4 of 5 (140 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*
pbejse
Posts: 2,511
Registered: ‎11-24-2009
Message 5 of 5 (136 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:

 

Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.