明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
12
返回列表 发新帖
楼主: wang_hui

请教各位大侠:自己做的LSP怎样能在别的命令中被透明调用?

  [复制链接]
发表于 2004-9-3 12:12:00 | 显示全部楼层
看来纯lsp可以实现透明调用
发表于 2004-9-3 12:37:00 | 显示全部楼层
No, I don't think so. Trying to call command function while another command is active will result in errors, such as application close unexpextedly or command nesting error. My suggestions are: 1. Change the first line of your code to (defun av:cz ()2. Replace   (command "zoom" pt333 pt3333) with
                       (axZoomWindow pt333 pt3333)3. Define another function
  1. (defun axZoomWindow (p1 p2)
  2.    (if (null app)(setq app (vlax-get-acad-object)))
  3.    (vla-ZoomWindow app (vlax-3d-point p1) (vlax-3d-point p2))
  4. )
4. (vlax-add-cmd "cz" 'cv:cz "cz" 5)
 楼主| 发表于 2004-9-3 17:43:00 | 显示全部楼层
1-3步照做了,可是第四步怎么样做,是运行时用,还是加在程序里?


版主你加载试过了吗?我英语真的太差了!
发表于 2004-9-3 18:34:00 | 显示全部楼层
写到程序文件里一起加载也可以,在命令行输入代码回车也可以
 楼主| 发表于 2004-9-3 20:00:00 | 显示全部楼层
我在命令行下运行(vlax-add-cmd "cz" 'cv:cz "cz" 5)


之后再打CZ怎么没有反应?


程序具体写成这样就可以吗?





要是把(vlax-add-cmd "cz" 'cv:cz "cz" 5)放在程序中该放在哪一行?

本帖子中包含更多资源

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

x
 楼主| 发表于 2004-9-3 21:23:00 | 显示全部楼层
1. Change the first line of your code to (defun av:cz () 4. (vlax-add-cmd "cz" 'cv:cz "cz" 5) 请问版主:1中是av:cz4中是cv:cz二者不要求一至吗? 再有(defun axZoomWindow (p1 p2)
(if (null app)(setq app (vlax-get-acad-object)))
(vla-ZoomWindow app (vlax-3d-point p1) (vlax-3d-point p2))
)运行时老是提示没有这个vlax-get-acad-object,到这就自动退出了! 何故?
发表于 2004-9-3 21:40:00 | 显示全部楼层
Sorry, 是我打错了,当然是一致的, 应为(vlax-add-cmd "cz" 'av:cz "cz" 5)



  1. 运行时老是提示没有这个vlax-get-acad-object,到这就自动退出了

复制代码

再程序前面加(vl-load-com), 这是常识。很多程序都必须,所以很多人在启动时已加载。


我用你的程序测试过,虽然不知具体是在干什么,但是好像没问题。
 楼主| 发表于 2004-9-4 11:22:00 | 显示全部楼层
非常感谢alin对我的帮助!!!
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-9-30 16:20 , Processed in 0.158096 second(s), 20 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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