XyToOffsetElevation Example

Land Auto

XyToOffsetElevation Example

Sub Example_XyToOffsetElevation()
    
    '  This example returns the offset and elevation for a selected point in the first
    '  alignment crosssection in the collection
    Dim alignXSect As AeccCrossSectionBlock
    Set alignXSect = AeccApplication.ActiveDocument.CrossSectionBlocks.Item(0)
    
    Dim station As String
    Dim offElev As Variant
    Dim returnPnt As Variant
    
    ' Get the station for the first alignment cross section in the collection.
    station = alignXSect.station
    
    ' Get a point in the alignment cross section.
    returnPnt = ThisDrawing.Utility.GetPoint(, vbCrLf & "Specify a point in the alignment cross section at station " & station & ": ")
    
    offElev = alignXSect.XyToOffsetElevation(returnPnt)
    
    MsgBox "The station for the selected point is: " & Format(offElev(0), "0.00") & vbCrLf & _
        "The offset for the selected point is: " & Format(offElev(1), "0.00") _
        , vbInformation, "XyToOffsetElevation Example"
    
End Sub