Hi @Yien I hope you’re well.
Try this:
import clr
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
doc = DocumentManager.Instance.CurrentDBDocument
app = doc.Application
filePath = IN[0]
modelPath = ModelPathUtils.ConvertUserVisiblePathToModelPath(filePath)
options = OpenOptions()
options.DetachFromCentralOption = DetachFromCentralOption.DetachAndPreserveWorksets
docOnDisk = app.OpenDocumentFile(modelPath, options)
OUT = docOnDisk
There were a few updates required:
- You need to instantiate your options object first, then set its DetachFromCentralOption property.
- Its DetachFromCentralOption requires a DetachFromCentralOption enum and you need to assign it to the property (so you need to use the = statement)
- To obtain the Application object use the active document Application property
- Call OpenDocumentFile from your Application object as its not a static method