新建DWG文挡
<p><font color="#ee1111">#include "StdAfx.h"<br/>#include "StdArx.h"<br/>#include "dbsymtb.h"<br/>#include "dbents.h"</font></p><p><font color="#ee1111">//-----------------------------------------------------------------------------<br/>// This is command 'NEWDOC, by , , <br/>void ACADnewdoc()<br/>{<br/>#ifdef OARXWIZDEBUG<br/> acutPrintf ("\nOARXWIZDEBUG - ACADnewdoc() called.");<br/>#endif // OARXWIZDEBUG</font></p><p><font color="#ee1111"> // TODO: Implement the command<br/> static char pData[] ="acad.dwt"; <br/> acDocManager->executeInApplicationContext(CreateDoc, (void *)pData);</font></p><p><font color="#ee1111"> AcDbDatabase *pdb =acdbHostApplicationServices()->workingDatabase();</font></p><p><font color="#ee1111"> AcDbBlockTable *pBtbl;<br/> pdb->getSymbolTable(pBtbl, AcDb::kForRead);</font></p><p><font color="#ee1111"> AcDbBlockTableRecord *pBtblRcd;<br/> pBtbl->getAt(ACDB_MODEL_SPACE, pBtblRcd,<br/> AcDb::kForWrite);<br/> pBtbl->close();</font></p><p><font color="#ee1111"> AcDbCircle *pCir1 = new AcDbCircle(AcGePoint3d(1,1,1),<br/> AcGeVector3d(0,0,1),<br/> 1.0),<br/> *pCir2 = new AcDbCircle(AcGePoint3d(4,4,4),<br/> AcGeVector3d(0,0,1),<br/> 2.0);<br/> pBtblRcd->appendAcDbEntity(pCir1);<br/> pCir1->close();<br/> <br/> pBtblRcd->appendAcDbEntity(pCir2);<br/> pCir2->close();<br/> pBtblRcd->close();</font></p><p><font color="#ee1111">}</font></p><p><font color="#ee1111">void CreateDoc( void *pData) <br/>{ <br/> AcApDocument* pDoc = acDocManager->curDocument(); <br/> if(acDocManager->isApplicationContext()) <br/> {<br/> acDocManager->appContextNewDocument((const char *)pData); <br/> } <br/> else<br/> acutPrintf("\nERROR To Create Doc!\n");<br/>}</font></p><p><font color="#ee1111"></font></p><p><font color="#ee1111"><font color="#3d11ee">上述代码执行后,圆并未画在新建出来的DWG文挡上,而画在了前一个DWG文挡上,这样新建的DWG并不是当前的WorkingDatabase</font></font></p>
页:
[1]