|
[code]//面域转AcGePoint3d:
void GetRegionPoints(AcDbRegion* pRegion,vector<AcGePoint3dArray> &vecPtsArr/*AcGePoint3dArray &points*/)
{
AcBrBrep *pBrep = new AcBrBrep;
pBrep->set(*pRegion);
AcBrBrepFaceTraverser brFaTrav;
/tBrep用于将遍历器设置(重设)至一个特定的brep面列表,且遍历器从表中的第一个面开始
for (brFaTrav.setBrep(*pBrep); !brFaTrav.done(); brFaTrav.next())
{
AcBrFaceLoopTraverser faLoTrav;
AcBrFace face;
//返回环列表的面宿主
brFaTrav.getFace(face);
for (faLoTrav.setFace(face); !faLoTrav.done(); faLoTrav.next())
{
AcGePoint3dArray ptsVert;
AcBrLoopEdgeTraverser loEdTrav;
if (loEdTrav.setLoop(faLoTrav) == AcBr::eOk)
{
for (; !loEdTrav.done(); loEdTrav.next())
{
AcBrEdge edge;
loEdTrav.getEdge(edge);
AcBrVertex start;
edge.getVertex1(start);
AcGePoint3d pt;
start.getPoint(pt);
ptsVert.append(pt);
}
} // else its an isolated loop
if (ptsVert.length()>0)
{
AcGePoint3d ptStart;
//if (points.length()>0)
if(vecPtsArr.size()>0)
{
bool bNoFind=false;
for (int k=0;k<vecPtsArr.size();k++)
{
AcGePoint3dArray ptsTmp;
ptsTmp=vecPtsArr[k];
/Start=points[points.length()-1];
ptStart=ptsTmp[ptsTmp.length()-1];
if (IsExistPoint(ptStart,ptsVert))
{
AcGePoint3dArray ptsNew;
m_myClass.GetPointLeftUpBegin(ptStart,ptsVert,ptsNew);
//points.append(ptsNew);
ptsTmp.append(ptsNew);
vecPtsArr[k]=ptsTmp;
bNoFind=true;
}
}
if (!bNoFind)
{
vecPtsArr.push_back(ptsVert);
}
}
else
{
vecPtsArr.push_back(ptsVert);
//points.append(ptsVert);
}
}
}
}
delete pBrep;
}[/code] |
|