We have known acedSSGet can select nested entities with the argument :N. But in default, it supports single selection. If you select by window, no any nested entity is returned. If you select by cross, only one nested entity will be returned.
The following code is a solution:
static void multi-select_nested_entity()
{
// switch on the multi selection of nested entities
setAllowDuplicateSelection(curDoc(), true);
curDoc()->inputPointManager()->turnOnSubentityWindowSelection();
ads_name sset, eName;
AcDbObjectId id;
// in the mode "_:n"
//
if (RTNORM == acedSSGet(L"_:n", NULL, NULL, NULL, sset))
{
acutPrintf(L"\n");
long len = 0;
acedSSLength(sset, &len);
for (long i = 0; i < len; i++)
{
resbuf *rb = NULL;
// ssnamex() returns all selected nested entities
//
if (RTNORM == acedSSNameX(&rb, sset, i))
{
resbuf *rbWalk = rb;
while (NULL != rbWalk)
{
if (RTENAME ==
rbWalk->restype)
{
eName[0] =
rbWalk->resval.rlname[0];
eName[1] =
rbWalk->resval.rlname[1];
if(Acad::eOk == acdbGetObjectId(id, eName))
{
acutPrintf(L"Entity %d: %x",
i,
id.asOldId());
AcDbEntity *pEnt;
if (Acad::eOk ==
acdbOpenObject(pEnt,
id,
AcDb::kForRead))
{
acutPrintf(L"(%s)\n",
pEnt->isA()->name());
pEnt->close();
}
else
{
acutPrintf(L"\nCouldn't open object");
}
}
//rbWalk = NULL;
}
//else
{
rbWalk = rbWalk->rbnext;
}
}
acutRelRb(rb);
}
}
acedSSFree(sset);
}
// swtich off
setAllowDuplicateSelection(curDoc(), false);
curDoc()->inputPointManager()->turnOffSubentityWindowSelection();
}