[求助]如何获取当前dwg的名字?
如何获取当前dwg的名字?另外如何获取polyline实体的节点、判断是否为封闭线、判断是二维还是三维?谢谢 获取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(); 谢谢!还有一个问题是3d、2d polyline如何判断其是否封闭,isclosed是判断acdbpolyline的
页:
[1]