|
void
XdDbUtils::collectVertices(const AcDb2dPolyline* pline, AcGePoint3dArray& pts,
AcGeDoubleArray& bulges, BOOL asWcsPts)
{
ASSERT(pline != NULL);
ASSERT(pts.isEmpty() && bulges.isEmpty());
AcDbObjectIterator* vertexIter = pline->vertexIterator();
ASSERT(vertexIter != NULL);
if (vertexIter == NULL)
return;
AcDb2dVertex* vertex;
for (; !vertexIter->done(); vertexIter->step()) {
if (acdbOpenObject(vertex, vertexIter->objectId(), AcDb::kForRead) == Acad::eOk) {
if (vertex->vertexType() != AcDb::k2dSplineCtlVertex) {
if (asWcsPts)
pts.append(pline->vertexPosition(*vertex)); // returns WCS
else
pts.append(vertex->position()); // returns ECS
bulges.append(vertex->bulge());
}
vertex->close();
}
}
delete vertexIter;
ASSERT(pts.isEmpty() == Adesk::kFalse);
if (pline->isClosed()) {
AcGePoint3d tmpPt = pts[0]; // get around Adesk dynamic array bug
pts.append(tmpPt);
bulges.append(0.0);
}
} |
|