亮显 面 顶点 边
ads采用name ss;if (acedSSGet(NULL,NULL,NULL,NULL,ss)!=RTNORM)
{
return;
}
struct resbuf* res;
if (acedSSNameX(&res,ss,0)!=RTNORM)
{
acedSSFree(ss);
return;
}
acedSSFree(ss);
struct resbuf* buf;
int i;
for (i=1,buf=res;i<3;i++,buf=buf->rbnext)
{;}
ads采用name ent;
ads采用name采用set(buf->resval.rlname,ent);
buf=buf->rbnext;
int maker=buf->resval.rint;
acutRelRb(res);
AcDbObjectId entId;
AcDbEntity *pEnt=NULL;
acdbGetObjectId(entId,ent);
if (acdbOpenObject(pEnt,entId,AcDb::kForWrite)==Acad::eOk)
{
AcGePoint3d ptOnOrNear;
AcGeMatrix3d mat;
int sunEntNums;
AcDbFullSubentPath* subentIds;
ACHAR leixing;
acedGetString(0,采用T("输入需要高亮显示的子实体类型:"),leixing);
if (*leixing==*采用T("边"))
{
pEnt->getSubentPathsAtGsMarker(AcDb::kEdgeSubentType,maker,ptOnOrNear,mat,sunEntNums,subentIds);
}
else if (*leixing==*采用T("面"))
{
pEnt->getSubentPathsAtGsMarker(AcDb::kFaceSubentType,maker,ptOnOrNear,mat,sunEntNums,subentIds);
}
else if (*leixing==*采用T("顶点"))
{
pEnt->getSubentPathsAtGsMarker(AcDb::kVertexSubentType,maker,ptOnOrNear,mat,sunEntNums,subentIds);
}
else
{
acedAlert(采用T("没有此类型的子实体........................."));
}
if (sunEntNums>0)
{
for (int i=0;i<sunEntNums;i++)
{
pEnt->highlight(subentIds);
}
ACHAR str={0};
acedGetString(0,采用T("按回车键结束高亮显示并进入低亮显示"),str);
for (int i=0;i<sunEntNums;i++)
{
pEnt->unhighlight(subentIds);
}
}
}
pEnt->close();
static void highlightEdge(const AcDbObjectId& objId, const int marker)
{
TCHAR dummy; // space for acedGetStringB pauses below
AcDbEntity *pEnt;
acdbOpenAcDbEntity(pEnt, objId, AcDb::kForRead);
AcGePoint3d pickpnt;
AcGeMatrix3d xform;
int numIds;
AcDbFullSubentPath *subentIds;
pEnt->getSubentPathsAtGsMarker(AcDb::kEdgeSubentType,
marker, pickpnt, xform, numIds, subentIds);
// At this point the subentId's variable contains the
// address of an array of AcDbFullSubentPath objects.
// The array should be one element long, so the picked
// edge's AcDbFullSubentPath is in subentIds.
//
// For objects with no edges (such as a sphere), the
// code to highlight an edge is meaningless and must
// be skipped.
//
if (numIds > 0) {
// Highlight the edge.
//
pEnt->highlight(subentIds);
// Pause to let user see the effect.
//
acedGetString(0, 采用T("\npress <RETURN> to continue..."),
dummy);
// Unhighlight the picked edge.
//
pEnt->unhighlight(subentIds);
// Get a copy of the edge, and add it to the database.
//
AcDbEntity *pEntCpy = pEnt->subentPtr(subentIds);
AcDbObjectId objId;
CMoftenuse::PostToModelSpace( pEntCpy);
}
delete []subentIds;
pEnt->close();
}
static void highlightFaces(const AcDbObjectId& objId, const int marker)
{
TCHAR dummy;
AcDbEntity *pEnt;
acdbOpenAcDbEntity(pEnt, objId, AcDb::kForRead);
// Get the subentIds for the faces.
//
AcGePoint3d pickpnt;
AcGeMatrix3d xform;
int numIds;
AcDbFullSubentPath *subentIds;
pEnt->getSubentPathsAtGsMarker(AcDb::kFaceSubentType,
marker, pickpnt, xform, numIds, subentIds);
// Walk the subentIds list, highlighting each face subentity.
//
for (int i = 0;i < numIds; i++) {
pEnt->highlight(subentIds); // Highlight face.
// Pause to let the user see the effect.
//
acedGetString(0, 采用T("\npress <RETURN> to continue..."),
dummy);
pEnt->unhighlight(subentIds);
}
delete []subentIds;
pEnt->close();
}
static void highlightAll(const AcDbObjectId& objId)
{
TCHAR dummy;
AcDbEntity *pEnt;
acdbOpenAcDbEntity(pEnt, objId, AcDb::kForRead);
// Highlight the whole solid.
//
pEnt->highlight();
// Pause to let user see the effect.
//
acedGetString(0, 采用T("\npress <RETURN> to continue..."),
dummy);
pEnt->unhighlight();
pEnt->close();
}
页:
[1]