• Blog posts

    Bio

    by Luke Davenport

      

    Problem:

    How can I get my iLogic form to automatically update my model?

     

    Solution:

    Well there are several things to check to make sure your updates happen automatically…… let’s take a look…

     

    1)    Check that the required iLogic rules are set to run automatically.

    The Options tab inside an iLogic rule allows us to control this. The screenshot below shows the default settings in here – as you can see this particular rule is set to run automatically. So firstly make sure you haven’t ticked the ‘Don’t run automatically’ option.

      

      

    But hold on a second – ‘Run Automatically’ - what exactly does this mean? Well it’s very simple – if there are any parameters referenced by name inside the iLogic rule, they will be highlighted in blue, and they will then automatically be set as a rule trigger. So for example, the following iLogic rule will run automatically whenever the ‘Length’ parameter OR the ‘Width’ parameter is changed absolutely anywhere on the Inventor model (including in a form).

     

    Length = Width/2
    InventorVb.DocumentUpdate()
     

    You can test this very simply by adding a messagebox in your iLogic rule and it’ll pop up with any changes to ‘blue’ parameters referenced inside that rule – try it!

     

    How about if there is no ‘blue’ parameters inside my iLogic rule?

     

    Well – you could add a dummy variable at the start of the iLogic rule to force the rule to run when that particular parameter changes. This rule below will now run when the Colour parameter changes (even though the Colour parameter may not be referenced elsewhere in the rule at all)

    DummyVariable = Colour

     

    2)    Put an update statement at the end of your iLogic rule

    If your iLogic rule is actually running, but you’re not seeing the changes in the model, you may have the little update ‘lightning bolt’ in the top left of the Inventor ribbon menu. To prevent this, and force an update when your rule has finished running, I tend to use these two standard lines (you won’t always need the first line).

     

    RuleParametersOutput()
    InventorVb.DocumentUpdate()

     

    3)    Apply an Event Trigger if required

    You can of course use an iLogic Event Trigger to specify which rules should run on a more global basis – e.g. for an iProperty change, Parameter change, etc. We won’t chat about those here, there’s tons of information available online.

     

      

      

    4)    Watch out for curveballs….

    Just as a final tip – I was with a customer recently, entering values for parameters and iProperties on an iLogic form. Normally you can type a value in the field, hit the enter key, and the model will instantly update. But on this one model it was not working – why?

     

    Here’s what it was – we had a couple of buttons on the form to run various iLogic rules. And ONE of the button’s ‘On Click Action’ had been set to ‘Apply and then Run Rule’, rather than (as normal) simply ‘Run Rule’. So, this meant that any numbers we typed into the form were not being ‘Applied’ to the model until we clicked that particular button to run the form, and then our changes were applied, and the rule was run. Makes sense? It took a bit of troubleshooting I tell you!

     

    So as soon as we set the ‘On Click Action’ setting for that button back to either ‘Run Rule’ (see pic below) or ‘Close and Then Run Rule’ (which will close the form for you as a bonus), the problem disappeared, and any changes entered in the form were being applied instantly.

      

      

    So I hope this helps you. ‘Til next time.