KeepHighestLevel

From scripting
Jump to: navigation, search
Sub KeepHighestLevel(LevelPlane As HybridShapePlaneOffset, TestPtObj As Variant)
If IsUpdatable(LevelPlane) And IsUpdatable(TestPtObj) Then
    Dim OrigOri As Integer
    OrigOri = LevelPlane.Orientation
    Dim OppOri As Integer
    OppOri = (-1) * OrigOri
    
    Dim TMeas
    Set TMeas  = TheSPAWorkbench.GetMeasurable(TestPtObj)
    Dim OrigPt Coords(2)
    TMeas.GetPoint OrigPtCoords
    
    LevelPlane.Orientation = OppOri
    IsUpdatable TestPtObj
    Dim TMeas2
    Set TMeas2 = TheSPAWorkbench.GetMeasurable(TestPtObj)
    Dim OppPtCoords(2)
    TMeas2.GetPoint OppPtCoords
    
    If OppPtCoords(2) < OrigPtCoords(2) Then
        LevelPlane.Orientation = OrigOri
        IsUpdatable TestPtObj
    End If
End If
End Sub