Import Example

Land Auto

Import Example

Examples:

l Alignment

l CrossSection (Civil Engineering Feature)

l EGProfile (Civil Engineering Feature)

l Parcel

l Surface


Sub Example_Import_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#)
    
    ' Import the alignment to the drawing
    align.Import
    
    MsgBox "The total number of entities in the Alignment is: " & align.AlignEntities.Count, _
        vbInformation, "Import Example"
    
End Sub

Sub Example_Import_CrossSection()
    
    ' This example inserts the first cross section in the
    ' cross section collection for the first alignment in the collection.
    Dim aligns As AeccAlignments
    Dim align As AeccAlignment
    Dim xSect As AeccCrossSection
    Set aligns = AeccApplication.ActiveProject.Alignments
    Set align = aligns.Item(0)
    Set xSect = align.CrossSections.Item(0)
    
    ' Get the cross section station and format it
    Dim station As String
    station = aligns.DoubleToStaFormat(xSect.station)
    
    ' Get the insertion point for the cross section
    Dim returnPnt As Variant
    returnPnt = ThisDrawing.Utility.GetPoint _
        (, "Select bottom insertion point for the cross setion at station " & station & ":")
    
    ' Import cross section with complete geometry
    xSect.import returnPnt, False
    
End Sub

Sub Example_Import_EGProfile()
    
    ' This example imports the the first existing ground profile
    ' in the first alignment in the collection.
    Dim aligns As AeccAlignments
    Dim align As AeccAlignment
    Dim EGProf As AeccEGProfile
    Set aligns = AeccApplication.ActiveProject.Alignments
    Set align = aligns.Item(0)
    Set EGProf = align.EGProfiles.Item(0)
    
    'Set the name of the first alignment to the current alignment
    aligns.CurrentAlignment = align.Name
    
    'Determine default starting and ending station
    Dim min As Double
    Dim asta As Variant
    asta = EGProf.StationElevations
    min = asta(1)
    
    Dim i As Integer
    For i = 0 To UBound(asta) - 1 Step 2
        If asta(i + 1) < min Then
            min = asta(i + 1)
        End If
    Next
    
    'Get the start point for the existing ground profile
    Dim returnPnt As Variant
    returnPnt = ThisDrawing.Utility.GetPoint(, "Select a starting point:")
    
    On Error Resume Next
    
    'Get gtating station
    Dim startSta As Double
    startSta = asta(0)
    startSta = ThisDrawing.Utility.GetReal("Starting Station <" & startSta & ">: ")
    
    'Get ending station
    Dim endSta As Double
    endSta = asta(UBound(asta) - 1)
    endSta = ThisDrawing.Utility.GetReal("Ending Station: <" & endSta & ">: ")
    
    'Get datum elevation
    Dim datumElev As Double
    datumElev = min
    datumElev = ThisDrawing.Utility.GetReal("Datum Elevation: <" & datumElev & ">: ")
    
    'Get vertical scale
    Dim vertScale As Double
    Dim pref As AeccDatabasePreferences
    Set pref = AeccApplication.ActiveDocument.Preferences
    vertScale = pref.VerticalScale
    vertScale = ThisDrawing.Utility.GetReal("Vertical Scale: <" & vertScale & ">: ")
    
    'Get direction
    Dim dir As Boolean
    dir = True
    Dim ans As String
    ans = ThisDrawing.Utility.GetString(0, "Direction LeftToRight (Y/N): ")
    dir = Switch(ans = "Y", True, ans = "y", True, ans = "N", False, ans = "n", False)
    
    'Get block only
    Dim block As Boolean
    block = True
    Dim ans As String
    ans = ThisDrawing.Utility.GetString(0, "Block only (Y/N): ")
    block = Switch(ans = "Y", True, ans = "y", True, ans = "N", False, ans = "n", False)
    
    'Import the existing ground profile
    EGProf.import returnPnt, startSta, endSta, datumElev, vertScale, dir, block
    
End Sub

Sub Example_Import_Parcel()
    
    ' This example adds a Parcel made up of lines and an arc.
    ' The parcel is then imported into the drawing.
    Dim parcels As AeccParcels
    Dim parcel As AeccParcel
    Set parcels = AeccApplication.ActiveProject.parcels
    
    ' Add a new Parcel
    Set parcel = parcels.Add("New Parcel")
    
    ' Add lines and a curve to the Parcel
    parcel.AddLine 50#, 50#, 150#, 50#
    parcel.AddLine 150#, 50#, 150#, 200#
    parcel.AddCurve 150#, 200#, 100#, 200#, 50#, 200#, True
    parcel.AddLine 50#, 200#, 50#, 50#
    
    ' Import the new Parcel
    parcel.Import
    
    MsgBox "The total number of entities in the parcel is: " & parcel.ParcelEntities.Count, _
        vbInformation, "Import Example"
    
End Sub

Sub Example_Import_Surface()
    
    ' This example draws the first surface in the collection.
    Dim surf As AeccSurface
    Set surf = AeccApplication.ActiveProject.Surfaces.Item(0)
    
    surf.Import
    
    MsgBox "The Name of the first surface just imported is: " & surf.Name, _
        vbInformation, "Import Example"
    
End Sub