Thanks for the input guys.
BricscadBoy: I couldn't get yours to work properly for me. It would find the tags that were not nested. All I could find were dynamic blocks. I think it's just returning the name of the parent block. But, I did get some valuable insight on the workings of it.
Lee: I was able to adapt your code, but it only gives me the parent blocks name. What I'm needing is the names of only the nested blocks. I couldn't figure out how to get it. It would find all the blocks with tags. One of my adaptations is for it to add to the list the EQMPTAG blocks that are all alone, not nested.
Here's what I came up with:
(defun _listofblockswithnestedblock ( nested / lst name )
(vlax-for block (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)));for each block in drawing do the code
(if;if block is in layout, is xref and if is anonymous, skip to next block
(and
(= :vlax-false (vla-get-islayout block))
(= :vlax-false (vla-get-isxref block))
(not (wcmatch (setq name (vla-get-name block)) "`**"))
)
(vlax-for obj block;for all other blocks, do code
(if
(and
(= "AcDbBlockReference" (vla-get-objectname obj))
(or
(and
(vlax-property-available-p obj 'effectivename)
(= (strcase nested) (strcase (vla-get-effectivename obj)))
);and
(= (strcase nested) (strcase (vla-get-name obj)))
);or
(not (member name lst))
);and
(setq lst (cons name lst))
);if
);vlax-for
);if
);vlax-for
lst
);defun
(defun LM:ss->ent ( ss / i l )
(if ss (repeat (setq i (sslength ss)) (setq l (cons (cdr (assoc 2 (entget (ssname ss (setq i (1- i)))))) l))))
);defun
;;;USE
(setq Allblocks (_listofblockswithnestedblock "EQPMTAG"))
(setq Allblocks (append (LM:ss->ent (ssget "_X" '((2 . "EQPMTAG")))) Allblocks))
I've attached a 2012 Autocad file showing the blocks I'm working with. What I'm needing is a list of the equipment tag blocks only. Or even better, a list with the entity names like when you do (car (entsel)). With that I'll be able to do everything else I need, which includes getting a count of those tags and then getting info from and Excel file that coordinates with the tags number.