1. How to define the local element axis

Define the reference vector

Then

The local zaxis is found as the cross product between the local xaxis and the reference vector.

The local yaxis is found as the cross product between the local zaxis and the local xaxis.

2. Reference vector

Local xaxis goes from end 1 to end of the element

The reference vector define a point relative to end 1.

The reference vector is nondimensional

Together the reference vector and the local xaxis define the local xyplane
3. Local Z

The local zaxis is found as the cross product between the local xaxis and the reference vector, i.e., Zloc = Xloc x R, where Xloc=[dx,dy,dz] and R=[Rnx,Rny,Rnz]
4. Local Y

The local yaxis is found as the cross product between the local zaxis and the local xaxis, i.e., Yloc = Zloc x Xloc, where Zloc =[dx,dy,dz] and Xloc=[dx,dy,dz]
5. Example 1  local x parallel along global xaxis

Reference point is R=[0,1,0]

Local zaxis will be parallel to global zaxis

Local yaxis will be parallel to global yaxis
6. Example 2  local x parallel along global xaxis

Reference point is R=[2,2,0]

The point is in the same plane as in example 1

Local zaxis will be parallel to global zaxis

Local yaxis will be parallel to global yaxis
7. Example 3  local x parallel along global xaxis

Reference point is R=[0,1,0]

The point is in the same plane as in example 1 but on the other side of the element

Local zaxis will be parallel to global zaxis but in the opposite direction; i.e. downwards