Check if Add-In is already running

64 views
Skip to first unread message

Coen Claus

unread,
Feb 28, 2018, 8:20:14 AM2/28/18
to RevitPythonShell
I've deployed a Revit Add-in with RPS. The tool uses WinForms to create a small GUI. 
However when the user clicks on the Add-In while it is already running it causes Revit to crash.
How can I check if the Add-In is already running or not?

Daren Thomas

unread,
Feb 28, 2018, 10:54:11 AM2/28/18
to revitpyt...@googlegroups.com
this depends a bit on your addin. so... as i understand it, your GUI stays open after the addin has run. you could use the Windows API to check for that window...

--
You received this message because you are subscribed to the Google Groups "RevitPythonShell" group.
To unsubscribe from this group and stop receiving emails from it, send an email to revitpythonshell+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

dynamo.u...@gmail.com

unread,
Mar 1, 2018, 2:23:28 AM3/1/18
to RevitPythonShell
I had the same issue. I solved by launching the form with form.ShowDialog(). This way the user can't go back to Revit unless it closes the form.

Coen Claus

unread,
Mar 1, 2018, 8:37:35 AM3/1/18
to RevitPythonShell
Thanks! Worked like a charm! Very easy solution.

Op donderdag 1 maart 2018 08:23:28 UTC+1 schreef dynamo.u...@gmail.com:

Coen Claus

unread,
Mar 1, 2018, 8:41:45 AM3/1/18
to RevitPythonShell
It is indeed what I meant. I was trying with the System module to check if the process was already running. But another user has proposed for me already another solution.
By the way, RevitPythonsShell is amazing! :-) . Makes it so easy to drive the Revit API for beginners like me.

This is the preliminary tool I made completely with RevitPythonShell if anyone is interested; 



Op woensdag 28 februari 2018 16:54:11 UTC+1 schreef Daren Thomas:
this depends a bit on your addin. so... as i understand it, your GUI stays open after the addin has run. you could use the Windows API to check for that window...
On Wed, Feb 28, 2018 at 2:20 PM, Coen Claus <coen...@gmail.com> wrote:
I've deployed a Revit Add-in with RPS. The tool uses WinForms to create a small GUI. 
However when the user clicks on the Add-In while it is already running it causes Revit to crash.
How can I check if the Add-In is already running or not?

--
You received this message because you are subscribed to the Google Groups "RevitPythonShell" group.
To unsubscribe from this group and stop receiving emails from it, send an email to revitpythonshe...@googlegroups.com.

Callum

unread,
Mar 1, 2018, 2:47:04 PM3/1/18
to RevitPythonShell
Really impressive Coen, looking forward to seeing what else you come up with!

dynamo.u...@gmail.com

unread,
Mar 2, 2018, 12:56:41 AM3/2/18
to RevitPythonShell
I like it! Something else you could do it's to have the form always showing in front and centred to the screen

Cyril Waechter

unread,
Mar 2, 2018, 3:38:48 AM3/2/18
to RevitPythonShell
If your goal is to get a modeless form (being able to touch revit with your GUI still open) without crashing you should check samples on my blog or in my pyRevit extension source code :
Simple modeless form
A more advanced example
Source code on github  many of my scripts use this process
I had pretty hard time with this subject I hope it will help ;-)

Coen Claus

unread,
Mar 15, 2018, 10:33:38 AM3/15/18
to RevitPythonShell
Thanks for all the positive feedback, very much appreciated!

I've uploaded a preliminary .exe here


Reply all
Reply to author
Forward
0 new messages