Calling RhinoCommon and Rhino.Inside.Revit in Python and C# Zero Touch Nodes - BoilerPlate samples

Thought this might be useful for anyone looking to make calls to Rhino.Inside or RhinoCommon in either custom Python nodes or custom C# nodes, I’ve added two example boilerplates to get started. Note that before making calls to the Rhino APIs, Rhino.Inside.Revit must be installed and running in the background otherwise the Rhino libraries can’t be accessed:


import clr
# Import ToDSType(bool) extension method
import Revit

# Import geometry conversion extension methods

# Import DocumentManager and TransactionManager
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
from System.Collections.Generic import *

# Import RevitAPI
import Autodesk
from Autodesk.Revit.DB import *

import sys
import os

roamingFolder = os.getenv('APPDATA')

rhinoInsidePath = roamingFolder + r'\Autodesk\Revit\Addins\2019\RhinoInside.Revit'

rhinoCommonPath = r'C:\Program Files\Rhino 7 WIP\System'


import RhinoInside
from RhinoInside.Revit.Convert.Geometry import *

import Rhino
from Rhino.Geometry import *

doc = DocumentManager.Instance.CurrentDBDocument

#Uncomment the line below to enable the first input
#t = UnwrapElement(IN[0])

# "Start" the transaction

# "End" the transaction

#Uncomment the line below to output an object
#OUT = t

C# (zero touch import)
Reference the following libraries to do pretty much anything you need:

using Autodesk.Revit.DB;
using Revit.GeometryConversion;
using RevitServices.Persistence;
using Rhino.Geometry;
using RhinoInside.Revit.Convert.Geometry;

namespace DynamoNodes.RhinoInside
    public class RhinoInsideNode
        public RhinoInsideNode(bool refresh)
            var doc = DocumentManager.Instance.CurrentDBDocument;

            // Write your code here.

@Thomas_Mahon if you import the os module and use “os.getenv(“APPDATA”)” this will give you the path to the current users roaming folder then no need to update it with user locations.

Wouldnt a similar approach be needed for the revit version as well?

Example can be found in this code:


@Brendan_Cassidy good tip - with Python I always resort to the bare-minimum as its only ever used for rapid prototyping in all of my cases, never production-code, which is why I’m kind of indifferent to this. Nevertheless, this is very useful for Python developers and I’ll modify the boilerplate.

Well, I guess yeah you could also address the fact the boilerplate is targeting Revit 2019 but now its getting anal - whats stopping whoever is using it from simply modifying this themselves? It is just a simple boilerplate to get started that’s all, plus a boilerplate is designed to be modified to suit the dev’s needs…anyway, enjoy!

1 Like