Hi,
Besides the TextNote class, the Leader class has the Elbow and End properties is what you are looking for to create something like your image.
Things to remind are; what is your current active view scale and text style (text height) you are to execute the command/macro.
The Leader is influenced by changing it's active view scale and text style properties, keep that in mind if you want to place the leader in all kinds of different view scale.
Let's say the active view scale is 1:100 and the current text style (height) is 2.5 mm, something like this will do (converted macro C# to VB.NET);
Public Sub CreateTwoSegmentsLeader()
' this macro is tested with a metric(mm) project unit setting
Dim uidoc As UIDocument = Me.ActiveUIDocument
Dim doc As Document = uidoc.Document
Dim width As Double = 0.15
' check current textstyle (2.5mm) and viewscale (1:100)
' check current leader arrowhead is the one you want to use
Dim options As New TextNoteOptions()
options.TypeId = doc.GetDefaultElementTypeId(ElementTypeGroup.TextNoteType)
options.HorizontalAlignment = HorizontalTextAlignment.Left
Dim point As XYZ = uidoc.Selection.PickPoint()
Using t As New Transaction(doc, "Create Empty Text Note")
t.Start()
Dim note As TextNote = TextNote.Create(doc, uidoc.ActiveView.Id, point, width, " ", options)
Dim l As Leader = note.AddLeader(TextNoteLeaderTypes.TNLT_STRAIGHT_L)
' change Y-coordinate when use different textstyle or viewscale
l.Elbow = New XYZ(-5.0, -0.6315616797901, 0.0) + point
l.[End] = New XYZ(-5.0, -5.0, 0.0) + point
t.Commit()
End Using
End Sub
You should also refer to the Revit Lookup tool (go to->Methods -> GetLeaders - List'1) to determine the 'Y-coordinate' of the 'Anchor' and 'Elbow' property of the Leader and how accurate you want to set.
The less accurate the more 'wiggle' the line appears, that's what i had observed.
Hope this is useful for you and good luck.