acedinitget

// 提示用户选择选择方式

        acedInitGet(0, _T("W CP"));

        int nRs = acedGetKword(_T("\n请输入关键字确定选择方式[窗选(W)/圈交(CP)]:<点选>"), szKword);

 

if (RTCAN == nRs)   // 取消

        {

            return;

        }

        elseif (RTNONE == nRs)  // 默认为点选

        {

            // 让用户选择一个点

            ads_point pt;

            nRs = acedGetPoint(NULL, _T("\n请选择点:"), pt);

            if (RTNORM != nRs)  // 取消

                return;

           

            nRs = acedSSGet(NULL, pt, NULL, NULL, ss);

        }

        elseif (RTNORM == nRs)

        {

            if (_tcscmp(szKword, _T("W")) == 0)

            {

                // W方式选择集,需要两个点

                ads_point pt1, pt2;

                nRs = acedGetPoint(NULL, _T("\n请输入第一个角点:"), pt1);

                if (RTNORM != nRs)

                    return;

 

                nRs = acedGetPoint(pt1, _T("\n请输入第二个角点:"), pt2);

                if (RTNORM != nRs)

                    return;

 

                nRs = acedSSGet(_T("W"), pt1, pt2, NULL, ss);

            }

            elseif (_tcscmp(szKword, _T("CP")) == 0)

            {

                // CP方式构造选择集,需要一组点,此处需要四个点

                ads_point pt[4];

                nRs = acedGetPoint(NULL, _T("\n输入第一个点:"), pt[0]);

                if (RTNORM != nRs)

                    return;

 

                nRs = acedGetPoint(pt[0], _T("\n第二个点:"), pt[1]);

                if (RTNORM != nRs)

                    return;

 

                nRs = acedGetPoint(pt[1], _T("\n第三个点:"), pt[2]);

                if (RTNORM != nRs)

                    return;

 

                nRs = acedGetPoint(pt[2], _T("\n第四个点:"), pt[3]);

                if (RTNORM != nRs)

                    return;

 

                resbuf* pRb = acutBuildList(RTPOINT, pt[0], RTPOINT, pt[1], RTPOINT, pt[2], RTPOINT, pt[3], 0);

                nRs = acedSSGet(_T("CP"), pRb, NULL, NULL, ss);

                acutRelRb(pRb);

            }

            else

            {

                acutPrintf(_T("\n无效输入"));

                return;

            }

        }

        else

        {

            acutPrintf(_T("\n无效输入"));

            return;

        }

 

        if (RTNONE == nRs)

        {

            acutPrintf(_T("\n选择集为空"));

            return;

        }

        elseif (RTNORM != nRs)

        {

            acutPrintf(_T("\n构建选择集失败"));

            return;

        }

 

        //

        // 遍历选择集,删除实体

        long lLen = 0;

        acedSSLength(ss, &lLen);

        for (long index = 0; index < lLen; index++)

        {

            ads_name ent;

            AcDbObjectId objId;

            acedSSName(ss, index, ent);

 

            acdbGetObjectId(objId, ent);

            if (!objId.isValid())

                continue;

 

            AcDbEntity* pEnt = NULL;

            if (Acad::eOk != acdbOpenAcDbEntity(pEnt, objId, AcDb::kForWrite))

                continue;

 

            pEnt->erase();

            pEnt->close();

        }

 

        acutPrintf(_T("\n删除成功"));

        return;

    }

} ;

 

转载于:https://www.cnblogs.com/xzh1993/p/4688382.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值