马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
也许并不是一个Bug,而是我们没发现罢了
- Sub Example_PickfirstSelectionSet()
- ' This example lists all the objects in the pickfirst selection set.
- ' Before running this example, create some objects in the active
- ' drawing and select those 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 = vbCrLf
-
- Set pfSS = ThisDrawing.PickfirstSelectionSet
- For Each ssobject In pfSS
- msg = msg & vbCrLf & ssobject.ObjectName
- Next ssobject
- MsgBox "The Pickfirst selection set contains: " & msg
-
- End Sub
以上的例子在IDE窗口中运行没问题
调用-vbarun命令运行时不能正确运行
可以用下列方法j解决
定义Lisp函数:
- (defun tls-sub2cmd(filename subname cmdname)
- (eval
- (list 'defun
- (read (strcat "c:" cmdname))
- nil
- '(if (cadr(ssgetfirst)) (sssetfirst nil (ssget)))
- (list 'vla-RunMacro
- '(vlax-get-acad-object)
- (strcat filename "!" subname)
- )
- '(sssetfirst nil nil)
- '(princ)
- )
- )
- (vlax-add-cmd cmdname (strcat "C:" cmdname))
- (princ)
- )
调用格式为:
(tls-sub2cmd "文件名" "宏名" "命令名") |