Hi CAB -- It appears to me, based on nominal experimentation, that a LEADER has one hard pointer (340 group) to an associated TEXT entity and that said TEXT entity has a soft pointer (330 group) back to the LEADER. However, as you noted, there will be more than one 330 group present in the TEXT entity's data, as each entity has a soft pointer (330 group) to it's owner, e.g. MODELSPACE. The upshot being that using ASSOC on the TEXT entity's data will not work per the previous snip I posted for the LEADER's entity data. Fascinating Michael, truly rivoting.
Having said that, is there anything you need beyond this (assuming all you're doing is setting the current TEXTSTYLE and TEXTSIZE from a LEADER)?
;; If the specified leader entity has associated text, save the existing
;; textsize and textstyle, then set them according to the properties of
;; the associated text, then return the original properties to the caller
;; so that if need be, they can be restored later.
(defun SetTextStyleFromLeader ( LeaderEname / LeaderData TextEname TextData PreviousProperties )
(if (eq "LEADER" (cdr (assoc 0 (setq LeaderData (entget LeaderEname)))))
(if (setq TextEname (cdr (assoc 340 LeaderData)))
(cond
( (setq TextData (entget TextEname))
(setq PreviousProperties
(mapcar
'(lambda (varname) (cons varname (getvar varname)))
'("TextStyle" "TextSize")
)
)
(foreach pair '(("TextStyle" . 7)("TextSize" . 40))
(setvar (car pair) (cdr (assoc (cdr pair) TextData)))
)
;; return the previous properties to the caller
PreviousProperties
)
)
)
)
)
Example:
(SetTextStyleFromLeader ValidLeaderEname) ==> (("TextSize" . 0.18) ("TextStyle" . "Standard"))
Without too much effort this function could be made generic so that if it is at all possible to set the TEXTSIZE and TEXTSTYLE from the ename passed to the function it would, e.g. the passed ename corresponds to a LEADER, A DIMENSION, TEXT, MTEXT ... I'll let you code that one. :)
Cheers,
MP