Cartesian product only between two sublists (level 3)

Hello, after some hours of heavy brainwork I have a huge node in my brain and I cannot find a way out. I googled around, I’ve found topics like (How to use List.CartesianProduct at @L3), but I couldn’t figure it out just using nodes, not using designscript or python yet. I hoped to find a solution using nodes only (mainly to understand Dynamo).

The case (just for your understanding): I have a couple of closed polylines, and I want to lay a 1-meter-raster of points over their boundingboxes. In my opinion its a classical usecase for cartesian product between all the xmin…xmax…1 and the ymin…ymax…1 of the polygon’s boundingbox. It works great with a single selected polyline using Point.ByCoordinates(x,y) and lacing with cartesian product, but unfortunately not with a set of selected polylines because all the x-values of polyline 1 are getting combined with all y-values of polyline 2, too. I had several tests the List.CartesianProduct. I attached a small sample to demonstrate what I desire to and what I’m just receiving.

Since I’m a new user I only can give you a link for download: Mensch und Maschine acadGraph GmbH

Maybe, there is enyone to lead me into the right direction.
Thanks in advance
Regards, Fred

Hi, to be more clear: I’m looking for a “node-version” of the following code.

inputList;
resultList=[];

t = [Imperative]
{
    for(i in inputList)
    {
        subList=[];
        for(x in i[0])
        {
            for(y in i[1])
            {
              subList = List.AddItemToEnd([x,y], subList);
            }
        }
        resultList = List.AddItemToEnd(subList, resultList);
    }
	return = resultList;
};

(inherited from List combination, Cartesian - #13 by Vikram_Subbaiah)

With regards, Fred

Hi,

This is so far i can got, for small project or it depends on how much you can type and duplicate node :D.
Tell me your thoughts if any.

Best regards.

Vào CN, 4 thg 9, 2022 vào lúc 21:19 Fred via Dynamo <notifications@dynamobim.discoursemail.com> đã viết:

CartesianProduct_reply.dyn (46.7 KB)

Hi, so I will do:
In conclusion: your note “/…and so on…/;” seems to me that there is no “generic node solution” for an unknown number of selected polylines (in memorial to my case), am I right? It would work, if I could place the line List.GetItemAtIndex(lst@L3<1>, i); in a loop, i is the index of sublist in level 3.

Then my question seems to be solved and I will go on to mark it as solved when no other member will post a reply.

With regards, Fred

(@Nicolas.B : sorry, I’ve forgotten to say thank you!)

Yes, you’re right.
If you put it in a loop, the output will be a list of lists, which is the problem.
You are welcome.