Private Function SwAddin_DisconnectFromSW() As Boolean
'MsgBox "SwAddin_DisconnectFromSW"
Dim bRet As Boolean
'MsgBox ("unload Addin")
'Remove any UI that was added earlier 清除先前加的任何UI
bRet = iSldWorks.RemoveMenu(swdocnone, "毛坯转换CAD", "")
bRet = iSldWorks.RemoveMenu(swDocPART, "毛坯转换CAD", "")
bRet = iSldWorks.RemoveMenu(swDocASSEMBLY, "毛坯转换CAD", "")
bRet = iSldWorks.RemoveMenu(swDocDRAWING, "毛坯转换CAD", "")
'bRet = iSldWorks.RemoveToolbar2(iCookie, iToolbarID)
Set iSldWorks = Nothing
SwAddin_DisconnectFromSW = True '从SW关闭
End Function
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Callback routines for SW
Public Sub DocNONE_Item()
MsgBox "毛坯转换CAD|DocNONE_Item menuitem was called"
End Sub
Public Function DocNONE_ItemUpdate() As Long
'Return the state information for the menu item 为菜单返回状态信息
' 0 - Disabled and unchecked
' 1 - Enabled and unchecked (default when update routine does not exist)
' 2 - Disabled and checked
' 3 - Enabled and checked
DocNONE_ItemUpdate = 1
End Function
Public Sub DocASSEMBLY_Item()
MsgBox "毛坯转换CAD|DocASSEMBLY_Item menuitem was called"
End Sub
Public Function DocASSEMBLY_ItemUpdate() As Long
'Return the state information for the menu item
' 0 - Disabled and unchecked
' 1 - Enabled and unchecked (default when update routine does not exist)
' 2 - Disabled and checked
' 3 - Enabled and checked
DocASSEMBLY_ItemUpdate = 1
End Function
Public Sub stadard() '标准件
'定位操作路径及文件
Dim fs, f, s, sss
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(App.Path)
s = f.ParentFolder
sss = s + "\毛坯转换"
'MsgBox Left(sss, 1)
ChDrive sss
ChDir sss
'MsgBox CurDir
'执行操作
Shell sss + "\毛坯.exe"
End Sub
Public Function stadardUpdate() As Long
'Return the state information for the menu item
' 0 - Disabled and unchecked
' 1 - Enabled and unchecked (default when update routine does not exist)
' 2 - Disabled and checked
' 3 - Enabled and checked
stadardUpdate = 1
End Function
Public Sub gongyi() '标准件
'定位操作路径及文件
Dim fs, f, s, sss
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(App.Path)
s = f.ParentFolder
sss = s + "\工艺路线"
'MsgBox Left(sss, 1)
ChDrive sss
ChDir sss
'MsgBox CurDir
'执行操作
Shell sss + "\工艺路线.exe"
End Sub
Public Function gongyiUpdate() As Long
'Return the state information for the menu item
' 0 - Disabled and unchecked
' 1 - Enabled and unchecked (default when update routine does not exist)
' 2 - Disabled and checked
' 3 - Enabled and checked
gongyiUpdate = 1
End Function
Public Sub abort() '关于
'MsgBox CurDir
'定位操作路径及文件
Dim fs, f, s, sss
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(App.Path)
s = f.ParentFolder
sss = s + "\退出"
'MsgBox Left(sss, 1)
ChDrive sss
ChDir sss
'MsgBox CurDir
'执行操作
Shell sss + "\tuichu.exe"
End Sub
Public Function abortUpdate() As Long
'Return the state information for the menu item
' 1 - Enabled and unchecked (default when update routine does not exist)
abortUpdate = 1
End Function
Public Sub DocDRAWING_Item()
MsgBox "毛坯转换CAD|DocDRAWING_Item menuitem was called"
End Sub
Public Function DocDRAWING_ItemUpdate() As Long
'Return the state information for the menu item
' 0 - Disabled and unchecked
' 1 - Enabled and unchecked (default when update routine does not exist)
' 2 - Disabled and checked
' 3 - Enabled and checked
DocDRAWING_ItemUpdate = 1
End Function
Public Sub ToolbarFunc()
MsgBox "Toolbar function was called"
End Sub
Public Function ToolbarFuncUpdate() As Long
' 0 Button is disabled (grey)
' 1 Button is enabled. This is the default state with if no update function is specified.
' 2 Button is Disabled and "ushed"
' 3 Button is Enabled and "ushed
ToolbarFuncUpdate = 1
End Function作者: font123 时间: 2005-7-16 22:18
上贴是我进行solidworks菜单插件二次开发的的VB小程序。