马上注册,结识高手,享用更多资源,轻松玩转三维网社区。
您需要 登录 才可以下载或查看,没有帐号?注册
x
static void mySaveAs() { AcDbDatabase* pDb = new AcDbDatabase(Adesk::kFalse); Acad::ErrorStatus es = pDb->readDwgFile(L"c:\\temp\\In.dwg"); assert(es == Acad::eOk); 0 Y" M: n4 X& N2 h: D$ Q/ l
// get the block table AcDbBlockTable *pBlockTable; es = pDb->getBlockTable(pBlockTable, AcDb::kForRead); if (es != Acad::eOk) { return; } // get model space AcDbBlockTableRecord *pBlockTableRec; es = pBlockTable-> getAt(ACDB_MODEL_SPACE, pBlockTableRec, AcDb::kForWrite);
9 a( x# E! k! q, n4 d7 l# x% Nif (es != Acad::eOk) { pBlockTable->close(); return; } # D C7 o& X$ s- v
pBlockTable->close(); // create a new entity) R: F/ J6 M$ h& ^6 K) o
AcDbCircle *pCircle = new AcDbCircle(AcGePoint3d(0,0,0), AcGeVector3d(0,0,1),100);
) s# D: e& q a! d1 E// add the new entity to the model space AcDbObjectId objId; pBlockTableRec->appendAcDbEntity(objId, pCircle); 4 y$ j q$ L1 i4 h, K# v
// close the entity pCircle->close(); // close the model space block pBlockTableRec->close();
" f( _: ~) m: K2 ?+ v. i2 f// save as to the new drawing es = pDb->saveAs(L"c:\\temp\\Out.dwg"); assert(es == Acad::eOk); delete pDb; } 转载自:http://www.colinchou.com/?p=308 ! [' _* A- K1 x% L! {: A8 f0 U
|