If I have a large amount of .dgn files which have a reference attached, located say for example in "C:\REFONE". Is there a batch process or an automated way I can change the reference in all the files to "C:\REFTWO" ?
Directories are made up, I just want to know if i can change all the existing ref directories for another.
yes you can do this with scripts in the batch processor
but the real easiest way without having to repath everything is to use win explorer and make and rename refone to refone_old and rename the reftwo to refone and cad will now see the same file name attached as the ref file but its content will be different as long as you dont change any file paths this will work globally for all you work...
The clipping may be a problem if the files are not coincedent ie same positions geographically .... but that would happen even with the batch processor ...
If you have win 7 you could find all places refone lives in and replace it with new refone ( made from reftwo) ... same result as above... but this assumes your only replaceing one ref file with another...
you could also do a search here these forums for replace ref macro or google may prove useful.....
Lorys
Started msnt work 1990 - Retired Nov 2022 ( oh boy am I old )
But was long time user V8iss10 (8.11.09.919) dabbler CE update 16 (10.16.00.80)
MicroStation user since 1990 Melbourne Australia.click link to PM me
Hi,
I've used this routine in the past to fix some of my drawings:
Sub ReferenceNameReplace() Dim oldString As String Dim newString As String Dim OldFileName As String oldString = "Details11" newString = "Details13" For Each AttachedFile In ActiveModelReference.Attachments OldFileName = AttachedFile.AttachName If Left(OldFileName, Len(oldString)) = oldString Then NewAttachmentName = newString & Right(OldFileName, Len(OldFileName) - Len(oldString)) AttachedFile.SetAttachNameDeferred NewAttachmentName AttachedFile.Rewrite End If NextEnd Sub
In your case, the old string is the old path and the new string is either the new path or a configuration variable and a colon. You could use a batch command to run this on each file (vba run ReferenceNameReplace), or you could continue it in vba and have vba open each file and then run the command.
Please note that I am using SetAttachedNameDEFERRED, which means that the new file will not show up until the drawing is re-opened. If you're doing this on multiple files, it will save time not loading up the new file.
--Robert
Unknown said:What do you mean by remove folder spec from each attachment?
Unknown said: The new string is either the new path or a configuration variable and a colon
Or the new string can be simply the file name. MicroStation's default mechanism is to use MS_RFDIR to search for reference files, so it's not necessary to specify it explicitly.
Regards, Jon Summers LA Solutions
We need the old DOS ref tool.
Ustn since 1988SS4 - i7-3.45Ghz-16 Gb-250/1Tb/1Tb-Win8.1-64bEric D. MilbergerArchitect + Master Planner + BIMSenior Master Planner NASA - Marshall Space Flight CenterThe Milberger Architectural Group, llc