- 积分
- 373
- 明经币
- 个
- 注册时间
- 2003-9-19
- 在线时间
- 小时
- 威望
-
- 金钱
- 个
- 贡献
-
- 激情
-
|
请问 为什么在一个对话筐里 画线按钮响应函数 执行出错 但如果在一个单独的命令中却可以正常?[br]请问 为什么在一个对话筐里 画线按钮响应函数 执行出错
但如果在一个单独的命令中却可以正常?
void CLineDlg::OnButtonLine()
{
AcDbDatabase *pCurDb;
AcGePoint3d startPt(40.0,20.0,0.0);
AcGePoint3d endPt(240.0,220.0,0.0);
AcDbLine *pLine = new AcDbLine(startPt, endPt);
pCurDb=acdbHostApplicationServices()->workingDatabase();
AcDbBlockTable *pBlockTable;
pCurDb->getBlockTable(pBlockTable,
AcDb::kForRead);
AcDbBlockTableRecord *pBlockTableRecord;
pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord,
AcDb::kForWrite);
pBlockTable->close();
AcDbObjectId lineId;
pBlockTableRecord->appendAcDbEntity(lineId, pLine);
pBlockTableRecord->close();
pLine->close();
}
说ACDB15.DLL出错
但在命令 执行函数 中却可以正常运行
void RELATIONqdp()
{
// TODO: Implement the command
AcDbDatabase *pCurDb;
AcGePoint3d startPt(40.0,20.0,0.0);
AcGePoint3d endPt(2400.0,2400.0,0.0);
//ads_getpoint(NULL,"\n 第 一 点:",asDblArray(startPt));
//ads_getpoint(asDblArray(startPt),"\n 第 二 点:",asDblArray(endPt));
::AfxMessageBox("2");
AcDbLine *pLine = new AcDbLine(startPt, endPt);
pCurDb=acdbHostApplicationServices()->workingDatabase();
AcDbBlockTable *pBlockTable;
pCurDb->getBlockTable(pBlockTable,
AcDb::kForRead);
AcDbBlockTableRecord *pBlockTableRecord;
pBlockTable->getAt(ACDB_MODEL_SPACE, pBlockTableRecord,
AcDb::kForWrite);
pBlockTable->close();
//AcDbObjectId lineId=AcDbObjectId::kNull;
AcDbObjectId lineId;
pBlockTableRecord->appendAcDbEntity(lineId, pLine);
pBlockTableRecord->close();
pLine->close();
} |
|