- 积分
- 329
- 明经币
- 个
- 注册时间
- 2003-9-3
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
发表于 2003-9-27 10:15:00
|
显示全部楼层
获取Polyline实体节点:
void readplinevertex(AcDbObjectId plineid,std::vector<AcGePoint3d> *verpt)
{//读取给定多义线ID的顶点数据,保存在verpt中
AcDbObject *pline;
acdbOpenObject(pline,plineid,AcDb::kForRead);
if(pline->isKindOf(AcDb2dPolyline::desc())){
pline->close();
AcDb2dPolyline *pline;
acdbOpenObject(pline,plineid,AcDb::kForRead);
AcDbObjectIterator *piter=pline->vertexIterator();
pline->close();
AcDbObjectId verid;
AcDb2dVertex *pver;
for(long i=0;!piter->done();i++,piter->step()){
verid=piter->objectId();
acdbOpenObject(pver,verid,AcDb::kForRead);
verpt->push_back(pver->position());
pver->close();
}
delete piter;
}else if(pline->isKindOf(AcDb3dPolyline::desc())){
pline->close();
AcDb3dPolyline *pline;
acdbOpenObject(pline,plineid,AcDb::kForRead);
AcDbObjectIterator *piter=pline->vertexIterator();
pline->close();
AcDbObjectId verid;
AcDb3dPolylineVertex *pver;
for(long i=0;!piter->done();i++,piter->step()){
verid=piter->objectId();
acdbOpenObject(pver,verid,AcDb::kForRead);
verpt->push_back(pver->position());
pver->close();
}
delete piter;
}else{//AcDbPolyline Object
pline->close();
AcDbPolyline *pline;
acdbOpenObject(pline,plineid,AcDb::kForRead);
AcGePoint3d pt;
for(long i=0;i<pline->numVerts();i++){
pline->getPointAt(i,pt);
verpt->push_back(pt);
}
pline->close();
}
}
上面函数中本身已包含2D合3D的判断。
判断是否封闭:
AcDbPolyline *pline;
acdbOpenObject(pline,objid,AcDb::kForRead);
if(pline->isClosed()==Adesk::kTrue)//是否封闭多义线
{}
pline->close(); |
|