Brian Ekins wrote a great article on this topic. You can find it here:
I’m not going to repeat his article here. But I found a couple of other ways to optimize my code.

Disable the Vault addin.

This optimization will only work if you open and close many files in your code. Every time you open/close a document the vault addin will check the status of that file in the vault. That will take time. It's possible to deactivate the vault addin and activate it again when your code is ready.

Public Class ThisRule

    Private vaultAddinID As String = "{48B682BC-42E6-4953-84C5-3D253B52E77B}"
    Private vaultAddin As ApplicationAddIn

    Sub Main()
        vaultAddin = ThisApplication.ApplicationAddIns.ItemById(vaultAddinID)

        MsgBox("Do your long running process here")

    End Sub
End Class

Delayed rule running mode (and silent mode)

There is another optimization that will only work if you have multiple iLogic rules that are triggered multiple times. It is possible to delay iLogic triggers till your program is finished and is ready for the triggers to be fired. The example below is shown how to do that.

In the example, I also incorporated a way to run rules in silent operation. Normally when rules are run, if any exceptions occur they will be shown in message dialogues. In silent operation mode, those messages are not shown. Waiting for a user to click a button can make your program terribly slow but you want to log those messages. How that is done is also shown.

Public Class ThisRule
    Sub Main()
        Dim iLogicAddinID As String = "{3BDD8D79-2179-4B11-8A5A-257B1C0263AC}"
        Dim iLogicAddin As ApplicationAddIn = ThisApplication.ApplicationAddIns.ItemById(iLogicAddinID)
        ' the next line will fail in run time because but it will make
        ' the code intelliSense (intelligent code completion) work.
        ' therfore i leave it in and uncomment it when im writing code.
        ' (If you have a better solution i would like to know about it :-)
        ' Dim automation As IiLogicAutomation = CType(iLogicAddin.Automation, IiLogicAutomation)
        Dim automation = iLogicAddin.Automation

        automation.SilentOperation = True

        MsgBox("Update all parameters here")
		' Run all rules that were triggered by parameter changes or other events 
		' while in delayed rule-running mode. Rules within each document will be run 
		' in the order in which they are found in the document.
        automation.SilentOperation = False

        For Each exceptionLogEntry In automation.RuleExceptionsLog.Exceptions

    End Sub
End Class



Autodesk Inventor, Vault, Git, C#, vb, .net, php HTML, css, js


University computer science.
HBO Mechanical engineer.
MBO Fine mechanics.


Programmer and Mechanical engineer at Kelvion
(2016 - 20..)

Mechanical engineer at Strukton
(2009 - 2016)

Mechanical engineer at RDG-engineering
(2007 - 2009)

CNC Programmer at VMC
(2005 - 2007)

volunteer at Taizé


Objectgeoriënteerd analyseren en ontwerpen, Objectgeoriënteerd programmeren in Java, Webapplicaties: de clientkant, Databases, Security Aware Programmer, Web Security Specialist