Missing several data types in Rhino.Runtime.InteropWrapper

I started to explore the methods in Rhino.Runtime.InteropWrapper name space when trying to transfer complex data struct between Rhino and cpp.

Little by little, I find that the wrapper is missing some basic methods from openNURBS.

For instance, a SimpleArrayVector3d besides the SimpleArrayPoint3d (additional discussion below, though I think it is still needed)

And SimpleArray3dex is missing, though there is a SimpleArray2dex.

It seems the namespace is created without too much of tests and user case collection.

It would be helpful if this could be improved.

Hi @xliotx,

The interop classes are what are used by RhinoCommon. So you may run into situations where there isn’t something you need.

– Dale

I see.

If RhinoCommon is just for internal use inside the company, I’m fine with it since it has already made a lot of things easier.

However, from a user’s perspective, if RhinoCommon is meant to be used for all developers, I would suggest the core development team be open to suggestions from the users.

For instance, the two methods I mentioned, especially the SimpleArray3dex make quite a sense for transferring triangle face indices. I’m not sure how you use the 2-dim form, but it would be really good to expand the wrapper namespace.

Hi @xliotx,

I guess I’m confused by this, as we add new functionality to RhinoCommon, based on user requests, in every Rhino service release.

That said, both the Rhino SDK and openNURBS are quite large. And It’s not a good use of anyone’s time if we wrappers for classes and functions that nobody needs or nobody asks for.

As for you inquiry - why here is no SimpleArrayVector3d or SimpleArray3dex interop classes - we can certainly add these if needed. Since these arrays really just map to arrays of ints or doubles, you can use SimpleArrayDouble and SimpleArrayInt knowing the stride is 3. This is a technique used in lieu of adding additional interop wrapper classes.

You can also write your open interop wrapper classes as needed. Here is an example of how to make your own:

SimpleArrayPolyline.cs
MooseCoreLib.h
MooseCoreLib.cpp

Thanks,

– Dale

Thank you for your quick response.

I guess I misunderstood your reply in another post as a “sense” of not liking suggestions like this.
Yes, I’m using those replacements for now.
And yes, I seriously suggest adding these as they are pretty basic data types, and should be included to make life easier (new users can directly use it, rather than reading the source code of the class and figure out what the replacement is).

Thanks.

@dale

FYI. I’m putting whatever I found is needed here in this post as my feedback, so that you and the team can decide what should be added.

For Rhino.Runtime.InteropWrappers.SimpleArrayPoint3d(), currently the method does not contain a constructor to take an existing List<Point3d> Q like:

Rhino.Runtime.InteropWrappers.SimpleArrayPoint3d(Q)

Given that I can do similar for List<double> dbl with:

Rhino.Runtime.InteropWrappers.SimpleArrayDouble(dbl)

It would be helpful to add a similar function to the SimpleArrayPoint3d method.

Question:
Is there an easy way to pass List<Point3d> to the cpp side? Do I have to convert it to SimpleArrayDouble and reconstruct it afterwards?

Hi @xliotx,

I’ve logged an issue for the interop classes you want:

https://mcneel.myjetbrains.com/youtrack/issue/RH-68006

RhinoCommon in the Rhino 8 WIP contains the constructor for SimpleArrayPoint3d that you are looking for. I’ll look into cherry picking that back into Rhino 7.

– Dale

2 Likes