|
[code]问题终于得到解决。原来是我没仔细看懂Objectarx帮助文件中的实例。很简单几行代码实现块内实体亮显功能,关键是弄懂AcDbFullSubentPath类的构造。
void HighlightEntityInBlock(ads_point pickpoint, bool bHighlight)
{
ads_name ename;
ads_matrix adsmat;
struct resbuf *insStack;
acedNEntSelP(NULL, ename, pickpoint, TRUE, adsmat, &insStack);
AcDbObjectId selId;
acdbGetObjectId(selId, ename);
ads_name sset;
acedSSGet(NULL, pickpoint, NULL, NULL, sset);
acedSSName(sset, 0, ename);
AcDbObjectId blRefId;
acdbGetObjectId(blRefId, ename);
AcDbEntity *pEnt = NULL;
acdbOpenAcDbEntity(pEnt, blRefId, AcDb::kForRead);
AcDbBlockReference *pBlock = AcDbBlockReference::cast(pEnt);
AcDbFullSubentPath subPath;
subPath.objectIds().append(blRefId);
subPath.objectIds().append(selId);
if (bHighlight)
pBlock->highlight(subPath);
else
pBlock->unhighlight(subPath);
pBlock->close();
}[/code] |
|