Converting Revit Geometry To Rhino Geometry

Hey All,

A quick caveat: Not sure if this is the right channel or if this should go to the Rhino Inside channel, but as my question directly relates to Python and accessing API’s, I figured I’d start here. I also have very little experience w/the Rhino API (unfortunately), as I spend most of my time in Dynamo.

My problem is part of a larger script. I’m trying to get geometry from Revit into Rhino for use in building an energy model to be analyzed by ClimateStudio. My end goal for this portion of the script is to convert all Revit windows to a single plane in Rhino. I have a script that I’ve adapted from Dynamo, but I’m having trouble converting the geometry to grasshopper/rhino geometry. From what I understand, last node in my definition cannot handle lists of lists, so I need a way to combine the 4 curves contained inside Revit CurveLoops into 1 single polycurve (eventually I want to create an edgesrf/patch of of this planar crv). I’m stuck trying figure out how to convert from DesignScript geo to GH geo.

Any help would be appreciated. I’ve been using this scipt on the “rac_basic_sample_project”. Feedback is very welcome on my methods in the python node. As I stated above, I don’t have much experience w/Rhino’s API. I’m doing some stuff using Revit/Dynamo methods that are probably best done using Rhino/grasshopper methods, but I don’t know them (yet)!

Get Window (4.1 KB)

edit: I guess there is a way below. I seem to remember trying to use the ToCurve method in the past, and having issues, but maybe I was doing something wrong…

I don’t think there is a method in RIR to easily convert the Revit CurveLoop/Curves to Gh/Rhino curves. What I do is loop through the Revit CurveLoop and grab the start and end points of each Curve and use those to create lines in Gh. Once you have the points you can easily use RhinoScriptSyntax, particularly this method: rs.AddLine(startpt, endpt) shown here –rhinoscriptsyntax

1 Like

Hi @hrasmussen,

There are two methods at RhinoInside.Revit.Convert.Geometry.GeometryDecoder class for this:

  1. ToCurve for DB.CurveLoop.
  2. ToCurves for DB.CurveArray.
1 Like

Thanks Kike,

Super easy! I love it when the people developing the solutions respond to my posts!

Hey @devin_jernigan,

Thanks for replying! I’ll probably use the method described below, but I’m sure I’ll find a use for this method at some point - thanks for the link!