Python in Dynamo vs GHPython - Revit API


I am trying to implement some automation with Rhino.Inside.Revit through GHPython to programmatically open a Revit model (Revit 2020). I found a Dynamo Python script at the link below, and it works fine to open a Revit document:

However, when I try to implement this in GHPython, it throws the following error:

Additionally, when I use the CovertUserVisiblePathToModelPath method in GHPython, it returns a FilePath rather than a ModelPath.

Any ideas what the differences are between Dynamo running the script vs GHPython? Any assistance is appreciated!


I removed the RevitServices and instead used Autodesk.Revit.ApplicationServices to get past the first error.

Here is what I was talking about re: ConvertUserVisiblePathToModelPath

As I understand it, it needs a string as input and would return a modelPath, but instead it is returning a FilePath.

Not sure why. If there is a better way to open a Revit model with RiR programmatically, I’d be all ears!

It looks like opening a Revit model is possible via the Document Grasshopper parameter, but I’m not entirely sure how this could be adapted for what I’m trying to do. See the link below, starting line 87:


Hi @jfreund,

Revit.ActiveDBApplication from “RhinoInside.Revit” should work.

1 Like

Thank you, @kike!