Rhino3dmIO, openNURBS Support for SubD to Brep, Nurbs, or Mesh?

Hello,
I am working on a tool that reads Rhino SubD objects with Rhino3dmIO. I want to support Rhino’s new SubD object type however I don’t see that Rhino3dmIO exposes adequate methods for reading a SubD as either a Brep or Nurbs represenation.

Furthermore, I don’t see that there is a way to get a render mesh or other mesh from a SubD using OpenNURBs. For example, with a Brep, I am able to get the face meshes using a GetMesh() method - I can’t seem to find a comparable way to get this geometry for SubDs. This would seem critical if you were to make a viewer or reader that could support SubD objects.

I see that Rhinocommon exposes a SubD.ToBrep() method - will these methods be exposed in Rhino3dmIO?

Best,
-Nate

1 Like

Hey Nate,
We definitely won’t be providing the ToBrep() function in Rhino3dm. That type of functionality will be available through compute.

We’re discussing internally how to help with respect to getting meshes from SubD instances. If you need this immediately, I would recommend grabbing an off the shelf Catmull-Clark library for generating meshes from the SubD control nets you get out of Rhino3dm so you don’t have to wait for us.

We’re not going to give away our mesher for SubD that gets you a tight limit surface mesh, but we do give away what might be considered good enough. There are two OpenNURBS functions that you can use to get a mesh.

bool ON_SubD::GlobalSubdivide(unsigned int count);
ON_Mesh* ON_SubD::GetControlNetMesh(ON_Mesh* mesh, ON_SubDGetControlNetMeshPriority priority) const;

You can subdivide an ON_SubD instance to a desired level and get the control net mesh for visualization.

This is available in OpenNURBS today. I’m working on adding this to our new rhino3dm.net, rhino3dm.py, and rhino3dm.js libraries right now.

2 Likes

@archinate1 I just released new versions of rhino3dm.py and rhino3dm.js last night that support subdivide and getControlNetMesh

Here’s an example of how this can be used in javascript to create a mesh from a SubD

Rhino3dmIO should have this feature on nuget after next week’s WIP release. I’m working on the .NET bindings for rhino3dm which is what we will eventually be switching to, but need to figure out the proper way to package things for nuget on all of the different platforms we are trying to support.

3 Likes

Awesome! This will be very helpful.

@archinate1- did you get a chance to test the new ToNurbs in Rhino?

SubD Ship Hull Modeling

I know it doesn’t fix your specific request here, but it does really change what is possible for freeform workflows for architects. Mesh > Quadremesh > subd > ToNurbs packed.

Hi @stevebaer,
I am trying this out now with Rhino3dmIO - It looks like the new methods are exposed but I am having a bit of trouble finding my Rhino object containing the SubD in the Rhino file’s File3DMObjectTable like Breps, Extrusions, etc? In Rhino, have a SubD object created. When I retrieve the File3DMObjectTable from File3dm.Objects, SubDs are not returned.

Is a SubD not wrapped up in a File3DMObject like other objects? If not, how can I retrieve it in the file?

This is tested with 7.0.20259.15365-wip NuGet package.

Hi @archinate1,

The attached seem to to work. What are we missing?

TestRead3dm.zip (83.6 KB)

– Dale

Hi @dale
It seems I had an old librhino3dmio_native.dll being copied over in my application. Totally my fault.

It’s all up and running now.

Thank you for the assist.
-Nate

1 Like

Whew; thanks for letting us know

1 Like