找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 1537|回复: 2

[求助]:moveGripPointsAt中参数的意义和用法?

[复制链接]
发表于 2008-5-12 16:14:25 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?立即注册

×
如题:该函数原型如下:
virtual Acad::ErrorStatus moveGripPointsAt( const AcDbIntArray& indices, const AcGeVector3d& offset);
请问第一个参数具体如何使用?,帮助文件说是指示getGripPoints函数得到的夹点中当前“hot”夹点的index,问题是:indices是一个数组,一般我在例子中看到的是用indices[0]来得到当前热点的索引值,那么indices[1]、indices[2]......等等得到的是什么索引呢?
   另外,getGripPoints( AcGePoint3dArray& gripPoints,  AcDbIntArray& osnapMasks, AcDbIntArray& geomIds) const 函数中的第一参数gripPoints帮助文件说是pre-existing array to append grip points ,并说最好是在自定义实体中append自己的夹点,而不应该用赋值(assigning ),因为gripPoints可能已经有了别的实体的夹点,?此话何解?“别的实体”?原文如下:The gripPoints array is passed to all entities involved in the grip operation, so the array may already contain grip points for other entities. Therefore, it is very important to append the new points rather than assigning them to any existing elements in the array.
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
发表于 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;

}
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

 楼主| 发表于 2008-5-15 11:47:17 | 显示全部楼层
谢谢binbin,代码很经典!关键是这句://移动GripPoint时, CAD按shift可以选中多个GripPoint
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|申请友链|Archiver|手机版|小黑屋|辽公网安备|晓东CAD家园 ( 辽ICP备15016793号 )

GMT+8, 2024-9-24 06:18 , Processed in 0.362777 second(s), 36 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

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