Sub CreateMenu() Dim currMenuGroup As AcadMenuGroup Set currMenuGroup = ThisDrawing.Application.MenuGroups.Item(0) Dim newMenu As AcadPopupMenu On Error Resume Next Set newMenu = currMenuGroup.Menus.Add("绘制球面")
' 向新菜单添加菜单项ai_sphere Dim newMenuItem As AcadPopupMenuItem Dim Macro As String ' 为菜单项添加执行命令 Macro = Chr(3) + Chr(3) + "ai_sphere"+ Chr(13) Set newMenuItem = newMenu.AddMenuItem(newMenu.Count + 1, "Ai_sphere", Macro)
' 在菜单栏上显示菜单 newMenu.InsertInMenuBar (ThisDrawing.Application.MenuBar.Count + 1) End Sub |