Actually, it’s not an iLogic Rule. Its a line of code. But it rules!
For those of you who have created more complicated parts using iLogic, you may have reached a sort of tipping point where the time it takes to update your part can jump dramatically. On this particular part, the iCabinet, the update time jumped to over ten minutes at one point. The cause was some squirrely code that I created, and subsequently fixed, but in the end, it was still taking 4 to 5 minutes to update. I believe this has to do with how your code is written and the order of execution, but ultimately, the problem likely goes a bit deeper…….iLogic automates processes that were coded long ago, and therefore were never designed to be part of an automated process to begin with.
When going about your everyday design process, you don’t suppress features very often. When you do suppress something, it may take 10 or 15 seconds to complete ….it is not a very noticeable event. Now, with the ability to string numerous feature suppression/unsuppressions together— along with other changes, equations, and calculations, you begin to see problems.
The once lone 15 second task can now be one in a string of many 15 second tasks….. and the process can chug away quite slowly…..but, there is a fix. The line of code below, used at the beginning of a bloated chunk of code, will roll up the EOP (End of Part) while the iLogic code executes. The same line of code is used at the end of the code block, this time set to (False), to roll the EOP back down again:
‘Rolls up the EOP when set to true, down at false
ThisDoc.Document.ComponentDefinition.SetEndOfPartToTopOrBottom(True)
It works great to speed things up….but does so at the cost of having your screen go blank while the processing is going on. There is another version of the code that will roll the EOP up to any feature you wish so you can leave some geometry on screen. It reads like this:
‘Sets EOP Below feature listed.
Feature.InventorFeature(“FeatureName”).SetEndOfPart(True)
The above code snippets along with some ‘best practice’ coding guidelines will undoubtedly enhance performance. The code alone sped things up greatly for the iCabinet –all rules take less than a minute to run except for a major width adjustment (huge amount of feature change) —but faster is always better so I’ll keep digging.