AddLabel Example

Land Auto

AddLabel Example

Sub Example_AddLabelAt()
    
    ' This example adds a label to a Contour object by selecting the
    ' 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 Ent As AeccContour
    Set Ent = ssetObj.Item(0)
    Ent.AddLabelAt returnPnt(0), returnPnt(1)
    
End Sub