Point Creation from Sublists - Cross Product issue

Hi All,
I’m having an issue with generating a set of points by combining 2 sublists of x and y values.
I would like a point to be created through the combination of each item in each list. i.e. if there are 9 x-values and 3 y-values in a list there would be a resulting 27 points. It seems that in my current list structure the point creation is not doing this (as in List 6 below, which should have 4 corresponding points)… Changing the lacing is not helping as well. Any thoughts would be appreciated!

Hi @ddigi,
Welcome to the Dynamo community.
You need to switch the lacing from Auto to Cross Product [xxx] as shown.

Hi @AmolShah,
thanks for the welcome and your response!
I have tried the cross-product lacing but it is still not giving me far too many results. (Maybe my own brain’s logic is off…) I began working on this with points on a surface to aid my visualization (see image below).

At the 6th level of the list I would like to get 6 points as a result of the combination of 3 x-values and 2 y-values. Instead I am getting 141 points (many are duplicates)! I assume this is an error of list management on my part. I am aiming to maintain my list structure for use down the road in the script.

What do you think?

@ddigi I do see it now what you are trying to suggest. I think this has been discussed on the forum before so you can look it up through search.

If you are comfortable with using Python then give this a try:

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

toNestList = lambda x: x if any(isinstance(i, list) for i in x) else [x]
l1 = toNestList(IN[1])
l2 = toNestList(IN[2])

points = []

if len(l1) == len(l2):
	for sub1,sub2 in zip(l1,l2):
		temp = []
		for i in sub1:
			for j in sub2:
				temp.append(Surface.PointAtParameter(IN[0],i,j))
		points.append(temp)
	OUT = points
else:
	OUT = "List lengths don't match"
1 Like