Hi all, I am being sent a bunch of BIM360 models that I need to run some data extraction on. Since I am not the author of the models I am working with them on my local computer. There are several nodes to repath links but from what I can tell they are all based on the Revit API call LoadFrom.
When trying to repath the links I get the following error. “Exception: An internal error has occurred.”
In the documentation for LoadFrom it says “This must be an absolute path for local path.” The Path Type for cloud links is “Cloud” and I do not see a way to change this via the API and it cannot be changed by hand.
If I manually repath the link to a random local file path type automatically changes from “Cloud” to “Absolute” and repathing works as exspected.
Does anyone know of a way to repath BIM360 links to a local drive?
#Based on a Nick Boyts's script.
import clr
# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *
import traceback
doc = DocumentManager.Instance.CurrentDBDocument
linkInstances = Autodesk.Revit.DB.FilteredElementCollector(doc).OfClass(Autodesk.Revit.DB.RevitLinkInstance)
toggle = IN[0]
folderpath = IN[1]
reloadedlinks= []
errorList = []
if toggle == True:
for i in linkInstances:
name = i.Name
path = folderpath + "\\" + name
paths = path.rsplit(' : ',2)[0]
filepath = FilePath(paths)
RevitLinkType=doc.GetElement(i.GetTypeId())
try:
RevitLinkType.LoadFrom(filepath,None)
except Exception as e:
errorList.append(traceback.format_exc())
pass
reloadedlinks.append(RevitLinkType)
if errorList:
OUT = errorList
else:
OUT= reloadedlinks
Thank you for any help you are able to provide,
Steven