Replace a variable number of slices in a spread

Hello again lovely people of the forum,
I once again ask your help, as I am self taught and trying my best :,)

Changing only one slice at a time is easy enough with a SetSlice node, but I need to be able to replace more than one at a time, and I need a way to do so that accommodates for a variable number of slices to replace…

Screenshot (512)

For example here I’d like the 3rd, 6th, 11th, and 14th slices to be set to their corresponding index number. Is there a way to do it all in one go? Is there a way to do it so that if it wasn’t 4 slices to replace, but 6, or 2, that it would work all the same?

This would help me massively!


Did you have a look at the ForEach loop?

Hello, yes, I do know how to use a forEach loop, and I’ve been trying to use one to solve my problems but I still can’t figure it out :,)

One of the spreads has 15 elements, whereas the other has 4. If I try to bring the 4 element spread in the forEach with the 15 element one, the output will be a 4 element spread, not a 15 element spread where the slices corresponding to the ones indicated in the 4 element spread have been substituted. Basically I think I’d need to be able to read all the contents of the 4 element spread at the same time to get the 15 element spread to substitute all of the elements I want substituted.

This might currently be above my metaphorical paygrade as a self-taught patcher heh

A-ha, maybe ForEach (Max) could help then!

I’ll check it out! Thank you :D

Not sure I understand what you’re after, but if that helps, this is how you can use a normal ForEach and accumulators to set only specific slices of a spread :


setMultipleSlices.vl (6.9 KB)


I was misusing accumulators so this is definitely what I was looking for! Thank you so much @sebescudie :D

1 Like

wish this would be demonstrated in the setslice help patch too. not so obvious construct but pretty handy. definitely not something you come up with yourself as a beginner.


good point. done.