Can't get the right orientation to rotate my lines

I am trying to model this plant…

i got the lines for the leaves… but i want to rotate the leaves up. So the line that is pointing outwards needs to be rotate along the Z plane of it’s base plane, i can get it to rotate, but some go up and some go down and i have no idea any more why…

i have tried so much…that i don’t know what the right way is any more… could someone help with this script to get me moving again.
reed.dyn (106.6 KB)

Hi @Arno_De_Lange, what happens if you switch your line start and end points?

Hi,

one idea to try (sorry don’t have access to Revit at the moment to check):

Make a vector from your leaf line and then calculate a crossproduct against a vector from XY plane (basisX or basisY)
As a result you should get a vertical vector - sometimes pointing upwards sometimes downwards.
Maybe then you can extract its Z value sign and adjust rotation accordingly.

Might not work though if your line would be exactly parallel to the test vector - cross product would be zero…

problem is some go uo some go down…

Does that change when the line is reversed?
https://www.linkedin.com/pulse/fractal-geometry-exercises-using-dynamo-laura-da-luo/

i got it working… took a plane form the base line where the line i want to rotate is connected… thanks for your help