There is a lot of code for temporary hiding on the internet. I’ll post the code directly here.

1
2
3
4
// Temporary Hide
view.HideElementsTemporary(_HiddenElementIds);
// Hide
view.HideElements(_HiddenElementIds);

Most blogs only explain how to hide elements, or just show the element display interface. However, in actual projects, what users mostly want is to directly cancel the temporary hide mode and continue working.

This article explains how to invoke the window for showing hidden elements in Revit.

Revit Secondary Development: Isolate and Hide Elements

Unhide:

  1. Confirm if it is hidden
    1
    Element(id).IsHidden(view)
  2. Unhide via API
    1
    doc.ActiveView.UnhideElements(ids);
  3. Check the result. If it still doesn’t appear, it might be an issue with the View Mode.
  4. If step 3 is problematic, you can use the interface below to deactivate all display modes in the view and check the result.
    1
    doc.ActiveView.TemporaryViewModes.DeactivateAllModes();