Leaders

Jun 6, 2015 at 2:34 PM
Is there any way to create Leaders or any plans to add them?
Coordinator
Jun 8, 2015 at 3:34 PM
Neither the LEADER nor the more modern MLEADER entities are implemented. I'll see what I can do, but do not expect them any time soon.

Daniel
Jun 8, 2015 at 3:41 PM
Ok, thanks.
Aug 26, 2015 at 3:19 PM
Too bad. I need'em too. :(

Do you have anything alternative to make my own leader as a block?
Coordinator
Aug 31, 2015 at 5:22 PM
You will have to wait a little bit longer. I am planning to add the Leader entity in the next update, only the Leader not the more modern MLeader that is a lot more complex, check the dxf documentation for more information about this.

A Leader is basically a polyline with an arrowhead at one end and a text, tolerance, or insert at the other.

Daniel
Sep 14, 2015 at 11:37 PM
Edited Sep 14, 2015 at 11:42 PM
Public Sub Leader(ByVal X1 As Double, ByVal Y1 As Double, ByVal X2 As Double, ByVal Y2 As Double, RightorLeft As Boolean, ByVal Text As String, _
               ByVal Textwidth As Double, ByRef dxf As DxfDocument)


    'leader line
    Dim LeaderLine As New Entities.Line(New Vector2(X1, Y1), New Vector2(X2, Y2))
    LeaderLine.Layer = LayerHere
    dxf.AddEntity(LeaderLine)

    'getting angle of leader line
    Dim leaderangle = System.Math.Atan((Y2 - Y1) / (X2 - X1))

    'arrow as it relates to angle and leader line
    If X2 < X1 Then
        Dim arrowleft As New Entities.Solid(New Vector2(X1, Y1), New Vector2(X1 + System.Math.Cos(leaderangle + 9.25) * 12.165525, Y1 + System.Math.Sin(leaderangle + 9.25) * 12.165525),
                                        New Vector2(X1 + System.Math.Cos(leaderangle - 9.25) * 12.165525, Y1 + System.Math.Sin(leaderangle - 9.25) * 12.165525), New Vector2(X1, Y1))
        arrowleft.Layer = LayerHere
        dxf.AddEntity(arrowleft)
    Else
        Dim arrowright As New Entities.Solid(New Vector2(X1, Y1), New Vector2(X1 + -1 * (System.Math.Cos(leaderangle + 9.25) * 12.165525), Y1 + -1 * (System.Math.Sin(leaderangle + 9.25) * 12.165525)),
                            New Vector2(X1 + -1 * (System.Math.Cos(leaderangle - 9.25) * 12.165525), Y1 + -1 * (System.Math.Sin(leaderangle - 9.25) * 12.165525)), New Vector2(X1, Y1))
        arrowright.Layer = LayerHere
        dxf.AddEntity(arrowright)

    End If

    'leader points left or right and Mtext position
    If RightorLeft = True Then
        Dim PointerRight As New Entities.Line(New Vector2(X2, Y2), New Vector2(X2 + 12, Y2))
        PointerRight.Layer = LayerHere
        dxf.AddEntity(PointerRight)


        Dim saysomethingelse As New Entities.MText(Text, New Vector2(X2 + 18, Y2 + 3), 6, Textwidth, TextsyleHere)
        saysomethingelse.Layer = LayerHere
        saysomethingelse.AttachmentPoint = Entities.MTextAttachmentPoint.TopLeft
        dxf.AddEntity(saysomethingelse)

    Else
        Dim PointerLeft As New Entities.Line(New Vector2(X2, Y2), New Vector2(X2 - 12, Y2))
        PointerLeft.Layer = LayerHere
        dxf.AddEntity(PointerLeft)

        Dim saysomethingelse As New Entities.MText(Text, New Vector2(X2 - 18, Y2 - 3), 6, Textwidth, TextsyleHere)
        saysomethingelse.Layer = LayerHere
        saysomethingelse.AttachmentPoint = Entities.MTextAttachmentPoint.BottomRight
        dxf.AddEntity(saysomethingelse)

    End If

End Sub
This is what I have resorted to to make a leader work you would have to put in you own layer and textstyles

x1 and y1 are the start coordinates
x2 and y2 end coordinates
true is right and false is left
add your text
and because it is mtext you get to specify a width