要想使用我们必须跳过vbarun这个步骤。
使用下列方法既可以跳过这个步骤。
Private Sub AcadDocument_BeginLisp(ByVal FirstLine As String)
Select Case UCase(FirstLine)
Case "(C:GADD)"
MsgBox "GADD"
.......
Case "(C:GDEL)"
MsgBox "gdel"
.......
End Select
End Sub
(defun c:gadd()(princ)) (defun c:gdel()(princ))
command:gadd
Select Case UCase(FirstLine)
Case "(C:GADD)"
MsgBox "GADD"
.......
Case "(C:GDEL)"
MsgBox "gdel"
.......
End Select
End Sub
(defun c:gadd()(princ)) (defun c:gdel()(princ))
command:gadd
[本日志由 tiancao1001 于 2008-10-28 10:46 PM 编辑]
|
bill165 于 2010-05-18 01:34 PM 发表评论:
谢谢
tiancao1001 于 2008-10-28 10:47 PM 发表评论:
也许并不是一个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 "文件名" "宏名" "命令名")
代码:
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 "文件名" "宏名" "命令名")
发表评论 - 不要忘了输入验证码哦! |