Hi, I have a list of list and I want to create a lop with Python which associates the first two items of each list, then the second items and so on. How can I do that?
You won’t need Python for task, this should do the trick:
2021-05-07 CombineIndicesBy2.dyn (12.4 KB)
Regards,
Daan
PS: no loops needed, you almost never need loops
Hi, thanks this seems amazing! The only issue is that I need
List 0
A1
A2
B1
B2
and the foollowing list should be
List 1
A2
A3
B2
B3
Like “concatenated” if you see my point! Is that possible?
and also @Daan other problem is that when i combine them it combines me the first with the last and not the two consecutives
while basically I need these groups (Like in the example but 4 the entire wall)
List.TakeItems with proper lacing and list levels will do the trick for the first list.
List.DropItems and then a List.Flatten both woth proper lacing and list levels would work well for the second.
Finally a List.Create will put the two lists into one.
@jacob.small I have more than two lists, thus should I manually do that everytime? Can you please give me an example
Give this a try. I think it’s the output you’re looking for, but we’re getting dangerously high list levels here.
I only shifted indices once so you just get couplets instead of quads, but you should be able to continue this logic with two more index shifts to get the other sets of points.
I’m gonna try yes im extremely scared but this level of listing ahhahah
I’d also recommend installing LunchBox if you haven’t already. It has a node for locating quad panels/points that does exactly what you’re looking for. It’ll be much easier.
wait wait wait, I have LunchBox do you remember the name of this node?
Panel.PanelQuad
. You’ll need to convert your points to UV parameters on the surface first, but that’s straightforward with Surface.UVParameterAtPoint
.
@Nick_Boyts So i should create a surface before?
It looks like you already have one from your screenshot. You just need a surface that contains those points.
Unfortunately none of this is working, since it skip some surfaces. Couldn’t be easier a Python Script with a loop?
Try this.
row = IN[0]
col = len(row[0])
r = 0
out = []
while r+1 < len(row):
c = 0
while c+1 < col:
quad = [row[r][c],row[r][c+1],row[r+1][c],row[r+1][c+1]]
out.append(quad)
c = c+1
r=r+1
OUT = out
Update!! It is working super good!!! Thanks a lot!!! @Nick_Boyts this is amazing