各位大虾,下面是我写的一段代码,想实现的功能是在把路径为"D:\\test.dwg"的文件作为块插入到当前的图形中去。 但是不能成功运行。请指教 #include "StdAfx.h" #include "StdArx.h" #include "aced.h" #include "migrtion.h" #include "gemat3d.h " #include "dbents.h " //----------------------------------------------------------------------------- // This is command 'CHARUDWG, by [2008-1-30], , void test1basiccharudwg() { #ifdef OARXWIZDEBUG acutPrintf ("\nOARXWIZDEBUG - test1basiccharudwg() called."); #endif // OARXWIZDEBUG // AcGeMatrix3d pt=(0,0,0); AcDbDatabase extDb(Adesk::kFalse); //定义一个空数据库 extDb.readDwgFile("D:\\test.dwg"); AcDbDatabase *ptempdb; extDb.wblock(ptempdb); AcDbObjectId blockid; acdbCurDwg()->insert(blockid,"kkk",ptempdb); delete ptempdb; AcDbBlockTable *pBlkTbl; acdbHostApplicationServices()->workingDatabase() ->getBlockTable(pBlkTbl, AcDb::kForWrite); AcGePoint3d ptInsert(100,100,0); AcDbBlockReference *pBlkRef = new AcDbBlockReference(ptInsert,blockid); AcDbBlockTableRecord *pBlkTblRcd; pBlkTbl->getAt(ACDB_MODEL_SPACE, pBlkTblRcd, AcDb::kForWrite); pBlkTblRcd->appendAcDbEntity(pBlkRef); pBlkTbl->close(); pBlkRef->close(); pBlkTblRcd->close(); } |