ObjectARX, AutoCAD. Среда программирования библиотеки C++


         

все лица, окружающие тот край,


//  highlightEdge (), highlightFaces (), и highlightAll () чтобы высветить выбранный
//  край, все лица, окружающие тот край, и затем твердое целое.
//
void
highlightTest()
{
AcDbObjectId objId;
int marker;
if (getObjectAndGsMarker(objId, marker) != Acad::eOk)
return;
highlightEdge(objId, marker);
highlightFaces(objId, marker);
highlightAll(objId);
}
// This function uses acedSSGet() to let the user select a
// single entity. It then passes this selection set to
// acedSSNameX() to get the gsmarker. Finally, the entity name
// in the selection set is used to obtain the object ID of
// the selected entity.
//
Acad::ErrorStatus
getObjectAndGsMarker(AcDbObjectId& objId, int& marker)
{
ads_name sset;
if (acedSSGet("_:S", NULL, NULL, NULL, sset) != RTNORM) {
acutPrintf("\nacedSSGet has failed");
return Acad::eInvalidAdsName;
}
// Get the entity from the selection set and its
// subentity ID. This code assumes that the user
// selected only one item, a solid.
//
struct resbuf *pRb;
if (acedSSNameX(&pRb, sset, 0) != RTNORM) {
acedSSFree(sset);
return Acad::eAmbiguousOutput;
}
acedSSFree(sset);
// Walk the list to the third item, which is the selected
// entity’s entity name.
//
struct resbuf *pTemp;
int i;
for (i=1, pTemp = pRb;i<3;i++, pTemp = pTemp->rbnext)
{ ; }
ads_name ename;
ads_name_set(pTemp->resval.rlname, ename);
// Move on to the fourth list element, which is the gsmarker.
//
pTemp = pTemp->rbnext;
marker = pTemp->resval.rint;
acutRelRb(pRb);
acdbGetObjectId(objId, ename);
return Acad::eOk;
}
// This function accepts an object ID and a gsmarker.
// The object is opened, the gsmarker is used to get the
// AcDbFullSubentIdPath, which is then used to highlight
// and unhighlight the edge used to select the object.
// Next, the object’s subentPtr() function is used to get
// a copy of the edge. This copy is then added to the
// database. Finally, the object is closed.

Содержание  Назад  Вперед