Replace Item at Index in 2 Dimensions

I’m looking for a way to create a 2 Dimensional list based putting values on specific spots.


In the left list there’s a gigantic list of 0’s of which the indices would be replaced (I don’t know if it’s necessary but I want al the other values to be 0 ayway), in the second list there’s the values that I want to get into that list. The third list containst the “position” these values would have.

Thanks in advance!

Edit, to make the problem a bit clearer.


In which, the first is the template, the second the data, the third the “position” and the fourth the result.

@PauLtus

this might be of use.

image

Well, I don’t how I would solve it with that and don’t know where these nodes come from.

bakery

@PauLtus

?

So the right list in the image is not the desired result. These are the 2-Dimensional indices I want the items from the middle list to end up in.

can you show me what is the result your looking for.

1 Like


In which, the first is the template, the second the data, the third the “position” and the fourth the wanted result.

I don’t understand the connection (specifically the “positions” part), can you draw some arrows? :slight_smile:


Like so?
Value, check position, set at position.

More or less, though the content of the “position” part is still a mystery to me :wink:
What does {0,0} mean, is it {list,position} so {2,2} is {list2, position2}?

  • Think I just explained it to myself, let me ponder :sweat_smile:
2 Likes

I know you’re usually not much for Python but it works with just 2 lines of Python :slight_smile:

Edit:
Could actually be simplified even more:

5 Likes

I think that will do.
Thanks a lot!
It’s not that I particularly dislike Python btw, I’m just not any good at it so I never use it. :wink: My general understanding of programming does make me understand what’s going on in the script you wrote. But I couldn’t set that up myself.
I should probably spend some time practicing it but I’ve been having my hands full with “regular dynamo” already.

1 Like

Just in case you need to do something with items in nD lists, then I made these nodes long ago

They are running recursively.
List Index (3 nodes).dyn (17.9 KB)

1 Like