Add Example

Land Auto

Add Example

Examples:

l Alignments

l Boundaries

l BreakLines

l CogoPoints

l ContourItems

l DEMFiles

l DescriptionKeyFile

l DescriptionKeyFiles

l EGProfiles (Civil Engineering Feature)

l FGProfiles (Civil Engineering Feature)

l Parcels

l PointFiles

l PointGroupNames

l PointGroups

l Projects

l PVIs (Civil Engineering Feature)

l StationEquations

l Surfaces


Sub Example_Add_Alignments()
    
    ' This example adds an Alignment made up of a tangent,
    ' curve, and spiral entities.
    Dim aligns As AeccAlignments
    Dim align As AeccAlignment
    Set aligns = AeccApplication.ActiveProject.Alignments
    
    ' Add an Alignment named "Example Alignment" and starting at Station 50.0
    Set align = aligns.Add("Example Alignment", 50#)
    
    ' Add a tangent, curve, and spiral to the alignment
    Dim tangent As AeccAlignTangent
    Dim curve As AeccAlignCurve
    Dim spiral As AeccAlignSpiral
    
    Set tangent = align.AddTangent(0#, 0#, 150#, 0#)
    Set spiral = align.AddSpiral(150#, 0#, 388.069176379758, -5.83082052087824E-14, 250#, 100#, 0, 0, kClothoid)
    Set curve = align.AddCurve(250, 100#, 320.966940499621, 197.983470249737, 200#, 200#, False)
    
    MsgBox "The total number of entities in the Alignment is: " & align.AlignEntities.count, _
    vbInformation, "Add Example"
    
End Sub

Sub Example_Add_Boundaries()
    
    ' This example starts by displays the initial count of the Boundaries
    ' for the first surface in the collection. A new visible Boundary is added
    ' and the count is redisplays. Finally, the new Boundary is deleted. The count is
    ' displayed again, showing the deletion.
    Dim surf As AeccSurface
    Dim bounds As AeccBoundaries
    Dim Bound As AeccBoundary
    Set surf = AeccApplication.ActiveProject.Surfaces.Item(0)
    Set bounds = surf.Inputs.Boundaries
    
    MsgBox "The Boundaries Count is: " & bounds.count, vbInformation, "Add Example"
    
    ' Initialize variables
    Dim pnts(0 To 14) As Double
    Dim count As Integer
    Dim index As Integer
    Dim pnt As Variant
    
    index = 0
    
    ' Add a new Boundary based on five selected points
    For count = 1 To 5
        pnt = ThisDrawing.Utility.GetPoint(, "Select point" + Str(count) + " of Boundary: ")
        pnts(index) = pnt(0): pnts(index + 1) = pnt(1): pnts(index + 2) = pnt(2)
        index = index + 3
    Next count
    
    ' Add a new Boundary
    Set Bound = bounds.Add(kBoundaryTypeShow, False, pnts, "NewBoundary")
    
    MsgBox "The BreakLines Count after the add is: " & bounds.count, vbInformation, "Add Example"
    
    ' Delete the new Boundary
    bounds.Delete Bound.Id
    
    MsgBox "The Boundaries Count after the delete is " & bounds.count, vbInformation, "Add Example"
    
End Sub

Sub Example_Add_BreakLines()
    
    ' This example starts by displays the initial count of the BreakLines
    ' for the first surface in the collection. A new BreakLines is added
    ' and the count is redisplays. Finally, the new file is deleted. The count is
    ' displayed again, showing the deletion.
    Dim surf As AeccSurface
    Dim brkLines As AeccBreakLines
    Dim brkLine As AeccBreakLine
    Set surf = AeccApplication.ActiveProject.Surfaces.Item(0)
    Set brkLines = surf.Inputs.BreakLines
    
    MsgBox "The BreakLines Count is: " & brkLines.count, vbInformation, "Add Example"
    
    ' Initialize variables
    Dim pnts(0 To 14) As Double
    Dim count As Integer
    Dim index As Integer
    Dim pnt As Variant
    
    index = 0
    
    ' Add a new BreakLine based on five selected points
    For count = 1 To 5
        pnt = ThisDrawing.Utility.GetPoint(, "Select point" + Str(count) + " of BreakLine: ")
        pnts(index) = pnt(0): pnts(index + 1) = pnt(1): pnts(index + 2) = pnt(2)
        index = index + 3
    Next count
    
    Set brkLine = brkLines.Add(pnts, "NewBreakLine")
    
    MsgBox "The BreakLines Count after the add is: " & brkLines.count, vbInformation, "Add Example"
    
    ' Delete the new BreakLines
    brkLines.Delete brkLine.Id
    
    MsgBox "The BreakLines Count after the delete is " & brkLines.count, vbInformation, "Add Example"
    
End Sub

Sub Example_Add_CogoPoints()
    
    ' This function adds a new CogoPoint to the CogoPoints collection.
    Dim cogoPnts As AeccCogoPoints
    Dim newCogoPnt As AeccCogoPoint
    Set cogoPnts = AeccApplication.ActiveProject.CogoPoints
    
    ' Get a point
    Dim newPnt As Variant
    newPnt = ThisDrawing.Utility.GetPoint(, "Select point location: ")
    
    ' Add CogoPoint
    Set newCogoPnt = cogoPnts.Add(newPnt, kCoordinateFormatXYZ)
    
    MsgBox "The Number for the new CogoPoint is: " & newCogoPnt.Number, vbInformation, "Add Example"
    
End Sub

Sub Example_Add_ContourItems()
    
    ' This example Adds a Contour, with an elevation of 100,
    ' to the first collection in ContourItems.
    Dim surf As AeccSurface
    Dim conts As AeccContourItems
    Set surf = AeccApplication.ActiveProject.Surfaces.Item(0)
    Set conts = surf.Inputs.ContourItems
    
    ' Display the number of ContourItems in the collection before the add
    MsgBox "The number of ContourItems in the collection is: " & conts.count, vbInformation, "Add Example"
    
    ' Initialize variables
    Dim pnts(0 To 29) As Double
    Dim count As Integer
    Dim index As Integer
    Dim pnt As Variant
    
    index = 0
    
    'Define a new contour based upon 10 entered points
    For count = 1 To 10
        pnt = ThisDrawing.Utility.GetPoint(, "Select point" + str(count) + " of Contour: ")
        pnts(index) = pnt(0): pnts(index + 1) = pnt(1): pnts(index + 2) = 100#
        index = index + 3
    Next count
    
    ' Add Contour to the collection
    conts.Add Points
    
    ' Display the number of ContourItems in the collection after the add
    MsgBox "The number of ContourItems in the collection is: " & conts.count, vbInformation, "Add Example"
    
End Sub

Sub Example_Add_DEMFiles()
    
    ' This example starts by displays the initial count of DEMFiles
    ' for the first surface. A new DEMfile is added and the count is redisplays.
    ' Finally, the new file is deleted. The count is displayed again, showing
    ' the deletion.
    Dim surf As AeccSurface
    Dim DEMFiles As AeccDEMFiles
    Set surf = AeccApplication.ActiveProject.Surfaces.Item(0)
    Set DEMFiles = surf.Inputs.DEMFiles
    
    MsgBox "The DEMFiles Count is: " & DEMFiles.Count, vbInformation, "Add Example"
    
    'Get the DEMFile name and format the prompt
    Dim DEMName As String
    Dim prompt As String
    
    prompt = "Enter the name of the DEMFile for surface " & surf.Name & ": "
    DEMName = ThisDrawing.Utility.GetString(False, prompt)
    
    ' Add a new DEMFile
    DEMFiles.Add DEMName
    
    MsgBox "The DEMFiles Count after the add is: " & DEMFiles.Count, vbInformation, "Add Example"
    
    ' Delete the new DEMFile
    DEMFiles.Delete DEMName
    
    MsgBox "The DEMFiles Count after the delete is " & DEMFiles.Count, vbInformation, "Add Example"
    
End Sub

Sub Example_Add_DescriptionKeyFile()
    
    ' This example starts by displays the initial count of DescriptionKeys
    ' in the DEFAULT DescriptionKey file. A new DescriptionKey is added
    ' and the count is redisplays. Finally, the new key is deleted. The
    ' count is displayed again, showing the deletion.
    Dim dkeyFile As AeccDescriptionKeyFile
    Set dkeyFile = AeccApplication.ActiveProject.DescriptionKeyFiles.Item("DEFAULT")
    
    MsgBox "The DescriptionKey Count is " & dkeyFile.count, vbInformation, "Add Example"
    
    ' Add a new DescriptionKey
    dkeyFile.Add "New"
    
    MsgBox "The DescriptionKey Count is " & dkeyFile.count, vbInformation, "Add Example"
    
    ' Delete the new DescriptionKey
    dkeyFile.Delete "New"
    
    MsgBox "The DescriptionKey Count is " & dkeyFile.count, vbInformation, "Add Example"
    
End Sub

;Sub Example_Add_DescriptionKeyFiles()
    
    ' This example starts by displays the initial count of DescriptionKeyFiles
    ' on the system. A new DescriptionKeyFile is added and the count is redisplays.
    ' Finally, the new file is deleted. The count is displayed again, showing
    ' the deletion.
    Dim dKeyFiles As AeccDescriptionKeyFiles
    Set dKeyFiles = AeccApplication.ActiveProject.DescriptionKeyFiles
    
    MsgBox "The DescriptionKeyFiles Count is " & dKeyFiles.count, vbInformation, "Add Example"
    
    ' Add a new DescriptionKeyFile
    dKeyFiles.Add "NewFile"
    
    MsgBox "The DescriptionKeyFiles Count is " & dKeyFiles.count, vbInformation, "Add Example"
    
    ' Delete the new DescriptionKeyFile
    dKeyFiles.Delete "NewFile"
    
    MsgBox "The DescriptionKeyFiles Count is " & dKeyFiles.count, vbInformation, "Add Example"
    
End Sub

Sub Example_Add_EGProfiles()
    
    ' This example gets the surface name from the user and adds a new
    ' existing ground profile for the first alignment in the collection.
    Dim align As AeccAlignment
    Dim newEGProf As AeccEGProfile
    Set align = AeccApplication.ActiveProject.Alignments.Item(0)
    
    'Get the surface name and format the prompt
    Dim surfName As String
    Dim prompt As String
    
    prompt = "Enter the name of the surface for alignment " & align.Name & ": "
    surfName = ThisDrawing.Utility.GetString(False, prompt)
    
    'Add the new existing ground profile
    Set newEGProf = align.EGProfiles.Add(kEgCenter, surfName)
    
    MsgBox "The first station for the new existing ground profile is: " _
        & newEGProf.StationElevations(0), vbInformation, "Add Example"
    
End Sub

Sub Example_Add_FGProfiles()
    
    ' This example adds a center type finished ground profile 
    ' to the first alignment in the collection.
    Dim align As AeccAlignment
    Dim newFGProf As AeccFGProfile
    Set align = AeccApplication.ActiveProject.Alignments.Item(0)
    
    'Add the new finished ground profile
    Set newFGProf = align.FGProfiles.Add(kFgCenter)
    
    MsgBox "The type for the new existing ground profile is: " _
        & newFGProf.Type, vbInformation, "Add Example"
    
End Sub

Sub Example_Add_Parcels()
    
    ' This example starts by displays the initial count of Parcels
    ' A new Parcel is added and the count is redisplayed. Finally,
    ' the new Parcel is deleted. The count is displayed again, showing
    ' the deletion.
    
    Dim parcels As AeccParcels
    Set parcels = AeccApplication.ActiveProject.Parcels
    
    MsgBox "The Parcel Count is: " & parcels.Count, vbInformation, "Add Example"
    
    ' Add a new Parcel
    parcels.Add "NewParcel"
    
    MsgBox "The Parcel Count is: " & parcels.Count, vbInformation, "Add Example"
    
    ' Delete the new Parcel
    parcels.Delete "NewParcel"
    
    MsgBox "The Parcel Count is: " & parcels.Count, vbInformation, "Add Example"
    
End Sub

Sub Example_Add_PointFiles()
    
    ' This example starts by displays the initial count of PointFiles
    ' on the system. A new Pointfile is added and the count is redisplays.
    ' Finally, the new file is deleted. The count is displayed again, showing
    ' the deletion.
    Dim surf As AeccSurface
    Dim pntFiles As AeccPointFiles
    Set surf = AeccApplication.ActiveProject.Surfaces.Item(0)
    Set pntFiles = surf.Inputs.PointFiles
    
    MsgBox "The PointFiles Count is: " & pntFiles.Count, vbInformation, "Add Example"
    
    ' Add a new PointFile
    pntFiles.Add "NewPointFile"
    
    MsgBox "The PointFiles Count after the add is: " & pntFiles.Count, vbInformation, "Add Example"
    
    ' Delete the new PointFile
    pntFiles.Delete "NewPointFile"
    
    MsgBox "The PointFiles Count after the delete is " & pntFiles.Count, vbInformation, "Add Example"
    
End Sub

Sub Example_Add_PointGroupNames()
    
    ' This example starts by displays the initial count of the PointGroupNames
    ' for the first surface in the collection. A new PointGroupName is added
    ' and the count is redisplays. Finally, the new file is deleted. The count is
    ' displayed again, showing the deletion.
    Dim surf As AeccSurface
    Dim pntGrpNames As AeccPointGroupNames
    Set surf = AeccApplication.ActiveProject.Surfaces.Item(0)
    Set pntGrpNames = surf.Inputs.PointGroupNames
    
    MsgBox "The PointGroupNames Count is: " & pntGrpNames.Count, vbInformation, "Add Example"
    
    ' Add a new PointGroupName
    pntGrpNames.Add "NewPointGroupName"
    
    MsgBox "The PointGroupNames Count after the add is: " & pntGrpNames.Count, vbInformation, "Add Example"
    
    ' Delete the new PointGroupName
    pntGrpNames.Delete "NewPointGroupName"
    
    MsgBox "The PointGroupNames Count after the delete is " & pntGrpNames.Count, vbInformation, "Add Example"
    
End Sub

Sub Example_Add_PointGroups()
    
    ' This function adds a new PointGroup named "New Group".
    Dim pntGrps As AeccPointGroups
    Dim newPntGrp As AeccPointGroup
    Set pntGrps = AeccApplication.ActiveProject.PointGroups
    
    ' Show the number of alignments in the project
    MsgBox "The initial Count of PointGroups is: " & pntGrps.Count, vbInformation, "Add Example"
    
    ' Add PointGroup
    Set newPntGrp = pntGrps.Add("Example Group", "1-10, 20-30")
    
    ' Show the number of alignments in the project after the Add
    MsgBox "The Count of PointGroups is: " & pntGrps.Count, vbInformation, "Add Example"
    
End Sub

Sub Example_Add_Projects()
    
    ' This example creates a new project.
    Dim projs As AeccProjects
    Set projs = AeccApplication.Projects
    
    ' Show the number of projects
    MsgBox "The initial Count of Projects is: " & projs.Count, vbInformation, "Add Example"
    
    projs.Add "New Project", "Default (Feet)"
    
    ' Show the number of projects after the Add
    MsgBox "The Count of Projects is: " & projs.Count, vbInformation, "Add Example"
    
End Sub

Sub Example_Add_PVIs()
    
    'This example adds a PVI in the first finished
    'ground profile of 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)
    
    MsgBox "The number of PVIs in the finished ground profiles is: " _
        & FGProf.PVIs.Count, vbInformation, "Add Example"
    
    'Get the station, elevation, and curve length
    Dim station As Double
    Dim elevation As Double
    Dim curvelength As Double
    station = ThisDrawing.Utility.GetReal("Enter a station on finished grade profile: ")
    elevation = ThisDrawing.Utility.GetReal("Enter an elevation on finished grade profile: ")
    station = ThisDrawing.Utility.GetReal("Enter a curve length on finished grade profile: ")
    
    'Add the PVI
    FGProf.PVIs.Add station, elevation, curvelength
    
    MsgBox "The number of PVIs in the finished ground profiles is: " _
        & FGProf.PVIs.Count, vbInformation, "Add Example"
    
End Sub

Sub Example_Add_StationEquations()
    
    ' This example adds a StationEquation to
    ' the first alignment in the collection.
    Dim aligns As AeccAlignments
    Dim align As AeccAlignment
    Set aligns = AeccApplication.ActiveProject.Alignments
    
    ' Get the first alignment
    Set align = aligns.Item(0)
    
    ' Set the first alignment current.
    aligns.CurrentAlignment = align.Name
    
    Dim staEqus As AeccStationEquations
    Dim staEqu As AeccStationEquation
    Set staEqus = align.StationEquations
    
    ' Show the StationEquation count for the first alignment
    MsgBox "The StationEquation count for the first alignment is: " & staEqus.count, _
        vbInformation, "Add Example"
    
    ' Add a new StationEquations
    Set staEqu = staEqus.Add(100, 50, kIncreasing)
    
    ' Show the stationEquation count after the add
    MsgBox "The StationEquation count for the first alignment is: " & staEqus.count, _
        vbInformation, "Add Example"
    
     End; Sub

Sub Example_Add_Surfaces()
    
    ' This example creates a new Surface and adds it to the Surfaces collection
    
    Dim surfs As AeccSurfaces
    Set surfs = AeccApplication.ActiveProject.Surfaces
    
    Surfs.Add "New Surface"
    
    MsgBox "The Number of Surfaces has increased to " & surfs.Count, vbInformation, "Add Example"
    
End Sub