#include "StdAfx.h" #include "StdArx.h" #include "dbsymtb.h" #include "dbents.h" //----------------------------------------------------------------------------- // This is command 'NEWDOC, by [2005-10-16], , void ACADkaifanewdoc() { #ifdef OARXWIZDEBUG acutPrintf ("\nOARXWIZDEBUG - ACADkaifanewdoc() called."); #endif // OARXWIZDEBUG
// TODO: Implement the command static char pData[] ="acad.dwt"; acDocManager->executeInApplicationContext(CreateDoc, (void *)pData);
/*if(acDocManager->isApplicationContext()) { acDocManager->appContextNewDocument((const char *)pData); } else { acutPrintf("\nERROR To Create Doc!\n"); return; } */ AcApDocument *pDoc; pDoc=acDocManager->curDocument(); AcDbDatabase *pdb = pDoc->database();
acDocManager->lockDocument(pDoc);
AcDbBlockTable *pBtbl; Acad::ErrorStatus es = pdb->getSymbolTable(pBtbl, AcDb::kForRead); acutPrintf("es=%d\n",es); if (es != Acad::eOk) { return; } AcDbBlockTableRecord *pBtblRcd; es = pBtbl->getAt(ACDB_MODEL_SPACE, pBtblRcd, AcDb::kForWrite); acutPrintf("es=%d\n",es); if (es != Acad::eOk) { pBtbl->close(); return; } 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();
acDocManager->unlockDocument(pDoc);
}
void CreateDoc( void *pData) { AcApDocument* pDoc = acDocManager->curDocument(); if(acDocManager->isApplicationContext()) { acDocManager->appContextNewDocument((const char *)pData); } else acutPrintf("\nERROR To Create Doc!\n");
} 我这样修改了一下!现在运行不错!但问题还是那样!加入的实体不在新建的文件中!而是在旧文件中!!!! |