Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

iLogic Script to Add iLogic Rules

e_frissell
Advocate

iLogic Script to Add iLogic Rules

e_frissell
Advocate
Advocate

I don't think I've seen anyone post anything like this however I was wondering if it's possible to write an external iLogic rule that adds a collection of external rules to the iLogic External Rules browser and adds them as custom user commands on the ribbon?

 

I'm the only one who writes code and have about 7 or 8 people who want me to add a bunch of my scripts to their browser/user commands and thought it might be easier to do as a rule...and it'll give me some ability to to make changes without breaking things for everyone

0 Likes
Reply
Accepted solutions (1)
1,419 Views
8 Replies
Replies (8)

Curtis_Waguespack
Consultant
Consultant

Hi @e_frissell ,

 

I'm not sure about doing the button creation with a script, but you can set this up and then use the Export/Import options to distribute the customizations, see information below.

 

As for setting the external rule configuration path, see this link:

https://forums.autodesk.com/t5/inventor-ilogic-and-vb-net-forum/can-i-place-external-rule-directory-...

 

For Inventor 2023 and beyond you can add buttons for the ilogic rules to the ribbon using the built in tools as described here:

To add a button to the ribbon:

  • Right click a ribbon Customize User Commands
  • Filter rules/forms in the drop down
  • Ensure the correct tab is listed
  • Double click a rule to add
  • Add text or make large
  • Use the Export/Import buttons to transfer the customizations between machines.

 

To create a custom icon for your iLogic Ribbon button:

  • Create a *.png file that is 16x16 pixels or 32x32 pixels
  • Place this image file in the same folder as the Rule resides in
  • Format the name to be as such:
    • <Name of the iLogic Rule or Form> . <light or dark> . <small or large> .png

 

Example:

iLogic rule name:  Create PDF

iLogic rule button image name: Create PDF.light.small.png

 

Restart Inventor if needed.

 

see related link:

https://forums.autodesk.com/t5/inventor-forum/inventor-2023-ilogic-rules-and-forms-on-ribbon/m-p/110...

 

See this link for an app that might help with adding your rules to the ribbon also:

https://apps.autodesk.com/INVNTOR/en/Detail/Index?id=2268703737300536294&appLang=en&os=Win64

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

0 Likes

Frederick_Law
Mentor
Mentor

External rules are just rules in a folder.

Including trigger setup xml.

0 Likes

e_frissell
Advocate
Advocate

@Curtis_Waguespack yeah, the import/export wizard would be the best option but I'd see it as too cumbersome for most people.  The thought was if you have an iLogic rule that is "Import iLogic Rules" that it'd make it really easy for me to move rules around, remove rules, add new rules, etc... and keep people current.  Right now the rules need some better organization but I think if I start moving rules around I'd have to tell people to remove Rule1 from iLogic tab, go to some folder, then re-add Rule1 to iLogic browser.  Simply running an iLogic rule to remove all rules, then re-add the current ones would be a really streamlined process to make sure everyone is current.

0 Likes

Frederick_Law
Mentor
Mentor
Accepted solution

iLogic-05.jpg

0 Likes

WCrihfield
Mentor
Mentor

I just wanted to add a precautionary note in here, to potentially save you from a lot of headaches when you start adding a lot of external iLogic rules into your ribbons.  I upgraded directly from Inventor Pro 2022 to Inventor Pro 2024 earlier this year, and this ability was one I was very much looking forward to.  However I am still disappointed that we are not allowed to add new RibbonTabs or RibbonPanels to the user interface using the Customize dialog.  Anyways, the problem I encountered was that any time I added an external iLogic rule to a ribbon, if that rule had the character "&" (ampersand) in its name, it would cause problems later.  After doing that, all (not just that button) of my customizations would be gone the next time I restarted Inventor.  And if I exported my customizations to an XML while a button like that was in my ribbon somewhere, I could not restore anything from that XML file later.  I could simply rename that same external iLogic rule, then add that rule to the ribbon again, and there were no problems anymore.  It has nothing to do with the contents of the rule, just that character in its name.  And don't attempt to rename an external iLogic rule while there is a button for it in your ribbon.  That will instantly make it disappear from your ribbon (and may cause other problems we don't know about yet).  I tried several other fringe characters, and didn't find any others that gave me any problems...yet.  I informed the folks at Autodesk about this too, so hopefully they are working on a solution for that odd situation.  Sometimes my rules do multiple tasks, so I try to include something about both in the rule's name, without making the rule's name too long.  Using the "&" symbol has never caused any problems over the years until I encountered this odd situation a while back.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes

e_frissell
Advocate
Advocate

Thanks for letting me know, I had no idea there was a character issue.  Thankfully I don't have anything with special characters but that's not to say it wouldn't have happened in the future so this likely saved me from some potential headaches.  This reminds me of an issue I had in VBA with Inventor when I would make a module and I'm sure you know that by default your macro is named Module(X) but your sub will have a different name.  In the customize user commands it looks at the sub name so if you want to attach it to your ribbon there's no problem knowing what you're attaching.  After a while of using the default naming convention you get too many modules to keep track of and you don't know what Module1, Module2, .... Module20 are.  Well, if you rename one of the modules the customize user commands stores the original sub and loses the link to it, then adds the newly renamed sub to the list - in this case it essentially doubled up the number of my macros and only half of them were usable!  Had to recreate an entirely new ivb file.  What an absolute pain that was

WCrihfield
Mentor
Mentor

Yep.  I encountered something similar to that a few years ago.  But luckily, I started messing around with the custom icons and adding buttons for my macro's around the same time I started using macros, and saw that the image files needed to include the module name, then the name of the main Sub, and so on.  That caused me to start naming my module the same as the main Sub within the module, so that they would be easier to tell apart in a list.  It is very easy to miss though.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes

e_frissell
Advocate
Advocate

This should work well enough for what I need, thanks!

0 Likes