Not able to load plugin in inventor

Not able to load plugin in inventor

veeresh.huvinahalliACK3L
Enthusiast Enthusiast
116 Views
2 Replies
Message 1 of 3

Not able to load plugin in inventor

veeresh.huvinahalliACK3L
Enthusiast
Enthusiast

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>

0 Likes
117 Views
2 Replies
Replies (2)
Message 2 of 3

JelteDeJong
Mentor
Mentor

Have a look at my blog post: "Help: My addin won't load". Maybe you will find your solution there.

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

0 Likes
Message 3 of 3

jjstr8
Collaborator
Collaborator

In your .addin file, valid values for Addin Type are Standard or Translator. Application is not a valid value.

0 Likes