Rhino in Revit with C# and Revit API

Hi there,
I am new to Rhino.
I am developing Revit add-ins with Revit API and C# and sometimes, as far as geometry goes, Revit API can be quite limiting.

Is there a possible way to use Rhino inside Revit in my C# rather than using its GUI and Grasshopper?

For example lets say I have a list of elements that I got using the FilteredElementCollector of Revit API, from there I want to convert/cast them into Rhino elements and use Rhino’s functionality to play around with their geometry, and then convert/cast them back to Revit API elements.

Is what im saying makes any sense?
Thanks

Hi Ido,

Here is our guide on using RiR with C#

1 Like

Hey, thanks for your response.

I tried to use RhinoIside.Revit.dll and RhinoCommon.dll to try and play with some solids/BReps programmatically with Revit 2025.

RhinoIside.Revit.dll was taken from the addins folder after I installed RhinoInside.Revit.
RhinoCommon.dll is an installed nugget in my project.

I took 2 Revit solids out of 2 different Revit elements
tried to use GeometryDecoder.ToBrep() on both solids
perform a union operation using Brep.CreateBooleanUnion()

But my Revit crashed with a Rhino Error reporting window…
Would be nice to get a point in the right direction please.

using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using System;
using System.Linq;
using System.Collections.Generic;
using RhinoInside.Revit.Convert.Geometry;
using Rhino.Geometry;

.
.
.

Solid s1 = GetSolidsOfElement(element1);
Solid s2 = GetSolidsOfElement(element2);

 try
  {
      Brep bRep1 = GeometryDecoder.ToBrep(s1);
      Brep bRep2 = GeometryDecoder.ToBrep(s2);
      IList<Brep> bReps = new List<Brep>()
      {
          bRep1,
          bRep2,
      };

      //double tolerance = Rhino.RhinoDoc.ActiveDoc.ModelAbsoluteTolerance;
      double cmToFeet = 0.033;
      Brep[] union12 = Brep.CreateBooleanUnion(bReps, cmToFeet);
  }
  catch (Exception ex)
  {
      TaskDialog.Show("ex", ex.Message);
  }
.
.
.

Update:
I was able to install and use the code from my last message in Revit 2025.
But I am having trouble with Revit 2024.

I upgraded to Revit 2024.3 but I still can’t use Rhino.Inside in a c# project for Revit 2024.3.

When I try to build the project I get an error regarding a missing Rhino.Inside assembly, and this warning message about .net versions mismatch:

The primary reference “RhinoInside.Revit.dll” could not be resolved because it was built against the “.NETFramework,Version=v4.8.1” framework. This is a higher version than the currently targeted framework “.NETFramework,Version=v4.8”.

I am referencing Rhino.Inside from the Revit add-ins folder, works just fine for Revit 2025 which its add-ins are built on .net 8.0.

is there a way to use Rhino.Inside on .net4.8 projects?

Hi there,

I guess to make it work you’ll need installer and DLLs from older version of RiR compatible with Revit2024.

Check out RiR website.

Regards,

Pavel