# Elements Joining

Hi!

I made a simple script, that works well, but when I have a lot of elements (500 columns, 300 walls, 200 floors) its processing is too long (1 hour or more) and I don’t know if it even works. What can I do with what? Maybe there is other way to join elements fast?

This is because you’re joining every element to every other element, even if they don’t even touch. Check your warnings before and after running this on a simple graph.

1 Like

I have no warnings.
I understand that if I have 1000 element the script have to do joining 1000000 times. But how can I filter only those elements which intersect?

You can try to :

• use the Geometry.DoesIntersect node and filter
• filter the elements by level, by room, etc.
• join element 1 and element 2, then join the result with element 3, then join the result with element 4 etc. (in that case, you are doing N operations, where N is the number of elements you have, rather than N² operations).
1 Like

Filter can’t be used, because I have different situations when one element intersects another at another level.
Is there a node, that gives all intersected elements of a choosen? It seems somewhen I used it, but now can’t remember

F.e. 1st element intersects 2nd. I join them. 2ns intersects 3rd. I join 2nd to the 3rd and I get 1st, 2nd and 3rd joined. But what if the 3rd don’t intersect 4th, but 4th intersect the 1st? I join 3rd and 4th, the script does nothing, then the script joins 4th to 5th. And 4th remains not joined to the 1st?

I have a script, written in CodeBlock mainly, that might help you, but is actually designed for joining Curves. It assumes that you can compute which couple of element does or does not intersect. Can you compute in a reasonnable time which element intersects which element ? I guess Geometry.DoesIntersect might help.

According to my example, as I understand I must compute if one intersects another, but I should make it for all possible pairs. And number of pairs will be N². And only then I will join them. Will it be faster? I think, no.

There is a huge difference between computing if two elements intersect with one another and computing the join element for every possible pair.

Moreover, as you have written it, your graph seem wrong : you are joining geometry by cross product lacing, meaning that you are joining 1 and 1, then 1 and 2, then 1 and 3, then 1 and 4 etc. then 1 and n, then 2 and 1, then 2and 2 etc. then 2 and n, … then n and 1, etc… then n and n.

At no moment you are joining all of your elements together. If it was the case, you would have to put one input in your fonction, the list of your elements.

Hello Dynamo Experts,
Did you guys find out any usefull result to this topic ? I’m currently searching for the same :-/
Erol

Just a hint. Cycling the parent element the number of times the count of the respective intersecting elements to be joined and then running the joining node with short lacing will solve your problem.
All the best.

I used AutoJoin with Onion Packages and it works