本帖最后由 作者 于 2004-7-7 13:09:48 编辑
下列代码在Cad2005及2002中测试通过 Lisp代码- (defun c:aabbcc()
- (setvar "cmdecho" 0)
- (if (ssget) (command "-vbarun" "aabbcc"))
- (setvar "cmdecho" 1)
- (princ)
- )
VBA代码- Sub aabbcc()
- ' This example lists all the objects in the pickfirst selection set.
- ' Before running this example, create some objects in the active
- ' drawing and select thos e objects. The objects currently selected
- ' in the active drawing will be returned in the pickfirst selection set.
-
- Dim pfSS As AcadSelectionSet
- Dim ssobject As AcadEntity
- Dim msg As String
- msg = vbCrLfa
-
- Set pfSS = ThisDrawing.ActiveSelectionSet
-
- For Each ssobject In pfSS
- msg = msg & vbCrLf & ssobject.ObjectName
- Next ssobject
- MsgBox "The Pickfirst selection set contains: " & msg
-
- End Sub
|