Cancel long process

64 views
Skip to first unread message

bejen...@gmail.com

unread,
Feb 7, 2018, 12:18:54 PM2/7/18
to RevitPythonShell
Hi everyone,

I'm handling some code that depending on the project can last up to 5 minutes. Some times I remember I've inputed something wrong and there's no way of stoping it.
Do you know any workaround to implment an Escape Key event?

Cyril Waechter

unread,
Feb 9, 2018, 12:11:33 PM2/9/18
to RevitPythonShell
Hi Andrei,

I'm happy to see you here ^^

I have forwarded your question. Answers  say that there is no already implemented (like usual Ctrl-C) way to cancel an RPS process yet.

They refer to this post : https://stackoverflow.com/questions/22657514/terminating-an-ironpython-script/22856785#22856785 and suggest to use a cancel/toggle button or something like this (or alternatively a file you delete). I assume considering time required that you have loops. Maybe you could try something like :
if button has been pushed => break at the beginning of your main loop.

The file alternative is to check if a file still exist. You delete the file to cancel the loop.

Maybe native in RPS in a future release ^^

Andrei Bejenaru

unread,
Feb 11, 2018, 5:15:07 PM2/11/18
to RevitPythonShell
Hi Cyril,

I wasn't expecting a response from someone I realy know in person. I'm very pleased!!!.
Your answer confirms my suspitions. For now there's no out of the box solution for this. Yes, maybe the best aoproch is a continuos check within the loops for key events.

Thank you fot your reply
Reply all
Reply to author
Forward
0 new messages