[求助]为什么夹点拖动会出现错误中断,怎么解决
为什么夹点拖动会出现错误中断,怎样解决?谢谢我用ObjectARX做了一个剖视符号的自定义实体,可是有时候拖动夹点会弹出下面的对话框
致命错误:Unhandled Access Violation Reading 0x12c0000 Exception at 63acda70h
请大家帮帮我,万分感激
自定义实体的virtual函数都重载了吗?比如getGripPoint之类的,moveGripPoint。光贴个地址没用,版本不同,异常的地址是不同的,要分析。贴点代码出来。
都重载了,代码如下,调试发现问题出现在倒数第二个if,谢了
Acad::ErrorStatus TyIcDbSectViewSym::moveGripPointsAt (const AcDbIntArray &indices, const AcGeVector3d &offset)
{
assertWriteEnabled () ;
//----- This method is never called unless you return eNotImplemented
//----- from the new moveGripPointsAt() method below (which is the default implementation)
for(int i=0; i
int index = indices.at(i);
if (index == 0)
{
view_name_pnt += offset;
break;
}
if (index == 1)
{
AcGePoint3d tempnt = ori_dir_pnt + offset;
AcGeVector3d ver = ori_dir_pnt - m_pnts;
AcGeVector3d ofs_ver = tempnt - m_pnts;
if (ver.angleTo(ofs_ver) > 0.5 * PI)
{
AcGeVector3d tempvec = m_pnts - ori_dir_pnt;
ori_dir_pnt = m_pnts + tempvec;
}
break;
}
if (index == 2)
{
AcGePoint3d tempnt = end_dir_pnt + offset;
AcGeVector3d ver = end_dir_pnt - m_pnts;
AcGeVector3d ofs_ver = tempnt - m_pnts;
if (ver.angleTo(ofs_ver) > 0.5 * PI)
{
AcGeVector3d tempvec = m_pnts - end_dir_pnt;
end_dir_pnt = m_pnts + tempvec;
}
break;
}
if ((2
if (index == 3 || index == 4 || index == m_pnts_num + 1 || index == m_pnts_num +2)
{
AcGeVector3d odir_vec(m_pnts - m_pnts);
AcGeVector3d oarr_vec(ori_dir_pnt - m_pnts);
if (!oarr_vec.isPerpendicularTo(odir_vec) || (oarr_vec.length() != LineLength))
{
AcGePlane oplane(m_pnts, odir_vec);
AcGePoint3d otempnt(ori_dir_pnt.orthoProject(oplane));
AcGeVector3d otem_vec = otempnt - m_pnts;
ori_dir_pnt = m_pnts + LineLength * otem_vec.normalize();
}
AcGeVector3d edir_vec(m_pnts - m_pnts);
AcGeVector3d earr_vec(end_dir_pnt - m_pnts);
if (!earr_vec.isPerpendicularTo(edir_vec) || (earr_vec.length() != LineLength))
{
AcGePlane eplane(m_pnts, edir_vec);
AcGePoint3d etempnt(end_dir_pnt.orthoProject(eplane));
AcGeVector3d etem_vec = etempnt - m_pnts;
ori_dir_pnt = m_pnts + LineLength * etem_vec.normalize();
}
}
break;
}
if ((m_pnts_num + 2
}
return Acad::eOk;
//return (AcDbEntity::moveGripPointsAt (indices, offset)) ;
}
我浏览了一下你代码,我没法调,所以只能给你几点建议。
1.避免数组访问越界。
2.用AcGeVector3d时注意,是不是0向量。因为move这函数会被不断调用,对调试带来难度。再就是,你这类的基类是撒,根据不同要求,有些情况是需要调用基类的move的。要看你要做什么。
3.确定Crash是确定发生在你的代码。而不是由你产生错误,导致CAD其他地方CRASH,后一种较难调。如果发生在你的CODE。那就把倒数第二个IF全comment。运行,如果不crash,可以确定是在这里面问题,慢慢减小范围来查。comment最多造成功能不正确。若可避免crash,问题就很清楚,重新审视这段代码吧
页:
[1]