Assign u & v directions to a surface

I have a model with multiple object types (curves, polysurfaces, points etc.) and I want to retain only the individual surfaces from each polysurface with U/V direction vectors. I wrote a program to loop through all the objects and store only the underlying surfaces on each Brep as individual ON_NurbsSurfaces. I do this by looping through each surface on each Brep and duplicating each ON_NurbsSurface. I create a new Brep from each of the surfaces using:


I then clean the model: model.m_object_table.Empty(). I write the new Breps to the model object table so what I end up with in the new model are only Breps with one underlying surface per Brep. When I opened the file in Rhino I noticed the U & V direction vectors were gone for all the surfaces. For my application it is very important to have the U & V orientations assigned and assigned to a specific direction. I can’t seem to find a method that will assign U & V directions to newly created Breps from surfaces.

Is there a way to assign U & V direction vectors to a Brep?
Thanks in advance,

Sorry for the post. Works fine!
I’m not sure what happened, but U/V direction vectors are still assigned to each surface on Brep after the surface duplicate. Again sorry, I’m not sure what happened when I checked it earlier.