Here is a sample ObjectARX code to toggle the highlight state of an entity.
static void ToggleHighlight(void)
{
ads_point pick;
ads_name ename;
int ret = acedEntSel(
ACRX_T("Select an entity :"),
ename,
pick
);
if ( RTNORM != ret)
return;
Acad::ErrorStatus es;
AcDbObjectId entId = AcDbObjectId::kNull;
es = acdbGetObjectId( entId, ename );
if ( Acad::eOk != es)
return;
AcDbEntity *pEnt = NULL;
es = acdbOpenAcDbEntity ( pEnt,
entId,
AcDb::kForRead
);
if ( Acad::eOk != es)
return;
AcDbFullSubentPath subPath;
AcGiHighlightStyle hs = pEnt->highlightState(subPath);
if(hs == AcGiHighlightStyle::kAcGiHighlightNone)
{// Entity is not highlighted, lets highlight
pEnt->highlight();
}
else
{// Entity is already highlighted, lets unhighlight
pEnt->unhighlight();
}
pEnt->close();
}