[每日一码] AcDbEntity::getOsnapPoints()函数例子代码
static void test(void){
ads采用name ent;
AcGePoint3d pickPt(0, 0, 0);
if(acedEntSel(采用T("/n请选择圆、圆弧或椭圆对象:"), ent,
asDblArray(pickPt)) != RTNORM)
{
return;
}
AcDbObjectId entId;
acdbGetObjectId(entId, ent);
AcDbEntity *pEnt;
acdbOpenAcDbEntity(pEnt, entId, AcDb::kForWrite);
pEnt->close();
AcGePoint3dArray snapPts;
AcDbIntArray geomIds;
pEnt->getOsnapPoints(AcDb::kOsModeCen, 0, pickPt, pickPt,
AcGeMatrix3d::kIdentity, snapPts, geomIds);
for(int i = 0; i < snapPts.length(); i++)
{
acutPrintf(采用T("/n您点取的点是: %.4f, %.4f, %.4f"), pickPt.x,
pickPt.y, pickPt.z );
acutPrintf(采用T("/n您捕捉到的点是: %.4f, %.4f, %.4f"), snapPts.x,
snapPts.y, snapPts.z );
}
}
页:
[1]