Button in Ribbon is visible but click event isn't triggering

Button in Ribbon is visible but click event isn't triggering

Anonymous
Not applicable
316 Views
1 Reply
Message 1 of 2

Button in Ribbon is visible but click event isn't triggering

Anonymous
Not applicable

Hi I have added a button to a ribbon in Inventor 2014. My button is appearing properly but the problem is that it does nothing when it is clicked.

My code is 

 

 

public void Activate(Inventor.ApplicationAddInSite addInSiteObject, bool firstTime)
{
// This method is called by Inventor when it loads the addin.
// The AddInSiteObject provides access to the Inventor Application object.
// The FirstTime flag indicates if the addin is loaded for the first time.
// Initialize AddIn members.
m_inventorApplication = addInSiteObject.Application;
string clientId = "13c57375-55ee-4c28-a567-7a0d490e5bd3";
RibbonPanel panel;
_buttonDef = m_inventorApplication.CommandManager.ControlDefinitions.AddButtonDefinition("MergeIDW","MergeIDW",CommandTypesEnum.kQueryOnlyCmdType,clientId,"MergeIDW",null,null,ButtonDisplayEnum.kDisplayTextInLearningMode);
string[] ribNames = { "Drawing", "Part", "Assembly", "Presentation", "id_TabAssemble" };
foreach(var ribName in ribNames)
{
try
{ 
panel = m_inventorApplication.UserInterfaceManager.Ribbons[ribName].RibbonTabs["id_TabTools"].RibbonPanels["id_MergeTab"];
}
catch
{
panel = m_inventorApplication.UserInterfaceManager.Ribbons[ribName].RibbonTabs["id_TabTools"].RibbonPanels.Add("MergeIDW", "id_MergeTab", clientId);
}
panel.CommandControls.AddButton(_buttonDef, true, true, "", false); 
}
_buttonDef.Enabled = true;
_buttonDef.OnExecute += _buttonDef_OnExecute; 

}
public void _buttonDef_OnExecute(NameValueMap context)
{ 
sample s = new sample();
s.Show();
}

 

 

Can someone point out what may be wrong in my code. The problem is happening because I am not able to debug it from Visual Studion because no breakpoints are hit as soon as Inventor starts.

0 Likes
317 Views
1 Reply
Reply (1)
Message 2 of 2

adam.nagy
Autodesk Support
Autodesk Support

Hi,

 

If you cannot set breakpoints that usually happens if for some reason the loaded dll is not the same as the one you are trying to debug.

You could double check what dll the loaded AddIn is pointing to in the AddIn Manager: Tools [tab] >> Add-Ins

 

Cheers, 



Adam Nagy
Autodesk Platform Services
0 Likes