你好Daniel,
我使用了你之前的代码,只是修改了一些以使用我的数据库。
以下代码在autocad中抛出错误对话框。
是否有我丢失的东西?如果我使用workingDatabase,它不会报告此错误。
关于,
Pawan
- int test_save()
- {
- AcDbDatabase *pDb = new AcDbDatabase();
- AcDbBlockTable *pBtbl;
- pDb->getSymbolTable(pBtbl, AcDb::kForRead);
- AcDbBlockTableRecord *pBtblRcd;
- pBtbl->getAt(ACDB_MODEL_SPACE, pBtblRcd, AcDb::kForWrite);
- pBtbl->close();
- ////////////////dim starts
- ads_point pt1 = {5,10};
- ads_point pt2 = {15,10};
- ads_point pt3 = {10,10};
- ads_point temp = {10,10};
- ads_real tAngle = 0;
- AcGePoint3d stpt(asPnt3d(pt1)); //3d starting point
- AcGePoint3d endpt(asPnt3d(pt2));; //3d ending point
- acutPolar(pt3, tAngle, 0, temp);
- AcGePoint3d dimPoint(asPnt3d(temp)); //3d dim point
-
- // if i use working database, this doesn't give error
- // AcDbDatabase *pDb= acdbHostApplicationServices()->workingDatabase();
- // AcDbBlockTableRecordPointer pBtblRcd(pDb->currentSpaceId(),AcDb::kForWrite);
-
- AcDbAlignedDimension *dim = new AcDbAlignedDimension (stpt,endpt,dimPoint);
- dim->setDatabaseDefaults(pDb);
- pBtblRcd->appendAcDbEntity(dim);
- dim->close();
- ////////////////dim ends
-
- //close the blocktable record
- pBtblRcd->close();
- //save the file
- Acad::ErrorStatus es = pDb->saveAs(_T("c:\\temp\\test.dwg"));
- //delete the database
- delete pDb;
- return 0;
- }
|