hi there,
check the following
(defun c:inherit_another_block (/ nentsel_data target_attribute attribute_referenced_tag target_block another_block attribute_found)
(setq nentsel_data (nentsel "\nPick target attribute: ")
target_attribute (vlax-ename->vla-object (cdr (assoc -1 (entget (car nentsel_data)))))
attribute_referenced_tag (cdr (assoc 2(entget (cdr (assoc 331 (entget (cdr (assoc 360 (entget (cdr (assoc 360 (entget (cdr (assoc 360 (entget (cdr (assoc 360 (entget (car nentsel_data)))))))))))))))))))
)
(if (= 4 (length nentselp_data))
(setq target_block (vlax-ename->vla-object (car (last nentselp_data))))
(setq target_block (vlax-ename->vla-object (ssname (ssget (cadr nentsel_data)) 0)))
)
(terpri)
(while (and
(setq another_block (car (entsel "\nPick another target_block to reference field: ")))
(not
(and
(= (cdr (assoc 0 (entget another_block))) "INSERT")
(equal '(66 . 1) (assoc 66 (entget another_block)))
(vl-some '(lambda (attribute) (= attribute_referenced_tag (vla-get-tagstring (setq attribute_found attribute))))
(vlax-invoke (vlax-ename->vla-object another_block) 'getattributes)
)
)
)
(princ "wrong block")
)
)
(vla-put-textstring target_attribute (strcat "%<\\AcObjProp Object(%<\\_ObjId " (itoa (vla-get-objectid attribute_found)) ">%).TextString \\f \"%tc1\">%"))
(vla-regen (vla-get-activedocument (vlax-get-acad-object)) acactiveviewport)
)