Open files without loading linked documents

I have a lot of models to upgrade to 2021, and i already have a script to open and save all the files out, the only issue that all the linked models (some models have upwards of 20) also load and take up time to convert. When we compound this with the fact that the version must be appended to our file name we have quite the slowdown.

Can I get a file to essentially unload all its links as it opens?


One way is if the links are on a workset and you do specify worksets on your opening process.

1 Like

hmm, i wonder how they did it?

I would suggest you to use this class, especifically designed for this purpose:


Yes, I use this in my app that mines o legacy Revit models just to limit this exact kind of behavior.

Note that you’ll need to have write access to the files, and I am not sure about B360 working correctly.

1 Like

I can confirm the transmission data class allows this on a local network without issue. May share out some Python code if BIM360 pans out.

1 Like

There is a node in Rhythm now for unloading links based on the TransmissionData class mentioned.



and the Python

if you want to hurt my feelings and not use Rhythm :pleading_face:

import clr

from Autodesk.Revit.DB import *

def UnloadRevitLinks(path):
    mPath = FilePath(path)
    tData = TransmissionData.ReadTransmissionData(mPath)
    #collect all (immediate) external references in the model
    externalReferences = tData.GetAllExternalFileReferenceIds()
    for refId in externalReferences:
        extRef = tData.GetLastSavedReferenceData(refId)
        if extRef.ExternalFileReferenceType  == ExternalFileReferenceType .RevitLink:
            tData.SetDesiredReferenceData(refId, extRef.GetPath(), extRef.PathType, False)
    #make sure the IsTransmitted property is set 
    tData.IsTransmitted = True
    #modified transmission data must be saved back to the model
    TransmissionData.WriteTransmissionData(mPath, tData);
    return path
#the model paths
modelPaths = UnwrapElement(IN[0])

#return the results
if isinstance(IN[0], list): OUT = [UnloadRevitLinks(x) for x in modelPaths]
else: OUT = UnloadRevitLinks(modelPaths)

Great stuff as always @john_pierson !!

1 Like

This is the Python i was testing out before. Note that it runs from any version of Revit on any other supported file versions (ie: if you’re in 2019 you can modify 2022 files, and vice versa) because it doesn’t require opening the document. Includes some UI to select the file and allows unloading or loading of all RVTs or all CAD files.

I have not tried it in the BIM360 environment yet.
(actually attached the dyn this time)
Set Reference Load State.dyn (12.0 KB)

1 Like