Permlink Replies: 7 - Last Post: Jul 12, 2005 5:30 PM Last Post By: Sanjay Ramaswam...
Jim Dowthwaite
Problem creating a custom commandbar
Posted: Jul 11, 2005 7:31 PM
  Click to reply to this thread Reply
I'm trying to create a custom commandbar in Inventor 10 but I seem to be
stuck. I can create the button definitions and I can create the toolbar but
when I load Inventor the buttons are not being added to the toolbar. I've
used the InteractionTest as a template but no luck.

Source code below. Any ideas?

Private Sub ApplicationAddInServer_Activate(ByVal AddInSiteObject As
Inventor.ApplicationAddInSite, _
ByVal FirstTime As Boolean)
Dim oIF As IPictureDisp
Dim oIBF As IPictureDisp
Dim oCommandbar As CommandBar

' Save a reference to the Application object.
Set oApp = AddInSiteObject.Application
Set oAppEvents = oApp.ApplicationEvents

Set oIF = LoadResPicture(101, vbResIcon)
Set oIBF = LoadResPicture(111, vbResIcon)

Set oBH_VF =
oApp.CommandManager.ControlDefinitions.AddButtonDefinition("Front", _

"scVF", _

kQueryOnlyCmdType, _

"{57E6E593-2CAE-4016-AE01-74BB752C670E}", _

"Front", _

"Front", _

oIF, _

oIBF, _

kNoTextWithIcon)

oBH_VF.Enabled = True

If FirstTime = True Then
' Create a new toolbar
Set oCommandbar = oApp.UserInterfaceManager.CommandBars.Add("SCV",
"scCBV", kButtonPopupCommandBar, "{57E6E593-2CAE-4016-AE01-74BB752C670E}")

' Add the controls to the command bar.
oCommandbar.Controls.AddButton oBH_VF

' Make the toolbar visible
oCommandbar.Visible = True
End If
End Sub
Sanjay Ramaswam...
Re: Problem creating a custom commandbar
Posted: Jul 11, 2005 8:43 PM   in response to: Jim Dowthwaite in response to: Jim Dowthwaite
  Click to reply to this thread Reply
In the CommandBars.Add method, specify the command bar type (the 3rd
argument) to be kRegularCommandBar. The kButtonPopupCommandBar flavor that
you are creating in the code below is for a specialized control (a button
pop-up). See the UI Customization overview in Programming Help for more
details.

Sanjay-


"Jim Dowthwaite" wrote in message
news:4898195@discussion.autodesk.com...
I'm trying to create a custom commandbar in Inventor 10 but I seem to be
stuck. I can create the button definitions and I can create the toolbar but
when I load Inventor the buttons are not being added to the toolbar. I've
used the InteractionTest as a template but no luck.

Source code below. Any ideas?

Private Sub ApplicationAddInServer_Activate(ByVal AddInSiteObject As
Inventor.ApplicationAddInSite, _
ByVal FirstTime As Boolean)
Dim oIF As IPictureDisp
Dim oIBF As IPictureDisp
Dim oCommandbar As CommandBar

' Save a reference to the Application object.
Set oApp = AddInSiteObject.Application
Set oAppEvents = oApp.ApplicationEvents

Set oIF = LoadResPicture(101, vbResIcon)
Set oIBF = LoadResPicture(111, vbResIcon)

Set oBH_VF =
oApp.CommandManager.ControlDefinitions.AddButtonDefinition("Front", _

"scVF", _

kQueryOnlyCmdType, _

"{57E6E593-2CAE-4016-AE01-74BB752C670E}", _

"Front", _

"Front", _

oIF, _

oIBF, _

kNoTextWithIcon)

oBH_VF.Enabled = True

If FirstTime = True Then
' Create a new toolbar
Set oCommandbar = oApp.UserInterfaceManager.CommandBars.Add("SCV",
"scCBV", kButtonPopupCommandBar, "{57E6E593-2CAE-4016-AE01-74BB752C670E}")

