C# plugin making

Top  Previous  Next

Quick notes.


Install the SDK and this should appear in the new projects selection:




So far I've only got it to work in VS2017.


And you may not have all the Windows references, so you may have to add them by hand...



...alternatively add a form and the IDE should bring in the required references.


You will get some sources which look like this:


using System;

using System.Runtime.InteropServices;

using System.Windows.Forms;

using Inventor;

using Microsoft.Win32;


namespace InventorAddIn1


   /// <summary>

   /// This is the primary AddIn Server class that implements the ApplicationAddInServer interface

   /// that all Inventor AddIns are required to implement. The communication between Inventor and

   /// the AddIn is via the methods on this interface.

   /// </summary>


   public class StandardAddInServer : Inventor.ApplicationAddInServer



       // Inventor application object.

       private Inventor.Application m_inventorApplication;


       public StandardAddInServer()




       #region ApplicationAddInServer Members


       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;


           // TODO: Add ApplicationAddInServer.Activate implementation.

           MessageBox.Show ("Hello");



       public void Deactivate()


           // This method is called by Inventor when the AddIn is unloaded.

           // The AddIn will be unloaded either manually by the user or

           // when the Inventor session is terminated


           // TODO: Add ApplicationAddInServer.Deactivate implementation


           // Release objects.

           m_inventorApplication = null;






       public void ExecuteCommand(int commandID)


           // Note:this method is now obsolete, you should use the

           // ControlDefinition functionality for implementing commands.



       public object Automation


           // This property is provided to allow the AddIn to expose an API

           // of its own to other programs. Typically, this  would be done by

           // implementing the AddIn's API interface in a class and returning

           // that class object through this property.




               // TODO: Add ApplicationAddInServer.Automation getter implementation

               return null;
















Text, images and diagrams © 2021 Owen F. Ransen. All rights reserved. (But copy the source code as much as you want!)