InstantGrade Example

Land Auto

InstantGrade Example

Examples:

l EGProfile (Civil Engineering Feature)

l FGProfile (Civil Engineering Feature)


Sub Example_InstantGrade_FGProfile()
    
    ' This example gets a station from the user and returns the grade for
    ' the first existing ground profile in the first alignment in the collection.
    Dim align As AeccAlignment
    Dim EGProf As AeccEGProfile
    Set align = AeccApplication.ActiveProject.Alignments.Item(0)
    Set EGProf = align.EGProfiles.Item(0)
    
    Dim station As Double
    Dim grade As Double
    Dim prompt As String
    
    'Format the prompt and get the station
    prompt = "Enter a station on alignment " & align.Name & ": "
    station = ThisDrawing.Utility.GetReal(prompt)
    
    'Get the grade
    EGProf.InstantGrade station, grade
    
    MsgBox "The grade at station and format the prompt" & Format(station, "0.00") & " is: " _
        & Format(grade, "0.00") & "%.", vbInformation, "InstantGrade Example"
    
End Sub

Sub Example_InstantGrade_FGProfile()
    
    ' This example gets a station from the user and returns the grade and difference
    ' for the first finished ground profile in the first alignment in the collection.
    Dim align As AeccAlignment
    Dim FGProf As AeccFGProfile
    Set align = AeccApplication.ActiveProject.Alignments.Item(0)
    Set FGProf = align.FGProfiles.Item(0)
    
    Dim station As Double
    Dim grade As Double
    Dim diff As Double
    Dim prompt As String
    
    'Format the prompt and get the station
    prompt = "Enter a station on alignment " & align.Name & ": "
    station = ThisDrawing.Utility.GetReal(prompt)
    
    'Get the grade and difference
    FGProf.InstantGrade station, grade, diff
    
    MsgBox "The grade at station " & Format(station, "0.00") & " is: " _
        & Format(grade, "0.00") & vbCrLf & _
        "% and the difference is " & Format(diff, "0.00") & "%.", _
        vbInformation, "InstantGrade Example"
    
End Sub