Extract 4 edge corner from mesh file

Hi.
I am trying to write script which extract 4 edge corner from mesh file as following.
def topo():
obj=rs.AllObjects(select=True)
line=rs.MeshOutline(obj,view=“Top”)
points=rs.PolylineVertices(line)
print (len(points))
problem here is that polyline we can extract from mesh include additional control point other than 4 edge corner. Thus, points I got is 136 as shown in following image.

Can anyone advise me how to extract 4 edge corner point from mesh file?

Thank you in advance.

You will need to simplify the polyline somehow. In Grasshopper, you can use the SimplifyCurve component. In rhinoscript, you can use the rs.SimplifyCurve() function. With RhinoCommon, you can use the Rhino.Geometry.Curve.Simplify() method. The one with the deepest choice level is the RhinoCommon one, but all should allow you to simplify.

Please let me know if this helps,

Giulio

Giulio Piacentino
for Robert McNeel & Associates
giulio@mcneel.com

1 Like