明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

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

SelectOnScreen选择完回车后,无法将选好的对象留给cad,求助。

[复制链接]
发表于 2004-8-22 13:28:00 | 显示全部楼层
本帖最后由 作者 于 2004-8-23 8:45:34 编辑

Lisp代码
  1. (defun c:testpf(/ oldstr oldint ss)
  2.   (setq oldstr (getvar "users1"))
  3.   (setq oldint (getvar "useri1"))
  4.   (setvar "users1" "T")
  5.   (setq ss (cadr (ssgetfirst)))
  6.   (setvar "useri1" 0)
  7.   (if ss (setvar "useri1" (sslength ss)))
  8.   (sssetfirst nil nil)
  9.   (vla-RunMacro (vlax-get-acad-object) "TlsCad.dvb!mTest.testpf")
  10.   (if (= (getvar "users1") "T")
  11.    (sssetfirst nil (ssget "_p"))
  12.   )
  13.   (setvar "useri1" oldint)
  14.   (setvar "users1" oldstr)
  15.   (princ)
  16. )
VBA代码
  1. Sub testpf()
  2. On Error Resume Next
  3. Dim ss As AcadSelectionSet
  4. Dim ft(0) As Integer, fd(0)
  5. Dim pfCount As Integer
  6. pfCount = ThisDrawing.GetVariable("useri1")
  7. ThisDrawing.ActiveSelectionSet.Delete
  8. ThisDrawing.SelectionSets("tlstest").Delete
  9. Set ss = ThisDrawing.SelectionSets.Add("tlstest")
  10. ft(0) = 0: fd(0) = "Line"
  11. ss.SelectOnScreen ft, fd
  12. If ss.Count = 0 And pfCount = 0 Then
  13.        ThisDrawing.SetVariable "users1", "F"
  14. End If
  15. End Sub
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2024-11-28 02:43 , Processed in 0.200043 second(s), 16 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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