Using Rhino.Inside.Revit + Rhino3dm.dll to export Revit Geo

Hello,

I’m working in Visual Studio and am trying to write a simple export function taking advantage of Rhino.Inside.Revit’s Convert Methods. However, this ends in a problem.
We end up wanting to do something like this eventually

IEnumerable<Rhino.Geometry.GeometryBase> rhino_geometry = RhinoInside.Revit.Convert.Geometry.GeometryDecoder.ToGeometryBaseMany(geometry_element);

We get a problem where Rhino.Geometry.GeometryBase belongs to the Rhino3dm.dll and it keeps mentioning it can’t find the dll. Eventually, because I am doing this without Rhino being open, I will need to use the Rhino3dm as a reference right? If so - how do I convert it?

As I only get the message, which in this case, isnt very helpful.
'cannot convert from ‘System.Collections.Generic.IEnumerable<Rhino.Geometry.GeometryBase>’ to ‘System.Collections.Generic.IEnumerable<Rhino.Geometry.GeometryBase>’

1 Like

Don’t have an answer to your question, but I am trying to explore something similar. Do you know if there is any documentation available for RhinoInside.Revit.Convert? I have been referring to this but its very surface level: Rhino.Inside®.Revit

Hi @matthewaustin233,

Rhino.Inside.Revit uses RhinoCommon, so you need to reference RhinoCommon Geometry classes from your project as well to interact with the conversion methods Rhino.Inside.Revit provides.

The message you receive is confusing because even the types are named the same way are defined in two different assemblies.

Hi @hardik,

Unfortunatelly there is still no documentation about the API, but is planned.

Methods to convert geometry from Revit to Rhino are at rhino.inside-revit/GeometryDecoder.cs.

GeometryDecoder class is a static class with some extension methods to convert from RevitAPI.dll types to RhinoCommon.dll types.

The methods use to follow a ToRHINOTYPE name schema like…

using DB = Autodesk.Revit.DB;
using Rhino.Geometry;
using RhinoInside.Revit.Convert.Geometry;

DB.UV uv;
Point2d point2d = uv.ToPoint2d();
Vector2d vector2d = uv.ToVector2d();

DB.XYZ xyz;
Point3d point3d = xyz.ToPoint3d();
Vector3d vector3d = xyz.ToVector3d();

DB.BoundingBoxXYZ bbxyz;
BoundingBox bbox = bbxyz.ToBoundingBox();
Box box = bbxyz.ToBox();

DB.Curve crv;
Curve curve = crv.ToCurve();

DB.Solid solid;
Brep brep = solid.ToBrep();

DB.Mesh msh;
Mesh mesh = msh.ToMesh();

1 Like

Hi Kike,

I get that. I am wondering how to cast between these two types. From the documentation i understand that the rhinocommons assembly will only work within a rhino app, something i am trying to bypass, so i need to get it in the Rhino3dm assembly form.

Both Dll have different use cases.
Rhino3dm is meant to be used when you have no access to RhinoCommon and is a subset of it to do just IO on 3DM files.

Since Rhino.Inside.Revit RhinoCommon assembly loads and runs inside Revit well.

In fact the conversion routines are calling RhinoCommon in Revit and need Rhino to be loaded inside Revit to work.

So if you just reference RhinoCommon instead of Rhino3dm from your project what you are trying should work.