' Add the controls to the command bar.
oCommandbar.Controls.AddButton oBH_VF

' Make the toolbar visible
oCommandbar.Visible = True
End If
End Sub
Jim Dowthwaite
Re: Problem creating a custom commandbar
Posted: Jul 11, 2005 11:26 PM   in response to: Sanjay Ramaswam... in response to: Sanjay Ramaswam...
  Click to reply to this thread Reply
Sanjay,

Thanks for the help but unfortunately, still no luck. The toolbar is
loading but the button(s) are not appearing on the toolbar.

Jim

"Sanjay Ramaswamy (Autodesk)" wrote in
message news:4898312@discussion.autodesk.com...
In the CommandBars.Add method, specify the command bar type (the 3rd
argument) to be kRegularCommandBar. The kButtonPopupCommandBar flavor that
you are creating in the code below is for a specialized control (a button
pop-up). See the UI Customization overview in Programming Help for more
details.

Sanjay-


"Jim Dowthwaite" wrote in message
news:4898195@discussion.autodesk.com...
I'm trying to create a custom commandbar in Inventor 10 but I seem to be
stuck. I can create the button definitions and I can create the toolbar but
when I load Inventor the buttons are not being added to the toolbar. I've
used the InteractionTest as a template but no luck.

Source code below. Any ideas?

Private Sub ApplicationAddInServer_Activate(ByVal AddInSiteObject As
Inventor.ApplicationAddInSite, _
ByVal FirstTime As Boolean)
Dim oIF As IPictureDisp
Dim oIBF As IPictureDisp
Dim oCommandbar As CommandBar

' Save a reference to the Application object.
Set oApp = AddInSiteObject.Application
Set oAppEvents = oApp.ApplicationEvents

Set oIF = LoadResPicture(101, vbResIcon)
Set oIBF = LoadResPicture(111, vbResIcon)

Set oBH_VF =
oApp.CommandManager.ControlDefinitions.AddButtonDefinition("Front", _

"scVF", _

kQueryOnlyCmdType, _

"{57E6E593-2CAE-4016-AE01-74BB752C670E}", _

"Front", _

"Front", _

oIF, _

oIBF, _

kNoTextWithIcon)

oBH_VF.Enabled = True

If FirstTime = True Then
' Create a new toolbar
Set oCommandbar = oApp.UserInterfaceManager.CommandBars.Add("SCV",
"scCBV", kButtonPopupCommandBar, "{57E6E593-2CAE-4016-AE01-74BB752C670E}")

' Add the controls to the command bar.
oCommandbar.Controls.AddButton oBH_VF

' Make the toolbar visible
oCommandbar.Visible = True
End If
End Sub
Sanjay Ramaswam...
Re: Problem creating a custom commandbar
Posted: Jul 12, 2005 12:10 AM   in response to: Jim Dowthwaite in response to: Jim Dowthwaite
  Click to reply to this thread Reply
Jim,

I'm not sure why the buttons don't appear. Here are a few thoughts:

1. Have you stepped thru the code to make sure that the call
oCommandbar.Controls.AddButton oBH_VF is being made? Perhaps your AddIn is
not being loaded for the first time and the code in the If FirstTime = True
block is being skipped?
2. Try to replace kNoTextWithIcon with kAlwaysDisplayText in the
AddButtonDefinition method. Just to make sure the problem is not related to
icons.
3. I didn't see oBH_VF being defined (as a ButtonDefinition). Perhaps you
have that outside the sub?

Sanjay-


"Jim Dowthwaite" wrote in message
news:4898438@discussion.autodesk.com...
Sanjay,

Thanks for the help but unfortunately, still no luck. The toolbar is
loading but the button(s) are not appearing on the toolbar.

Jim

