RemoveAll Example

Land Auto

RemoveAll Example

Examples:

l Alignment

l StationEquations


Sub Example_RemoveAll_Alignment()
    
    ' This example adds an Alignment made up of a tangent.
    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
    Dim tangent As AeccAlignTangent
    Set tangent = align.AddTangent(0#, 0#, 150#, 0#)
    
    MsgBox "The total number of entities in the Alignment is: " & align.AlignEntities.Count, vbInformation, "RemoveAll Example"
    
    ' Remove the entities from the alignment
    align.RemoveAll
    
    MsgBox "The total number of entities in the Alignment is: " & align.AlignEntities.Count, vbInformation, "RemoveAll Example"
    
End Sub

Sub Example_RemoveAll_StationEquations()
    
    ' This example removes all 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
    
    ' Show then StationEquation count for the first alignment
    MsgBox "The StationEquation count for the first alignment is: " & align.StationEquations.count, vbInformation, "RemoveAll Example"
    
    ' Remove all StationEquations
    align.StationEquations.RemoveAll
    
    ' Show the StationEquation count as zero after the remove all
    MsgBox "The StationEquation count for the first alignment is: " & align.StationEquations.count, vbInformation, "RemoveAll Example"
    
End Sub