Setting linked paths within a Central file

Setting linked paths within a Central file

danny.polkinhorn
Autodesk Support Autodesk Support
845 Views
3 Replies
Message 1 of 4

Setting linked paths within a Central file

danny.polkinhorn
Autodesk Support
Autodesk Support

I need to change the PathType of linked files (rvt, dwg, etc) within a Central file, from Absolute to Relative.  I am aware of the TransmissionData API and have used it, however when writing TransmissionData, you must open the Central File as detached, and resave it as a new Central file.  I have to open the central file anyway to perform other tasks, and would like to change the linked item PathType while it's open, but there doesn't seem to be a property I can use to do that.  All other properties of a linked file are available, except the PathType.  Am I missing something?

 

Thanks,

-Danny



Danny Polkinhorn
Sr. Product Manager
0 Likes
846 Views
3 Replies
Replies (3)
Message 2 of 4

jeremytammik
Autodesk
Autodesk

Dear Danny,

 

Can you simply set the ModelPath that you need and let Revit decide for itself whether it is relative or absolute?

 

Looking at the ModelPath class description, it says "A path to a file stored on a disk or on a server. ModelPaths are paths to another file. They can refer to Revit models, or to any of Revit's external file references (DWG links, for example.) Paths can be relative or absolute, but they must include an extension indicating what kind of file it is. Relative paths are generally relative to the currently opened document. "

 

Cheers,

 

Jeremy



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 3 of 4

Anonymous
Not applicable

There was a similar discussion about this a while back. I'm sorry if there's nothing new in there for you but here's the link, maybe it will be of use.

 

http://forums.autodesk.com/t5/revit-api/mapped-to-unc-path/m-p/5131570/

 

 

BTW I dropped some test code in at the end of the thread that might be of use to you, this line in particular:

 

 transData.SetDesiredReferenceData(linkId, newLinkPath, PathType.Relative, true);

 

If I remember correctly from my testing in v2015, the pathtype can be changed, but the change won't be visible until the project file is closed and re-opened.

 

0 Likes
Message 4 of 4

danny.polkinhorn
Autodesk Support
Autodesk Support

Yes, I've seen that thread and have some working code around it.  Unfortunately, I'm hoping to avoid the need to re-open the file and save it again by doing the change while the file is already open, similar to changing the PathType in the Manage Links UI.

 

It looks like the ExternalfileReference.PathType is read-only, which I really need to be read-write I guess.

 

Thanks for the response,

-Danny



Danny Polkinhorn
Sr. Product Manager
0 Likes