I have posted about a similar subject a while ago. The idea is to copy and paste an existing iLogic rule in a series of Inventor files.
In the solution that I offered originally I was able to accomplish this but there was a missing link.
What good would an iLogic rule be that was created in an automatic way when at the same time you cannot decide when the rule will run?
This kind of defeated the whole purpose of automatically adding AND running rules on certain events throughout multiple files.
One of the loyal readers of the blog came to the rescue.
Megajerk has graciously provided the source code and the executable for a VB.NET tool that completely automates the process. So I decided to post this tool on the Inventor support blog on behalf of him.
The tool is called "Code Injector" and can be downloaded from here.
After unzipping the tool to any location on your disk drive and when you start the file …\Code Injector\Code Injector\bin\Debug\Code Injector.exe, you will see following dialog:
Fig 1: Code Injector in action ( (click here to see a full size screenshot)
Note that I have selected two part files in the dialog, defined an iLogic rule that displays the name of the active document and the rule gets triggered on open.
From the way the buttons in the dialog are labeled you can easily figure out most of the other tool options:
- Open multiple files from the types ipt, iam and idw from a folder
- Either copy and paste the rule text or import it from an existing text file
- Overwrite rules with duplicate names or not
- Run rules on creation or not
Once the tool has finished , you will se an Operation complete dialog that you can dismiss.
One small quirk is that rules that get added and that are set to trigger before or after save, ignore the setting of the "Run rules on creation" checkbox.
Such rules will automatically run while the Inventor files get saved by the tool. It is a sort of chicken and egg thing which is difficult to avoid.
Rules that trigger on open obviously obey the checkbox. Thanks again to Megajerk for sharing his tool with all of us.