Find an index of maximum value in the list

Hello, GH Community,
I have a main Brep split by five other Breps. After Split(using Split Brep Multiple component) I want to pick the remnant Brep, which in many cases is messed in the result list ( sometimes it is on the top of the list , sometimes it is on the bottom, in my case it is on the second place in the list) Pls. see an attached file.
Since, There is not the component in GH, which directly gets the index of maximum members in the list, I want to pick the item based areas of the Breps, naturally the Brep (remnant) I want to pick up has
the largest area.

Sort the fragments by area or by sum of edge lengths, which is often faster. I have two clusters for this.

If you had posted your code/geometry I would have shown you.

Sort List will indeed do exactly what you need. At the end pick the last item of the list by reversing it and taking the first.

SortList.gh (12.5 KB)

Thx Joseph,
Teddy has solved the issue ( so easy :face_with_peeking_eye:) Anyway, it would be great if you share your version - sort out by areas or edge lengths.
this is an example file attached.
brep_multiple.gh (12.7 KB)

Thank You, Teddy. It worked perfectly.

Internally, both clusters (yellow group) sort the fragments by sum of edge lengths. Srf SL (the one I used) adds List Item to return only the largest and smallest fragments.


brep_multiple_2023Jan16a.gh (18.5 KB)

Using edge length instead of area is way faster when there are hundreds or thousands of fragments but the advantage is negligible when there are only a few. There may be special cases where edge length gives incorrect results but it usually works.

I realized that it’s silly to have two clusters when one can just as easily return all three values.


brep_multiple_2023Jan16b.gh (15.0 KB)

This cluster can easily be modified to use area instead of edge length, see aSort below (yellow group). Most of the time in this model is consumed by SrfSplit (1,200 holes in 3.9s) but as you can see, EL Sort (89ms) is considerably faster than aSort (1.8s).


holes_2023Jan16a.gh (21.0 KB)

I keep clusters like this as “User Objects” - select the cluster and use ‘File | Create User Object…’.

Once again many thanks Joseph,
I think the main logic behind your clusters is the very same what Teddy used. However, it’s my pleasure, to look through the different approaches, especially, great use of the “Mass Addition” component. :pray: :pray: :pray:

Hell GH community again, sorry to bother you with questions …
I have only two curve containers. One contains four “room curves” while the other includes six “door section curves”. Is it possible to get the desired result without using additional curve containers or manually arranging the curves inside my initial containers? ( I deliberately messed the curves up inside my containers). Pls. see the attached files.
Thank you in advance.

DoorSections.gh (5.3 KB)


DoorSections_2023Jan22a.gh (11.7 KB)

P.S. UPDATE - Sorry, I got lost in a tangent and didn’t back it out thoroughly. It’s simpler than that.


DoorSections_2023Jan22b.gh (10.2 KB)

Hello Joseph,
Thank you for your reply. I think the “room shapes” overlapped each other in the drawing. So, I nudged bit the “desired rooms” to be more clear to understand what I want to get in the end. Please, if you have time, see the “Desired Room Curves” container in the GH file attached.

:roll_eyes:


DoorSections_2023Jan23a.gh (20.0 KB)

Thanks for your great work and patience, Joseph.
It works nicely. It’s a very good and useful solution indeed.