Combining 3 lists with Levels

Hello,

I wish to combine the lists in below snap for expected results, not able to find a solution with list levels and lacing.

first list is a combination of lists and I need to create a new list by taking the first item from list and create a new list for each item in combined list (expected result).

Thanks alot for guidance and support.

oups
edit 1 : misread the statement
edit 2: rectified

Cordially
christian.stan

2 Likes

Hi
You can get simple in Python

result = []
for x,y,z in zip(IN[0],IN[1],IN[2]):
    result.append([x,y])
    result.append([x,z])

OUT = result
3 Likes

Another approach:

DSCore.List.Flatten(
	DSCore.List.AddItemToFront(x<1>,y<1><1>)@L2<1>, -1
);
5 Likes

@manhgt214 and @christian.stan Thanks alot for reply, due to certain limitation (about python and list insert) i am going ahead with @EdsonMatt solution.

Matt,

I feel this will work with list chop as suggested above, but in my practical example i am facing issue, it would be really great if you can provide some info about (x<1>,y<1><1>). as i am trying to understand is it like index calling thing ?

Practical use - links in red, blue, black and so on

1 Like

Hello,
Try it like this, must be from Dynamo’s version (never sure what i’m getting at, as usual :smile:)

DSCore.List.Flatten(
	DSCore.List.AddItemToFront(x<1>,y<1><1>)@L2,1);

(in 2.16.1 Mr. Matt’s code works)

a node version improved

Cordially
christian.stan

2 Likes

Thanks Got it, this was the correction needed

Also have done some digging and got to know about List lasing in code are defined as <1>,<2>,<3>

https://primer.dynamobim.org/07_Code-Block/7-2_Design-Script-syntax.html
for learning reference

2 Likes