找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 1014|回复: 3

[求助] [求助]:关于透明命令的问题

[复制链接]
发表于 2002-10-15 15:39:18 | 显示全部楼层 |阅读模式

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

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

×
欲要做一个窗口缩放和动态缩放的透明命令,可以使用户在其他命令执行的过程中能执行这些命令。
(defun zw(/ pt1 pt2)
   (command "zoom" "w")
  (princ)
)

(vlax-add-cmd "zw" 'zw "zw" 1)

(defun zd(/)
  (command "zoom" "d")
  (princ)
)

(vlax-add-cmd "zd 'zd"zd 1)

为何加载上面代码后在使用其他命令的过程中使用这些命令会出错?
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
发表于 2002-10-15 17:21:24 | 显示全部楼层
你试试这个
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

 楼主| 发表于 2002-10-16 00:15:39 | 显示全部楼层
我对vla系列函数不熟悉.
论坛插件加载方法
发帖求助前要善用【论坛搜索】功能,那里可能会有你要找的答案;
如果你在论坛求助问题,并且已经从坛友或者管理的回复中解决了问题,请把帖子标题加上【已解决】;
如何回报帮助你解决问题的坛友,一个好办法就是给对方加【D豆】,加分不会扣除自己的积分,做一个热心并受欢迎的人!
回复 支持 反对

使用道具 举报

已领礼包: 145个

财富等级: 日进斗金

发表于 2002-10-16 00:23:37 | 显示全部楼层
最初由 leemanzhuo 发布
[B]我对vla系列函数不熟悉. [/B]


看下帮助就可以了,这个函数是用LISP把LISP定义的命令加到ACAD的命令堆栈中,这样就和标准的内部命令一样了。也就是说可以:(command "yourcmd".....)了。

添加的方式可以有“透明命令”参数等




  1. [FONT=courier new]
  2. Adds commands to the AutoCAD built-in command set

  3. (vlax-add-cmd global-name func-sym [local-name cmd-flags])

  4. With vlax-add-cmd you can define a function as an AutoCAD command, without using the c: prefix in the function name. You can also define a transparent AutoLISP command, which is not possible with a c: function.

  5. Warning! You cannot use the command function call in a transparently-defined vlax-add-cmd function. Doing so can cause AutoCAD to close unexpectedly.

  6. The vlax-add-cmd function makes an AutoLISP function visible as an ObjectARX-style command at the AutoCAD Command prompt during the current AutoCAD session. The function provides access to the ObjectARX acedRegCmds macro, which provides a pointer to the ObjectARX system AcEdCommandStack object.

  7. The vlax-add-cmd function automatically assigns commands to command groups. When issued from a document namespace, vlax-add-cmd adds the command to a group named doc-ID; doc-ID is a hexadecimal value identifying the document. If issued from a separate-namespace VLX, vlax-add-cmd adds the command to a group named VLC-Ddoc-ID:VLX-name, where VLX-name is the name of the application that issued vlax-add-cmd.

  8. It is recommended that you use the vlax-add-cmd function from a separate-namespace VLX. You should then explicitly load the VLX using theAPPLOAD command, rather than by placing it in one of the startup LISP files.

  9. Note: You cannot use vlax-add-cmd to expose functions that create reactor objects or serve as reactor callbacks.

  10. Arguments

  11. global-name

  12. A string.

  13. func-sym

  14. A symbol naming an AutoLISP function with zero arguments.

  15. local-name

  16. A string (defaults to global-name).

  17. cmd-flags

  18. An integer (defaults to ACRX_CMD_MODAL + ACRX_CMD_REDRAW)

  19. The primary flags are:

  20. ACRX_CMD_MODAL (0) Command cannot be invoked while another command is active.

  21. ACRX_CMD_TRANSPARENT (1) Command can be invoked while another command is active.

  22. The secondary flags are:

  23. ACRX_CMD_USEPICKSET (2) When the pickfirst set is retrieved it is cleared within AutoCAD. Command will be able to retrieve the pickfirst set. Command cannot retrieve or set grips.

  24. ACRX_CMD_REDRAW (4) When the pickfirst set or grip set is retrieved, neither will be cleared within AutoCAD. Command can retrieve the pickfirst set and the grip set.

  25. If both ACRX_CMD_USEPICKSET and ACRX_CMD_REDRAW are set, the effect is the same as if just ACRX_CMD_REDRAW is set. For more information on the flags, refer to the Command Stack topic in the ObjectARX Reference manual.

  26. Return Values

  27. The global-name argument, if successful. The function returns nil, if acedRegCmds->addCommand(...) returns an error condition.

  28. Examples

  29. The hello-autocad function in the following example has no c: prefix, but vlax-add-cmd makes it visible as an ObjectARX-style command at the AutoCAD Command prompt:

  30. _$ (defun hello-autocad () (princ "hello Visual LISP"))

  31. HELLO-AUTOCAD
  32. _$ (vlax-add-cmd "hello-autocad" 'hello-autocad)

  33. "hello-autocad"
  34. See Also

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

使用道具 举报

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

本版积分规则

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

GMT+8, 2025-9-26 05:10 , Processed in 0.316881 second(s), 39 queries , Gzip On.

Powered by Discuz! X3.5

© 2001-2025 Discuz! Team.

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