Calling Vector3d.Unitize() - "Unable to load rhcommon_c.dll"

OK, so I’m dabbling with a C# ConsoleApp (Framework 4.8.1)) framework and in one of my methods I’m instantiating a Vector3d from RhinoCommon and try to call Unitize() on the new vector, but then this happens:

“Unable to load rhcommon_c.dll”.

So I can create the Vector3d, but not call this specific method on the vector variable. This seems to me to be a problem with the C# API for this specific method, no?

My code works fine until row 190 (image below), which it shouldn’t if the referenced RhinoCommon.dll would have a general problem.

If I do the unitizing myself (commented code) the Vector3d itself is still OK.

Any ideas about why this specific method fails?

//Rolf

Hi @RIL,

If you are in a standalone console application, then you should be using Rhino3dm, not RhinoCommon which is for Rhino use only.

– Dale

Problem is that I’m planning to use RhinoCommon quite extensively, not from ConsoleApp, but from a class library (wrapping some Rhino.Geometry) which I will call from Grasshopper using RhinoCommon functionality (Assuming Rhino3dm is only geometry, not much Rhino logic?)

The ConsoleApp code (calling into this wrapper class library) is only for some basic testing while I develop the wrapping class library. (The MLine class return type in the image is part of that wrapper lib.)

The method on the line 190 (CompareTo(…)) works fine, only the Unitize() method seems to have a problem.

//Rolf

It only has a problem when RhinoCommon is incorrectly used outside of Rhino.

If you want full Rhino from a console app, then use Rhino.Inside.

– Dale

1 Like

OK, I’ll try calling the same code from the new Grasshopper component instead which should work.

Edit: Yes, Calling from grasshopper works fine.

//Rolf

Here’s a sample console app that uses RhinoCommon via Rhino.Inside

1 Like