看了一下教程有点不明白,能否指点一下?
看了一下教程有点不明白,能否指点一下:Sub Ch6_AddButton()<BR>Dim currMenuGroup As AcadMenuGroup<BR>Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(0)
<BR>' 建立一个新工具栏<BR>Dim newToolbar As AcadToolbar<BR>Set newToolbar = currMenuGroup.Toolbars.Add("TestToolbar")
<BR>' 在新工具栏上增加一个按钮<BR>Dim newButton As AcadToolbarItem<BR>Dim openMacro As String
<BR>' 赋值这个宏的VB表达式为"ESC ESC _open "
' ^C^C-vbarun ff<BR>openMacro = Chr(94) + Chr(67) + Chr(94) + Chr(67) + Chr(95) + ??'此处应该怎样表示?
Set newButton = newToolbar.AddToolbarButton("", "NewButton", "Open a file.", openMacro)<BR>End Sub<BR>
sub ff
msgbox"help me please! thanks"
end sub 以下是正确的教程:
Sub Ch6_InsertMenu()
' 为当前菜单组定义变量
Dim currMenuGroup As AcadMenuGroup
Set currMenuGroup = ThisDrawing.Application. _
MenuGroups.Item(0)' 创建新的菜单
Dim newMenu As AcadPopupMenu
Set newMenu = currMenuGroup.Menus.Add("TestMenu")' 为菜单项声明变量
Dim newMenuItem As AcadPopupMenuItem
Dim openMacro As String' 赋值宏字符串为VB语句"ESC ESC _open "并创建菜单项
openMacro = Chr(3) + Chr(3) + Chr(95) + "open" + Chr(32)
Set newMenuItem = newMenu.AddMenuItem(newMenu.Count + 1, _
"Open", openMacro)' 在菜单条上显示菜单
currMenuGroup.Menus.InsertMenuInMenuBar "TestMenu", ""
End Sub 我指的不是OPEN,而是让按扭执行FF()应该怎么表示.我找了以前的帖子,说的是用"^c^c-vbran mysub",有点不明白,到底应该怎样表示? "^c^c-vbran mysub",vbarun后面跟的参数格式是工程名称!模块名称.过程名称,过程名称应该是不带参数的。 具体点行吗。<BR> 用下面的Lisp代码把宏注册为命令调用格式为(tls-sub2cmd "myvba.dvb" "mysub" "mycmd")(defun tls-sub2cmd(filename subname cmdname)
(eval
(list 'defun
(read (strcat "c:" cmdname))
nil
(list 'vla-RunMacro '(vlax-get-acad-object) (strcat filename "!" subname))
'(princ)
)
)
(vlax-add-cmd cmdname (strcat "C:" cmdname))
(princ)
)
您就是说用VBA不能实现这个目的吗??
就是让那个按扭在按它时执行FF()
我本来就够糊涂的了! vba的宏不能在命令行直接调用,而按扭的巨集指令也是调用命令 lzh741206发表于2004-9-13 19:43:00static/image/common/back.gif用下面的Lisp代码把宏注册为命令
调用格式为
(tls-sub2cmd \"myvba.dvb\" \"mysub\" \"mycmd\")
(defun tls-sub2cmd(filename subname cmdname)
具体怎么做啊.发在哪里,怎样注册宏. 放在Acad200?doc.lsp文件里
页:
[1]