Floating Toolbar/UI Element while a command is running in Revit.

Floating Toolbar/UI Element while a command is running in Revit.

mhillis
Advocate Advocate
471 Views
1 Reply
Message 1 of 2

Floating Toolbar/UI Element while a command is running in Revit.

mhillis
Advocate
Advocate

I am wondering.. How I can go about having a floating toolbar in Revit while simultaneously running a command like drawing a run of Duct using the Revit-based Duct routing tools?  For example, you start the "Duct" command in Revit, from there once you are actually drawing and placing duct, a UI element/toolbar comes out and allows you to insert objects while that command is running. 

 

I have got a lot of this concept put together in a routine I have made, but the problem I am encountering is that the UI Element/Toolbar will briefly load with the Duct routine but then vanish because it seems the way Idling is setup in Revit causes that code to keep executing, closing the UI element.  For what its worth I am opening/creating the UI element/toolbar utilizing a Modeless Window.  

 

Any suggestions on tips or resources to help me achieve this? Thanks! 

0 Likes
Accepted solutions (1)
472 Views
1 Reply
Reply (1)
Message 2 of 2

jeremy_tammik
Alumni
Alumni
Accepted solution

You are absolutely correct: a modeless window or form is the way to go. Ensure that the Revit main window is registered as its parent window. Once you have launched it, it will stay. It has nothing to do with Idling or any other Revit API. In fact, being modeless, it cannot make any use of the Revit API at all.  That is the first step.

  

Second step: from your modeless context, you wish to interact with the Revit API after all. Well, there is a way: use an external event.

 

All you need to know about that is discussed by The Building Coder and numerous previous threads here in the forum:

 

https://thebuildingcoder.typepad.com/blog/about-the-author.html#5.28

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes