我是純業余的(可能問題都說不明白)
我用ObjectARX使用MFC撰寫了幾個對話框,寫了一些陳述句,想把計算結果直接輸出到CAD模型空間中。
當我把 “ CString outStr14;
outStr14.Format(_T("%d"),m_Yb75_4DJZ1);
AcGePoint3d ptInsert;
ptInsert.set(112, 257, 0);
CCreateTuKuang::Create1MText(ptInsert,outStr14);” 放到acrxEntryPoint.cpp中時,沒有問題,可以正常輸出計算結果。
而當我把 “ CString outStr14;
outStr14.Format(_T("%d"),m_Yb75_4DJZ1);
AcGePoint3d ptInsert;
ptInsert.set(112, 257, 0);
CCreateTuKuang::Create1MText(ptInsert,outStr14);” 放到void CWELCOME::OnYb754()時,程式除錯無錯誤,當CAD加載程式運行時出現中斷。系統顯示“acad.exe 中的 0x6458bd80 處最可能的例外: 0xC0000005: 讀取位置 0x00000004 時發生訪問沖突”
“下面的框架可能不正確或缺失,沒有為acdb17.dll加載符號”。錯誤的位置就在“ pBlockTable->close();
pBlockTableRecord->close();
pEnt->close();”
AcDbObjectId CCreateTuKuang::CreateMText(const AcGePoint3d& ptInsert,const ACHAR* text, AcDbObjectId style,double height, double width)
{
AcDbMText *pMText = new AcDbMText();
// 設定多行文字的特性
pMText->setTextStyle(style);
pMText->setContents(text);
pMText->setLocation(ptInsert);
pMText->setTextHeight(height);
pMText->setWidth(width);
pMText->setAttachment(AcDbMText::kTopMid);
return CCreateTuKuang::PostToModelSpace(pMText);
}
AcDbObjectId CCreateTuKuang::Create1MText(const AcGePoint3d& ptInsert,const ACHAR* text, AcDbObjectId style,double height, double width)
{
AcDbMText *pMText = new AcDbMText();
// 設定多行文字的特性
pMText->setTextStyle(style);
pMText->setContents(text);
pMText->setLocation(ptInsert);
pMText->setTextHeight(height);
pMText->setWidth(width);
pMText->setAttachment(AcDbMText::kTopMid);
return CCreateTuKuang::PostToModelSpace(pMText);
}
void CWELCOME::OnYb754()
{
// TODO: 在此添加命令處理程式代碼
//防止資源沖突
CAcModuleResourceOverride resOverride;
CENTERYB75TJNUM Enteryb75TjNumDlg;
if(Enteryb75TjNumDlg.DoModal()==IDOK)
{
m_Yb75_TjNum=Enteryb75TjNumDlg.m_Yb75_TjNum;
}
DJZ();//自定義函式
CString outStr14;
outStr14.Format(_T("%d"),m_Yb75_4DJZ1);
AcGePoint3d ptInsert;
ptInsert.set(112, 257, 0);
CCreateTuKuang::Create1MText(ptInsert,outStr14);
}
uj5u.com熱心網友回復:
崩潰的時候在彈出的對話框按相應按鈕進入除錯,按Alt+7鍵查看Call Stack即“呼叫堆疊”里面從上到下列出的對應從里層到外層的函式呼叫歷史。雙擊某一行可將游標定位到此次呼叫的源代碼或匯編指令處,看不懂時雙擊下一行,直到能看懂為止。uj5u.com熱心網友回復:
問題在 CCreateTuKuang::PostToModelSpace(pMText); 里頭uj5u.com熱心網友回復:
這個我會 可我看不懂啊。。

求大神幫忙!!感謝!
uj5u.com熱心網友回復:
除錯能通過,CAD加載程式的時候提示有問題,確實是這里有問題。求解決方法。拜托拜托了。。自學路上例外艱難。
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/67076.html
標籤:基礎類
