VB.Net add-in abort button - ctrl + break

VB.Net add-in abort button - ctrl + break

basnederveen
Advocate Advocate
589 Views
5 Replies
Message 1 of 6

VB.Net add-in abort button - ctrl + break

basnederveen
Advocate
Advocate

Hi all,

 

I am creating an add-in which will run for quite a long time. When I was doing this with a macro and I wanted to cancel I could press CTRL + Break. This is as far as I know not possible with add-ins, is there any option I could have an abort or pause button on my form which can be pressed while running the inventor commands?

 

Ideally I would be able to 'pause' my code like I would when stepping through it while debugging. Cancelling the whole routine would also be okay.


Thanks in advance.

 

0 Likes
590 Views
5 Replies
Replies (5)
Message 2 of 6

AlexFielder
Advisor
Advisor

There may be a method to "wait" for the escape key or whatever (have you searched here for it?), but in theory if you're running/debugging the Add-in through Visual Studio, you can simply set a break point by hitting F9 inside of a For loop or function that you know the code will hit.

 

This would be functionally identical to hitting ctrl+break in VBA.

0 Likes
Message 3 of 6

basnederveen
Advocate
Advocate
Hi, thanks for your reply.

That is not exactly what I meant. I need that behaviour but I would like to
implement it so a user can pause whatever command is being executed, do
some stuff, and then have the script continue.


0 Likes
Message 4 of 6

AlexFielder
Advisor
Advisor

You can certainly prompt the user for input, and/or a selection of features/occurrences etc. but are you talking about having them run separate (built-in?) commands?

 

0 Likes
Message 5 of 6

basnederveen
Advocate
Advocate

I have a program which analyzes interference on multiple configurations (by setting parameters) of an assembly. This process takes a long time.

 

Once you press 'Start' there is no way back - only task manager and closing inventor. (Basically the same as everything in inventor. i.e. exporting/importing etc.)

 

I was wondering if it is at all possible to cancel running code in an add-in, while not debugging. Maybe this is not achievable when running in-process in inventor, since the form also freezes as soon as the 'start' button is pressed? 

 

 

0 Likes
Message 6 of 6

AlexFielder
Advisor
Advisor

I seem to recall seeing a post a while ago which showed how to use the same "Escape key stops process" mechanic that Inventor itself uses.

Perhaps one of the Autodesk peeps can chime in with an example..?

0 Likes