TA的每日心情 | 开心 昨天 06:36 |
---|
签到天数: 15 天 [LV.4]偶尔看看III
管理员
- 积分
- 1308
|
- void
- highlightEdge(const AcDbObjectId& objId, const int marker)
- {
- TCHAR dummy[133]; // 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[0].
- //
- // 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[0]);
- // Pause to let user see the effect.
- //
- acedGetString(0, 采用T("\npress <RETURN> to continue..."),
- dummy);
- // Unhighlight the picked edge.
- //
- pEnt->unhighlight(subentIds[0]);
- // Get a copy of the edge, and add it to the database.
- //
- AcDbEntity *pEntCpy = pEnt->subentPtr(subentIds[0]);
- AcDbObjectId objId;
- addToModelSpace(objId, pEntCpy);
- }
- delete []subentIds;
- pEnt->close();
- }
- void
- highlightFaces(const AcDbObjectId& objId, const int marker)
- {
- TCHAR dummy[133];
- 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[i]); // Highlight face.
- // Pause to let the user see the effect.
- //
- acedGetString(0, 采用T("\npress <RETURN> to continue..."),
- dummy);
- pEnt->unhighlight(subentIds[i]);
- }
- delete []subentIds;
- pEnt->close();
- }
- void
- highlightAll(const AcDbObjectId& objId)
- {
- TCHAR dummy[133];
- 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();
- }
- Acad::ErrorStatus
- addToModelSpace(AcDbObjectId &objId, AcDbEntity* pEntity)
- {
- AcDbBlockTable *pBlockTable;
- AcDbBlockTableRecord *pSpaceRecord;
- acdbHostApplicationServices()->workingDatabase()
- ->getSymbolTable(pBlockTable, AcDb::kForRead);
- pBlockTable->getAt(ACDB采用MODEL采用SPACE, pSpaceRecord,
- AcDb::kForWrite);
- pSpaceRecord->appendAcDbEntity(objId, pEntity);
- pBlockTable->close();
- pEntity->close();
- pSpaceRecord->close();
- return Acad::eOk;
- }
-
复制代码 |
|