Block Revit while Windows Form is running

Block Revit while Windows Form is running

franjavigarciavalencia
Enthusiast Enthusiast
1,220 Views
4 Replies
Message 1 of 5

Block Revit while Windows Form is running

franjavigarciavalencia
Enthusiast
Enthusiast

Hello,

 

I would like to block the use of Revit while my plugin runs a certain functionality (in this case, it opens a Windows Form, and I want Revit to be unusable while that Form is open) just like when you want to modify the visibility of a view and it won't allow you to do anything else until you finished any modification.

 

Is there any method to do this directly?

 

Thank you.

0 Likes
Accepted solutions (1)
1,221 Views
4 Replies
Replies (4)
Message 2 of 5

PavelAnd
Advisor
Advisor
Accepted solution

Hi @franjavigarciavalencia. I always thought that if you use System.Windows.Forms after Form.ShowDialog() Revit becomes unusable. All my forms work this way…

 

image.png

Best regards, Pavel Plotitsyn.

Message 3 of 5

naveen.kumar.t
Autodesk Support
Autodesk Support

Hi @franjavigarciavalencia ,

Understand the difference between modal dialog and modeless dialog.

Dialog Guidelines 

 

Create a modal dialog to block Revit while Form is running.

 


Naveen Kumar T
Developer Technical Services
Autodesk Developer Network

Message 4 of 5

jeremytammik
Autodesk
Autodesk

I fully agree with Pavel and Naveen.

 

If your external Windows functionality is in a separate application, you could still block Revit by launching an external command presenting a modal Windows form, blocking Revit, and use the Windows API or .NET libraries to send a message to close that form and terminate the external command once your external application has done its dirty deed.

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Message 5 of 5

franjavigarciavalencia
Enthusiast
Enthusiast

I see, I thought it was something related to the Revit UI and not to Forms itself.

Thank you all for your help!

0 Likes