Opennurbs convert subd to nurbs issue

i want to use opennurbs c++ to try to convert subd to nurbs, and the test code is following. and the subd->HasBrepForm() is false.
What`s wrong with it?
Does opennurbs has the function to convert subd to nurbs?

“”"

ON_SubD* subd = new ON_SubD();
std::vector<ON_SubDVertex*> vtcs;
vtcs.push_back(subd->AddVertex(ON_3dPoint(0, 0, 0)));
vtcs.push_back(subd->AddVertex(ON_3dPoint(1, 0, 0)));
vtcs.push_back(subd->AddVertex(ON_3dPoint(1, 1, 0)));
vtcs.push_back(subd->AddVertex(ON_3dPoint(0, 1, 0)));
ON_SimpleArray<ON_SubDEdge*> edges;
edges.Append(subd->AddEdge(vtcs[0], vtcs[1]));
edges.Append(subd->AddEdge(vtcs[1], vtcs[2]));
edges.Append(subd->AddEdge(vtcs[2], vtcs[3]));
edges.Append(subd->AddEdge(vtcs[3], vtcs[0]));
subd->AddFace(edges);
std::cout << subd->FaceCount() << ", " << subd->VertexCount()
    << ", " << subd->EdgeCount() << std::endl;

subd->UpdateAllTagsAndSectorCoefficients(true);
std::cout << "Has Brep Form: " << subd->HasBrepForm() << std::endl;

“”"

Hi @childadrianpan,

In the standalone, openNURBS toolkit, ON_SubD::HasBrepForm() always returns false. The code for converting SubD objects to Breps is not included with the openNURBS toolkit.

Of course, these functions are implemented in core Rhino and accessible from Rhino plug-ins.

Does this help?

– Dale

1 Like

@dale
Yes. Thank you very much, I decide to turn to rhinoinside.
My target is actually use this “subd2nurbs” function in houdini.

And another question is, in RhinoCommon, SubDFacesList does not have “Add” method.
How can I construct a SubDFace and add it to a SubD?

Hi @childadrianpan,

How would you do this if you were just using Rhino?

– Dale

@dale
Thanks to reply.
I can see a lot of commands to create a subdface just in rhino, like _3DFace, it could just add some point to a face.
but in opennurbs and rhinocommom it seems not so straightforward.
And I cannot find a method to add SubD Face in rhinocommon API.

Could you help me figure out which api can do this? in rhinocommon. Or by now there are no api for this?

Thanks.

Hi @childadrianpan,

A number of Rhino’s SubD creation commands just create meshes and then convert them to SubD.

– Dale

1 Like

@dale
Thank you for help.
Another question is:
Will Rhino 7 ver. add the similar “SubD.AddFace” and “SubD.Edges.FindEdge with two vertices” api to rhinocommon?like opennurbs c++?

Because I also want to crease edges in SubD, and Add Ngon face to SubD directly.