OffsetelevationToXy Example

Land Auto

OffsetElevationToXy Example

Sub Example_OffsetElevationToXy()
    
    ' This example returns an Autocad XY for a given offset and elevation for the
    ' first alignment cross section in the collection.
    Dim alignXSect As AeccCrossSectionBlock
    Set alignXSect = AeccApplication.ActiveDocument.CrossSectionBlocks.Item(0)
    
    Dim offElev(0 To 1) As Double
    Dim XY As Variant
    Dim station As String
    Dim offset As Double
    Dim elevation As Double
    
    'Get the station for the first alignment cross section in the collection.
    station = alignXSect.station
    
    'Get the offset and the elevation
    offset = ThisDrawing.Utility.GetReal(vbCrLf & "Enter the offset in station " & station & ": ")
    elevation = ThisDrawing.Utility.GetReal("Enter the elevation in station " & station & ": ")
    
    ' Use the entered values to get the X and Y values
    offElev(0) = offset
    offElev(1) = elevation
    
    XY = alignXSect.OffsetElevationToXy(offElev)
    
    MsgBox "The X value for the offset is: " & Format(XY(0), "0.00") & vbCrLf & _
        "The Y value for the elevation is: " & Format(XY(1), "0.00") _
        , vbInformation, "OffsetElevationToXy Example"
    
End Sub