Restore Focus To Revit UI between PickObject() instances in while loop

Restore Focus To Revit UI between PickObject() instances in while loop

Anonymous
Not applicable
550 Views
2 Replies
Message 1 of 3

Restore Focus To Revit UI between PickObject() instances in while loop

Anonymous
Not applicable

Hi everyone,

 

In my current addin, the user selects multiple walls within a while(true) loop until they hit the escape key; through the PickObject() method, a wall is selected to have its join ends toggled between the "Allow Join" and "Disallow Join" settings. With Revit's focus shifted to my addin (away from the UI), the user cannot manually edit any of their selected walls until the command finishes executing. 

I would like for my addin to pause the while loop and restore focus back to the UI after the user picks a wall; this would allow the user to modify a wall before selecting another wall in the next iteration of the loop.

 

Coming up with a strategy for this has been challenging, so I would appreciate any advice.

 

Thank you,

IanMage1 

0 Likes
Accepted solutions (1)
551 Views
2 Replies
Replies (2)
Message 2 of 3

jeremytammik
Autodesk
Autodesk
Accepted solution

Test the ModelessDialog/ModelessForm_ExternalEvent SDK sample and see whether it behaves in the manner you wish. 

 

Cheers,

 

Jeremy

 



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

Message 3 of 3

Anonymous
Not applicable

Thanks, Jeremy!

 

I had just recently used that sample--for the first time--as a reference for another one of my addins, but did not think that it would be applicable in this case; I was wrong. 

I chose to do away with the loop and use a modeless form button to trigger my PickObject() routine, so that the user could choose to pick another object after modifying their previous selection.

 

Thanks again,

IanMage1

0 Likes