Inventor: Run iLogic Rules from your Ribbon

Zen Admin
Zen Admin

By Clint Brown

A common request from Inventor users, is the ability to run iLogic rules from Inventor’s Ribbon interface. Unfortunately, this is not possible using iLogic alone. But the good news, is that Inventor has a built in VBA editor, and Macros created in this editor can be added to the Ribbon Interface.

To create a button for an iLogic rule on the ribbon, you will need to create a VBA macro in Inventor that will fire an iLogic rule. Once the Macro is created, you can add it to the Ribbon.

Firstly, make a backup copy of the following file: C:\Users\Public\Documents\Autodesk\Inventor XXX \Default.ivb

Then paste the code from the attached text file into your VBA editor under "Module 1" as shown.

I've set the code in the text file to look for an internal rule named "Rule0", you can change this to match your rule name. The code can be adjusted for an external rule. The external rule in this instance is set to "3D PDF" (based on a rule from a previous blog post). The external rule is currently commented out, in favour of the internal rule (see the last 3 lines of code).

Adding the Button to the Ribbon:

To add your macro to the ribbon, right click on the ribbon, and select "Customise User Commands" then select "Macros" from the drop down menu on the left hand side. You can add your macro to the ribbon, as shown below. Note the options for size and text (see the section on Button icons below).

Best Practice:

The Inventor .ivb file (accessed through the VBA editor) will need to be manually edited on each user's machine. This makes any updates to the "button/s" more difficult.

I would suggest that you use 1 external iLogic rule. This rule should simply fire up a global iLogic form. This form can be edited and shared with your team, without having to change the VBA, the code to implement this is very simple (see below).

SyntaxEditor Code Snippet

iLogicForm.ShowGlobal("Form Name")


This global form can have buttons showing any number of external rules. These external rules can be controlled centrally.

Customising your Button Icon

You can create Bitmap icons for your Macro. You will need 2 sizes, a Large (32x32px) and a Small (16x16px).

The icons will need to be named very specifically in order for them to work. The naming convention is “ModuleName.MacroName.IconSize.bmp”, the size can only be "Small" or "Large". In my example below, the Macro is called "Run_iLogic", my icons are named "Module1.Run_iLogic.Large.bmp" & "Module1.Run_iLogic.Small.bmp".

The icons must be saved to the same location as your Inventor .ivb file, the default location for this file is: "C:\Users\Public\Documents\Autodesk\Inventor XXX" Note that you will need to reboot your system for the icons to become available in Inventor.

For more details on the icons, please see the following blog post:

The VBA Macro that I have used, is based on the following Autodesk Forum post: 


Was this article helpful?

1 out of 1 found this helpful

Have more questions? Submit a request



  • Comment author
    Martin Depta

    Hello, everything works except for your own icons.

  • Comment author
    Zen Admin

    Hi Martin, you may need to restart Inventor. But the key to this, is that the icons have to have the correct naming convention (as detailed above) and they will not show up unless the icons are sized perfectly.

  • Comment author
    Zen Admin

    Hi Fábio

    I would use an iProperty or a parameter within Inventor. You could set this property from a form etc. You could then call that property in your code.

    I hope this is helpful!

  • Comment author
    Fábio Ferreira

    Hi, is it possible to execute the rule with a specific variable, or to make a SharedVariable within the macro?

    I would like to use 2 buttons to open the same rule, but with the difference of a shared variable called SharedVariable("FileSelection").


Please sign in to leave a comment.