Grasshopper

algorithmic modeling for Rhino

# Graft consecutive numbers into a branch

I am very inexperienced with grasshopper but I am sure this is an easy question.  I need to graft a list of consecutive numbers into their own branch so the result will be several branches with all numbers within the branch being the same.  Unfortunately there is not a consistent pattern so I cannot use cullpattern. Can anyone help me out?

Sam

Views: 2654

### Replies to This Discussion

[Partition List]

Thanks Danny, but is there a way I could partition the list based off the number of consecutive items in the list.  I do not have a consistent number of consecutive items.  In other words, I need to graft the first (4) 0's into a branch, then the next (5) 26's, then (5) 52's, then (8) 72's, and so on.  The list is being generated does not have a consistent pattern of consecutive numbers, but if I could count the number of consecutive items, then I would be able to tell the list where to partition.

Sorry Sam,

You could do it this way:

the advantage being it doesn't matter what the values are they just have to be the same and consecutive

What am I missing here?  Is it because I am only using numbers?

C O R R E C T E D

=============

You are using

Create Set (S) --> (A) Equality

Shift List (L) --> (B) Equality

Where as it should be

Create Set (M) --> (A) Equality

Shift List (L)  --> (B) Equality

Ah! I see.  Ok, Thank you for your time!

Thanks Sridevi.  This one worked for what I am trying to do.  Thank you for your time everyone.

Sam

Hi all.  This is my first post to the forum, woohoo!  If anyone is still paying attention to this thread:  Is it possible to perform the same operation but instead of sorting numbers or strings, sorting branches by like path values (either at a Masterbranch or parent branch/path level)?

I have a series of curve sets, I'm dividing each curve in each set by a number unique among sets (basically a function of the longest curve length in each set), but all curves in each set get the same subdivision number.  Different sets are comprised of different numbers of curves (2,3,4,5 etc.).  Hence the need to send each curve group to its own branch.  I'm hoping to achieve this in a fully automatic way as opposed to path mapping manually, in case the number of curve groups gets very high.

Below is my first (failed for now) attempt.  Thanks to anyone who will listen!

-Nick

Attachments: