- UID
- 63469
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2003-7-8
- 最后登录
- 1970-1-1
|
发表于 2006-3-3 22:26:25
|
显示全部楼层
Acad::ErrorStatus
postToDb(AcDbDatabase *pDb, AcDbEntity *pEnt, AcDbObjectId &idObj)
{
assert ( pEnt != NULL ) ;
if ( pDb == NULL )
pDb = acdbHostApplicationServices()->workingDatabase();
//----- Get a pointer to the current drawing
//----- and get the drawing's block table. Open it for read.
Acad::ErrorStatus es ;
AcDbBlockTable *pBlockTable ;
if ( (es =pDb->getBlockTable (pBlockTable, AcDb::kForRead)) == Acad::eOk ) {
//----- Get the Model Space record and open it for write. This will be the owner of the new entity.
AcDbBlockTableRecord *pSpaceRecord ;
if ( (es =pBlockTable->getAt (ACDB_MODEL_SPACE, pSpaceRecord, AcDb::kForWrite)) == Acad::eOk ) {
//----- Append pEnt to Model Space, then close the Model Space record.
es =pSpaceRecord->appendAcDbEntity (idObj, pEnt);
pSpaceRecord->close () ;
}
pBlockTable->close () ;
}
//----- It is good programming practice to return an error status
if(es != Acad::eOk) idObj=NULL;
return (es) ;
}
void drawSpline()
{
AcDbDatabase *pDb;
pDb = acdbHostApplicationServices()->workingDatabase();
AcDbSpline *pSpl;
AcGePoint3dArray pnts;
//.... 设置pnts数据 ...//
pSpl = new AcDbSpline(pnts);
AcDbObjectId eId;
postToDb(pDb, pSpl, eId);
pSpl->close();
} |
|