明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1748|回复: 1

自定义实体制作中出现 的问题

[复制链接]
发表于 2006-6-24 09:48:00 | 显示全部楼层 |阅读模式

我从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;
}

我这样做之后,能够得到夹点,但在移动的时候出现问题,说什么内存不足!请高手指教一下,谢谢!!!!!!

在下想知道,在重载这些函数的时候需要有些什么原则和注意的地方吗? 

发表于 2006-6-26 17:37:00 | 显示全部楼层
看你的worlddraw,估计是那的问题
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-25 23:23 , Processed in 0.166487 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表