I’m trying to reload the linked CAD from another path, but I keep getting the error:
Here is my code (I only have 1 CAD in allcadlinks just for testing out the reload method):
import clr
from Autodesk.Revit.DB import FilteredElementCollector,CADLinkType, ModelPathUtils, BuiltInParameter
doc = __revit__.ActiveUIDocument.Document
allcadlinks = list(FilteredElementCollector(doc).
OfClass(CADLinkType).
WhereElementIsElementType().ToElements())
for cadlink in allcadlinks:
reloaded = cadlink.LoadFrom('C:\Users\xxx\Downloads\Drawing1.dwg')
Exception: An internal error has occurred.
Script Executor Traceback:
Autodesk.Revit.Exceptions.InternalException: An internal error has occurred.
at Autodesk.Revit.DB.CADLinkType.LoadFrom(String path)
at Microsoft.Scripting.Interpreter.FuncCallInstruction3.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame) at Microsoft.Scripting.Interpreter.LightLambda.Run4[T0,T1,T2,T3,TRet](T0 arg0, T1 arg1, T2 arg2, T3 arg3) at System.Dynamic.UpdateDelegates.UpdateAndExecute3[T0,T1,T2,TRet](CallSite site, T0 arg0, T1 arg1, T2 arg2) at Microsoft.Scripting.Interpreter.DynamicInstruction
4.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.Interpreter.Run(InterpretedFrame frame)
at Microsoft.Scripting.Interpreter.LightLambda.Run2[T0,T1,TRet](T0 arg0, T1 arg1)
at IronPython.Compiler.PythonScriptCode.RunWorker(CodeContext ctx)
at PyRevitLabs.PyRevit.Runtime.IronPythonEngine.Execute(ScriptRuntime& runtime)