Message 1 of 29
Add a button

Not applicable
08-15-2006
09:44 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
I used ScanDrawingViews addin as a template and add a extra button. The
program works fine, howver, the second button called oButtonDefPart is not
shown up in IV. Anyone please see the code
Thx, Chris
Implements ApplicationAddInServer
Private WithEvents oButtonDefScanDrawingViews As ButtonDefinition
Private WithEvents oButtonDefPart As ButtonDefinition '
*********************
Private oInventorApp As Inventor.Application
Private Sub ApplicationAddInServer_Activate(ByVal AddInSiteObject As
Inventor.ApplicationAddInSite, ByVal FirstTime As Boolean)
' Save a reference to the Application object.
Set oInventorApp = AddInSiteObject.Application
'create the button to create the text graphics
Set oButtonDefScanDrawingViews =
oInventorApp.CommandManager.ControlDefinitions.AddButtonDefinition("ScanDrawingViews",
_
"ScanDrawingViewsCmdIntName",
kQueryOnlyCmdType, "{0E2365C9-C7A2-4304-9B1C-29285781218A}", _
"Scan Drawing Views", "Scan Drawing
Views")
Set oButtonDefPart =
oInventorApp.CommandManager.ControlDefinitions.AddButtonDefinition("Part",
"Generate a Part", kQueryOnlyCmdType, _
"{0E2365C9-C7A2-4304-9B1C-29285781218A}", "Part",
"Generate a part")
'enable the button
oButtonDefScanDrawingViews.Enabled = True
oButtonDefPart.Enabled = True
'if AddIn is called first time, create toolbar and add button to toolbar
If FirstTime = True Then
'create a new toolbar
Dim oCommandBar As CommandBar
Set oCommandBar =
oInventorApp.UserInterfaceManager.CommandBars.Add("ScanDrawingViews",
"ScanDrawingViewsToolbarIntName", , _
"{0E2365C9-C7A2-4304-9B1C-29285781218A}")
'add the button to the toolbar
oCommandBar.Controls.AddButton oButtonDefScanDrawingViews
oCommandBar.Controls.AddButton oButtonDefPart
'make the toolbar visible
oCommandBar.Visible = True
End If
End Sub
--
IV11 Pro. sp1 (uninstall)
Window XP Pro sp2
Pentium 3.2 Ghz, 3.0 GB of RAM
NVIDIA FX 3400 84.26
SpacePilot V 1.1.2
I used ScanDrawingViews addin as a template and add a extra button. The
program works fine, howver, the second button called oButtonDefPart is not
shown up in IV. Anyone please see the code
Thx, Chris
Implements ApplicationAddInServer
Private WithEvents oButtonDefScanDrawingViews As ButtonDefinition
Private WithEvents oButtonDefPart As ButtonDefinition '
*********************
Private oInventorApp As Inventor.Application
Private Sub ApplicationAddInServer_Activate(ByVal AddInSiteObject As
Inventor.ApplicationAddInSite, ByVal FirstTime As Boolean)
' Save a reference to the Application object.
Set oInventorApp = AddInSiteObject.Application
'create the button to create the text graphics
Set oButtonDefScanDrawingViews =
oInventorApp.CommandManager.ControlDefinitions.AddButtonDefinition("ScanDrawingViews",
_
"ScanDrawingViewsCmdIntName",
kQueryOnlyCmdType, "{0E2365C9-C7A2-4304-9B1C-29285781218A}", _
"Scan Drawing Views", "Scan Drawing
Views")
Set oButtonDefPart =
oInventorApp.CommandManager.ControlDefinitions.AddButtonDefinition("Part",
"Generate a Part", kQueryOnlyCmdType, _
"{0E2365C9-C7A2-4304-9B1C-29285781218A}", "Part",
"Generate a part")
'enable the button
oButtonDefScanDrawingViews.Enabled = True
oButtonDefPart.Enabled = True
'if AddIn is called first time, create toolbar and add button to toolbar
If FirstTime = True Then
'create a new toolbar
Dim oCommandBar As CommandBar
Set oCommandBar =
oInventorApp.UserInterfaceManager.CommandBars.Add("ScanDrawingViews",
"ScanDrawingViewsToolbarIntName", , _
"{0E2365C9-C7A2-4304-9B1C-29285781218A}")
'add the button to the toolbar
oCommandBar.Controls.AddButton oButtonDefScanDrawingViews
oCommandBar.Controls.AddButton oButtonDefPart
'make the toolbar visible
oCommandBar.Visible = True
End If
End Sub
--
IV11 Pro. sp1 (uninstall)
Window XP Pro sp2
Pentium 3.2 Ghz, 3.0 GB of RAM
NVIDIA FX 3400 84.26
SpacePilot V 1.1.2