I agree. I used Append() in the end and didn’t use a const_cast, and that’s exactly why I think there should be an overload function for that purpose.
To respond to your questions, I’m developing a GH plugin for mesh processing using many methods developed and existing in the computer graphics community (cpp mainly).
For this purpose, all computation is done on the cpp side, using libraries like eigen. and then transfer data back to the Rhino side. I guess that’s why I’m posting pretty frequently in the past a few days…
For the question specifically in this post, I’d like to convert a eigen::VectorXd class, which provide a method vec.array() as a const T* so that I can initialize a ON_SimpleArray<T> with it. However, there is no overload function for the openNURBS class, and I need to manually convert it to a middle form or assign the data one by one using the Append method.
if I create severalON_3dPointArray on the CPP side, and append it to my ON_SimpleArray<ON_3dPointArray*>* where the pointer is created on the C# side, then series of ON_3dPointArray will be unavailable after the cpp function ends its lifecycle, and I won’t get anything from the C# side.
So the question is re-framed to:
What is the CORRECT way of using Rhino.Runtime.InteropWrappers.SimpleArrayArrayPoint3d() between C# and cpp ?