Dear Dynamo Team,
I was planing to prepare script to replace items of list with the new one according to index numbers. Please see photo and script to understand problem. I used List.Replaceitem and etc nodes but did not work when i want to replace item with multiple values. Could you please help me.
Task.dyn (2.0 KB)
Dear Dynamo Team,
List.ReplaceItemAtIndex node exists…
I checked that node also. Unfortunately, could not get result.
How important is the non-chronological order of the list of indices to you?
I don’t know if you know python and\or want to have it in python, but I made a little script for your problem.
Can you please share script as text file.
That looks like it should work.
Within Dynamo these things are really difficult, it’s like you’d have to create a
List.Map except you need to get it working for two different inputs instead of one.
Many thanks for your support. The python worked great. However due to some difference at my input (level of input list) it did not worked at my computer. Most probably we need minor change at your script to work. Is it possible you to connect my computer throw team viewer to solve this problem?
You can also use List.ReplaceItemAtIndex+ from Clockwork to replace multiple indices in the same list.
Another python script:
#The inputs to this node will be stored as a list in the IN variables. inlist = IN for i,r in zip(IN,IN): inlist.pop(i) inlist.insert(i,r) #Assign your output to the OUT variable. OUT = inlist
Made this before realizing NLDaniel had already made one. Here is just a shorter version of NLDaniel’s:
#The inputs to this node will be stored as a list in the IN variables. inlist = IN for i,r in zip(IN,IN): inlist[i] = r #Assign your output to the OUT variable. OUT = inlist
If you are having problems with levels, can you show a picture of the actual inputs you are using?