Grasshopper

algorithmic modeling for Rhino

I have a list of numbers:

1.524764
1.524764
1.524764
4.574291
4.574291
4.574291
7.623819
7.623819
7.623819
10.673346
10.673346
10.673346
13.722874
13.722874
16.772401
16.772401
19.821929
22.871456
25.920984
28.970511

I would like to group them by in branches so that the same numbers are in a branch together like this:

{0}

1.524764
1.524764
1.524764

{1}
4.574291
4.574291
4.574291

{2}
7.623819
7.623819
7.623819

{3}
10.673346
10.673346
10.673346

{4}
13.722874
13.722874

{5}
16.772401
16.772401

{6}
19.821929

{7}
22.871456

{8}

25.920984

{9}
28.970511

I have a parallel list of breps that I would like to group in the same way. Anybody have an idea of how to do this?

Views: 4452

Replies to This Discussion

There's probably a more efficient way of doing this with native grasshopper components, but until then here's one solution (I used circles instead of breps, but the principle is the same):

Attachments:

Thanks, works great!

Indeed even more simple. Thank you, Thomas.

I never use sets, so I'm sure this is will be even more helpful in the future.

Thank you!

Does the list always consist of increasing (or equal) values? If so, then here's is a way using a VB scriptable component:
(I purposely put an extra 2.7 to the end of the list to show the difference in behaviour)
I couldn't think of a more concise way using only native GH components...

Attachments:

Pieter, thanks for the response. The list I posted is from a simple (imaginary) master planning massing model. The numbers are the height of each floor volume. I sorted the list of heights in sync with the volumes. By grouping them, I am putting all the volumes for each floor in a separate branch where branch {0} are the ground floor volumes, {1} first floor, etc.

So for my purposes it is always increasing values. However, the next step for me would be to group by numbers that are close, but not necessarily the same, within a range. That is, the first floor of building A might have a slightly taller ground floor than building B, but I'd still want to report ground, 1st, 2nd, etc. floors of A and B together.

This simple version is a very specific, quick-and-dirty tool I needed today. I can see it being built-out a lot more, though, and your VB script definitely gives me ideas. Thanks.

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service