Grasshopper

algorithmic modeling for Rhino

Hello everyone!

i'm struggling with this:

i have a list of values in branches of different sizes (picture attached), sometimes 6 values in one branch, sometimes 3, etc.

I'm looking for the value that is repeated 3 times in a row (easy thing where it's just three of them, but they are always mixed with other branches of different sizes), so for instance the value in bold in the picture.

ps. the values correspond to a X coordinate of points, i need to extract all the points with the same X coordinate. Points are in a 3x3 grid, and not all the cells are "full" (attachement 2)

Thanks!

Views: 4246

Attachments:

Replies to This Discussion

Hello Lorenzo

gave it a go native grasshopper components only

cheers

alex

*edit same as nikos solution

or if you want to keep the count of items/branch and have "null" the other items...

Attachments:

Guys thanks everyone for the support!

somehow, when I equalize values, it messes up with true/false.

In attachment you can see an example (branch 25). 940.5 is in position 0, 1 and 4. Somehow, the bool outcome is messed up (position 1 gives false when it should be true).

any ideas?

thanks

Attachments:

That might be what David pointed out in his first reply.

And this is probably why Raul has been working with indices instead of float numbers.

Your definition has two more problems though:

1. You shouldn't use 0 in the expression because if you have a set of 3 points with x=0 it will mess up.

2. If you have 2 sets of points with equal x in the same list, it will not work.

And finally it appears from your screenshot that you are not after the actual number that repeats 3 times but rather a true-false pattern to help you evaluate another list.

So something like this should work:

just notice that you actually want the [Num] component to give an error because this way it turns empty items to nulls.

also notice that the pattern provided by [Null] component is the opposite from the one you want, so you should use the B output.

Attachments:

Yes, it all appears to work but this, and it's driving me crazy:

I already told you, this is probably what David pointed out in his post.

Check these posts out as well:

http://www.grasshopper3d.com/page/search-results?cx=007664031582976...

as nikos told you, it is dangerous to assign "0". However i can't understand what is wrong with this solution. Here you have one with true/false at the end:

It works as intended for me. And don't care about the "Item" component. It turns red, but it still works.

RM

Attachments:

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service