Automate the creations of lines

Hello comunite, I have a problem on the script that I just wrote, the interest is to create lines automatically, the list contains 4 sublists, each sublist has points,
The problem is how to switch in this list and create the lines all at once.


@ismail.essamae can you write that DS code in here to save us the trouble of rewriting it?

1 Like

@viktor_kuzev this is the objectif that i want but dosent work with this script:
// premier index de la liste;
// troisième index de la liste;
result=[ ];
result[ ]=Line.ByStartPointEndPoint(wallon<1>,her<2>);
}return result;

Right click on the node and change the lacing to Cross Product

1 Like

wich node?? I have problem in the code blocks (script) specify in the loop while it return to a empty list

How many nodes have you shown in your screenshot?
Might help if you share more

like this ?

When you’re using the node Line.ByStartPointEndPoint to get the result you have in mind you need to set the Lacing to CrossProduct. When doing it in a Code Block with Design script you have to do the same, using replicators that look like that <1><2> to specify how exactly you want to combine the two lists. In your case it should look something like:


1 Like

Erreur:Imperative_factor incorrect .the Lacing to CrossProduct can’t be oin while loop .


@ismail.essamae try this one, as long as you have quad lines per each list, I guess it will work:


@Elie.Trad Hello thank you for your answer :smiley:
I tried it but it doesn’t work i don’t know where the problem you find attached the dynamo file if you could help me and thank you

Intersct Dist5.dyn (66.9 KB)
wetransfer_211216-new-layouts-marakesh_2021-12-16_1019 (2).zip.0002.rvt (5.7 MB)

@ismail.essamae your file’s unit is meters, mine was millimeters, so change the 2000 value to 2 in case you want a spacing of 2 meters:

1 Like

@Elie.Trad great it work but the I have a problem I try to do the same thing but when I change the geometry or I add onther gometry it works for one goemetry not all

@ismail.essamae the script works specifically for quad lines as I have told you, can you share what are you after with this kind of division?

1 Like

@Elie.Trad Thank you very much for your answer, as I have some problems with the script, I have chosen another way to divide these lines that can adapt to the different
geometry ,the reason why I can put the lighting family in a specific point that I have chosen also with the number that I give as (if it is a room I put 4 led or 5 it depends on the surface of the room ,if it is a cvc I put a led in the center of it …), but I have a problem with the index for each point . I share the last script and if you have a suggestion it will be useful and I thank you.

TEST2204.dyn (35.5 KB)

@Elie.Trad if there are onther solution please share with us :smiley:

If you are using a Surface for the room area, have you considered Patching its perimeter and then using IsoLines as an overlay to extract a Grid Pattern?

IsoDivide.dyn (74.4 KB)

1 Like

@Ewan_Opie thanks for the answer. the problem of the lines is solved, the next step I am looking for how can I control the position and number of the lighting family in the celling.knowing that I have already added it on all intesctions out of all line points .

@ismail.essamae try to locate the center point of the rooms, sort the points based on the centers, pick the first point of the sorted points, this will get the center point based on the grid you desire, from there translate these points in X and Y directions (+/-) based on the grid value multiplied by a spacing value as per the design intent, to get 4 or 5 lighting families.
It would be better to make it room by room because the placement will differ from one room to another.

1 Like

@Elie.Trad Hello, I hope you are well, I tried to solve this problem with the solution you gave me but I didn’t get an answer, so as I am bigger in dynamo and with the help of my friends I found a solution but if you have an optimal solution it will be better.

this is the solution i propose:
Centre pièce - Dynamo.dyn (181.5 KB)