Redundant snippets at end of rules

Redundant snippets at end of rules

J.Oye
Advocate Advocate
515 Views
1 Reply
Message 1 of 2

Redundant snippets at end of rules

J.Oye
Advocate
Advocate

Some of the snippets within ilogic seem to do the same action in some shape or form, wondering what snippets would not be needed If these were placed at end of a rule in ilogic.

 

ThisDoc.Document.Rebuild2()

Parameter.UpdateAfterChange = True
RuleParametersOutput()
InventorVb.DocumentUpdate()
iLogicVb.UpdateWhenDone = True
0 Likes
Accepted solutions (1)
516 Views
1 Reply
Reply (1)
Message 2 of 2

WCrihfield
Mentor
Mentor
Accepted solution

Yes, there are often several different ways to accomplish the same task.  And I, for one, am all for more out-of-the-box iLogic Snippets, to help give some examples/guidance on how to accomplish many of the most common tasks many of us are attempting to do on a regular basis.

 

The 'Rebuild' and 'Rebuild2' subs (as well as oDoc.Update and oDoc.Update2(True)), seems to focus on mathematical updates, like dimensions, parameters, and physical properties, such as mass, center of gravity, etc, and would generally be tagged as an 'immediate' action (rather than a preparation for future actions).

 

[Parameter.UpdateAfterChange = True] (and also MultiValue.UpdateAfterChange = True) are Properties, instead of Subs,  and would be tagged as preparations rather than immediate actions.  These are usually used near the beginning of a rule, instead of at the end.  When set to True, as the rule progresses, any changes to any parameters should take immediate effect (at that time, not after the rule is completely read through).  Sometimes this behavior is beneficial or even required for the rule to progress as expected or without errors.  Other times this behavior could cause problems.  That's why they exposed it as a setting (not an action).

 

The "RuleParametersOutput()" sub (in contrast to the UpdateAfterChage) is an immediate action, that can be useful in some situations where turning the UpdateAfterChange setting on would cause problems, but using this code in one or more specific points within a longer code might work as needed.  Sometimes you may want to make a bunch of changes before actually applying those changes to the model.  Similarly to using an iLogic global form.  Often those changes don't have any effect on the model until after you click Apply or Done (or equivalent).

 

I agree that having multiple methods to accomplish the same task can get confusing, but after several years of running into odd/complex situations while coding and developing your own style/preferences, these will most likely have their place in your toolbox.

 

 

Wesley Crihfield

EESignature

(Not an Autodesk Employee)