Hello MicroStation novice here!
I have been working with MicroStation and the batch process tool for almost 2 years and have gotten to save us a lot of time doing so. However with all the scripts I was able to make, I could never figure out how to attach a reference to a file with the relative path but only through an actual path.
reference attach "C:\Users\2263\Desktop\Batch Process\YYYY-TB44x36.dgn",,,*,,,reference levels off ALL YYYY-TB44x36.dgn;selview 1 reference levels on Default,A-ANNO-NOTE,A-TB,A-TB-0GRID,A-TB-TEXT,NOPLOT YYYY-TB44x36.dgn;selview 1filedesignsave design
It is important to us that all of the files we attach have the paths as relative for the clients use after the design is complete. I have done research and seen people recommend MDL apps to help but I don't understand them all too well. If someone could guide me to an article that helps explain them or the problem I am having would help a bunch!
Michael Drew said: I have done research and seen people recommend MDL apps
Reference files have extensive support built-in to MIcroStation. You don't need MDL or any other programming language to get the job done.
As Robert Hook comments, yours isn't a programming question. You'd be better off moving it to the MicroStation Forum, where there are plenty of people who can answer questions about batch processing and reference attachments.
Michael Drew said: I could never figure out how to attach a reference to a file with the relative path
Configuration variable MSDIR points to the location of the active DGN file. You could try to specify a relative path starting from that variable. Something like this (but I don't know your folder structure)...
MSDIR
reference attach "$(MSDIR)..\..\Batch Process\YYYY-TB44x36.dgn"
or
reference attach "MSDIR:..\..\Batch Process\YYYY-TB44x36.dgn"
Regards, Jon Summers LA Solutions
Thanks for the info and the suggestioin to get this to the MicroStation forum!
I tried what you said but had no luck adding that to my script. below is how I placed it with screenshot of our folder structure in case that helps. The file I am editing is in the 03 Arch folder and the file I am referencing is in the 000 Xrefs folder.
reference attach "MSDIR:..\..\000 Xrefs\YYYY-TB44x36.dgn",,,TB,,,
Michael Drew said:I tried what you said but had no luck adding that to my script
What you write in a script is exactly what you would key-in to MicroStation. Therefore you can test individual lines of your script by typing them manually into MicroStation's key-in window.
That is what I had tried originally. Just to test it by pasting it into the key in window but nothing happens.
These key-ins work for me...
reference attach "MSDIR:../testrefs/pipes 3d test.dgn"
reference attach "../testrefs/pipes 3d test.dgn"
Folder testrefs is a sister of the active DGN folder. Note that I use the forward-slash (/) as the folder separator.
testrefs
Answer Verified By: Robert Hook
So for whatever reason using MSDIR does not work for me. HOWEVER, doing either of the scripts below actually works out! Forward or backslash doesn't seem to make a difference for when I do it.
reference attach "../000 Xrefs/YYYY-TB44x36.dgn",,,TB,,,
reference attach "..\000 Xrefs\YYYY-TB44x36.dgn",,,TB,,,
Thanks for all your help!