紧急求助:vba对cad二次开发
以前只是用autocad来画图,现在想编个小软件,实现一些简单的功能。请教一下对autocad二次开发的过程。1我想自定义菜单,工具箱中想加一个功能,作clothoid曲线。怎么把clothoid曲线的程序做进去呢。怎么样把我自己定义的菜单集成到我的软件中,就是说最后出来的东西是我自己定制的界面。
2在我的软件中,对画出来的任意曲线,点击后都可以弹出一个相同的对话框,以供输入参数,然后保存为文档。
就这么简单,不知道怎么集成到一起,最后生成一个我自己的东西。
谢谢。 本帖最后由 作者 于 2003-10-3 17:18:48 编辑
只能提供以下一端代码给你,希望能给你帮助(我老师的,以前说过的)
Option Explicit
Sub Menu()
'定义变量
Dim NewMenuGroup As AcadMenuGroup '群组
Dim NewMenu As AcadPopupMenu '列
Dim NewMenuItemName As AcadPopupMenuItem '菜单项
Dim Menuseparator As AcadPopupMenuItem '分隔条
Dim NewMenuItemName1 As AcadPopupMenu '菜单项
Dim subMenuItem '子菜单
'定义下拉菜单群组
Set NewMenuGroup = ThisDrawing.Application.MenuGroups.Item(0)
'创建下拉菜单列
Set NewMenu = NewMenuGroup.Menus.Add("参数化绘图")
'创建下拉菜单项
Set NewMenuItemName1 = NewMenu.AddSubMenu(NewMenu.Count + 1, "螺栓螺钉")
Set subMenuItem = NewMenu.Item(0).SubMenu.AddMenuItem(1, "十字盘头螺栓", "-vbarun uf1 ")
Set subMenuItem = NewMenu.Item(0).SubMenu.AddMenuItem(2, "十字沉头螺栓", "-vbarun uf2 ")
Set subMenuItem = NewMenu.Item(0).SubMenu.AddMenuItem(3, "十字半沉头螺栓", "-vbarun uf3 ")
Set subMenuItem = NewMenu.Item(0).SubMenu.AddMenuItem(4, "内六角螺钉", "-vbarun uf4 ")
Set NewMenuItemName1 = NewMenu.AddSubMenu(NewMenu.Count + 2, "螺 母")
Set subMenuItem = NewMenu.Item(1).SubMenu.AddMenuItem(1, "六角螺母", "-vbarun uf5 ")
Set subMenuItem = NewMenu.Item(1).SubMenu.AddMenuItem(2, "开槽螺母", "-vbarun uf6 ")
Set subMenuItem = NewMenu.Item(1).SubMenu.AddMenuItem(3, "圆螺母", "-vbarun uf7 ")
Set subMenuItem = NewMenu.Item(1).SubMenu.AddMenuItem(4, "蝶形螺母", "-vbarun uf8 ")
Set NewMenuItemName1 = NewMenu.AddSubMenu(NewMenu.Count + 3, "销类零件")
Set subMenuItem = NewMenu.Item(2).SubMenu.AddMenuItem(1, "圆 柱 销", "-vbarun uf9 ")
Set subMenuItem = NewMenu.Item(2).SubMenu.AddMenuItem(2, "圆 锥 销", "-vbarun uf10 ")
Set subMenuItem = NewMenu.Item(2).SubMenu.AddMenuItem(3, "开 口 销", "-vbarun uf11 ")
Set subMenuItem = NewMenu.Item(2).SubMenu.AddMenuItem(4, "A型销轴", "-vbarun uf12 ")
Set NewMenuItemName = NewMenu.AddSeparator(NewMenu.Count + 4)
Set NewMenuItemName = NewMenu.AddMenuItem(NewMenu.Count + 6, "退 出", "-vbarun uf60 ")
'显示新菜单
NewMenu.InsertInMenuBar (ThisDrawing.Application.MenuBar.Count + 1)
End Sub
Sub uf1()
UserForm1.Show
End Sub
Sub uf2()
UserForm2.Show
End Sub
Sub uf3()
UserForm3.Show
End Sub
Sub uf4()
UserForm4.Show
End Sub
Sub uf5()
UserForm5.Show
End Sub
Sub uf6()
UserForm6.Show
End Sub
Sub uf7()
UserForm7.Show
End Sub
Sub uf8()
UserForm8.Show
End Sub
Sub uf9()
UserForm9.Show
End Sub
Sub uf10()
UserForm10.Show
End Sub
Sub uf11()
UserForm11.Show
End Sub
Sub uf12()
UserForm12.Show
End Sub
Sub uf60()
ThisDrawing.SendCommand "filedia 0 "
ThisDrawing.SendCommand "menu acad" + Chr(13)
ThisDrawing.SendCommand "filedia 1 "
End Sub
页:
[1]