I have a block (let's call it MAIN BLOCK) that contains other blocks and also may contain some elements that are not blocks (dimensions, lines, etc)
I need to get the list of entity names of blocks contained in the MAIN BLOCK.
I found this code that returns the list of all entity names contained in the MAIN BLOCK.
However, I this list contains also entity names that are not block.
How can i filter the list of entities to keep only blocks and remove everything else?
Or can this code be modified to only return entities that are blocks?
(defun getblkitems ( / sel nfo items)
(if
(and
(setq sel (entsel "Select a block: "))
(= (cdr (assoc 0 (setq nfo (entget (car sel))))) "INSERT")
)
(vlax-for
item
(vla-item
(vla-get-blocks
(vla-get-activedocument
(vlax-get-acad-object)
)
)
(cdr (assoc 2 nfo))
)
(setq items (cons (vlax-vla-object->ename item) items))
)
(prompt "\nNo block selected.")
)
)