几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量

几何尺寸与公差论坛------致力于产品几何量公差标准GD&T (GDT:ASME)|New GPS(ISO)研究/CAD设计/CAM加工/CMM测量 (http://www.dimcax.com/hust/index.php)
-   ObjectARX(C++) (http://www.dimcax.com/hust/forumdisplay.php?f=34)
-   -   【转帖】自定义实体制作中出现 的问题 (http://www.dimcax.com/hust/showthread.php?t=8027)

yang686526 2009-04-18 07:05 PM

【转帖】自定义实体制作中出现 的问题
 
自定义实体制作中出现 的问题
自定义实体制作中出现 的问题
我从acdbentity派生了一个子类azhtentity,然后又从azhtentity派生azhtbreaker,如下:一些必须的重载函数还有些返回值都已省略,
azhtentity中:
class azhtentity:public acdbentity
{
public:
acrx_declare_members(azhtentity);
azhtentity();
virtual ~azhtentity();
.....................................
.....................................
..................movegrippointsat()..........
..................getgrippoints()................
..................transformby()..................
.........................................................
........................................................
private:
acgepoint3d m_insertpt; //插入点
};
azhtentity::getgrippoints(acgepoint3darray& grippoints, acdbintarray& osnapmodes, acdbintarray& geomids) const
{
assertreadenabled();
grippoints.append(m_insertpt);
return acad::eok;
}
azhtentity::movegrippointsat(const acdbintarray& indices, const acgevector3d& offset)
{
assertwriteenabled();
return acad::eok;
}
azhtentity::transformby(const acgematrix3d& xform)
{
assertwriteenabled();
return acad::eok;
}
azhtbreaker中:
class azhtbreaker:public azhtentity
{
public:
acrx_declare_members(azhtbreaker);
azhtbreaker();
virtual ~azhtbreaker();
.....................................
.....................................
..................movegrippointsat()..........
..................getgrippoints()................
..................transformby()..................
.........................................................
........................................................
private:
acgepoint3d m_otherpt; //插入点
};
azhtbreaker::getgrippoints(acgepoint3darray& grippoints, acdbintarray& osnapmodes, acdbintarray& geomids) const
{
assertreadenabled();
int idirection = ((azhtentity*)this)->getdirection();
acgepoint3d insertpt = ((azhtentity*)this)->getinsertpt();
grippoints.append(m_otherpt);
azhtentity::getgrippoints(grippoints, osnapmodes, geomids);
return acad::eok;
}
azhtbreaker::movegrippointsat(const acdbintarray& indices, const acgevector3d& offset)
{
assertwriteenabled();
//若没有选中点或偏移为0
if(indices.length()==0 || offset.iszerolength())
return acad::eok;
return transformby(acgematrix3d::translation(offset));
}
azhtbreaker::transformby(const acgematrix3d& xform)
{
assertwriteenabled();
acgepoint3d insertpt = getinsertpt();
insertpt.transformby(xform);
m_otherpt.transformby(xform);
return acad::eok;
}
我这样做之后,能够得到夹点,但在移动的时候出现问题,说什么内存不足!请高手指教一下,谢谢!!!!!!
在下想知道,在重载这些函数的时候需要有些什么原则和注意的地方吗?
看你的worlddraw,估计是那的问题


所有的时间均为北京时间。 现在的时间是 07:30 AM.