Please improve the ShowElements methods.
As you can see, we just can handle over some element IDs...
If the elements are not visible in any view, we get this dialog which needs user interaction to be closed:
Why not giving that as (boolean) return value of ShowElements?
Also, there may be several views suitable for displaying the elements.
Why not providing a parameter for desired view ID?
If we want to display an element in a view plan but Revit decides to use a 3D view, that's not optimal.
Also, it may be the case that if you want to show a chair inside the building, in the chosen 3D view you only see the outer side of a wall, hiding the chair.
Revit decides which view to use, but its decisions are not always the best ones.
I suggest something like this:
bool ShowElements(ICollection<ElementId> ids, ElementId desiredViewId)
Returns "true" if elements could be displayed properly, otherwise "false".
As default, the "No good view" dialog is suppressed.
Depending on the result value, we can inform the user ourselves that there is no good view.
A "false" result could be used to try the method using another view ID.
The list of candidate view IDs needs to be priorized by the programmer, using view names, parameters, scales as criteria, whatever he (or she) wants.
Revitalizer
Can't find what you're looking for? Ask the community or share your knowledge.