Forum

Duplicate each slice n times?


#1

Hello vvvv-lers.

I’m not sure if I am having a momentary lapse of reason and my mind is blanked or if I have really never needed this before.

I have an input spread with a few slices of strings (or values), eg:

a
b
c

and now I want to duplicate each slice n times, eg. with n=3 it would be:

a
a
a
b
b
b
c
c
c

I am sure there is a node or simple combination that does that, but can’t seem to find it right now.

I have to say I have really gotten used to the way Grasshopper handles data and being able to alter data much more freely and deeply.

Anyone have a simple solution for this?

Thank you!


#2

Ehm… It’s just the Select (String) with its Select set to n. For more advanced cases, there are always ‘bin’ versions, like Select (String Bin).


#3

Thanks @robotanton!

But I just noticed a few things: I think I would have found it more easily if it:

a) had a better name

b) had a better description

c) if Select(Value) would be in the “spreads” group in the node browser, which weirdly it isn’t

It says in the short description for Select(Value): “Select which slices and how many form the output spread” - what does that even mean? Because that could also be the description for GetSlice and would make a lot more sense. No mention at all of duplicating slices. Also you can’t actually select (ie. pick) something, but it duplicates all input slices.

I think it should be called “Duplicate” or “Repeat” and the Select Pin should be called “Count” or “Pattern”. There is already a Repeat (String) node, which weirdly does exactly the same as *(String).

I see that for Select (Value) it says “resample” behind it in the node browser, but for the ones by @woei it says more correctly “repeat”, which gives a hint at its function. But then in all select nodes except Select (Value) it doesn’t even have the “…and how many form the output spread” part in the description, which makes them sound even more like GetSlice.

Maybe there is a good reason it is called Select rather than Repeat and has a description like that, maybe one of the devvvvs can answer it. If not maybe its a good idea to change it. I am using vvvv for 2 years now and just by browsing would not have thought to use the Select node for that purpose, which likely means a newbie would have no chance. Thank god for this forum :)


#4

Hi seltzdesign,

I agree, that the name is a bit misleading. But the node actually ‘selects’ (or ‘picks’) the slices from the input spread and ‘forms’ the output spread from them. Indeed, its like the GetSlice (Value), but you can easily define how many times you want to use each slice from the input spread.

For the Select pin you could set not only one value, but a Spread of values, so you could say: “give me the first slice of the input spread 4 times, the second slice 0 times, the third slice 2 times…”.


#5

Select is probably the single most important node for solving any sufficiently complex spreading problem. A lack of knowledge about it can be a showstopper for quite a lot of problems.

So I agree, it should be advertised and categorized in a prominent way. After all the time I spent using vvvv, I would not be too fond of a renaming, ofc ;)

As why this node is called “Select” - in most cases i am using it, my wanted count is strictly a boolean, that selects the input slices according to some condition and removes the rest.


#6

i added repeat, duplicate & resample tags to the select nodes.