马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
下面是示例代码,求端点是(0 0 0) (0 0 1)的LINE和Su**ce的交点。
注意:include和lib文件在 ObjectARX SDK\\utils\brep 目录下。
- static AcGePoint3dArray Intersect(AcDbSu**ce* pSu**ce,AcGeLine3d line)
- {
- AcGePoint3dArray returnPtArray;
- AcDbBody* pBody = new AcDbBody();
- // 2013
- // Acad::ErrorStatus es = pBody->setASMBody(pSu**ce->ASMBodyCopy());
- //before 20123
- Acad::ErrorStatus es = pBody->setBody(pSu**ce->body());
- //build AcBrBrep
- AcBrBrep* pBrep = new AcBrBrep();
- //
- if(AcBr::eOk == pBrep->set(*pBody))
- {
- AcBrBrepFaceTraverser* pFaceTrav = new AcBrBrepFaceTraverser;
- if(AcBr::eOk == pFaceTrav->setBrep(*pBrep))
- {
- for(pFaceTrav->restart();!pFaceTrav->done();pFaceTrav->next())
- {
- AcB**ce face;
- if(AcBr::eOk == pFaceTrav->getFace(face))
- {
- double area = 0.0f;
- face.getSu**ceArea(area);
- acutPrintf(L"\nSu**ce Area: %f", area);
- //*****whole su**ce of the Brep face******
- //AcGeNurbSu**ce nurbSu**ce;
- //face.getSu**ceAsNurb(nurbSu**ce);
- //AcGeCurveSurfInt curveSI;
- ////input the curve and line
- //curveSI.set(line,nurbSu**ce);
- ////get the count of intersect points
- //int count = curveSI.numIntPoints(err_1);
- // if(err_1 == AcGe::kXXOk && count >0 )
- // {
- // AcGeIntersectError err_2;
- // for(int index = 0 ;index < count; index ++)
- // {
- // AcGePoint3d pt =
- // curveSI.intPoint(index,err_2);
- // returnPtArray.append(pt);
- // }
- //
- // }
- //**********
- //****real su**ce of the orignal AcDbSu**ce
- AcGeExternalBoundedSu**ce** nurbs = NULL;
- Adesk::UInt32 numNurbs = 0;
- face.getSu**ceAsTrimmedNurbs(numNurbs,nurbs);
- //*****
- for (Adesk::UInt32 i = 0; i < numNurbs; i++)
- {
- AcGeCurveSurfInt curveSI;
- AcGeIntersectError err_1 = AcGe::kXXOk;
- //input the curve and line
- curveSI.set(line,*nurbs);
- //get the count of intersect points
- int count = curveSI.numIntPoints(err_1);
- if(err_1 == AcGe::kXXOk && count >0 )
- {
- AcGeIntersectError err_2;
- for(int index = 0 ;index < count; index ++)
- {
- AcGePoint3d pt =
- curveSI.intPoint(index,err_2);
- returnPtArray.append(pt);
- }
- }
- delete nurbs;
- }
- // your responsibility to delete the
- // array of su**ces
- delete[] nurbs;
- }
- }
- }
- delete pFaceTrav;
- }
- delete pBrep;
- return returnPtArray;
- }
|