LineIntersection Example

Land Auto

LineIntersection Example

Sub Example_LineIntersection()
    
    ' This example gets the LineIntersection from a user supplied point
    ' for the first Alignment in the collection..
    Dim align As AeccAlignment
    Set align = AeccApplication.ActiveProject.Alignments.Item(0)
    
    Dim pnt1 As Variant
    Dim pnt2 As Variant
    Dim coords As Variant
    
    ' Get the points
    pnt1 = ThisDrawing.Utility.GetPoint(, "Enter the first point near the first alignment: ")
    pnt2 = ThisDrawing.Utility.GetPoint(, "Enter the second point near the first alignment: ")
    
    ' Get the line intersection location
    coords = align.LineIntersection(pnt1(0), pnt1(1), pnt2(0), pnt2(1))
    
    MsgBox "The LineIntersection for the first Alignment is:" & vbCrLf & _
        "   Station: " & coords(0) & vbCrLf & _
        "   Direction: " & coords(1) & vbCrLf & _
        "   Easting: " & coords(2) & vbCrLf & _
        "   Northing: " & coords(3), vbInformation, "LineIntersection Example"
    
End Sub