My previous post on how to save multiple file formats automatically using iLogic prompted a question from one of our users here in the UK about where rules should be saved and how they should be added. As I was putting a response together I thought it might be a useful topic for others.
iLogic rules can be saved within the part, assembly or drawing file, these rules are then saved within that document and can be used each time that document is open.
You can save iLogic rules within your part, assembly and\or drawing templates so that any new file created using said template will already contain any of the standard rules you want users to use. This is a really good way of working as it means you can create your rules and then add them to each of the templates meaning they are always there for users to work with. If you need to update a rule, you can update the template and that rule will then be updated for all subsequent documents.
The other way of using iLogic rules is by using external rules, this is where the iLogic rules lice outside of the Inventor documents and are referenced by the user when they are needed. To add an external rule, it's pretty straight forward:
First, you can configure search paths for your external rules on the Tools ribbon within Inventor:
The iLogic Configuration tool is on the extended menu which to access you need to click on the black arrow next to where it says Options.
The iLogic Configuration dialogue allows you to add search paths for folders which contain your external rules. External rules are basically text files that contain the iLogic code and are saved with an extension of:
You can see in my example below I have added the folder which contains all of my external rules:
Now that I have this configured, I can add a rule to my drawing by selecting the External Rules tab and the right-mouse clicking to Add External Rule:
By doing this, I create a link between the iLogic rule stored in my folder and the document I have added it into. I can run the rule whenever I want just by right-mouse clicking and selecting Run Rule:
You'll notice that I have options to Edit Rule, which will open the rule in the iLogic editor. I can reload from file, which is great for when a change is made to the iLogic code within the external text file; and I can also Open the folder the rule is saved in and finally remove\detach the external rule from the list.
The final part of this is that I can call an external rule from a rule stored within the document. I can add a little bit of iLogic code that I can have within my template file that references the external file and rule.
You'll notice that I only add the filename of the external rule, I don't need to add the full path as setting iLogic Configuration to include the search path of my external rules takes care of which folder to look in (you can add multiple search folders too).
Why would I do this I hear you ask? Well, it means that users don't always have to attach rules when they need them but it gives flexibility should a rule need to be edited or updated - making the update within the external rule is quick and simple and will propagate to all of the documents the rule is linked to.