明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 2089|回复: 5

[求助]关于自定义工具条

[复制链接]
发表于 2003-7-11 10:50 | 显示全部楼层 |阅读模式
请问在AutoCAD中能不能将dvb文件关联到某个自定义的按钮?
就是说,先在工具条上增加一个自定义的按钮,然后将dvb文件关联到这个按钮上,
点击这个按钮后就开始运行我的程序。我只知道SolidWorks有这个功能,请问在AuotoCAD中也可以吗?

另外,在AutoCAD的工具条的右键菜单中有一个“自定义”选项,这个可以用来自定义
新的工具条及定制新的按钮,可是我不知道在定制按钮时的“将宏关联到这个按钮”这个输入框应该怎么使用?
麻烦哪位大虾给我较详尽的介绍一下?谢了!
发表于 2003-7-12 12:54 | 显示全部楼层
本站的教程有详细的介绍
要不你就把代码写到vb里,编译一个exe,然后在按钮中这样写:^C^C^P(startapp "L:/fordj.exe")(princ)
发表于 2003-7-12 17:01 | 显示全部楼层
^C^C_-vbarun 运行模块,添加到按钮的宏上。
 楼主| 发表于 2003-7-13 22:45 | 显示全部楼层
要不要每次都加载模块?

能不能写完整一点儿,假设dvb工程文件放在“d:\test.dvb”

那应该怎样添加到按钮?(就是说关联代码怎么写)

谢谢
发表于 2003-7-15 09:57 | 显示全部楼层
Sub Example_AddToolbarButton()
    ' This example creates a new toolbar called TestToolbar and inserts a
    ' toolbar button into it. The toolbar is then displayed.
    ' To remove the toolbar after execution of this macro, use the Customize Menu
    ' option from the Tools menu.
   
    Dim currMenuGroup As acadMenuGroup
    Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(0)
   
    ' Create the new toolbar
    Dim newToolBar As AcadToolbar
    Set newToolBar = currMenuGroup.Toolbars.Add("TestToolbar")
   
    ' Add a button to the new toolbar
    Dim newButton As AcadToolbarItem
    Dim openMacro As String
   
    ' Assign the macro string the VB equivalent of "ESC ESC _open "
    openMacro = Chr(3) & Chr(3) & Chr(95) & "open" & Chr(32)
   
    Set newButton = newToolBar.AddToolbarButton("", "NewButton", "Open a file.", openMacro)
   
   
    ' Display the toolbar
    newToolBar.Visible = True
   
End Sub
看一下以上程序,运行后,在CAD中有一个图标,也可多加几个,形成工具条.再在CAD中改它的图案.一切OK.
 楼主| 发表于 2003-7-15 19:56 | 显示全部楼层
谢谢
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-6-2 13:57 , Processed in 0.138692 second(s), 24 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表