"Sanjay Ramaswamy (Autodesk)" wrote in
message news:4898312@discussion.autodesk.com...
In the CommandBars.Add method, specify the command bar type (the 3rd
argument) to be kRegularCommandBar. The kButtonPopupCommandBar flavor that
you are creating in the code below is for a specialized control (a button
pop-up). See the UI Customization overview in Programming Help for more
details.

Sanjay-


"Jim Dowthwaite" wrote in message
news:4898195@discussion.autodesk.com...
I'm trying to create a custom commandbar in Inventor 10 but I seem to be
stuck. I can create the button definitions and I can create the toolbar but
when I load Inventor the buttons are not being added to the toolbar. I've
used the InteractionTest as a template but no luck.

Source code below. Any ideas?

Private Sub ApplicationAddInServer_Activate(ByVal AddInSiteObject As
Inventor.ApplicationAddInSite, _
ByVal FirstTime As Boolean)
Dim oIF As IPictureDisp
Dim oIBF As IPictureDisp
Dim oCommandbar As CommandBar

' Save a reference to the Application object.
Set oApp = AddInSiteObject.Application
Set oAppEvents = oApp.ApplicationEvents

Set oIF = LoadResPicture(101, vbResIcon)
Set oIBF = LoadResPicture(111, vbResIcon)

Set oBH_VF =
oApp.CommandManager.ControlDefinitions.AddButtonDefinition("Front", _

"scVF", _

kQueryOnlyCmdType, _

"{57E6E593-2CAE-4016-AE01-74BB752C670E}", _

"Front", _

"Front", _

oIF, _

oIBF, _

kNoTextWithIcon)

oBH_VF.Enabled = True

If FirstTime = True Then
' Create a new toolbar
Set oCommandbar = oApp.UserInterfaceManager.CommandBars.Add("SCV",
"scCBV", kButtonPopupCommandBar, "{57E6E593-2CAE-4016-AE01-74BB752C670E}")

' Add the controls to the command bar.
oCommandbar.Controls.AddButton oBH_VF

' Make the toolbar visible
oCommandbar.Visible = True
End If
End Sub
Jim Dowthwaite
Re: Problem creating a custom commandbar
Posted: Jul 12, 2005 12:47 AM   in response to: Sanjay Ramaswam... in response to: Sanjay Ramaswam...
  Click to reply to this thread Reply
Sanjay,

Looks like the FirstTime code is not being executed. Any idea why this
would happen? kAlwaysDisplayText didn't help. oBH_VF is defined as a
private variable for event handling. Think your first tip hit the nail on
the head.

Jim

"Sanjay Ramaswamy (Autodesk)" wrote in
message news:4898518@discussion.autodesk.com...
Jim,

I'm not sure why the buttons don't appear. Here are a few thoughts:

1. Have you stepped thru the code to make sure that the call
oCommandbar.Controls.AddButton oBH_VF is being made? Perhaps your AddIn is
not being loaded for the first time and the code in the If FirstTime = True
block is being skipped?
2. Try to replace kNoTextWithIcon with kAlwaysDisplayText in the
AddButtonDefinition method. Just to make sure the problem is not related to
icons.
3. I didn't see oBH_VF being defined (as a ButtonDefinition). Perhaps you
have that outside the sub?

Sanjay-


"Jim Dowthwaite" wrote in message
news:4898438@discussion.autodesk.com...
Sanjay,

Thanks for the help but unfortunately, still no luck. The toolbar is
loading but the button(s) are not appearing on the toolbar.

Jim

"Sanjay Ramaswamy (Autodesk)" wrote in
message news:4898312@discussion.autodesk.com...
In the CommandBars.Add method, specify the command bar type (the 3rd
argument) to be kRegularCommandBar. The kButtonPopupCommandBar flavor that
you are creating in the code below is for a specialized control (a button
pop-up). See the UI Customization overview in Programming Help for more
details.

Sanjay-


