How to Insert Elements at Specific Indices in a List in One Step?

Hi everyone,

I need some help with manipulating lists. Specifically, I have a list where I need to insert the text ‘State Property’ at certain indices provided in an image. After that, I plan to insert ‘Council Property’ at the remaining indices.

I’m looking for a way to do this in one step. How can I create a list where the correct values appear at the specified indices in a single operation? Any advice or code examples would be greatly appreciated!

Thanks in advance for your help!

For bulk replacement, you will need the Clockwork package and this node:

1 Like

I’ve tried that node as well, but didn’t work for me. :frowning:

What you show in the screenshot might be due to levels. Get rid of the square bracket in the code block with the 0 to 5 sequence. 0…5 is already a list. The square brakcets put that list into another list. that should solve it. Alternatively, you can set the seq input to Level 2.

2 Likes

A simple Design Script solution:

The code:
lst;
indexes;
replacement;
result =
	[Imperative]
	{
		for (i in indexes)
		{
			lst[i] = replacement;
		}
		return lst;
	};
3 Likes