明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 874|回复: 2

[ARX视频教程] 在任何需要选择的情况下都可以用pr或last来选择

[复制链接]
发表于 2016-1-15 17:52 | 显示全部楼层 |阅读模式
本帖最后由 xinxirong 于 2016-1-17 16:32 编辑

在任何需要选择的情况下都可以用pr或last来选择,但我做的ads命令,在普通的命令比如copy下输入'p1,可以获得保存的选择集,但在lisp命令中比如ssget却不能获得选择集。有办法解决吗?

        static int ads_p1(void)
        {
                long len;
                int ret=acedSSLength(DocVars.docData().myss1,&len);
                if(ret!=RTNORM)                return RTERROR;
                if (len==0)        return RTERROR;

                ret=acedRetName(DocVars.docData().myss1,RTPICKS);
                if (ret==RTNORM)
                {
                        acutPrintf(_T("<P1 Selection set>"));
                }
                return (RSRSLT) ;
        }

ACED_ADSCOMMAND_ENTRY_AUTO(CBYApp, p1, true)

比如这个Lisp命令:
(setq b (ssget))回车后,输入'P1,会出现:
cannot reenter Lisp(无法重复进入 LISP。)
的提示.
在VB下编程可以这样做,但只能针对这个应用,不能对ssget有效:
Dim ed As Editor =     Application.DocumentManager.MdiActiveDocument.Editor
Dim Opts As New PromptSelectionOptions()
Opts.Keywords.Add("myFence")
Opts.Keywords.Add("myWindow")
Opts.Keywords.Add("myWpoly")
Opts.Keywords.Add("myLastSel"
Opts.Keywords.Add("myPrevSel")
AddHandler Opts.KeywordInput, AddressOf handle_KeywordInput

.....

If e.Input.CompareTo("myPrevSel") = 0 Then  Dim ed As Editor = Application.DocumentManager.MdiActiveDocument.Editor  Dim res As PromptSelectionResult = ed.SelectPrevious()  If res.Status = PromptStatus.Error Then    Return  End If  Dim SS As Autodesk.AutoCAD.EditorInput.SelectionSet = res.Value  Dim idarray As ObjectId() = SS.GetObjectIds()  e.AddObjects(idarray)End If



 楼主| 发表于 2016-3-8 21:59 | 显示全部楼层
居然delete命令没有调用acedSSGet函数,但它却拥有acedSSGet一样的功能?
  1. 命令: d ERASE
  2. 选择对象: ssa
  3. *无效选择*
  4. 需要点或窗口(W)/上一个(L)/窗交(C)/框(BOX)/全部(ALL)/栏选(F)/圈围(WP)/圈交(CP)/编组(G)/添加(A)/删除(R)/多个(M
  5. )/前一个(P)/放弃(U)/自动(AU)/单个(SI)/子对象/对象
  6. 选择对象: ssa
  7. *无效选择*
  8. 需要点或窗口(W)/上一个(L)/窗交(C)/框(BOX)/全部(ALL)/栏选(F)/圈围(WP)/圈交(CP)/编组(G)/添加(A)/删除(R)/多个(M
  9. )/前一个(P)/放弃(U)/自动(AU)/单个(SI)/子对象/对象
  10. 选择对象: *取消*
复制代码
本来P1命令是可以透明调用的,但对于lisp却不能重复进入,所以才想到hook acedSSGet,现在只有两个命令同时在用,ssa-ssd是lisp函数中用,p1-p4是cad命令中用
发表于 2016-3-10 20:06 来自手机 | 显示全部楼层
定义为c:p1 和透明命令 p1
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-4-19 15:22 , Processed in 0.809537 second(s), 23 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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