- 积分
- 1865
- 明经币
- 个
- 注册时间
- 2002-12-4
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
以下是原代码:其中parr为点的数组
AcDb2dPolyline *pNewPline = new AcDb2dPolyline(
AcDb::k2dSimplePoly,parr);
AcDbBlockTable *pBlockTable;
acdbHostApplicationServices()->workingDatabase()
->getBlockTable(pBlockTable,AcDb::kForRead);
AcDbBlockTableRecord *pBlockTableRecord;
pBlockTable->getAt(ACDB_MODEL_SPACE,pBlockTableRecord,AcDb::kForWrite);
pBlockTable->close();
AcDbObjectId plineObjId;
pBlockTableRecord->appendAcDbEntity(plineObjId,pNewPline);
pBlockTableRecord->close();
///////////////////////////////加入字典
AcDbDictionary *pNamedobj=NULL,*pDict=NULL;
acdbHostApplicationServices()->workingDatabase()->
getNamedObjectsDictionary(pNamedobj,AcDb::kForWrite);
if(pNamedobj->getAt("EGS",(AcDbObject* &)pDict,
AcDb::kForWrite)==Acad::eKeyNotFound)
{
pDict=new AcDbDictionary;
AcDbObjectId DictId;
pNamedobj->setAt("EGS",pDict,DictId);
}
pNamedobj->close();
if(pDict){
AcDbObjectId rId;
pDict->setAt("AcDb2dPolyline",pNewPline,rId);
pNewPline->close();
pDict->close();
} |
|