- UID
- 482730
- 积分
- 0
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2006-8-26
- 最后登录
- 1970-1-1
|
楼主 |
发表于 2006-8-30 15:27:24
|
显示全部楼层
我按照REDCAD的意思,自定义了一个矩形类.但是不知道为什么当我拖放完成时候会出现致命错误.无法完成矩形的最终绘制.
哪位大哥可以帮小弟看看是什么原因.
拖放结束后出现: Unhandled Expception C0000005(Access Violation Reading Ox0054)at address 65462AC9h
关掉AUTCAD后 出现 :INTERNAL ERROR!XCOMMAND.cpp@3337:Was Open For Write
代码如下:
class CMARectWindow : public AcDbEntity
{
public:
ACRX_DECLARE_MEMBERS(CMARectWindow);
CMARectWindow();
virtual ~CMARectWindow();
virtual Acad::ErrorStatus dwgOutFields(AcDbDwgFiler* pFiler) const;
virtual Acad::ErrorStatus dwgInFields(AcDbDwgFiler* pFiler);
virtual Adesk::Boolean worldDraw(AcGiWorldDraw* mode);
AcGePoint3d m_UpLeftPt;
AcGePoint3d m_DownRightPt;
AcGePoint3d m_DownLeftPt;
AcGePoint3d m_UpRightPt;
private:
};
ACRX_DXF_DEFINE_MEMBERS(CMARectWindow, AcDbEntity,
AcDb::kDHL_CURRENT, AcDb::kMReleaseCurrent,
AcDbProxyEntity::kNoOperation,
CMAWINDO_INFO, PGL_02);
CMARectWindow::CMARectWindow():m_UpLeftPt(0,0,0),m_DownRightPt(0,0,0)
{
}
CMARectWindow::~CMARectWindow()
{}
Adesk::Boolean CMARectWindow::worldDraw(AcGiWorldDraw* mode)
{
assertReadEnabled();
m_DownLeftPt[0]=m_UpLeftPt[0];
m_DownLeftPt[1]=m_DownRightPt[1];
m_UpRightPt[0]=m_DownRightPt[0];
m_UpRightPt[1]=m_UpLeftPt[1];
AcGePoint3d pLineArray[5];
pLineArray[0] =m_UpLeftPt;
pLineArray[1] =m_UpRightPt;
pLineArray[2] =m_DownRightPt;
pLineArray[3] =m_DownLeftPt;
pLineArray[4] =m_UpLeftPt;
mode->geometry().polyline(5, pLineArray);
return AcDbEntity::worldDraw(mode);
}
Acad::ErrorStatus CMARectWindow::dwgInFields(AcDbDwgFiler* pFiler)
{
assertReadEnabled();
Acad::ErrorStatus es;
if ((es = AcDbEntity::dwgInFields(pFiler)) != Acad::eOk)
{
return es;
}
pFiler->readItem(&m_UpLeftPt);
pFiler->readItem(&m_DownRightPt);
return pFiler->filerStatus();
}
Acad::ErrorStatus CMARectWindow::dwgOutFields(AcDbDwgFiler* pFiler) const
{
assertReadEnabled();
Acad::ErrorStatus es;
if ((es = AcDbEntity::dwgOutFields(pFiler)) != Acad::eOk)
{
return es;
}
pFiler->writeItem(m_UpLeftPt);
pFiler->writeItem(m_DownRightPt);
return pFiler->filerStatus();
}
class AsdkRectJig:public AcEdJig
{
public:
AsdkRectJig(AcGePoint3d &);
void doIt();
virtual DragStatus sampler();
virtual Adesk::Boolean update();
virtual AcDbEntity* entity() const;
protected:
private:
CMARectWindow *mpRect;
AcGePoint3d mUpLeftPt,mDownRightPt;
double m_length,m_height;
AcGeVector3d mNormal;
};
AsdkRectJig::AsdkRectJig(AcGePoint3d &Pt)
{
mpRect=new CMARectWindow();
mpRect->m_UpLeftPt=Pt;
}
void AsdkRectJig::doIt()
{
setDispPrompt("\nRect choose the second point:");
AcEdJig::DragStatus stat=drag();
if (stat==kNormal)
{
append();
}
else
delete mpRect;
}
AcEdJig::DragStatus
AsdkRectJig::sampler()
{
DragStatus stat;
setUserInputControls((UserInputControls)
(AcEdJig::kGovernedByOrthoMode
|AcEdJig::kAccept3dCoordinates
|AcEdJig::kNoNegativeResponseAccepted
|AcEdJig::kNoZeroResponseAccepted));
static AcGePoint3d axispointTemp;
stat=acquirePoint(mDownRightPt);
if (axispointTemp!=mDownRightPt)
{
axispointTemp=mDownRightPt;
}
else if(stat==AcEdJig::kNormal)
{
return AcEdJig::kNoChange;
}
return stat;
}
Adesk::Boolean
AsdkRectJig::update()
{
mpRect->m_DownRightPt=mDownRightPt;
return Adesk::kTrue;
}
AcDbEntity *
AsdkRectJig::entity() const
{
return mpRect;
}
// This is command 'REC'
void studyrectrec()
{
// TODO: Implement the command
AcGePoint3d tempPt;
struct resbuf rbFrom,rbTo;
ads_getpoint(NULL,"\nRect choose the first point:",asDblArray(tempPt));
rbFrom.restype=RTSHORT;
rbFrom.resval.rint=1;
rbTo.restype=RTSHORT;
rbTo.resval.rint=0;
ads_trans(asDblArray(tempPt),&rbFrom,&rbTo,Adesk::kFalse,asDblArray(tempPt));
AsdkRectJig *pJig=new AsdkRectJig(tempPt);
pJig->doIt();
delete pJig;
} |
|