Coordinates Example
Examples:
l Boundary
l CrossSectionBlock (Civil Engineering Feature)
l Edge
l Face
l ProfileBlock (Civil Engineering Feature)
Sub Example_Coordinates_AeccContour()
' This example displays the Coordinates for a selected contour
On Error Resume Next
' Delete existing SelectionSet
ThisDrawing.SelectionSets("SSet").Delete
' Create the selection set based on a point selection
' and filter for Contour objects
Dim ssetObj As AcadSelectionSet
Set ssetObj = ThisDrawing.SelectionSets.Add("SSet")
Dim mode As Integer
Dim gpCode(0) As Integer
Dim dataValue(0) As Variant
gpCode(0) = 0
dataValue(0) = "AECC_CONTOUR"
Dim groupCode As Variant
Dim dataCode As Variant
Dim returnPnt As Variant
groupCode = gpCode
dataCode = dataValue
returnPnt = ThisDrawing.Utility.GetPoint(, "Enter a point on a contour line: ")
ssetObj.SelectAtPoint returnPnt, groupCode, dataCode
Dim objContour As AeccContour
Set objContour = ssetObj.Item(0)
Dim coords As Variant
coords = objContour.Coordinates
MsgBox "The first point in Coordinates is: " & coords(0) & ", " & coords(1) & ", " & coords(2), _
vbInformation, "Coordinates Example"
End Sub
Sub Example_Coordinates_Boundary()
' This example returns the first point in the Coordinates
' for the first Boundary in the collection.
Dim surf As AeccSurface
Dim bound As AeccBoundary
Set surf = AeccApplication.ActiveProject.Surfaces.Item(0)
Set bound = surf.Inputs.Boundaries.Item(0)
Dim coords As Variant
coords = bound.Coordinates
MsgBox "The first Coordinate for the Boundary is: " & coords(0) & ", " & coords(1) & ", " & coords(2) _
, vbInformation, "Coordinates Example"
End Sub
Sub Example_Coordinates_BreakLine()
' This example returns the first point in the Coordinates
' for the first BreakLine in the collection.
Dim surf As AeccSurface
Dim brkLine As AeccBreakLine
Set surf = AeccApplication.ActiveProject.Surfaces.Item(0)
Set brkLine = surf.Inputs.BreakLines.Item(0)
Dim coords As Variant
coords = brkLine.Coordinates
MsgBox "The first Coordinate for the BreakLine is: " & coords(0) & ", " & coords(1) & ", " & coords(2) _
, vbInformation, "Coordinates Example"
End Sub
Sub Example_Coordinates_CogoPoint()
' This example returns the Coordinate for the first CogoPoint in the collection
Dim cogoPnt As AeccCogoPoint
Set cogoPnt = AeccApplication.ActiveProject.CogoPoints.Item(0)
Dim coords As Variant
coords = cogoPnt.Coordinates
MsgBox "The Coordinates for the first CogoPoint in the collection is: " & coords(0) & ", " & coords(1) & ", " & coords(2)
End Sub
Sub Example_Coordinates_ContourItem()
' This example returns the first point in the Coordinates
' for the first ContourItem in the collection.
Dim surf As AeccSurface
Dim cont As AeccContourItem
Set surf = AeccApplication.ActiveProject.Surfaces.Item(0)
Set cont = Surf.Inputs.ContourItems.Item(0)
Dim coords As Variant
coords = cont.Coordinates
MsgBox "The first Coordinates for the ContourItem is: " & coords(0) & ", " & coords(1) & ", " & coords(2) _
, vbInformation, "Coordinates Example"
End Sub
Sub Example_Coordinates_CrossSectionBlock()
' This example returns the coordinates for the
' first alignment cross section in the collection.
Dim alignXSects As AeccCrossSectionBlocks
Dim alignXSect As AeccCrossSectionBlock
Set alignXSects = AeccApplication.ActiveDocument.CrossSectionBlocks
Set alignXSect = alignXSects.Item(0)
'Get the station for the first alignment cross section in the collection
Dim station As String
station = alignXSect.station
'Get the coordinates for the first alignment cross section in the collection
Dim coords As Variant
coords = alignXSect.Coordinates
MsgBox "The coordinates for the alignment cross section at station " & station & " is: " & vbCrLf & _
"X Value: " & Format(coords(0), "0.00") & vbCrLf & _
"Y Value: " & Format(coords(1), "0.00"), vbInformation, "Coordinates Example"
End Sub
Sub Example_Coordinates_Edge()
' This example returns the coordinates for the first
' Edge in the collection.
Dim surf As AeccSurface
Dim edge As AeccEdge
Set surf = AeccApplication.ActiveProject.Surfaces.Item(0)
Set edge = Surf.Outputs.Edges.Item(0)
Dim coords As Variant
coords = edge.Coordinates
MsgBox "The Coordinates for the first Edge are:" & vbCrLf & _
"FromNorthing: " & coords(0) & vbCrLf & _
"FromEasting: " & coords(1) & vbCrLf & _
"FromElevation: " & coords(2) & vbCrLf & _
"ToNorthing: " & coords(3) & vbCrLf & _
"ToEasting: " & coords(4) & vbCrLf & _
"ToElevation: " & coords(5), vbInformation, "Coordinates Example"
End Sub
Sub Example_Coordinates_ElevationContour()
' This example returns the first point in the coordinates for the
' first ElevationContour in the collection at 100.0
Dim surf As AeccSurface
Dim elevContours As AeccElevationContours
Dim elevContour As AeccElevationContour
Dim coords As Variant
Set surf = AeccApplication.ActiveProject.Surfaces.Item(0)
Set elevContours = Surf.Outputs.ElevationContours
'Create a collection of ElevationContours at 100.0
elevContours.Elevation = 100#
Set elevContour = elevContours.Item(0)
coords = elevContour.Coordinates
MsgBox "The first point in Coordinates is: " & coords(0) & ", " & coords(1) & ", " & coords(2), vbInformation, "Coordinates Example"
End Sub
Sub Example_Coordinates_Face()
' This example returns the Coordinates
' for the first Face in the collection.
Dim surf As AeccSurface
Dim face As AeccFace
Set Surf = AeccApplication.ActiveProject.Surfaces.Item(0)
Set face = surf.Outputs.faces.Item(0)
Dim coord As Variant
coord = face.Coordinates
MsgBox "The points for the first face are: " & vbCrLf & _
coord(0) & ", " & coord(1) & ", " & coord(2) & vbCrLf & _
coord(3) & ", " & coord(4) & ", " & coord(5) & vbCrLf & _
coord(6) & ", " & coord(7) & ", " & coord(8), vbInformation, "Coordinates Example"
End Sub
Sub Example_Coordinates_ProfileBlock()
' This example returns the Coordinate for the first ProfileBlock
' in the collection.
Dim alignProf As AeccProfileBlock
Set alignProf = AeccApplication.ActiveDocument.ProfileBlocks.Item(0)
Dim coords As Variant
coords = alignProf.Coordinates
MsgBox "The Coordinates for the first Alignment Profile are:" & vbCrLf & _
"X Value: " & Format(coords(0), "0.00") & vbCrLf & _
"Y Value: " & Format(coords(1), "0.00"), vbInformation, "Coordinates Example"
End Sub