Insert a list into another list with two different indexes

Hello,
I have a problem. I need to replace the false from list 1 with the coordinates from list 2.

Thats what I got, but I want the index with 101 from list 1 and replace every false (I have 21) with the coordinates (also 21) from list 2, problem is the index of the lists are different. And dynamo only replace the false one with the coordinates of the same index.

Any ideas?

Hi @lauratraum12,
Welcome to the Dynamo community.

See if this helps:

You can either use the List.ReplaceItemAtIndex+ node from Clockwork Package
or use this python script

for i,j in zip(IN[1],IN[2]):
	IN[0][i]=j
OUT = IN[0]
5 Likes

thank you that with python worked, even i dont understand it. xD
For option 2 I cant find the code block
but thank you very much

@lauratraum12 Glad that the Python option worked for you.
For option-2, you need to install a package called Clockwork.

To search and install a package

  1. Click on Packages Menu
  2. Choose “Search for a Package…” to browse through available packages
  3. Search the package you want to install (Clockwork for Dynamo 2.x here)
  4. Click the download button to install the Package

1 Like

Also tell people how to manual install packages please. My experience is that manual installation gives a lot less trouble.

With nodes …


replace.dyn (22.9 KB)

Design Script …

cnt = 0..List.Count(lst)-1;
bln = lst == false;
lst1 = List.FilterByBoolMask(lst,bln)["out"];
lst2 = List.Flatten([lst1,rep],-1);
ind1 = List.FilterByBoolMask(cnt,bln);
ind2 = List.Flatten([ind1["out"],ind1["in"]],-1);
rep1 = List.SortByKey(lst2,ind2)["sorted list"];
3 Likes

So far I have not encountered any issues using the package manager.
And the manual loading is quite tedious for someone who just started with Dynamo. So I usually don’t suggest that!

But in case if the package manager route fails, this should help them install the packages manually.

3 Likes

Thank you this works well too

1 Like