Elevation Example

Land Auto

Elevation Example

Examples:

l AeccContour

l AeccPoint

l CogoPoint

l CrossSectionPointCode (Civil Engineering Feature)

l ElevationContours

l PointGroup

l PVI (Civil Engineering Feature)

l TinPoint


Sub Example_Elevation_AeccContour()
    
    ' This example displays The Elevation for a selected contour.
    
    On Error Resume Next
    ' Delete existing SelectionSet
    ThisDrawing.SelectionSets("SSet").Delete
    
    ' Create the selection set based on a point selection
    ' and filter for Contour objects
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SSet")
    
    Dim gpCode(0) As Integer
    Dim dataValue(0) As Variant
    
    gpCode(0) = 0
    dataValue(0) = "AECC_CONTOUR"
    
    Dim groupCode As Variant
    Dim dataCode As Variant
    
    groupCode = gpCode
    dataCode = dataValue
    ssetObj.SelectOnScreen groupCode, dataCode
    
    ' Get first contour from selection set
    Dim objContour As AeccContour
    Set objContour = ssetObj.Item(0)
    
    MsgBox "The Contour Elevation is: " & objContour.Elevation, vbInformation, "Elevation Example"
    
End Sub

Sub Example_Elevation_AeccPoint()
    
    ' This example returns the Elevation setting for the
    ' first Point object in a selection set
    
    On Error Resume Next
    
    ' Delete existing SelectionSet
    ThisDrawing.SelectionSets("SSet").Delete
    
    ' Create the selection set based on a point selection
    ' and filter for the Point objects
    Dim ssetObj As AcadSelectionSet
    Set ssetObj = ThisDrawing.SelectionSets.Add("SSet")
    
    Dim gpCode(0) As Integer
    Dim dataValue(0) As Variant
    
    gpCode(0) = 0
    dataValue(0) = "AECC_POINT"
    
    Dim groupCode As Variant
    Dim dataCode As Variant
    
    groupCode = gpCode
    dataCode = dataValue
    ssetObj.SelectOnScreen groupCode, dataCode
    
    Dim objPoint As AeccPoint
    Set objPoint = ssetObj.Item(0)
    
    MsgBox "The setting for Elevation is: " & objPoint.Elevation, vbInformation, "Elevation Example"
    
End Sub

Sub Example_Elevation_CogoPoint()
    
    ' This example returns the Elevation for the first CogoPoint in the collection
    Dim cogoPnt As AeccCogoPoint
    Set cogoPnt = AeccApplication.ActiveProject.CogoPoints.Item(0)
    
    MsgBox "The Elevation for the first CogoPoint in the collection is: " & cogoPnt.Elevation, vbInformation, "Elevation Example"
    
End Sub

Sub Example_Elevation_CrossSectionPointCode()
    
    ' This example returns the point code data 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 xSectPCode As AeccCrossSectionPointCode
    Set aligns = AeccApplication.ActiveProject.Alignments
    Set align = aligns.Item(0)
    Set xSect = align.CrossSections.Item(0)
    Set xSectPCode = xSect.CrossSectionPointCodes.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)
    
    MsgBox "The alignment name is: " & alignName & vbCrLf & _
        "The first cross section is at station: " & station & vbCrLf & _
        "The data for the first point code is: " & vbCrLf & _
        vbTab & "Code: " & xSectPCode.Code & vbCrLf & _
        vbTab & "Description: " & xSectPCode.Description & vbCrLf & _
        vbTab & "Elevation: " & Format(xSectPCode.elevation, "0.00") & vbCrLf & _
        vbTab & "Offset: " & Format(xSectPCode.offset, "0.00"), _
        vbInformation, "Elevation Example"
    
End Sub

Sub Example_Elevation_ElevationContours()
    
    ' This example returns the number of ElevationContours at 100.0 for
    ' the first surface in the collection
    Dim surf As AeccSurface
    Dim elevContours As AeccElevationContours
    Set surf = AeccApplication.ActiveProject.Surfaces.Item(0)
    Set elevContours = Surf.Outputs.ElevationContours
    
    elevContours.Elevation = 100#
    
    MsgBox "The number of ElevationContours at 100.0 is: " & elevContours.Count _
        , vbInformation, "Elevation Example"
    
End Sub

Sub Example_Elevation_PointGroup()
    
    ' This function gets the Elevation for the first PointGroup
    ' in the collection.
    Dim pntGrp As AeccPointGroup
    Set pntGrp = AeccApplication.ActiveProject.PointGroups.Item(0)
    
    MsgBox "The Elevation for the first PointGroup is: " & _
        pntGrp.Elevation, vbInformation, "Elevation Example"
    
End Sub

Sub Example_Elevation_PVI()
    
    ' This example returns the Elevation value for the second PVI in the
    ' first finished ground of the first alignment in the collection.
    Dim align As AeccAlignment
    Dim FGProf As AeccFGProfile
    Dim PVI As AeccPVI
    Set align = AeccApplication.ActiveProject.Alignments.Item(0)
    Set FGProf = align.FGProfiles.Item(0)
    Set PVI = FGProf.PVIs.Item(1)
    
    MsgBox "The Elevation of the second PVI is: " _
        & Format(PVI.Elevation, "0.000"), vbInformation, "Elevation Example"
    
End Sub

Sub Example_Elevation_TinPoint()
    
    ' This example returns the Elevation of the first
    ' TIN Point in the collection.
    Dim surf As AeccSurface
    Dim tin As AeccTinPoint
    Set surf = AeccApplication.ActiveProject.Surfaces.Item(0)
    Set tin = surf.Outputs.TinPoints.Item(0)
    
    MsgBox "The Elevation of the first TIN Point is: " & tin.Elevation, _
        vbInformation, "Elevation Example"
    
End Sub