本帖最后由 作者 于 2004-8-23 8:45:34 编辑
Lisp代码- (defun c:testpf(/ oldstr oldint ss)
- (setq oldstr (getvar "users1"))
- (setq oldint (getvar "useri1"))
- (setvar "users1" "T")
- (setq ss (cadr (ssgetfirst)))
- (setvar "useri1" 0)
- (if ss (setvar "useri1" (sslength ss)))
- (sssetfirst nil nil)
- (vla-RunMacro (vlax-get-acad-object) "TlsCad.dvb!mTest.testpf")
- (if (= (getvar "users1") "T")
- (sssetfirst nil (ssget "_p"))
- )
- (setvar "useri1" oldint)
- (setvar "users1" oldstr)
- (princ)
- )
VBA代码- Sub testpf()
- On Error Resume Next
- Dim ss As AcadSelectionSet
- Dim ft(0) As Integer, fd(0)
- Dim pfCount As Integer
- pfCount = ThisDrawing.GetVariable("useri1")
- ThisDrawing.ActiveSelectionSet.Delete
- ThisDrawing.SelectionSets("tlstest").Delete
- Set ss = ThisDrawing.SelectionSets.Add("tlstest")
- ft(0) = 0: fd(0) = "Line"
- ss.SelectOnScreen ft, fd
- If ss.Count = 0 And pfCount = 0 Then
- ThisDrawing.SetVariable "users1", "F"
- End If
- End Sub
|