Find and Replace Linked Revit and AutoCAD File Paths

Find and Replace Linked Revit and AutoCAD File Paths

ralvarez1976
Enthusiast Enthusiast
3,711 Views
4 Replies
Message 1 of 5

Find and Replace Linked Revit and AutoCAD File Paths

ralvarez1976
Enthusiast
Enthusiast

I need to create a Revit addin similar in functionality to AutoCAD's external "Reference Manager" tool. It needs to find all Revit and AutoCAD links, present them in a dialog box, and allow the user to find and replace the path or portions of it, and change them to relative or absolute, etc.

 

We are currently using Revit Architecture 2012. I am a complete beginner to programming and the API. How would I go about attacking this problem?

 

I appreacite any help you can provide, thanks.

 

Rafael.

0 Likes
Accepted solutions (1)
3,712 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable

What exactly do you want to do that the "Manage Links" command in Revit does not do?

0 Likes
Message 3 of 5

ralvarez1976
Enthusiast
Enthusiast

Manage links does not allow you to change more than one link path at once, so if you have many links it takes forever to repath them all.

 

This is especially true for AutoCAD links, which tend to be numerous in projects. Its just the reality of projects that they have to have many links, and sometimes we have to move them to a different server, etc.

 

The relative paths setting takes care of this, but if it was set to absolute the addin I am trying to create would help solve the problem.

0 Likes
Message 4 of 5

Joe.Ye
Alumni
Alumni
Accepted solution

 

Hi Rafael,

 

 TransmissionData class may help to do that. This class can get and set the file reference information without opening the main Revit file in Revit.

 

TransmissionData stores information on both the previous state and requested state of an external file reference. This means that it stores the load state and path of the reference from the most recent time this TransmissionData's document was opened. It also stores load state and path information for what Revit should do the next time the document is opened.

As such, TransmissionData can be used to perform operations on external file references without having to open the entire associated Revit document. The methods ReadTransmissionData and WriteTransmissionData can be used to obtain information about external references, or to change that information. For example, calling WriteTransmissionData with a TransmissionData object which has had all references set to LinkedFileStatus.Unloaded would cause no references to be loaded upon next opening the document.

TransmissionData cannot add or remove references to external files. If AddExternalFileReference is called using an ElementId which does not correspond to an element which is an external file reference, the information will be ignored on file load.

Note that TransmissionData objects must be set to "transmitted" for the requested reference data to be meaningful. Revit ignores the TransmissionData for non-transmitted files. Marking a file as transmitted has other effects - workshared files are opened as detached from the central model, and creation of new local files is prohibited, until the file is in its final location and the file has been marked as no longer transmitted. 

 

Several posts in Jeremy's talked about the usage of TransmissionData class and its methods.

http://thebuildingcoder.typepad.com/blog/2011/10/using-the-writetransmissiondata-method.html

http://thebuildingcoder.typepad.com/blog/2011/05/list-linked-files-and-transmissiondata.html

http://thebuildingcoder.typepad.com/blog/2011/10/using-the-writetransmissiondata-method.html

 

And you can see more posts by searching his blog.

 

Hope this helps.

 



Joe Ye
Contractor
Developer Technical Services
Autodesk Developer Network
0 Likes
Message 5 of 5

ralvarez1976
Enthusiast
Enthusiast

Thanks Joe, that was exactly what I was hoping for. Too bad my search on google did not give me any hits to these blogs entries.

Now I just have to figure out how to make an interface that allows the user to change part of the paths in a "find and replace" fashion.

0 Likes