How to move geometry parallell to a plane instead of along z-axis?

Hi

I’m new to the world of Dynamo and could really need some help with a script i have made.
I draw Cable Trays and want to get an volume on top of my trays to reserve some space when collaborating with others via IFC-files.

I have created a script that creates a volume and it works great with all horizontal trays, but as soon as it not horizontal the positioning gets off.

I have made it so it will create a line between every trays start and end point, than it create a plane and sweep a rectangle along the plane. finaly it create the geometry with directshape and name the volumes with the trays ElementID. The geometry is created on top of the tray and this is adjusted according to hight of the tray

As it is now, the centerline of the geometry is moved in z-axis instead of perpendicular to the plane.
How can i make it move perpendicular? I have tried to use normal, but without success :frowning:

image

image

Stegar med volym_elementID_v2.dyn (22.1 KB)

@Ulf_Berglund Could you post a dummy Revit file?

Oh, great!
I’m really new at this and i thought that i needed to create that line but apperantly not :grinning:
Seems to work great with the changes you suggsted.
Thanks! :+1: