Hi,
Is it possible to stop an infinite loop when running an iLogic rule?
Thanks,
Pascal Langlais
Solved! Go to Solution.
Solved by MjDeck. Go to Solution.
@arron.craig, do you have Visual Studio installed? If so you can use it to attach to the Inventor 2019 process and then "Break All". This will most likely jump right to your rule code in Visual Studio. You might be able to break out of the loop that's currently running. And if you can't break out, you can at least step though the statements in the loop to find out why it's stuck.
I figured it out. The vb file is stored in
appdata\Local\Temp\iLogic Rules
if its not there, go back to \Temp and find the most recent .out (moldDesignFileHandler) file and open it in visual studio. this gave me the location where all of my inventor vb files were saved.
this just saved me a days worth of work
hope this helps
inventor professional 2019
@Leonardo_Czuy , in Inventor 2023 and 2024 there is no easy way to stop an infinite loop. However, if you have Visual Studio you can attach to the Inventor process and debug to try to find out why the rule is stuck in a loop.
If you know that a loop might run too long (or forever) in some situations, you can add code to check if a key is down and exit the loop in that case. See the attached rule for a sample. With that Keyboard class in your rule, you would add checking code such as the following in each loop:
ThisApplication.UserInterfaceManager.DoEvents
Dim keyDown = Keyboard.IsKeyDown(Keys.ShiftKey)
If keyDown Then
Logger.Debug("shift key down = {0}. Exiting loop.", keyDown)
Exit For ' use Exit Do for Do loops, or Exit While for While loops
End If
iLogic debug is available since 2019 with VS:
https://modthemachine.typepad.com/my_weblog/2019/12/using-visual-studio-to-debug-ilogic-rules.html
Just tested with VS2022 Community on IV2023.
Can't find what you're looking for? Ask the community or share your knowledge.