Delete Example
Examples:
l DEMFiles
l EGProfiles (Civil Engineering Feature)
l FGProfiles (Civil Engineering Feature)
l Parcels
l Projects
l PVIs (Civil Engineering Feature)
l Surfaces
Sub Example_Delete_Alignments()
' This example deletes an Alignment from the Alignments Collection
Dim aligns As AeccAlignments
Set aligns = AeccApplication.ActiveProject.Alignments
' Show the number of alignments in the project
MsgBox "The initial Count of Alignments is: " & aligns.Count, vbInformation, "Delete Example"
' Add an Alignment named New Alignment and starting at Station 2000
aligns.Add "New Alignment", 2000
' Show the number of alignments in the project
MsgBox "The Count of Alignments after Add is: " & aligns.Count, vbInformation, "Delete Example"
' Deletes the Alignment named New Alignment
aligns.Delete "New Alignment"
' Show the number of alignments in the project
MsgBox "The Count of Alignments after Delete is: " & aligns.Count, vbInformation, "Delete Example"
End Sub
Sub Example_Delete_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, "Delete 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, "Delete Example"
' Delete the new Boundary
bounds.Delete Bound.Id
MsgBox "The Boundaries Count after the delete is " & bounds.count, vbInformation, "Delete Example"
End Sub
Sub Example_Delete_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, "Delete 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, "Delete Example"
' Delete the new BreakLines
brkLines.Delete brkLine.Id
MsgBox "The BreakLines Count after the delete is " & brkLines.count, vbInformation, "Delete Example"
End Sub
Sub Example_Delete_CogoPoints()
' This examples displays the used point numbers, deletes a point number
' and the displays the used point numbers again to confirm the deletion.
Dim cogoPnts As AeccCogoPoints
Set cogoPnts = AeccApplication.ActiveProject.CogoPoints
MsgBox "Used point numbers are " & cogoPnts.UsedPointNumbers, _
vbInformation, "Delete Example"
' Get a point number
Dim pntNum As Long
pntNum = ThisDrawing.Utility.GetReal("Enter a valid point number : ")
pntNum = Fix(pntNum)
' Delete the CogoPoint
cogoPnts.Delete pntNum
MsgBox "Used point numbers are " & cogoPnts.UsedPointNumbers, _
vbInformation, "Delete Example"
End Sub
Sub Example_Delete_ContourItems()
' This example Deletes the ContourItem with ID equal to one (1)
' from the first collection of 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 delete
MsgBox "The number of ContourItems in the collection is: " & conts.Count, _
vbInformation, "Delete Example"
' Delete ContourItem with ID equal to one.
conts.Delete 1
' Display the number of ContourItems in the collection after the delete
MsgBox "The number of ContourItems in the collection is: " & conts.Count, _
vbInformation, "Delete Example"
End Sub
Sub Example_Delete_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, "Delete 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, "Delete Example"
' Delete the new DEMFile
DEMFiles.Delete DEMName
MsgBox "The DEMFiles Count after the delete is " & DEMFiles.Count, vbInformation, "Delete Example"
End Sub
Sub Example_Delete_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, "Delete Example"
' Add a new DescriptionKey
dkeyFile.Add "New"
MsgBox "The DescriptionKey Count is " & dkeyFile.count, vbInformation, "Delete Example"
' Delete the new DescriptionKey
dkeyFile.Delete "New"
MsgBox "The DescriptionKey Count is " & dkeyFile.count, vbInformation, "Delete Example"
End Sub
Sub Example_Delete_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, "Delete Example"
' Add a new DescriptionKeyFile
dKeyFiles.Add "NewFile"
MsgBox "The DescriptionKeyFiles Count is " & dKeyFiles.count, vbInformation, "Delete Example"
' Delete the new DescriptionKeyFile
dKeyFiles.Delete "NewFile"
MsgBox "The DescriptionKeyFiles Count is " & dKeyFiles.count, vbInformation, "Delete Example"
End Sub
Sub Example_Delete_EGProfiles()
' This example deletes 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)
MsgBox "The number of existing ground profiles in the first alignment is: " _
& align.EGProfiles.Count, vbInformation, "Delete Example"
Dim surfName As String
Dim offset As Integer
surfName = EGProf.SurfaceName
offset = EGProf.Type
' Delete the profile
align.EGProfiles.Delete offset, surfName
MsgBox "The number of existing ground profiles in the first alignment is: " _
& align.EGProfiles.Count, vbInformation, "Delete Example"
End Sub
Sub Example_Delete_FGProfiles()
' This example deletes 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)
MsgBox "The number of finished ground profiles in the first alignment is: " _
& align.fGProfiles.Count, vbInformation, "Delete Example"
Dim offset As Integer
offset = FGProf.Type
' Delete the profile
align.FGProfiles.Delete offset
MsgBox "The number of finished ground profiles in the first alignment is: " _
& align.FGProfiles.Count, vbInformation, "Delete Example"
End Sub
Sub Example_Delete_Parcels()
' This example starts by displaying 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_Delete_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, "Delete Example"
' Add a new PointFile
pntFiles.Add "NewPointFile"
MsgBox "The PointFiles Count after the add is: " & pntFiles.Count, vbInformation, "Delete Example"
' Delete the new PointFile
pntFiles.Delete "NewPointFile"
MsgBox "The PointFiles Count after the delete is " & pntFiles.Count, vbInformation, "Delete Example"
End Sub
Sub Example_Delete_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, "Delete Example"
' Add a new PointGroupName
pntGrpNames.Add "NewPointGroupName"
MsgBox "The PointGroupNames Count after the add is: " & pntGrpNames.Count, vbInformation, "Delete Example"
' Delete the new PointGroupName
pntGrpNames.Delete "NewPointGroupName"
MsgBox "The PointGroupNames Count after the delete is " & pntGrpNames.Count, vbInformation, "Delete Example"
End Sub
Sub Example_Delete_Projects()
' This example creates a new project named "New Project" and then
' deletes the project. A project count is displayed during the process.
Dim projs As AeccProjects
Set projs = AeccApplication.Projects
' Show the number of projects
MsgBox "The initial Count of Projects is: " & projs.Count, vbInformation, "Delete Example"
projs.Add "New Project", "Default (Feet)"
' Show the number of projects after the Add
MsgBox "The Count of Projects after Add is: " & projs.Count, vbInformation, "Delete Example"
projs.Delete "New Project"
' Show the number of projects after the Delete
MsgBox "The Count of Projects after Delete is: " & projs.Count, vbInformation, "Delete Example"
End Sub
Sub Example_Delete_Prototypes()
' This example deletes the first prototype in the collection.
Dim prots As AeccPrototypes
Dim prot As AeccPrototype
Set prots = AeccApplication.Prototypes
Set prot = prots.Item(0)
' Get the source prototype names
Dim source As String
source = prot.Name
' Delete the prototype
prots.Delete source
MsgBox "The deleted prototype was named: " & source, vbInformation, "Delete Example"
End Sub
Sub Example_Delete_PointGroups()
' This example adds and deletes a PointGroup from the PoinGroups Collection.
Dim pntGrps As AeccPointGroups
Set pntGrps = AeccApplication.ActiveProject.PointGroups
' Show the number of PointGroups in the project
MsgBox "The initial Count of PointGroups is: " & pntGrps.Count, vbInformation, "Delete Example"
' Add PointGroup
pntGrps.Add "New Group", "1-100"
' Show the number of PointGroups in the project after the Add
MsgBox "The Count of PointGroups is: " & pntGrps.Count, vbInformation, "Delete Example"
' Deletes the PointGroup named "New Group"
pntGrps.Delete "New Group"
' Show the number of PointGroups in the project after the Delete
MsgBox "The Count of PointGroups is: " & pntGrps.Count, vbInformation, "Delete Example"
End Sub
Sub Example_Delete_PVIs()
' This example deletes the second PVI in the first finished
' ground profile 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 number of PVIs in the finished ground profile is: " _
& FGProf.PVIs.Count, vbInformation, "Delete Example"
' Get the station and the elevation
Dim station As Double
station = PVI.station
' Delete the second PVI
FGProf.PVIs.Delete station
MsgBox "The number of PVIs in the finished ground profile is: " _
& FGProf.PVIs.Count, vbInformation, "Delete Example"
End Sub
Sub Example_Delete_StationEquations()
' This example deletes the first StationEquations from
' 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
Set staEqus = align.StationEquations
' Show the StationEquation count for the first alignment before the delete
MsgBox "The StationEquation count for the first alignment is: " & staEqus.count, _
vbInformation, "Delete Example"
' Delete the first StationEquation
staEqus.Delete(0)
' Show the StationEquation count for the first alignment after the delete
MsgBox "The StationEquation count for the first alignment is: " & staEqus.count, _
vbInformation, "Delete Example"
End Sub
Sub Example_Delete_Surfaces()
' This example deletes the first surface from the collection.
Dim surfs As AeccSurfaces
Dim surf As AeccSurface
Set surfs = AeccApplication.ActiveProject.Surfaces
Set surf = surfs.Item(0)
' Get the name of the first surface in the collection
Dim surfName As String
surfName = surf.Name
' Show the Surfaces count before the delete
MsgBox "The Surface count is: " & surfs.Count, vbInformation, "Delete Example"
' Delete the first StationEquation
surfs.Delete (surfName)
' Show the Surfaces count after the delete
MsgBox "The Surfaces count is: " & surfs.Count, vbInformation, "Delete Example"
End Sub