- 积分
- 767
- 明经币
- 个
- 注册时间
- 2004-11-1
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
我选择了一条pline线,并对其中的点遍历,并把点坐标,导出到一个点数组points()中
但我的程序运行完了后,这条线就不能在CAD中编辑,一修改编辑,CAD就自动关闭了!
请版主看一看,谢谢!!!
AcDb2dPolyline* pline2d; AcDbObjectId objId=AcDbObjectId::kNull; AcGePoint3d lPt( 0.0, 0.0, 0.0); int j;j=0; long sslen;
int result;
ads_name m_ss; struct resbuf* filter; result = acedSSGet(_T(":S"), NULL, NULL, NULL, m_ss); acedSSLength(m_ss, &sslen);
int ret; ads_name ent;
for (long i=0L; i<sslen; i++) { ret = acedSSName(m_ss, i, ent); ASSERT(ret == RTNORM); Acad::ErrorStatus es = acdbGetObjectId(objId, ent); } AcDbEntity * pEnt; acdbOpenObject(pEnt,objId,AcDb::kForRead);
AcDb3dPolyline* pline3d; AcDbPolygonMesh* pmesh; AcDbPolyFaceMesh* pface; AcDbPolyline* pline; AcDbObjectIterator* vertexIter; Acad::ErrorStatus es;
if ((pline2d = AcDb2dPolyline::cast(pEnt)) != NULL) vertexIter = pline2d->vertexIterator(); else if ((pline3d = AcDb3dPolyline::cast(pEnt)) != NULL) vertexIter = pline3d->vertexIterator(); else if ((pmesh = AcDbPolygonMesh::cast(pEnt)) != NULL) vertexIter = pmesh->vertexIterator(); else if ((pface = AcDbPolyFaceMesh::cast(pEnt)) != NULL) vertexIter = pface->vertexIterator(); else if ((pline = AcDbPolyline::cast(pEnt)) != NULL) { for (unsigned int j=0; j<pline->numVerts(); j++) { es = pline->getPointAt(j, lPt); if (es == Acad::eOk) { points[j].x=lPt.x; points[j].y=lPt.y; } } return j; } else vertexIter = NULL; pline->close(); pEnt->close(); return 0; |
|