I was looking some dynamo (searched in forum but not able to found) which is add Tray Union when tray intersect with gridline/wall.
Kindly refer attached image.
Cable tray union shall be placed at red highlighted points.
i.e. when cable tray cross grid line union fitting shall be placed.
I got some ideas by observing your script.
But as I am new to this dynamo world field I can’t understand all the things.
my script run. it was placed at another location (not at where it intersected) union. but not as part of the tray but as a separate element. also, the size is not the same as the tray size.