TheSwamp

Code Red => VB(A) => Topic started by: ANDYSMI on March 14, 2012, 10:01:28 AM

Title: change raster image path in multiple files
Post by: ANDYSMI on March 14, 2012, 10:01:28 AM
Hi group
I need to move thousands of dwg files. I have written a routine in VB6 that walks the directory structure, finds each file and using objectdbx, changes the xref paths to match the new location.
I need to do the same with the paths of the raster images. Using objectdbx I can locate the dictionary object 'ACAD_IMAGE_DICT'. I can loop through the dictionary object and get the name of the image, an object ID and a handle but cannot figure out how to access the object's properties. The object I can access is an acdbRasterImageDef object.
This is a one shot deal, I need to use this routine just once to move the files. I like the speed of the objectdbx interface but would be willing to use any programming method to do the job.
I'm migrating from xp to Win7 and from acad 2006 to acad 2012, have vb6 and VS2010 so can use any of the languages or versions mentioned. My lisp is a little rusty, know a little C++ and I'm learning .net but VB(a) is my most famliar.
Title: Re: change raster image path in multiple files
Post by: ANDYSMI on March 14, 2012, 02:33:27 PM
OK... I wrote another routine that uses the regular Acad VB interface (not objectdbx), loops through the drawings, finds any image objects and changes thier paths. It's slower then using objectdbx (takes about 3 to 4 times longer) but it would work.
Only problem is one of the drawings threw up a dialog box prompting the user to click OK button and program halts waiting for a reply. The dialog was 'Newer Version AEC Objects Detected'. All the typical dialog boxes asking for missing linetypes ect are skipped but this one. This program will take hours to run and I was planning on running it overnight unattended.
Anyway to clear such dialogs programically?
Title: Re: change raster image path in multiple files
Post by: ANDYSMI on March 14, 2012, 05:45:29 PM
ok... now I'm getting the feeling I'm talking to myself.
Funny thing I've noticed testing this application. When I go back and open the drawings, all the paths for xrefs and images are changed but the little bubble pops up and says xrefs need reloaded. When I go into the xref manager, all the paths are correct and acad has found all the xrefs in thier new locations, but they still say they need reloaded. I reload all of them, save the drawing, close it and reopen it and it says they need reloading again. It isn't until I've opened ever xrefed drawing and saved it that it stops prompting me to reload them. A minor annoyance but still...
Anybody got any idea why?
comments?
Title: Re: change raster image path in multiple files
Post by: M-dub on March 15, 2012, 08:14:01 AM
ok... now I'm getting the feeling I'm talking to myself.
Funny thing I've noticed testing this application. When I go back and open the drawings, all the paths for xrefs and images are changed but the little bubble pops up and says xrefs need reloaded. When I go into the xref manager, all the paths are correct and acad has found all the xrefs in thier new locations, but they still say they need reloaded. I reload all of them, save the drawing, close it and reopen it and it says they need reloading again. It isn't until I've opened ever xrefed drawing and saved it that it stops prompting me to reload them. A minor annoyance but still...
Anybody got any idea why?
comments?

First of all, welcome to theSwamp. :)
These xrefs... did they give you any warnings when you opened them?

I don't know if you've seen this thread (http://www.theswamp.org/index.php?topic=37809.15), but I've got my own image pathing issues...
Title: Re: change raster image path in multiple files
Post by: Matt__W on March 15, 2012, 08:23:24 AM
We all have "issues", Dub.  :)


As for the AEC message, once you toggle on the "don't ever show me this freaking message again" option and click ok, you should be good to go with your program and shouldn't see the message again.
Title: Re: change raster image path in multiple files
Post by: ANDYSMI on March 16, 2012, 01:08:09 PM
As for the AEC message, once you toggle on the "don't ever show me this freaking message again" option and click ok, you should be good to go with your program and shouldn't see the message again.
In just that drawing file or forever more with every drawing that has newer AEC objects?
Title: Re: change raster image path in multiple files
Post by: ANDYSMI on March 16, 2012, 01:45:07 PM
First of all, welcome to theSwamp. :)
These xrefs... did they give you any warnings when you opened them?

I don't know if you've seen this thread (http://www.theswamp.org/index.php?topic=37809.15), but I've got my own image pathing issues...
thanks for the welcome. No warnings when opening the xrefs and no solution to changing path type of image after insertion.
Title: Re: change raster image path in multiple files
Post by: ANDYSMI on March 30, 2012, 04:11:17 PM
Hi folks
Don't know if anybody will catch this but I'm having a problem. I wrote this application, tested it for awhile, got it running well and then move one users files to the new server and ran the application. It changed the path on all the xrefs and image files on over 1500 drawing and everything works peachy. Did the same thing on the next users files, same server, same share, same version. This time, I open autocad, the new path is correctly inserted, looks right but the xrefs and image files all say 'Not Found'.
If you browse for the file, the same exact path is inserted in and it works. Tried the whole thing a few times and every manner of reloading and everything I could think of but still the problem remains.
Title: Re: change raster image path in multiple files
Post by: BlackBox on March 30, 2012, 04:40:38 PM
Silly question, I know... But why not just use Reference Manager???  :?
Title: Re: change raster image path in multiple files
Post by: ANDYSMI on April 02, 2012, 10:14:24 AM
OK... well, I had made a silly mistake. Was inserting two backslashes into the middle of the path instead of one. Had a coworker looking at it earlier and he didn't catch it either. But anyhow, all is well, processed over 5000 drawings, changed all the paths in all the xrefs and images. The biggest trick was trapping for all the various errors, corupt drawings, newer versions, locked layers ect. Thanks to everyone here in the swamp who lent a hand!!!

Silly question, I know... But why not just use Reference Manager???  :?
You know, I looked at the reference manager (acad2006 version) and couldn't figure out how to do more then one drawing at a time. Maybe I missed how it works and I needed to do a LOT of drawings.
Title: Re: change raster image path in multiple files
Post by: M-dub on April 02, 2012, 10:26:31 AM
But anyhow, all is well, processed over 5000 drawings, changed all the paths in all the xrefs and images...

Glad to hear!