Transformation of cable tray in revit using python automation

Rotation of cable tray from horizontal to vertical and vise versa as shown in image.
I want to automate cable tray in revit using python. I want to provide support too. If cable tray is going vertical ,i want to change its its dimension to horizontal at turning point.

Hi @vinteeshukla1 ,

What have you tried so far?

I’m assuming the facing direction of the cable tray is determined by a parameter of some sorts, maybe you could combine that with a simple calculation of the vector of the underlying curve of the cable tray.