My NURBS surface can not add to Doc

Hi,
I got a ON_NurbsSurface with IsValid() returning true but I can not add it to Doc. I tried to Create a Surface Object but failed because BoundingBox is a unit box and Geometry() returning nullptr. Please help me check it.
The attachement is the Dump() file from the surface. My Rhino is 6.0.
rhino.zip (12.4 KB)

Thanks.

Stan

Hi @stankindraw,

How did you create surface? From code? From reading some file?

How can we repeat what you’ve created?

– Dale

I got it from my code in my own data structure. My code will do a conversion to ON_NurbsSurface. I fixed some errors but I can not get the right result.
Now, the problems are the control points. Internally, My code uses array like: Cpts[10][20]. I think ON_NurbsSurface is a Cpts[200], not a 2-dim array. I found that for this 1-dim array, it’s colomn-major, not Row-Major like C-language.
So the key thing is : if I have a 2-dim array control points, how can I convert them to ON_NurbsSurface’s? Thanks.

It might be useful to use the SetCV functions if you want to make sure you’re copying them correctly. They let you interface the control points as if it were a 2D array. You can also check the IsValid function to see what issues your surface has.

1 Like