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