By reading couple of posts, here is a code which I used for passing an attribute value from a block to "dwgprops".
But it doesn't look right.
What is wrong in the code? Thanks for your help.
(defun c:Test ()
(defun get_att (en / att obj)
(if (or (and (eq (type en) 'ENAME)
(setq obj (vlax-ename->vla-object en))
(eq (vla-get-hasattributes obj) :vlax-true)
)
(and (eq (type en) 'VLA-OBJECT)
(setq obj en)
(eq (vla-get-hasattributes obj) :vlax-true)
)
)
(mapcar
'(lambda (att) (cons (vla-get-TagString att) (vla-get-TextString att)))
(vlax-invoke obj "GetAttributes")
)
)
)
(if (setq ss (ssget "_:S:E" '((0 . "INSERT") (2 . "BlockName")))) ; <= change "BlockName" to yours for testing
(progn (setq obj (vlax-ename->vla-object (ssname ss 0)))
(if (eq (vla-get-effectivename obj) "BlockName") ; <= change "BlockName" to yours for testing
(progn (get_att obj)
(setq DwgCustomProperties (car (car (get_att obj)))) ; <= 1st attribute in the selected block
(setq DwgCustomDescription (cdr (car (get_att obj))))
)
)
)
(princ "\nSelect a block...")
)
(setq summaryinfo (vla-get-SummaryInfo (vla-get-ActiveDocument (vlax-get-acad-object))))
(vla-SetCustomByKey summaryinfo DwgCustomProperties DwgCustomDescription)
(princ)
); end