When utilizing a multi-selection mode via the Revit API such as:
uidoc.Selection.PickObjects()
A manual "Finish" click is required to close the selection mode.
Question
I am wondering if there is a way to programmatically click or finish this step for us? My use case for this results from the need to perform several selections of different objects at a time and continuing onto functions such as basic get/set operations on those selections until the user decides to end. As a basic example:
Problem
The current "problem" is that the manual click of finishing a selection slows down the process for what I am trying to achieve. I know to a certain extent with a single selection mode, a pick and perform operation is possible until exited from a while loop but in the case of pick objects, again the finish prompt is required and the pickobjects is desired mostly because it allows quick window selection of multiple objects at a time.
When utilizing a multi-selection mode via the Revit API such as:
uidoc.Selection.PickObjects()
A manual "Finish" click is required to close the selection mode.
Question
I am wondering if there is a way to programmatically click or finish this step for us? My use case for this results from the need to perform several selections of different objects at a time and continuing onto functions such as basic get/set operations on those selections until the user decides to end. As a basic example:
Problem
The current "problem" is that the manual click of finishing a selection slows down the process for what I am trying to achieve. I know to a certain extent with a single selection mode, a pick and perform operation is possible until exited from a while loop but in the case of pick objects, again the finish prompt is required and the pickobjects is desired mostly because it allows quick window selection of multiple objects at a time.
Speaking from an official Revit API point of view, the answer is quick and simple:
No.
Speaking from the point of view of a hard-core Windows API hacking programmer, the answer is:
If it is a PC running Windows or some other common OS, absolutely everything is possible. So, yes, of course! Hack it, man. You can use the Windows API or possibly some higher-level .NET library to find the desired button and simulate a Click event on that.
Maybe you can use an even higher-level functionality such as some end-user Windows automation tool, e.g., AutoHotkey, with no programming required at all:
This is absolutely not recommended or officially supported. However, I can imagine that others would be interested in such a solution as well.
So, I am looking forward to hearing how you end up solving this. As always, please test very rigorously before passing this on to your end users!
Speaking from an official Revit API point of view, the answer is quick and simple:
No.
Speaking from the point of view of a hard-core Windows API hacking programmer, the answer is:
If it is a PC running Windows or some other common OS, absolutely everything is possible. So, yes, of course! Hack it, man. You can use the Windows API or possibly some higher-level .NET library to find the desired button and simulate a Click event on that.
Maybe you can use an even higher-level functionality such as some end-user Windows automation tool, e.g., AutoHotkey, with no programming required at all:
This is absolutely not recommended or officially supported. However, I can imagine that others would be interested in such a solution as well.
So, I am looking forward to hearing how you end up solving this. As always, please test very rigorously before passing this on to your end users!
Thank you @jeremy_tammik for the reply. I imagined a greater Windows API or automation may be required. I will definitely keep that option open. With that said, I was thinking a little more about this and one solution that may solve this somewhat, albeit not perfect, would be to reverse the operations a bit with the use of GetElementIds() instead of prompting a selection first. So the order of operations would be:
So mechanically speaking, this may be a quirky workaround to avoid having to click a finish button. The user would just select, hit command shortcut, rinse and repeat vs. the original run command shortcut, select, click finish, rinse and repeat. While not what I was originally hoping for, I suppose this may be one solution to save one step each time. I am still open to hearing any solutions others may have!
Thank you @jeremy_tammik for the reply. I imagined a greater Windows API or automation may be required. I will definitely keep that option open. With that said, I was thinking a little more about this and one solution that may solve this somewhat, albeit not perfect, would be to reverse the operations a bit with the use of GetElementIds() instead of prompting a selection first. So the order of operations would be:
So mechanically speaking, this may be a quirky workaround to avoid having to click a finish button. The user would just select, hit command shortcut, rinse and repeat vs. the original run command shortcut, select, click finish, rinse and repeat. While not what I was originally hoping for, I suppose this may be one solution to save one step each time. I am still open to hearing any solutions others may have!
Can't find what you're looking for? Ask the community or share your knowledge.