void ArxDbgUtils::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]; // used to be a bug in dynamic arrays (not sure if its still there??) pts.append(tmpPt); bulges.append(0.0); } }
void ArxDbgUtils::collectVertices(const AcDb2dPolyline* pline, AcGePoint3dArray& pts, AcDbIntArray& types, AcGeDoubleArray& bulges, AcGeDoubleArray& startWidths, AcGeDoubleArray& endWidths, bool& hasWidth) { ASSERT(pline != NULL); ASSERT(pts.isEmpty() && bulges.isEmpty()); hasWidth = false; 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) { pts.append(pline->vertexPosition(*vertex)); // returns WCS bulges.append(vertex->bulge()); startWidths.append(vertex->startWidth()); endWidths.append(vertex->endWidth()); if (vertex->startWidth() || vertex->endWidth()) hasWidth = true; types.append(vertex->vertexType()); } vertex->close(); } } delete vertexIter; ASSERT(pts.isEmpty() == false); if (pline->isClosed()) { AcGePoint3d tmpPt = pts[0]; // used to be a bug in dynamic arrays (not sure if its still there??) pts.append(tmpPt); bulges.append(0.0); int tmpType = types[0]; types.append(tmpType); double tmpWidth = startWidths[0]; startWidths.append(tmpWidth); tmpWidth = endWidths[0]; endWidths.append(tmpWidth); } }