Grasshopper

algorithmic modeling for Rhino

This involves use of the 'Member Index (MIndex)' component from the 'Sets' tab.

I've seen this done before but couldn't remember how it worked, couldn't figure it out and had a very hard time trying to find an example on the forum.

I eventually found a clue here: counting duplicate numbers in a list

The example below takes that one step further.  The problem is common enough that I decided to create this thread so the next person can find the answer more easily.

In distilled form, the problem is that I have a list of points and in some cases, there are multiple points with the same X and Y coordinates, differing only in Z.

'Create Set (CSet)' is used to get a list of all the unique X/Y coordinates by zeroing the Z value.  In this case, out of 303 points there are 178 unique "columns".

To get a list of the points in each column, do this:

Note how all the points in each branch have the same X/Y and differ only in Z.

When structured like this, it's easy to sort the points in each column by 'Z' and get the highest and/or lowest point.  Other operations by column are also simple.

This general method using 'CSet' and 'MIndex' has many applications.

Views: 3070

Attachments:

Replies to This Discussion

Hi Joseph,

Thank you for your help,I am trying to use your definition to select a group of rectangle with the same aarea, but I don't understand how to select the index related to the selection.

probably the picture is more clear.

Attachments:

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2020   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service