Order of duplicated edges

I’m trying to write a script that will offset planar surface edges inward then create a smaller surface. Everything is fine with 3-sided surfaces because no matter how you intersect the curves, they always intersect and I can connect the three points in any order.

Surfaces with 4 or more sides are problematic because the order matters. I’m using VBscript, Rhino.DuplicateEdgeCurves() command and when I label them, it is clear that it isn’t a clockwise or counterclockwise logic, it’s something else.

I tried something simple like:
temp = side3
side3 = side 1
side1 = side 2
side2 = temp

but it isn’t that predictable. Any suggestions for how to reliably order the DuplicateEdgeCurves() output in a clockwise or counterclockwise fashion? Or some other way of creating a bunch of inset surfaces?

I don’t know if you can accurately predict whether the curves will be in “clockwise” or counterclockwise" order as I’m pretty sure it depends on how the surface was made and oriented… However, they should be in a “connected” order, not random…

In offsetting the surface border, I would not deal with that anyway, I would duplicate the whole outer border into one closed curve with Rhino.DuplicateSurfaceBorder(srf,1) and then offset the result. The main problem after that is to determine whether the offset will go inside or outside…

–Mitch

I didn’t know about/ever find DuplicateSurfaceBorder()! That’ll be a lot easier. I’ve already got the inside/outside thing covered… the panels are reasonably shaped, so I can just use the centroid in 99.9% of cases. Thanks for your input, Mitch.