Lacing on replacing item on index

#21

He was initially trying to add items at an index but that was after he had already removed the same indices. What he was really looking for was a replace at index but it wasn’t working.

#22

Yes you’ll need to flatten your list of rectangles. The list structure doesn’t match that of the indices (one index per element).

1 Like
#23

Thanks!

#24

you are probably right, I read the “insert” node as a wish to insert and not replace… so my mistake :slight_smile:
I can see now that it was replace that was the goal… but now there is a code for padding if someone can use that :slight_smile:

#25

It was a little confusing. I didn’t realize it until I looked at why his indices were out of range.

#26

Nick,
Is there any way to do this with a list of lists? I am having trouble doing this with X number conduit runs. Thanks!

#27

You could modify the code to work with lists of lists or you could wrap it in a custom node and use lacing.

#28

Im afraid I dont know how to do either one of those things. If I wanted to create a custom node and use lacing would I just drop that pytho script node into the custom node environment and then create the same inputs and outputs? Thanks

#29

Yup. That’s all it is.

#30

Like this?

#31

Yup. Now you can use lacing or list levels with the appropriate list structure to run the node on multiple lists.

1 Like
#33

Thanks @Nick_Boyts, this little bit of Python is exactly what I need! Ever more reason to get my head around writing them myself! Cheers.