 # "Variable geometry" point list creation

Hello,

I still have a headache in Dynamo. Here is the issue:
I have a list made up of n sublists which represent points.
These sublists can be made up of 3 or 4 points depending on the case.

Here is where I am (based on a list of 4 items).

1. my basic list made up of 2 points (4 lists of 2 points) this is my base.
-List 0
-P1
-P2
-List 1
-P1
-P2
-List 2
-P1
-P2
-List 3
-P1
-P2
2. the list which determines if I should add 1 or 2 points (so 4 elements too)
-List 0
-1
-1
-1
-2
A) The point to add if 1
B) the 1st point to be added if 2
C) the 2nd point to add if 2

So I have this

-List 0
-P1
-P2
-List 1
-P1
-P2
-List 2
-P1
-P2
-List 3
-P1
-P2

And I would like to have this depending on (2)

-List 0
-P1
-P2
-A
-List 1
-P1
-P2
-A
-List 2
-P1
-P2
-A

-List 3
-P1
-P2
-B
-C

I do not see how, if you have ideas I am interested.

Thank you in advance.

@David_TESSON This might need some Imperative code

``````a = List.Chop(Point.ByCoordinates(0..7),2);
b = [1,1,1,2];

[Imperative]
{
c = 0;
d = [];
for (e in b)
{
if (e == 1)
{
d[c] = List.Flatten([a[c],"A"],-1);
}
else
{
d[c] = List.Flatten([a[c],"A".."B"],-1);
}
c = c + 1;
}
return d;
};``````
1 Like

Thank you.
it’s perfect !

1 Like