|
View Code
1 static void iterate(AcDbObjectId pLineId)
2 {
3 //打开AcDb2dPolyline对象
4 AcDb2dPolyline *pPline;
5 acdbOpenObject(pPline, pLineId, AcDb::kForRead);
6
7 //获得多段线的矢量遍历器
8 AcDbObjectIterator *pVertIter = pPline->vertexIterator();
9 pPline->close();
10
11 //对顶点进行遍历
12 AcDb2dVertex *pVertex;
13 AcGePoint3d location;
14 AcDbObjectId vertexobjectId;
15 for (int vertexNumber = 0; !pVertIter->done(); vertexNumber++, pVertIter->step())
16 {
17 //打开矢量对象
18 vertexobjectId = pVertIter->objectId();
19 acdbOpenObject(pVertex, vertexobjectId,AcDb::kForRead);
20
21 //获得矢量对象的坐标
22 location = pVertex->position();
23 pVertex->close();
24
25 //输出坐标
26 acutPrintf(L"\nVertox %d location is : %0.3f, %0.3f, %0.3f", vertexNumber, location[X], location[Y], location[Z]);
27 }
28 delete pVertIter;
29 } |
|