(defun _Conv_Pickset_To_EnameList (ss / i ret)

(if ss

(repeat (setq i (sslength ss))

(setq ret (cons (ssname ss (setq i (1- i))) ret))

)

)

)

(defun _Data_XdataGet (ename app)

(cdadr (assoc -3 (entget ename (list app))))

)

(defun _Data_XdataSet (ename app dataLst)

(regapp app)

(entmod

(append

(entget ename)

(list (list -3 (cons app dataLst)))

)

)

)

(defun _Sys_Apply (expr varLst / ret)

(if (not (vl-catch-all-error-p (setq ret (vl-catch-all-apply expr varLst))))

ret

)

)

(defun BlkDefNonAnnotative (obj)

(if

(and

(= :vlax-false (vla-get-isxref obj))

(_Data_XdataGet (vlax-vla-object->ename obj) "AcadAnnotative")

)

(_Data_XdataSet

(vlax-vla-object->ename obj)

"AcadAnnotative"

'(

(1000 . "AnnotativeData")

(1002 . "{")

(1070 . 1)

(1070 . 0)

(1002 . "}")

)

)

)

)

(defun BlkRefNonAnnotative (obj / dic ext)

(if

(and

(= :vlax-true (vla-get-hasextensiondictionary obj))

(setq ext (vla-getextensiondictionary obj))

)

(progn

(if (setq dic (_Sys_Apply 'vla-item (list ext "AcDbContextDataManager")))

(vla-delete dic)

)

(if (zerop (vla-get-count ext))

(vla-delete ext)

)

)

)

)

(defun c:bar ( / blks ss nmeLst)

(setq blks (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object))))

(if (setq ss (ssget '((0 . "INSERT"))))

(mapcar

'(lambda (enme / nme obj)

(setq obj (vlax-ename->vla-object enme))

(if (not (vl-position (setq nme (strcase (vla-get-name obj))) nmeLst))

(progn

(setq nmeLst (cons nme nmeLst))

(BlkDefNonAnnotative (vla-item blks nme))

)

)

(BlkRefNonAnnotative obj)

)

(_Conv_Pickset_To_EnameList ss)

)

)

(princ)

)
(c:bar)

Advertisements