Here is piece of sample code.
It iterates through the block collection and figures out the effectivename (even of anonymous blocks) and then iterates through the item collection and finds the solids.
You just need to search the list of sublists, find the data and add it as xdata to the object.
You could use ldata too.
Code:
(Defun C:SolidXdata (/ objBlockDefinition objItem)
(vl-load-com)
(vlax-for objBlockDefinition (vla-get-blocks (vla-get-activedocument (vlax-get-acad-object)))
(setq strBlockName (BlockDefinitionEffectiveName objBlockDefinition))
(print strBlockName)
(vlax-for objItem objBlockDefinition
(if (wcmatch (vla-get-objectname objItem) "AcDb3dSolid")
(print objItem)
)
)
)
)
; Function to get the effectivename of a block definition.
(defun BlockDefinitionEffectiveName (objBlockDefinition / dprAssoc lstEntity objBlock strBlockName)
(setq strBlockName (vla-get-name objBlockDefinition))
(and (= (substr strBlockName 1 1) "*")
(setq lstEntity (entget (vlax-vla-object->ename objBlockDefinition)))
(setq dprAssoc (assoc 331 lstEntity))
(setq objBlock (vlax-ename->vla-object (cdr dprAssoc)))
(setq strBlockName (vla-get-effectivename objBlock))
)
strBlockName
)