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: 4239

Attachments:

Replies to This Discussion

And each list contains at most three identical values? Are they always consecutive?

Yes, i mean, the fact that they are consecutive is because i sorted them, before are not.

Here s the definition

Attachments:

Numbers do not have to be consecutive, but they do have to be exactly the same. 82.5000000000000001 and 82.499999999999999999999999 are treated differently by this script.

Attachments:

Works great!

Thank you very much, as always! :))

One last thing. Would it be possible to assign "Null" to those that don't have 3 equal numbers?

So later if i need to create a pattern i can assign "0" to the Nulls.

thanks

maybe something like this...

cheers,

RM

Attachments:

Thanks RM, somehow this option of yours doesn't work if you have other numbers (i have tried to add a third branch with (12;12;12;5;8) (randomly) and the result goes to 0

I solved it by connecting the set output to the y input of the evaluation component.

The problem is that now it says "1. Data conversion failed from Text to Number" if i want to compare the numbers

yes, because 0 is the first index of 12

Now everything works. Connecting the set to the y solves the first issue, then instead of typing "null", i typed "0" and that makes everything into numbers.

thanks everyone for the help!

Yes, unless you have some points with x=0. In this case things would mess up.

Alternatively you could do something like this which returns empty branches instead of nulls but, in most cases, this is the same:

RSS

About

Translate

Search

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service