Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

QLeader Code

Status
Not open for further replies.

RufussMcGee

Technical User
Jan 7, 2005
117
US
The following code will add a leader to the drawing but what I am looking for is something like qleader whereas I have text to follow the leader and act as one.

Sub addleader_example()
Dim objLeader As AcadLeader
Dim dblPoints(0 To 8) As Double
Dim intleadertype As Integer
Dim objannotation As AcadObject
Dim objText As String

dblPoints(0) = 0: dblPoints(1) = 0: dblPoints(2) = 0:
dblPoints(3) = 3: dblPoints(4) = 3: dblPoints(5) = 0:
dblPoints(6) = 6: dblPoints(7) = 3: dblPoints(6) = 0:
intleadertype = acLineWithArrow
Set objannotation = Nothing

Set objLeader = ThisDrawing.ModelSpace.AddLeader(dblPoints, objannotation, intleadertype)
objLeader.Update
End Sub

So my question is how do I get these results?

Thanks
 
Hi Rufuss,

Try this (changes/additions are in red):
Code:
Sub addleader_example()
    Dim objLeader As AcadLeader
    Dim dblPoints(0 To 8) As Double
    Dim intleadertype As Integer
    Dim objannotation As AcadObject
    Dim objText As String
    [red]
    Dim MTextObj As AcadMText
    Dim strText As String
    Dim insPnt(0 To 2) As Double
    Dim dblWid As Double
    [/red]
    dblPoints(0) = 0:   dblPoints(1) = 0:   dblPoints(2) = 0:
    dblPoints(3) = 3:   dblPoints(4) = 3:   dblPoints(5) = 0:
    dblPoints(6) = 6:   dblPoints(7) = 3:   dblPoints([red]8[/red]) = 0:
    intleadertype = acLineWithArrow
    [red]
    ' Set the insertion point for the mtext object.
    '
    insPnt(0) = dblPoints(6)
    insPnt(1) = dblPoints(7)
    insPnt(2) = dblPoints(8)
    
    ' Set the mtext width.
    '
    dblWid = 3
    
    strText = "Annotation here"
    Set MTextObj = ThisDrawing.ModelSpace.AddMText(insPnt, dblWid, strText)
    Set objannotation = MTextObj
    [/red]           
    Set objLeader = ThisDrawing.ModelSpace.AddLeader(dblPoints, objannotation, intleadertype)
    objLeader.Annotation
    objLeader.Update
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top