"Jim Dowthwaite" wrote in message
news:4898195@discussion.autodesk.com...
I'm trying to create a custom commandbar in Inventor 10 but I seem to be
stuck. I can create the button definitions and I can create the toolbar but
when I load Inventor the buttons are not being added to the toolbar. I've
used the InteractionTest as a template but no luck.

Source code below. Any ideas?

Private Sub ApplicationAddInServer_Activate(ByVal AddInSiteObject As
Inventor.ApplicationAddInSite, _
ByVal FirstTime As Boolean)
Dim oIF As IPictureDisp
Dim oIBF As IPictureDisp
Dim oCommandbar As CommandBar

' Save a reference to the Application object.
Set oApp = AddInSiteObject.Application
Set oAppEvents = oApp.ApplicationEvents

Set oIF = LoadResPicture(101, vbResIcon)
Set oIBF = LoadResPicture(111, vbResIcon)

Set oBH_VF =
oApp.CommandManager.ControlDefinitions.AddButtonDefinition("Front", _

"scVF", _

kQueryOnlyCmdType, _

"{57E6E593-2CAE-4016-AE01-74BB752C670E}", _

"Front", _

"Front", _

oIF, _

oIBF, _

kNoTextWithIcon)

oBH_VF.Enabled = True

If FirstTime = True Then
' Create a new toolbar
Set oCommandbar = oApp.UserInterfaceManager.CommandBars.Add("SCV",
"scCBV", kButtonPopupCommandBar, "{57E6E593-2CAE-4016-AE01-74BB752C670E}")

' Add the controls to the command bar.
oCommandbar.Controls.AddButton oBH_VF

' Make the toolbar visible
oCommandbar.Visible = True
End If
End Sub
Sanjay Ramaswam...
Re: Problem creating a custom commandbar
Posted: Jul 12, 2005 2:04 AM   in response to: Jim Dowthwaite in response to: Jim Dowthwaite
  Click to reply to this thread Reply
Hi Jim,

The FirstTime argument will be true only when your AddIn is being loaded for
the very first time after registration. User interface items such as command
bars & controls need to be created only during the first time and they will
be persisted by Inventor. Please see page 6 of the UI Customization overview
in Programming Help for a detailed explanation regarding this.

