BEAM188 follower BC

!   Commands inserted into this file will be executed just prior to the ANSYS SOLVE command.
!   These commands may supersede command settings set by Workbench.

!   Active UNIT system in Workbench when this object was created:  Metric (mm, kg, N, s, mV, mA)
!   NOTE:  Any data that requires units (such as mass) is assumed to be in the consistent solver unit system.
!                See Solving Units in the help system for more information.

/SOLU
*GET,CURRENT_LOADSTEP,ACTIVE,,SET,LSTP 

*IF,CURRENT_LOADSTEP,GE,1,THEN

    ESEL,S,ENAME,,188
    NSLE

    NN = NDNEXT(0)
    NODE_I = NN
    NODE_J = NDNEXT(NN)

    *GET,NODE_I_X_LOC,NODE,NODE_I,LOC,X
    *GET,NODE_I_Y_LOC,NODE,NODE_I,LOC,Y
    *GET,NODE_I_Z_LOC,NODE,NODE_I,LOC,Z

    *GET,NODE_J_X_LOC,NODE,NODE_J,LOC,X
    *GET,NODE_J_Y_LOC,NODE,NODE_J,LOC,Y
    *GET,NODE_J_Z_LOC,NODE,NODE_J,LOC,Z
    
    NODE_I_X = UX(NODE_I) + NODE_I_X_LOC
    NODE_I_Y = UY(NODE_I) + NODE_I_Y_LOC
    NODE_I_Z = UZ(NODE_I) + NODE_I_Z_LOC

    NODE_J_X = UX(NODE_J) + NODE_J_X_LOC
    NODE_J_Y = UY(NODE_J) + NODE_J_Y_LOC
    NODE_J_Z = UZ(NODE_J) + NODE_J_Z_LOC

    X = NODE_J_X - NODE_I_X
    Y = NODE_J_Y - NODE_I_Y
    Z = NODE_J_Z - NODE_I_Z

    LENGTH_VECTOR = (X*X + Y*Y + Z*Z)**0.5

    X_DIRECTION = X / LENGTH_VECTOR
    Y_DIRECTION = Y / LENGTH_VECTOR
    Z_DIRECTION = Z / LENGTH_VECTOR 

    ! Uy  =  (0,50,0) mm
    ! --> Uy_rot = (50*X_DIRECTION,50*Y_DIRECTION,50*Z_DIRECTION)

    CMSEL,S,dispNode
    D_X = 50*X_DIRECTION
    D_Y = 50*Y_DIRECTION
    D_Z = 50*Z_DIRECTION
    D,ALL,UX,D_X
    D,ALL,UY,D_Y
    D,ALL,UZ,D_Z

*ENDIF

ALLSEL