- UID
- 3684
- 积分
- 844
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2002-4-8
- 最后登录
- 1970-1-1
|
发表于 2008-5-14 10:04:53
|
显示全部楼层
比如定义了一个实体CMyLine 有AcDbLine 的性质,那么应该这样写
CMyline有三个GripPoint
Acad::ErrorStatus CMyline::getGripPoints(AcGePoint3dArray& gripPoints,
AcDbIntArray& osnapModes,
AcDbIntArray& geomIds) const
{
assertReadEnabled();
gripPoints.append(m_ptStart);
gripPoints.append(m_ptEnd);
AcGePoint3d ptMid;//中点
//计算中点的坐标
gripPoints.append(ptMid);
return Acad::eOk;
}
//移动GripPoint时, CAD按shift可以选中多个GripPoint
Acad::ErrorStatus CMyline::moveGripPointsAt(const AcDbIntArray& indices,
const AcGeVector3d& offset)
{
assertWriteEnabled();
//GripPoint 中有中点
if (indices.contains(2))
{
m_ptStart += offset;
m_ptEnd += offset;
return Acad::eOk;
}
//GripPoint 中有起点,有终点,或者俩个都有,肯定没有中点
for (int i = 0; i < indices.length(); i++)
{
switch (indices)
{
case 0:
m_ptStart += offset;
break;
case 1:
m_ptEnd += offset;
break;
//不能这样写,中点要单独处理,如果GripPoint 三个点都选中,会导致case0,case1,case2都走了一遍,起终点移动了俩个offset
//case 2:
//m_ptStart += offset;
//m_ptEnd += offset;
// break;
default:
break;
}
}
return Acad::eOk;
} |
|