Rotating mutliple families

Hello Everyone , I wanted to ask how Can I rotate/aligin these families using dynamo , The picture on the left represents how the families are placed . the picture on the right represents how I want them to be placed.
Note here each 4 circles are considered as one family . I want the concept or the idea of how I can achieve that only .
thanks a lot

Hi, @ahmadkhalaf7892.

My idea is calculate angle between the normal vectors of the line and true north, and set rotation.
I tried it in my project but not tested with your family.
Try it and give me a feedback.

Best regards

Thanks Dylim, I will try it now , But how will I select the family here that I want to rotate ?
Thanks again

Just simply use “Select Model Elements”.
Here is the example.

By the way, the line must be 2D not 3D. if you want to use 3D line, you need to pull the line on the XY Plane first.

Sorry again I am a bit lost regarding where to place the nodes , can you provide with the script please

Sorry, I didn’t save the script.
However, I believe the images are well explained.


Dylim.dyn (26.5 KB)
Hello Dylim , this is the script but it wasn’t working . did I do anything wrong here

Please share your family.
I will take a look when i am free.

Rectangular Pile Sheet Foundation .rfa (352 KB)
Thanks a lot