@Sea-Haven wrote:
... this way becomes a bit more global working for any block. Typing a number is a bit quicker than a tagname.
I like the idea of making the code more generic 👍 We might as well do that with this one..
(defun c:demo (/ _init ss source sourceID)
(defun _init (l)
( (lambda (init choice)
(foreach str l
(setq init (Strcat init (car str) " ")
choice (Strcat choice (car str) " " (Cadr str) "/")))
(list init choice 2)
) "" "")
)
(if (and
(princ "\nSelect Callout")
(setq ss (ssget "_+.:S:E:L" '((0 . "MULTILEADER"))))
(princ "\nSelect Source")
(setq source (ssget "_+.:S:E" '((0 . "INSERT") (66 . 1))))
)
(progn
( (lambda (i)
(setq attVal (mapcar '(lambda (att)
(list (itoa (setq i (1+ i)))
(strcat (vla-get-tagstring att))
(itoa (vla-get-objectid att))
)
)
(vlax-invoke
(vlax-ename->vla-object (ssname source 0))
'GetAttributes
)
)
))
0)
(setq choices (_INIT attVal))
(initget 1 (Car choices))
(setq option (getkword (strcat "\nChoose option [" (Cadr choices) "]: ")))
(setq sourceID (caddr (nth (1- (atoi option)) attVal)))
(setpropertyvalue
(ssname ss 0)
"MText/Contents"
(strcat "F/N "
"%<\\AcObjProp Object(%<\\_ObjId "
sourceID
">%).TextString>%"
)
)
)
)
(princ)
)
Either you click on the choice of type in a number
It this particular demo code
Command: DEMO
Select Callout
Select objects:
Choose option [1 PARTNUMBER/2 FINDNUMBER/3 DESCRIPTION/]:
HTH