Hi everyone,

I have a Problem with the ActiveView in Revit. I want to hide seleted elements and here is the code:

UIDocument uiDoc = commandData.Application.ActiveUIDocument;
ElementSet elems = uiDoc.Selection.Elements;

uiDoc.Document.ActiveView.Hide(elems);
uiDoc.RefreshActiveView();


It works when this code is written directly in the Excute function (in the class which inherited from IEXternalCommand).

However, when I use a form to interact with Revit, it doesn't work. It is so, I have one button on the form. I want that once I click the button, the selected elements will be hidden. But when I click the button, nothing occurs.

I tried to use ShowElements(element) to activate the ActiveView fo Revit before using Hide(elems), but what I get is that the view window is changed so that I can see the element clearly but selected elements are still visible.

do you have any idea to deal with this problem?

Thanks.

Trang