MoveAxisSystemXDirFartherFromCoord
From scripting
Sub MoveAxisSystemXDirFartherFromCoord(CurvePar As AxisSystem, ResultObj As Variant, XVal As Double, YVal As Double, ZVal As Double) If IsUpdatable(CurvePar) And IsUpdatable(ResultObj) Then Dim CMeas Set CMeas = TheSPAWorkbench.GetMeasurable(ResultObj) Dim CCoords() ReDim CCoords(2) CMeas.GetCOG CCoords Dim FirstDist As Double FirstDist = find3DDistance(CCoords(0), CCoords(1), CCoords(2), XVal, YVal, ZVal) CurvePar.XAxisType = catAxisSystemAxisSameDirection If IsUpdatable(ResultObj) = False Then Exit Sub End If Dim CMeas2 Set CMeas2 = TheSPAWorkbench.GetMeasurable(ResultObj) Dim CCoords2() ReDim CCoords2(2) CMeas2.GetCOG CCoords2 Dim SecondDist As Double SecondDist = find3DDistance(CCoords2(0), CCoords2(1), CCoords2(2), XVal, YVal, ZVal) If SecondDist < FirstDist Then CurvePar.XAxisType = catAxisSystemAxisOppositeDirection If IsUpdatable(ResultObj) = False Then Exit Sub End If End If End If End Sub