# Trouble with placing element, based on selected element location

Hello forum!
I know there are other threads regarding this topic and I belive I have read and tried to solve my problem on my own, nevertheless the outcome is rather poor, so here goes…

A = empty panel box
B = power outlet
Distance between A_centerline and B_centerline = 32 mm.

In my project I have a lot of empty boxes and I want to place (not replace) a power outlet on the same location, however as you guys can see I have not quite succeeded yet… Any advice or hints towards a solution would really make my day!

I would use the node FamilyInstance.ByCoordinates, so you don’t have to care about the level.

If you need to rotate the element, you need to calculate the rotation of the existing element to X Axis, for example, and apply the same rotation to your new element.

1 Like

Maybe the “A” family is placed on the floor (elevation 0 from the level) but has an internal offset value? Probably you should add some value to Z.
Another problem might be that your family is face based, while you are placing as if it were normal. I think there is a node called FamilyInstance.ByFace or something

1 Like

The BIM4STRUC package has a node to get the orientation of the boxes you mention and gives you the vectors.
for example:
A has Vector.Z=1
B has Vector.Y=1

Maybe you can use it

Thank you all for your replies. Got me inspired to the solution with change workplane and facebased -> nonebased family. And then rotating the element!

So I still have a minor problem with placing copied elements at the selected element…

A: the selected junction box
B: the inserted junction boxes

Problem: based on the selected elements (x,y,z) -> the script must insert x-amount of junction boxes -> in (x,y,z) direction… Any thoughts on whats wrong would be appreciated

Nevermind, solved it with some experiments…