In order to work around your present situation, you can force the First Time
flag to True by changing the value of the "Version" entry in your AddIn's
registry (the same place where you set things such as LoadOnStartUp,
SupportedSoftwareVersionEqualTo, etc. Just increment the value of the
Version entry to 1 (and 2,3,4,.... for each time you want to change the way
your user interface looks).

Sanjay-


"Jim Dowthwaite" wrote in message
news:4898531@discussion.autodesk.com...
Sanjay,

Looks like the FirstTime code is not being executed. Any idea why this
would happen? kAlwaysDisplayText didn't help. oBH_VF is defined as a
private variable for event handling. Think your first tip hit the nail on
the head.

Jim

"Sanjay Ramaswamy (Autodesk)" wrote in
message news:4898518@discussion.autodesk.com...
Jim,

I'm not sure why the buttons don't appear. Here are a few thoughts:

1. Have you stepped thru the code to make sure that the call
oCommandbar.Controls.AddButton oBH_VF is being made? Perhaps your AddIn is
not being loaded for the first time and the code in the If FirstTime = True
block is being skipped?
2. Try to replace kNoTextWithIcon with kAlwaysDisplayText in the
AddButtonDefinition method. Just to make sure the problem is not related to
icons.
3. I didn't see oBH_VF being defined (as a ButtonDefinition). Perhaps you
have that outside the sub?

Sanjay-


"Jim Dowthwaite" wrote in message
news:4898438@discussion.autodesk.com...
Sanjay,

Thanks for the help but unfortunately, still no luck. The toolbar is
loading but the button(s) are not appearing on the toolbar.

Jim

"Sanjay Ramaswamy (Autodesk)" wrote in
message news:4898312@discussion.autodesk.com...
In the CommandBars.Add method, specify the command bar type (the 3rd
argument) to be kRegularCommandBar. The kButtonPopupCommandBar flavor that
you are creating in the code below is for a specialized control (a button
pop-up). See the UI Customization overview in Programming Help for more
details.

Sanjay-


"Jim Dowthwaite" wrote in message
news:4898195@discussion.autodesk.com...
I'm trying to create a custom commandbar in Inventor 10 but I seem to be
stuck. I can create the button definitions and I can create the toolbar but
when I load Inventor the buttons are not being added to the toolbar. I've
used the InteractionTest as a template but no luck.

Source code below. Any ideas?

Private Sub ApplicationAddInServer_Activate(ByVal AddInSiteObject As
Inventor.ApplicationAddInSite, _
ByVal FirstTime As Boolean)
Dim oIF As IPictureDisp
Dim oIBF As IPictureDisp
Dim oCommandbar As CommandBar

' Save a reference to the Application object.
Set oApp = AddInSiteObject.Application
Set oAppEvents = oApp.ApplicationEvents

Set oIF = LoadResPicture(101, vbResIcon)
Set oIBF = LoadResPicture(111, vbResIcon)

Set oBH_VF =
oApp.CommandManager.ControlDefinitions.AddButtonDefinition("Front", _

"scVF", _

kQueryOnlyCmdType, _

"{57E6E593-2CAE-4016-AE01-74BB752C670E}", _

"Front", _

"Front", _

oIF, _

oIBF, _

kNoTextWithIcon)

oBH_VF.Enabled = True

If FirstTime = True Then
' Create a new toolbar
Set oCommandbar = oApp.UserInterfaceManager.CommandBars.Add("SCV",
"scCBV", kButtonPopupCommandBar, "{57E6E593-2CAE-4016-AE01-74BB752C670E}")

' Add the controls to the command bar.
oCommandbar.Controls.AddButton oBH_VF

' Make the toolbar visible
oCommandbar.Visible = True
End If
End Sub
Jim Dowthwaite
Re: Problem creating a custom commandbar
Posted: Jul 12, 2005 2:43 PM   in response to: Sanjay Ramaswam... in response to: Sanjay Ramaswam...
  Click to reply to this thread Reply
Sanjay,

Setting the version in the reg file did the trick. Thank you very much!

One more question. Is it possible to add a separator bar and buttons beside
the sketch doctor (red +) button?

Jim.


"Sanjay Ramaswamy (Autodesk)" wrote in
message news:4898540@discussion.autodesk.com...
Hi Jim,

The FirstTime argument will be true only when your AddIn is being loaded for
the very first time after registration. User interface items such as command
bars & controls need to be created only during the first time and they will
be persisted by Inventor. Please see page 6 of the UI Customization overview
in Programming Help for a detailed explanation regarding this.

In order to work around your present situation, you can force the First Time
flag to True by changing the value of the "Version" entry in your AddIn's
registry (the same place where you set things such as LoadOnStartUp,
SupportedSoftwareVersionEqualTo, etc. Just increment the value of the
Version entry to 1 (and 2,3,4,.... for each time you want to change the way
your user interface looks).

Sanjay-


"Jim Dowthwaite" wrote in message
news:4898531@discussion.autodesk.com...
Sanjay,

Looks like the FirstTime code is not being executed. Any idea why this
would happen? kAlwaysDisplayText didn't help. oBH_VF is defined as a
private variable for event handling. Think your first tip hit the nail on
the head.

Jim

"Sanjay Ramaswamy (Autodesk)" wrote in
message news:4898518@discussion.autodesk.com...
Jim,

I'm not sure why the buttons don't appear. Here are a few thoughts:

1. Have you stepped thru the code to make sure that the call
oCommandbar.Controls.AddButton oBH_VF is being made? Perhaps your AddIn is
not being loaded for the first time and the code in the If FirstTime = True
block is being skipped?
2. Try to replace kNoTextWithIcon with kAlwaysDisplayText in the
AddButtonDefinition method. Just to make sure the problem is not related to
icons.
3. I didn't see oBH_VF being defined (as a ButtonDefinition). Perhaps you
have that outside the sub?

Sanjay-


"Jim Dowthwaite" wrote in message
news:4898438@discussion.autodesk.com...
Sanjay,

Thanks for the help but unfortunately, still no luck. The toolbar is
loading but the button(s) are not appearing on the toolbar.

Jim

"Sanjay Ramaswamy (Autodesk)" wrote in
message news:4898312@discussion.autodesk.com...
In the CommandBars.Add method, specify the command bar type (the 3rd
argument) to be kRegularCommandBar. The kButtonPopupCommandBar flavor that
you are creating in the code below is for a specialized control (a button
pop-up). See the UI Customization overview in Programming Help for more
details.

Sanjay-


"Jim Dowthwaite" wrote in message
news:4898195@discussion.autodesk.com...
I'm trying to create a custom commandbar in Inventor 10 but I seem to be
stuck. I can create the button definitions and I can create the toolbar but
when I load Inventor the buttons are not being added to the toolbar. I've
used the InteractionTest as a template but no luck.

Source code below. Any ideas?

Private Sub ApplicationAddInServer_Activate(ByVal AddInSiteObject As
Inventor.ApplicationAddInSite, _
ByVal FirstTime As Boolean)
Dim oIF As IPictureDisp
Dim oIBF As IPictureDisp
Dim oCommandbar As CommandBar

' Save a reference to the Application object.
Set oApp = AddInSiteObject.Application
Set oAppEvents = oApp.ApplicationEvents

Set oIF = LoadResPicture(101, vbResIcon)
Set oIBF = LoadResPicture(111, vbResIcon)

Set oBH_VF =
oApp.CommandManager.ControlDefinitions.AddButtonDefinition("Front", _

"scVF", _

kQueryOnlyCmdType, _

"{57E6E593-2CAE-4016-AE01-74BB752C670E}", _

"Front", _

"Front", _

oIF, _

oIBF, _

kNoTextWithIcon)

oBH_VF.Enabled = True

If FirstTime = True Then
' Create a new toolbar
Set oCommandbar = oApp.UserInterfaceManager.CommandBars.Add("SCV",
"scCBV", kButtonPopupCommandBar, "{57E6E593-2CAE-4016-AE01-74BB752C670E}")

' Add the controls to the command bar.
oCommandbar.Controls.AddButton oBH_VF

' Make the toolbar visible
oCommandbar.Visible = True
End If
End Sub
Sanjay Ramaswam...
Re: Problem creating a custom commandbar
Posted: Jul 12, 2005 5:30 PM   in response to: Jim Dowthwaite in response to: Jim Dowthwaite
  Click to reply to this thread Reply
Yes. Every control in the UI (including the doctor) is represented using a
CommandBarControl object. Setting the GroupBegins property on a
CommandBarControl to True, adds a separator before the control. Also, you
can control the position of any newly inserted controls by using the (Before
As Long) argument of the Add methods on CommandBarControls. This argument is
the index of the control before which you want to insert the new control.
For instance, in order to insert something before the sketch doctor control,
first find the sketch doctor control, find it's index (using
CommandBarControl.index property) and then use the index during the new
control creation.

Sanjay-

"Jim Dowthwaite" wrote in message
news:4898938@discussion.autodesk.com...
Sanjay,

Setting the version in the reg file did the trick. Thank you very much!

One more question. Is it possible to add a separator bar and buttons beside
the sketch doctor (red +) button?

Jim.


"Sanjay Ramaswamy (Autodesk)" wrote in
message news:4898540@discussion.autodesk.com...
Hi Jim,

The FirstTime argument will be true only when your AddIn is being loaded for
the very first time after registration. User interface items such as command
bars & controls need to be created only during the first time and they will
be persisted by Inventor. Please see page 6 of the UI Customization overview
in Programming Help for a detailed explanation regarding this.

In order to work around your present situation, you can force the First Time
flag to True by changing the value of the "Version" entry in your AddIn's
registry (the same place where you set things such as LoadOnStartUp,
SupportedSoftwareVersionEqualTo, etc. Just increment the value of the
Version entry to 1 (and 2,3,4,.... for each time you want to change the way
your user interface looks).

Sanjay-


"Jim Dowthwaite" wrote in message
news:4898531@discussion.autodesk.com...
Sanjay,

Looks like the FirstTime code is not being executed. Any idea why this
would happen? kAlwaysDisplayText didn't help. oBH_VF is defined as a
private variable for event handling. Think your first tip hit the nail on
the head.

Jim

"Sanjay Ramaswamy (Autodesk)" wrote in
message news:4898518@discussion.autodesk.com...
Jim,

I'm not sure why the buttons don't appear. Here are a few thoughts:

1. Have you stepped thru the code to make sure that the call
oCommandbar.Controls.AddButton oBH_VF is being made? Perhaps your AddIn is
not being loaded for the first time and the code in the If FirstTime = True
block is being skipped?
2. Try to replace kNoTextWithIcon with kAlwaysDisplayText in the
AddButtonDefinition method. Just to make sure the problem is not related to
icons.
3. I didn't see oBH_VF being defined (as a ButtonDefinition). Perhaps you
have that outside the sub?

Sanjay-


"Jim Dowthwaite" wrote in message
news:4898438@discussion.autodesk.com...
Sanjay,

Thanks for the help but unfortunately, still no luck. The toolbar is
loading but the button(s) are not appearing on the toolbar.

Jim

"Sanjay Ramaswamy (Autodesk)" wrote in
message news:4898312@discussion.autodesk.com...
In the CommandBars.Add method, specify the command bar type (the 3rd
argument) to be kRegularCommandBar. The kButtonPopupCommandBar flavor that
you are creating in the code below is for a specialized control (a button
pop-up). See the UI Customization overview in Programming Help for more
details.

Sanjay-


"Jim Dowthwaite" wrote in message
news:4898195@discussion.autodesk.com...
I'm trying to create a custom commandbar in Inventor 10 but I seem to be
stuck. I can create the button definitions and I can create the toolbar but
when I load Inventor the buttons are not being added to the toolbar. I've
used the InteractionTest as a template but no luck.

Source code below. Any ideas?

Private Sub ApplicationAddInServer_Activate(ByVal AddInSiteObject As
Inventor.ApplicationAddInSite, _
ByVal FirstTime As Boolean)
Dim oIF As IPictureDisp
Dim oIBF As IPictureDisp
Dim oCommandbar As CommandBar

' Save a reference to the Application object.
Set oApp = AddInSiteObject.Application
Set oAppEvents = oApp.ApplicationEvents

Set oIF = LoadResPicture(101, vbResIcon)
Set oIBF = LoadResPicture(111, vbResIcon)

Set oBH_VF =
oApp.CommandManager.ControlDefinitions.AddButtonDefinition("Front", _

"scVF", _

kQueryOnlyCmdType, _

"{57E6E593-2CAE-4016-AE01-74BB752C670E}", _

"Front", _

"Front", _

oIF, _

oIBF, _

kNoTextWithIcon)

oBH_VF.Enabled = True

If FirstTime = True Then
' Create a new toolbar
Set oCommandbar = oApp.UserInterfaceManager.CommandBars.Add("SCV",
"scCBV", kButtonPopupCommandBar, "{57E6E593-2CAE-4016-AE01-74BB752C670E}")

' Add the controls to the command bar.
oCommandbar.Controls.AddButton oBH_VF

' Make the toolbar visible
oCommandbar.Visible = True
End If
End Sub