How to extract the border curve of a surface


(C Heck) #1

Hi all,

I have a RhinoScript that operates directly from Rhino itself.
I am taking a list of all surfaces in the project (or a selection thereof), and for each surface I want to access the geometry of the border curve (ie all edit points of all edges around that border).

My approach looked like this:

  • Loop through all Surface objects
  • Get the border through Rhino.DuplicateSurfaceBorder
  • Loop on individual edges through Rhino.ExtractPolyCurveSegment
  • Get the edit points through Rhino.CurveEditPoints
    (those edit points are then extracted to an array, written to file to be used in another application).

This worked fine with RhinoScript (an rvb script).
However, when I try to replicate this in a Grasshopper VB.NET component, I get the following error:
"Error (BC30456): ‘DuplicateSurfaceMember’ is not a member of ‘Rhino’.

I spent a lot of time searching for hints in the online help, and apparently there seems to be something close to it using “Brep” objects instead of Surfaces. However, I am not sure how that would work.

Any recommendation on how to get to those edges & edit points in the most direct way, just in order to export that data?

Thanks !

Cyril


(Michael Pryor) #2

Convert the Surface to Brep.
Then get the edges.


(C Heck) #3

Hi Michael,

Brilliant, thanks !
I have now the edges but can’t find any method or property to get the edit points of those edges…

Also, I see that a brep has both “edges” and “curves” and I’m unclear as to the relative merits of both for my purpose.


(Michael Pryor) #4

Curves are for trim data, like holes, splits, ect. But you are just using a surface to brep so there wont be any trim data.

By edit points do you mean actual edit points (like Rhino’s EditPtOn command) or control points (like Rhino’s PointsOn command?

First convert to NurbsCurve.

For Control Points use: http://developer.rhino3d.com/5/api/RhinoCommon/html/P_Rhino_Geometry_NurbsCurve_Points.htm

For Edit Points use: http://developer.rhino3d.com/5/api/RhinoCommon/html/M_Rhino_Geometry_NurbsCurve_GrevillePoints.htm


(C Heck) #5

It works like a charm :slight_smile:

Indeed, I used Edit Points as the software I am exporting to requires points on the curve itself. The curves are not 100% matching due to different mathematical definitions, but it’s good enough for now.

Thanks again !