ksobon / MantisShrimp

A interop project for bridging the gap between Rhino/Grasshopper and Revit/Dynamo
37 stars 9 forks source link

Revolve Surface - poor translation from Dynamo to GH #13

Closed ksobon closed 9 years ago

ksobon commented 9 years ago

When a revolve surface is created in Grasshopper/Rhino it can be easily translated to Dynamo by casting it into NurbsSurface. It works well in Dynamo. However, when exporting a NurbsSurface such as such to Grasshopper causes some unexpected deformations. I am not sure what the issue is at the moment, but it would be nice to be able to get this surface into Dynamo as a Revolve surface. This has been filed with RhinoCommon dev team since none of the ON_RevSurface methods and properties are exposed in RhinoCommon. They are anticipating adding it in by the time Rhino 6 comes out.

ksobon commented 9 years ago

One more interesting thing about Revolve Surfaces: When referencing a RevSurface into GH you get a Brep. While extracting its face, and subsequently converting it to Nurbs using ToNurbsSurface() it changes the control points count on the surface. I am getting an extra point in the U direction which then, as mentioned above, works just fine when translating to Dynamo but seems to be affecting things when sending back to GH.

ksobon commented 9 years ago

Yet another little twist, here lies the gist of the issue: Dynamo does not return Weights() property for Rational Nurbs Surfaces. Since Weights are not equal to 1, which is what RhinoCommon sets them to if you don't re-set it yourself.

Ps. Do not attempt to set Nurbs Surface to non-rational using the MakeNonRational() method in Rhino because it will reset their weights to 1. :-)

ksobon commented 9 years ago

So, overall the issue is that at the moment Dynamo doesn't return Weights() for any Nurbs Surface and its causing all control points to be weighted 1. That's fine for some/most of surfaces but not a good idea in a long haul.

ksobon commented 9 years ago

Resolved. https://github.com/DynamoDS/Dynamo/issues/4945#issuecomment-129786733