AutoSave Example

Land Auto

AutoSave Example

Examples:

l Alignments

l CogoPoints

l DescriptionKeyFiles

l PointGroups


Sub Example_AutoSave_Alignments()
    
    ' This example changes the Description and StartingStation
    ' for the first alignment in the collection.
    Dim aligns As AeccAlignments
    Dim align As AeccAlignment
    Set aligns = AeccApplication.ActiveProject.Alignments
    Set align = Aligns.Item(0)
    
    ' Make the first alignment in the collection current
    aligns.CurrentAlignment = align.Name
    
    ' Set AutoSave to FALSE to prevent writing the changes
    ' until they are all made
    aligns.AutoSave = False
    
    ' Make changes
    align.Description = "New Description"
    align.StartingStation = 20#
    
    ' Save changes
    align.Save
    
    ' Reset AutoSave to the default state of TRUE
    aligns.AutoSave = True
    
    MsgBox "The first Alignments Description is: " & align.Description & vbCrLf & _
        "The first Alignments StartingStation is: " & align.StartingStation, _
        vbInformation, "AutoSave Example"
    
End Sub

Sub Example_AutoSave_CogoPoints()
    
    ' This example changes the Northing, Easting, and Elevation
    ' for the first CogoPoint in the collection.
    Dim cogoPnts As AeccCogoPoints
    Dim cogoPnt As AeccCogoPoint
    Set cogoPnts = AeccApplication.ActiveProject.CogoPoints
    Set cogoPnt = cogoPnts.Item(0)
    
    ' Set AutoSave to FALSE to prevent writing the changes
    ' until they are all made
    cogoPnts.AutoSave = False
    
    ' Make changes
    cogoPnt.Northing = 100#
    cogoPnt.Easting = 100#
    cogoPnt.Elevation = 150#
    
    ' Save changes
    cogoPnt.Save
    
    ' Reset AutoSave to the default state of TRUE
    cogoPnts.AutoSave = True
    
    MsgBox "The following changes were made to CogoPoint " & cogoPnt.Number & ":" & vbCrLf & _
        "   Northing: " & cogoPnt.Northing & vbCrLf & _
        "   Easting: " & cogoPnt.Easting & vbCrLf & _
        "   Elevation: " & cogoPnt.Elevation, vbInformation, "AutoSave Example"
    
End Sub

Sub Example_AutoSave_DescriptionKeyFiles()
    
    ' This example changes the layer settings
    ' for the first DescriptionKey in the collection.
    Dim dKeyFiles As AeccDescriptionKeyFiles
    Dim dKeyFile As AeccDescriptionKeyFile
    Dim dKey As AeccDescriptionKey
    Set dKeyFiles = AeccApplication.ActiveProject.DescriptionKeyFiles
    Set dKeyFile = dKeyFiles.Item(0)
    Set dKey = dKeyFile.Item(0)
    
    ' Set AutoSave to FALSE to prevent writing the changes
    ' until they are all made
    dKeyFiles.AutoSave = False
    
    ' Make changes
    dKey.DescriptionLayer = "dKey Desc"
    dKey.SymbolLayer = "dKey Symb"
    
    ' Save changes
    dKey.Save
    
    ' Reset AutoSave to the default state of TRUE
    dKeyFiles.AutoSave = True
    
    MsgBox "The DescriptionLayer is: " & dkey.DescriptionLayer & vbCrLf & _
        "The SymbolLayer is: " & dkey.SymbolLayer, vbInformation, "AutoSave Example"
    
End Sub

Sub Example_AutoSave_PointGroups()
    
    ' This example changes the Description and Elevation
    ' for the first PointGroup in the collection.
    Dim pntGrps As AeccPointGroups
    Dim pntGrp As AeccPointGroup
    Set pntGrps = AeccApplication.ActiveProject.PointGroups
    Set pntGrp = pntGrps.Item(0)
    
    ' Set AutoSave to FALSE to prevent writing the changes
    ' until they are all made
    pntGrps.AutoSave = False
    
    ' Make changes
    pntGrp.Description = "New Description"
    pntGrp.Elevation = 100#
    
    ' Save changes
    pntGrp.Save
    
    ' Reset AutoSave to the default state of TRUE
    pntGrps.AutoSave = True
    
    MsgBox "The first PointGroup Description is: " & pntGrp.Description & vbCrLf & _
        "The first PointGroup Elevation is: " & pntGrp.Elevation, vbInformation, "AutoSave Example"
    
End Sub