Error Element.Location with family

Purpose of the script, insert a booking family into a wall.
The script must be able to handle networks (sheath and other) but also accessories.
The script functions with ducts, cable tray and tube.
But I have a problem with the accessories. Indeed an accessory may be a complex element, made up of several solid.
I tried to change the beginning of the script using the solid union node with making the intersection with the wall.
But this does not work in the case where the accessory is circular (no surface with explode)
I do not know what to do, to have the angle of the family compared to the wall (my script seems more and more complicated!)
Do you have an idea?
Ducts OK