macroScript LINEPIVOT category:"yoko" buttonText:"LINEPIVOT" --- Thanks to barigazy for the setPivotDir function. ( ( local savesnap=snapMode.active snapMode.active=true pta = pickpoint snap:#3d ptb = pickpoint snap:#3d rubberBand:pta new_spline = splineShape () addNewSpline new_spline addKnot new_spline 1 #corner #curve [pta.x,pta.y,pta.z] addKnot new_spline 1 #corner #curve [ptb.x,ptb.y,ptb.z] updateshape new_spline new_spline.wirecolor = (color 141 7 58) new_spline.vertexTicks = on fn setPivotDir spl state = ( with redraw off local rotValInv = inverse ((matrixFromNormal (pathTangent spl 1 0.0)).rotationpart) spl.pivot = (getKnotPoint spl 1 1) ResetTransform spl ; animate off in coordsys spl spl.rotation *= RotValInv spl.objectoffsetrot *= RotValInv ; spl.objectoffsetpos *= RotValInv local curTM = spl.transform ; for i = 1 to 3 do spl[3][2][i].track.value = 0 resetXform spl ; collapseStack spl ; spl.transform = curTM if state != 3 do ( rot = case state of ( 1: (inverse ((EulerAngles -90 -90 0) as quat)) 2: ((EulerAngles -90 180 0) as quat) ) animate off in coordsys local spl.rotation *= rot spl.objectoffsetrot *= rot ; spl.objectoffsetpos *= rot ) ) setPivotDir new_spline 1 ) snapMode.active=savesnap )