How to control the sorting of Brep Vertices

Hi there!

I am using C# to iterate transformations of an initial Brep (or simply a Brep) by using its vertices’ information. Brep.DuplicateVertices() gives a certain order of vertices for the initial Brep. But, generated Breps are not following the same index order as the first one. Therefore, the code is not working as I want it to be. I found a very similar forum discussion on the old Grasshopper forum, but none of the solution suggestions seem to relevant or easy to imply to my case.

I am adding my gh and rhino file with some explanation. Thanks :slight_smile:
11072018.3dm (102.0 KB) (10.6 KB)

If your goal is to create some “folding” BrepFace via recursion

… (see the mp4 animating just one parameter [angle] ) your approach is wrong:

Truth is that there’s various ways to sort BrepFace vertrices … but … just Imagine the general case where a random polyline defines a BrepFace and then a folding axis (per loop) is made from some randomly picked edges (at some random t per edge) … blah, blah.

So you need a totally different way to contol the “folding” axis with regard the previous one (an oriented BBox can help on that but there’s other ways as well).