I have a dynamic block that is a circle with an attribute, if i select the circle i can get the entity name of the block, how do i get the block entity name if i select the attribute?
if i select the attribute i just get the pick point and the attributes entity name
Thanks for your help.
(defun c:foo (/ CODE DTA ED INP KEY)
(setq inp (grread)
code (car inp)
dta (cadr inp)
) ; grread => (2 ord of key pressed) OR (3, (pick point))
(cond
((= 2 code) ; character typed => S = 83, s = 115 X = 88, x = 120
(setq key (strcase (chr dta)))
)
((= 3 code) ; picked a point
(setq ed (nentselp dta)) ; so get entity at picked point
(cond ((= 0 (length ed)) (setq key NIL)) ; nothing selected)
; simple entity selected line, arc text, polyline => (entity pick_point)
((= 2 (length ed))
(setq key (cdr (assoc 0 (entget (car ed)))))
)
; block selected 0 = entity handle of selected subentity, 1 = pick point, 3 = ?????, 4 = entity handle of block
((= 4 (length ed))
(setq ed (list (car (nth 3 ed)) (nth 1 ed))
key (cdr (assoc 0 (entget (car ed))))
key (vla-get-effectivename
(vlax-ename->vla-object (car ed))
)
)
)
) ;_cond
) ;_ (= 3 code)
) ;_ cond
(if (= key NIL)
(setq inp (list "Nothing" NIL NIL))
(setq inp (list key (car ed) (cadr ed))) ; entity type, entity name, pick point
)
;; return values
) ;_ defun