LabelPoints Example

Land Auto

LabelPoints Example

Sub Example_LabelPoints()
    
    ' This example displays a LabelPoint 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(, "Select a contour line: ")
    ssetObj.SelectAtPoint returnPnt, groupCode, dataCode
    
    Dim objContour As AeccContour
    Set objContour = ssetObj.Item(0)
    Dim coords As Variant
    
    coords = objContour.LabelPoints
    
    MsgBox "The first point in LabelPoints is " & coords(0) & ", " & coords(0) & ", " & coords(2), _
        vbInformation, "LabelPoints Example"
    
End Sub