The following is a rather specialized function I wrote some time back to return a list containing all references (vla-objects) to a block, the name of which you supply as an argument.
After using a variation of Tharwat's second posted function to strip the attribute definitions from your block definition, you could use something like this (below) to collect all references to the block (by name). Then, use a variation of Tharwat's first posted function to strip the attribute references from each insert.
Code:
;;=============================================================================================
;; BLK-INS-FND RETURNS ALL INSERTIONS OF THE NAMED BLOCK, OTHERWISE NIL
(defun blk-ins-fnd (blk-nm / BLK-INS-LST BLKLST N NM-X SUB-BLKLST SUB-BLKLST-N
SUB-LST SUB-LST-LN THE-BLK THE-BLK-LST VL-X X)
(or blocks (setq blocks (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))))
(setq blk-nm (strcase blk-nm))
(if (not
(vl-catch-all-error-p
(setq the-blk (vl-catch-all-apply 'vla-item (list blocks blk-nm)))
) ; vl-catch-all-error-p
) ; not
(progn
(setq the-blk-lst (entget (vlax-vla-object->ename the-blk))
sub-lst (member (assoc 102 the-blk-lst) the-blk-lst)
sub-lst-ln (length sub-lst)
n 0
) ; setq
(while (< n sub-lst-ln)
(setq x (nth n sub-lst))
(cond ((/= 331 (car x)) nil) ; first condition
((vl-catch-all-error-p
(setq vl-x
(vl-catch-all-apply
'vlax-ename->vla-object
(list (cdr x))
) ; vl-catch-all-apply
) ; setq
) ; vl-catch-all-error-p
nil
) ; second condition
(t (setq blk-ins-lst (append blk-ins-lst (list vl-x)))) ; default condition
) ; cond
(setq n (1+ n))
) ; while
(if (eq (vla-get-isdynamicblock the-blk) ':vlax-true)
(progn
(vlax-for blk blocks
(if (wcmatch (strcase (vla-get-name blk)) "*U#*")
(progn
(setq blklst (entget (vlax-vla-object->ename blk))
sub-blklst (member (assoc 102 blklst) blklst)
sub-blklst-n (length sub-blklst)
n 0
) ; setq
(while (< n sub-blklst-n)
(setq x (nth n sub-blklst))
(cond ((/= 331 (car x)) nil) ; first condition
((vl-catch-all-error-p
(setq vl-x
(vl-catch-all-apply
'vlax-ename->vla-object
(list (cdr x))
) ; vl-catch-all-apply
) ; setq
) ; vl-catch-all-error-p
nil
) ; second condition
((vl-catch-all-error-p
(setq nm-x
(vl-catch-all-apply
'vla-get-effectivename
(list vl-x)
) ; vl-catch-all-apply
) ; setq
) ; vl-catch-all-error-p
nil
) ; third condition
((/= (strcase nm-x) blk-nm)
nil
) ; fourth condition
(t
(setq blk-ins-lst
(append blk-ins-lst
(list vl-x)
) ; append
) ; setq
) ; default condition
) ; cond
(setq n (1+ n))
) ; while
) ; progn
) ; if
) ; vlax-for
) ; progn
) ; if
) ; progn
) ; if
(if (vl-consp blk-ins-lst)
(setq blk-ins-lst (reverse (vl-remove nil blk-ins-lst)))
) ; if
blk-ins-lst
); defun