Rhino Inside Revit - Placing Areas/Boundaries inside GH C# Component

Hi all & @kike @scottd

I’m placing area boundary lines and areas on an area plan using the C# component in Grasshopper (inside Revit). Managed to get it all to work except the project units are out of wack. Project units for my Revit project are in mm as is my Rhino/GH. The strange thing is that the 3d preview of the boundary lines/areas appear fine in a 3d view (Revit), however when I go to my area plan view its completely off (factor of mm to m). Please see attachments. Any help is appreciated on this- units have been tricky so far in Rhino.Inside.Revit!

Thanks in advance,
Marco

It seems like it has something to do w/ the fact that Revit runs everything in feet in the background. (To clarify I am pulling a floor geometry from Revit into Rhino and then using that as my base. Then doing some stuff to that geometry in Rhino/GH and pushing it back into Revit - all in mm). After investigating a bit, if I scaled my geometry by 0.00328084 prior to pushing it into Revit, it comes in in the right place (conversion factor from mm to ft)…Would be interested in hearing cleaner solutions to this though! Thanks…

Hi,

We have recently released a new version that implements automatic units conversion in all the geometry conversion routines.

New converters are in RhinoInside.Revit.Convert.Geometry namespace.
Names have changed from ToRhino and ToHost to more specific names.

For instance to convert a Rhino Point3d to a Revit XYZ the code is like this:

XYZ xyzPoint = point.ToXYZ();
XYZ xyzVector = vector.ToXYZ();

The other way around is:

Point3d point = xyz.ToPoint3d();
Vector3d vector = xyz.ToVector3d();

Same for curves, breps and meshes.

Please update and tell us if this helps you.

2 Likes

Hi @kike,

Thanks for the update. What would be the conversion methods for lines/curves? How about UVs (UV needed for placing areas in Revit).

Thanks in advance!
Marco

I added conversion for those too in next release.

Those methods will be as you may expect:

UV uvPoint = point.ToUV();
UV uvVector = vector.toUV();

Point2d point = uv.ToPoint2d();
Vector2d vector = uv.ToVector2d();

Point conversion do unit conversion but vectors don’t.

Ok thanks for the heads up. Out of curiosity when would that be? Also to get latest release there isn’t a way to ‘update’ my RIR, I have to re-download correct?

Thanks for this!
M

Hi @kike hope all is well. Thought I would circle back to this… Just downloaded the latest RIR… Previously ‘RIR.Convert.ToHost(curve)’ worked just fine for converting to a DB.Curve… Now it seems unhappy. Tried RIR.Convert.ToCurve(), among other things. Any additional thoughts on this?

Thanks again in advance,
Marco

Hi,

All geometry converstion routines are in RhinoInside.Revit.Convert.Geometry namespace.

try adding using RhinoInside.Revit.Convert.Geometry; at the top of your script.

Hi,

Done.


Do I then need to use a different method to cast it to a DB.Curve? Do I need to reinstall something?

As I mentioned before ToHost do no longer exist.
To convert a Curve use rhinoCurve.ToCurve() to convert a Brep to a Solid brep.ToSolid()

2 Likes

Odd, maybe I need to reinstall RIR…

@kike now looking at it with fresh eyes, understood! implementation changed to rhinocurve.ToCurve() as you mentioned rather than it being RIR.Convert.ToHost(rhinocurve)… Thanks for the help.

M