OffsetElevations Example

Land Auto

OffsetElevations Example

Sub Example_OffsetElevations()
    
    ' This example returns the first three offsets and elevations for the first cross
    ' section surface in the collection for the first cross section
    ' in the collection.
    Dim aligns As AeccAlignments
    Dim align As AeccAlignment
    Dim xSect As AeccCrossSection
    Dim xSectSurf As AeccCrossSectionSurface
    Set aligns = AeccApplication.ActiveProject.Alignments
    Set align = aligns.Item(0)
    Set xSect = align.CrossSections.Item(0)
    Set xSectSurf = xSect.CrossSectionSurfaces.Item(0)
    
    '  Get the alignment name
    Dim alignName As String
    alignName = align.Name
    
    ' Get the cross section station and format it
    Dim station As String
    station = aligns.DoubleToStaFormat(xSect.station)
    
    ' Get the cross section surface name
    Dim surfName As String
    surfName = xSectSurf.Name
    
    ' Get the offsets and elevations
    Dim offElev As Variant
    offElev = xSectSurf.OffsetElevations
    
    MsgBox "The alignment name is: " & alignName & vbCrLf & _
        "The first cross section is at station: " & station & vbCrLf & _
        "The first surface name is: " & surfName & vbCrLf & _
        "The first three offsets and elevations for the surface are:" & vbCrLf & _
        vbTab & "Offset 1: " & Format(offElev(0), "0.00") & _
        vbTab & "Elevation 1: " & Format(offElev(1), "0.00") & vbCrLf & _
        vbTab & "Offset 2: " & Format(offElev(2), "0.00") & _
        vbTab & "Elevation 2: " & Format(offElev(3), "0.00") & vbCrLf & _
        vbTab & "Offset 3: " & Format(offElev(4), "0.00") & _
        vbTab & "Elevation 3: " & Format(offElev(5), "0.00"), _
        vbInformation, "OffsetElevation Example"
    
End Sub