I am trying to find a way to attach an mleader (Acad 2008) to an existing text or mtext object. I don't see a way in the active-x object model to do this, and can't decipher the enames in the entity list. Any pointers are appreciated. The following code selects the text object and creates the leader, but I see no way to make the association between the two:
(defun c:mlte (/) (c:MLeaderToExistingtext))
(defun c:MLeaderToExistingtext (/)
(cond
;;Select the text/mtext objects
((or
(null (setq ss1 (ssget ":S" '((0 . "text,mtext")))))
(= 0 (setq ssl (sslength ss1)))
)
nil ;nothing selected
)
(T
(setq
Textobj (vlax-ename->vla-object (ssname ss1 0))
ActSpace (if (= 0 (getvar "cvport"))
(vla-get-paperspace
(vla-get-activedocument (vlax-get-acad-object))
)
(vla-get-modelspace
(vla-get-activedocument (vlax-get-acad-object))
)
)
StartPt (getpoint "\nPick location for point of arrow head: ")
TextPt (vla-get-insertionpoint textobj)
TextPt (vlax-variant-value TextPt)
TextPt (vlax-safearray->list TextPt)
ptlist (vlax-make-safearray
vlax-vbdouble
'(0 . 5)
)
ptlist (vlax-safearray-fill ptlist (append StartPt TextPt))
MLObj (vla-addmleader
ActSpace
ptlist
'LeaderIndex
)
)
)
)
)