SetReferenceCurve Example

Land Auto

SetReferenceCurve Example

Sub Example_SetReferenceCurve()
    
    ' This example uses the SetReferenceCurve method to attach curve text
    ' to a selected arc or circle
    
    Dim ent As AcadEntity
    Dim basePnt As Variant
    
    ' Pick the curve
    On Error Resume Next
    RETRY:
    Err.Clear
    ThisDrawing.Utility.GetEntity ent, basePnt, "Select a curve"
    If Err <> 0 Then
        ThisDrawing.Utility.Prompt "No entity found" + vbCrLf
        GoTo RETRY
    End If
    If ent.ObjectName <> "AcDbCircle" And _
        ent.ObjectName <> "AcDbArc" Then
        ThisDrawing.Utility.Prompt "Entity is not an arc or circle" + vbCrLf
        GoTo RETRY
    End If
    
    ' Attach the curve text
    Dim ctext As AeccCurveText
    Set ctext = ThisDrawing.ModelSpace.AddCustomObject("AecDbCurveText")
    
    ctext.SetReferenceCurve ent
    ctext.TextAbove = "ABOVE"
    ctext.TextBelow = "BELOW"
    
End Sub