MatchBlendOrientationsWithEndPts

From scripting
Jump to: navigation, search
Sub MatchBlendOrientations(InputBlend As HybridShapeBlend)
Dim Curve1
Set Curve1 = MyHSFactory.GSMGetObjectFromReference(InputBlend.GetCurve(1))
Dim Curve2
Set Curve2 = MyHSFactory.GSMGetObjectFromReference(InputBlend.GetCurve(2)) 

IsUpdatable Curve1
Dim C1Meas
Set C1Meas = TheSPAWorkbench.GetMeasurable(Curve1)
Dim C1Coords()
ReDim C1Coords(8)
C1Meas.GetPointsOnCurve C1Coords
IsUpdatable Curve2
Dim C2Meas
Set C2Meas = TheSPAWorkbench.GetMeasurable(Curve2)
Dim C2Coords()
ReDim C2Coords(8)
C2Meas.GetPointsOnCurve C2Coords  

Dim FirstDist As Double
FirstDist = find3DDistance(C1Coords(0), C1Coords(1), C1Coords(2), C2Coords(0), C2Coords(1), C2Coords(2))
Dim SecondDist As Double
SecondDist = find3DDistance(C1Coords(0), C1Coords(1), C1Coords(2), C2Coords(6), C2Coords(7), C2Coords(8))

If FirstDist > SecondDist Then
    InputBlend.SetOrientation 1, 1
    InputBlend.SetOrientation 2, -1
End If
End Sub