I'm trying to create a REX extension that will involve having the user pick points and objects from the current Revit document view and then return to the extension UI, but I'm having problems. If I just Hide() the window while selecting points and objects, then Show() the window, it works the first time around, but if I want to have the user select another set of points/objects, it fails with the "user aborted the pick operation" issue described in http://forums.autodesk.com/t5/Autodesk-Revit-API/pick-2-points-consecutively/td-p/3080474 ("pick 2 points consecutively"). If I re-run the extension after closing it, the user is able to pick new points and objects, but it would be very difficult (not to mention inefficient) to close and restart the extension every time I need the user to make a selection in the Revit document. Since the main dialog window is shown by the REX framework application and the sequence of method execution leads to closing the extension altogether when the dialog window is closed, I can't perform the selection outside of the form/control code as the other topic suggests. How can I allow for user interaction with the Revit model (picking points or objects)? Are REX SDK applications just not meant for this sort of interaction?
It looks the you would like to use REX as modeless dialog.
REXes are external commands that support only modal dialogs
The simplify supported workflow is:
- Select some elements in Revit
- Open Dialog
- User change data exposed inside the dialog
- Do something with Revit model using API
- Close the dialog
- Command succeeded
It could be great to support this workflow by leveraging the external events framework.
It’s also not worth to look at the dockage windows framework and the drag and drop feature, since Revit API itself has this feature.