Create Brep from Surface C#

Extrude surface.gh (10.9 KB)

The extrude grasshopper component works with either curves or surfaces, but all the RhinoCommon commands I can find seem to work with curves only. I am trying to recreate the functionality for surfaces in C# (I want it for a web application using Rhino3dmIO and RhinoCompute).

I have managed to do it by:

  • Get the faces of the surface
  • Determine the curves that form each face
  • Sweep the curves and cap to form breps for each face
  • Boolean Union of each brep

Code included in attached file as well as grasshopper component I am trying to emulate.

While this works, I feel there is probably an override to one of the methods I am missing that would make this a simple one-liner. Any ideas?