pBlf=AcDbBlockReference::cast(pEnt); AcDbVoidPtrArray bentyset; pBlf->explode(bentyset); AcDbEntity *pblent=NULL; for (int blent=0;blent<bentyset.length();blent++) { pblent=(AcDbEntity*)bentyset.at(blent); if (pblent->isA()==AcDb2dPolyline::desc()) { p2dpoly=AcDb2dPolyline::cast(pblent); AcDbObjectIterator *pVertIter =p2dpoly->vertexIterator(); AcDb2dVertex *pVertex; AcGePoint3d location; AcDbObjectId vertexObjId; for(int vertexNumber=0;!pVertIter->done();vertexNumber++,pVertIter->step()) { AfxMessageBox("9"); vertexObjId=pVertIter->objectId(); // vertexObjId 不知为何是knull if (vertexObjId!=AcDbObjectId::kNull) { AfxMessageBox("qq"); Acad::ErrorStatus es; es=acdbOpenObject(pVertex,vertexObjId,AcDb::kForRead); acutPrintf("%d",es); } location=pVertex->position() ; pointlist.append(location); pVertex->close();*/ } } p2dpoly->close(); } } 得到的vertexObjId 总为knull,请问程序有什么问题,为什么打不开对象 |