原来又是一个 不可见的Attdef啊
(Defun C:Test (/ en vn atts) (vl-load-com) (setq en (vl-catch-all-apply 'entsel (list "\nPlease select a block:"))) (if (and (not (vl-catch-all-error-p en)) (setq vn (vlax-ename->vla-object (car en))) (equal (vla-get-ObjectName vn) "AcDbBlockReference") ) (progn (if (and (equal (vla-get-HasAttributes vn) :vlax-true) (setq atts (vlax-variant-value (vla-getAttributes vn))) (/= (vlax-safeArray-get-u-bound atts 1) -1) ) (foreach att (vlax-safeArray->list atts) (princ (strcat "\n" (vla-get-TagString att) "---" (vla-get-TextString att))) ) )
(if (and (setq atts (vla-getConstantAttributes vn)) (setq atts (vlax-variant-value atts)) (/= (vlax-safeArray-get-u-bound atts 1) -1) ) (foreach att (vlax-safeArray->list atts) (princ (strcat "\n" (vla-get-TagString att) "---" (vla-get-TextString att))) ) )
) ) (prin1) ) |