Open files without loading linked documents

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

Code:

Node:

and the Python

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

import clr

clr.AddReference('RevitAPI')
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)
5 Likes