MoveLineAngleCloserToCoord

From scripting
Jump to: navigation, search
Sub MoveLineAngleCloserToCoord(CurvePar As HybridShapeLineAngle, XVal As Double, YVal As Double, ZVal As Double)
MyPart.UpdateObject CurvePar
Dim CMeas
Set CMeas = TheSPAWorkbench.GetMeasurable(CurvePar)
Dim CCoords()
ReDim CCoords(8)
CMeas.GetPointsOnCurve CCoords                                   ' PointsOnCurve CCoords

Dim FirstDist As Double
FirstDist = find3DDistance(CCoords(6), CCoords(7), CCoords(8), XVal, YVal, ZVal)

CurvePar.Orientation = False
MyPart.UpdateObject CurvePar
Dim CMeas2 
Set CMeas2 = TheSPAWorkbench.GetMeasurable(CurvePar)
Dim CCoords2()
ReDim CCoords2(8)
CMeas2.GetPointsOnCurve CCoords2                                ' PointsOnCurve CCoords2
 
Dim secondDist As Double
secondDist = find3DDistance(CCoords2(6), CCoords2(7), CCoords2(8), XVal, YVal, ZVal) 

If secondDist > FirstDist Then
    CurvePar.Orientation = True
    MyPart.UpdateObject CurvePar
End If

End Sub