Acdbobjectidarray Obtainentid ()
{
Get Block table
Acdbblocktable *pblktbl;
Acdbhostapplicationservices ()->workingdatabase ()
->getblocktable (PBLKTBL, Zcdb::kforread);
Get block Table records
Acdbblocktablerecord *PBLKTBLRCD;
Pblktbl->getat (Acdb_model_space, PBLKTBLRCD, zcdb::kforwrite);
Pblktbl->close ();
Create a walker
Acdbblocktablerecorditerator *piter = NULL;
Pblktblrcd->newiterator (Piter);
Acdbobjectidarray Entids;
Traverse all entities to get their IDs
For (Piter->start ();!piter->done (); Piter->step ())
{
Using a walker to get each entity
Acdbentity *pent = NULL;
Acad::errorstatus es = piter->getentity (pent, Acdb::kforread, false);
if (acad::eok! = es)
{
acutprintf (_t ("\ n" Open entity failed! "));
return false;
}
Gets the list of specified extended data
struct RESBUF *PRC;
struct RESBUF *prc1;
PRc = Pent->xdata (_t ("Bmc_no_app"));
PRC1 = Pent->xdata (_t ("Bmesc_cable_app"));
If the list of two extended data is equal, the ID of this entity is stored in Entids
if (pRc! = NULL && PRC1! = null)
{
Entids.append (Pent->objectid ());
}
Pent->close ();
}
Delete Piter;
Pblktblrcd->close ();
return entids;
}
Gets the ID of all entities that have the specified extended data and is stored in the ID array