Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to stop an iLogic loop with the keyboard

29 REPLIES 29
SOLVED
Reply
Message 1 of 30
Anonymous
8202 Views, 29 Replies

How to stop an iLogic loop with the keyboard

Hi,

 

Is it possible to stop an infinite loop when running an iLogic rule?

 

 

Thanks,

 

Pascal Langlais

29 REPLIES 29
Message 21 of 30
arron.craig
in reply to: Anonymous

I wonder if this will be added in 2020....

Message 22 of 30
MjDeck
in reply to: arron.craig

@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.


Mike Deck
Software Developer
Autodesk, Inc.

Message 23 of 30
Anonymous
in reply to: MjDeck

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

Message 24 of 30
Luisfmts
in reply to: Anonymous

2021, and in few months it will be its 10th birthday 😋:birthday_cake: 

Message 25 of 30
jfenter
in reply to: Anonymous

Still waiting in 2021..... 10 years is a long time to wait.  I hope the OP shut down his computer by now.

Message 26 of 30
Leonardo_Czuy
in reply to: Anonymous

I am in 2023, This feature was added?

Message 27 of 30
MjDeck
in reply to: Anonymous

@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.


Mike Deck
Software Developer
Autodesk, Inc.

Message 28 of 30
MjDeck
in reply to: Anonymous

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

Mike Deck
Software Developer
Autodesk, Inc.

Message 29 of 30
Frederick_Law
in reply to: Anonymous

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.

Message 30 of 30
mfoster9TD82
in reply to: Anonymous

Any progress on this?

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Technology Administrators


Autodesk Design & Make Report