Not able to load plugin in inventor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all,
I'm trying the create the custom plugin in inventor 2024 but i'm not able load it.
StandardAddInServer1.cs
namespace ClassLibrary1
{
[Guid("0F8B2C05-DB26-4DF5-BFEB-5DD08D87FA8B")]
public class StandardAddInServer1 : ApplicationAddInServer
{
private Inventor.Application _inventorApp;
private ButtonDefinition _myButton;
public void Activate(ApplicationAddInSite addInSiteObject, bool firstTime)
{
_inventorApp = addInSiteObject.Application;
if (firstTime)
{
// Get the UI Manager
UserInterfaceManager uiMgr = _inventorApp.UserInterfaceManager;
// Get the Ribbon for Part/Assembly/Drawings
Ribbon partRibbon = uiMgr.Ribbons["Part"];
Ribbon assemblyRibbon = uiMgr.Ribbons["Assembly"];
Ribbon drawingRibbon = uiMgr.Ribbons["Drawing"];
// Create a new tab (if needed)
RibbonTab myTab = null;
try { myTab = partRibbon.RibbonTabs["MY_CUSTOM_TAB"]; }
catch { myTab = partRibbon.RibbonTabs.Add("My Custom Tab", "MY_CUSTOM_TAB", "AUTODESK"); }
// Create a new panel
RibbonPanel myPanel = myTab.RibbonPanels.Add("My Panel", "MY_PANEL", "AUTODESK");
// Create a button definition
CommandManager cmdMgr = _inventorApp.CommandManager;
_myButton = cmdMgr.ControlDefinitions.AddButtonDefinition(
"My Button", "MY_BUTTON",
CommandTypesEnum.kNonShapeEditCmdType, Guid.NewGuid().ToString(),
"Click to execute", "My custom button"
);
// Attach the button click event
_myButton.OnExecute += MyButton_OnExecute;
// Add button to panel
myPanel.CommandControls.AddButton(_myButton, true);
MessageBox.Show("Ribbon Panel Added!", "Inventor Add-in", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void MyButton_OnExecute(NameValueMap Context)
{
MessageBox.Show("Button Clicked!", "Inventor Add-in", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
public void Deactivate()
{
MessageBox.Show("My Inventor Application Add-in Unloaded!", "Inventor Add-in", MessageBoxButtons.OK, MessageBoxIcon.Information);
// Remove button definition
_myButton?.Delete();
_inventorApp = null;
}
public void ExecuteCommand(int commandID) { /* Not used */ }
public object Automation => null;
}
}
.addin file
<?xml version="1.0" encoding="utf-8"?>
<Addin Type="Application">
<!--Created for Autodesk Inventor Version 28.0-->
<ClassId>{0F8B2C05-DB26-4DF5-BFEB-5DD08D87FA8B}</ClassId>
<ClientId>{0F8B2C05-DB26-4DF5-BFEB-5DD08D87FA8B}</ClientId>
<DisplayName>StandardAddInServer</DisplayName>
<Description>Demo Library</Description>
<Assembly>C:\Users\Veeresh.Huvinahalli\AppData\Roaming\Autodesk\Inventor 2024\Addins\ClassLibrary1.dll</Assembly>
<LoadOnStartUp>1</LoadOnStartUp>
<SupportedSoftwareVersionGreaterThan>23..</SupportedSoftwareVersionGreaterThan>
</Addin>