|
我写了一段代码想实现创建实体后存盘如下,编译链接都通过了。但是在2002上
加载的时候出现“文件读写错误”的提示框,我实在是不知道错在哪里,请大侠指教啊
void createDwg()
{
AcDbDatabase*pDb=new AcDbDatabase();
AcDbBlockTable*pBtbl;
pDb->getSymbolTable(pBtbl,AcDb::kForRead);
AcDbBlockTableRecord*pBtblRcd;
pBtbl->getAt(ACDB_MODEL_SPACE,pBtblRcd,AcDb::kForWrite);
pBtbl->close();
AcDbCircle*pCir1=new AcDbCircle(AcGePoint3d(200,200,0),
AcGeVector3d(0,0,1),50.0);
AcDbCircle*pCir2=new AcDbCircle(AcGePoint3d(400,200,0),
AcGeVector3d(0,0,1),50.0);
AcDbLine*pLine=new AcDbLine(AcGePoint3d(300,230,0),
AcGePoint3d(300,50,0));
pLine->setColorIndex(1);
AcDbPolyline*pPolyline=new AcDbPolyline(4);
AcGePoint2d pt;
pt.x=220;
pt.y=60;
pPolyline->addVertexAt(0,pt,0.0,-1.0,-1.0);
pt.x=250;
pt.y=30;
pPolyline->addVertexAt(1,pt,0.0,-1.0,-1.0);
pt.x=350;
pt.y=30;
pPolyline->addVertexAt(2,pt,0.0,-1.0,-1.0);
pt.x=380;
pt.y=60;
pPolyline->addVertexAt(3,pt,0.0,-1.0,-1.0);
pPolyline->setThickness(100);
pPolyline->setColorIndex(4);
pBtblRcd->appendAcDbEntity(pCir1);
pCir1->close();
pBtblRcd->appendAcDbEntity(pCir2);
pCir2->close();
pBtblRcd->appendAcDbEntity(pLine);
pLine->close();
pBtblRcd->appendAcDbEntity(pPolyline);
pPolyline->close();//以上分别创建了两个园,一条线,一条多义线
//下面想把它们存盘
saveAs("face.dwg");//难道问题就出在这里?
delete pDb;
}
在响应消息kInitAppMsg时,定义了命令create
acedRegCmds->addCommand("ASDK_DWG_COMMANDS","ASDK_CREATE",
"CREATE",ACRX_CMD_MODAL,createDwg); |
|