Is it possible that not all API are exposed in .NET?

I am developing in .net, and for the Curve class there is no method called GetLength() which I find in the documentation.

It works fine here in python:

import rhinoscriptsyntax as rs
import Rhino

crv_id=rs.GetObject("Select curve",rs.filter.curve,preselect=True)
if crv_id:
    print crv.GetLength()

For RhinoCommon it most certainly is wrapped

Are you perhaps trying to use a different library?

I use Rhino3dm.

I don’t know to what extent the .NET version of rhino3dm wraps geometrical functionality, but in general the rhino3dm is only for reading and writing .3dm files.

If you need access to the geometry kernels you’ll have to write a plug-in for Rhino so that you get access to the RhinoCommon SDK.

1 Like

Can you share the code you are trying to run?

But it simply lacks many api declared in the documentation.
Example for Curve the GetLength () function is missing. But I am using Rhino3dm and I think it is not 100% complete.

As Nathan said, you are looking at the wrong thing, rhino3dm is just for reading and writing files.

Not necessarily. It is possible to create geometry as well, albeit without all of the nice tools in Rhino.

Getting the length of a curve seems like a great thing to have in rhino3dm. I’m surprised it isn’t there already. I have added it as a request. Wrap Length getters for curve types · Issue #439 · mcneel/rhino3dm · GitHub

1 Like

In fact, since there is the Curve object I don’t understand why there are 90% of the APIs except some.

We add functionality as it is requested. Apparently this had never been requested before!

1 Like

@Mirko_Magalotti So I just looked in our openNURBS C++ API, which the other rhino3dm libraries are based on. That only includes a length property for lines, arcs, and polylines. These are not wrapped, so we’ll get these added. The length for NURBS curves are more complex to calculate and are not included in openNURBS, only in Rhino.

1 Like

Generally, the open source libraries (openNURBS, rhino3dm) only contain the datamodel and read/write functionality. All other non-IO advanced stuff (curve length, surface intersections, boolean operations, etc. etc.) are only available with the Rhino SDK that requires the user to have a license.
It also means that the documentation you’re reading at RhinoCommon API - Redirect does not relate to the rhino3dm package. Much that you find there will be missing from the package.

Correction, these are already wrapped, so you should be able to get the length for these types.

Hi @Mirko_Magalotti ,
I had a similar issue.
I am converting a curve to a polyline (TryGetPolyline method) and then accessing its Length property. At least that’s the workaround.

1 Like