- UID
- 240596
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2005-4-9
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
怎么得到新建DWG文档的数据库指针????请高手大家帮帮忙!!
我用的是ARX2002,VC6.0
#include "StdAfx.h"
#include "StdArx.h"
#include "acdocman.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);
AcApDocument* pDoc = acDocManager->curDocument();
AcDbDatabase *pDb=new AcDbDatabase(false);
pDb=pDoc->database();
AcDbBlockTable *pBtbl;
pDb->getSymbolTable(pBtbl, AcDb::kForRead);
AcDbBlockTableRecord *pBtblRcd;
pBtbl->getAt(ACDB_MODEL_SPACE, pBtblRcd,
AcDb::kForWrite);
pBtbl->close();
acedAlert("ÎÒÊÇÌì²Å!");
AcDbLine *pline = new AcDbLine(AcGePoint3d(1,1,0),AcGePoint3d(100,100,0));
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(pline);
pline->close();
pBtblRcd->appendAcDbEntity(pCir2);
pCir2->close();
pBtblRcd->close();
// AcDbDatabase::saveAs() does not automatically
// append a DWG file extension, so it
// must be specified.
//
pDb->saveAs("test1.dwg");
delete pDb;
}
void CreateDoc( void *pData)
{
AcApDocument* pDoc = acDocManager->curDocument();
AcDbDatabase *pdb=new AcDbDatabase(false);
if(acDocManager->isApplicationContext())
{
acDocManager->appContextNewDocument((const char *)pData);
}
else
acutPrintf("\nERROR To Create Doc!\n");
} |
|