RVTDocs.com
Namespace: Autodesk.Revit.DB Class: View

View.HideElements

Method
Description:
Sets the elements to be hidden in the view.
Remarks:
This change is permanent until the elements are unhidden. All elements in the set must be currently unhidden and must be allowed to be hidden. An application can check this with IsHidden(View) and CanBeHidden(View).

Some elements cannot be hidden directly. Examples include: group, array, constraint, edit cut profile, face splitter and link to external documents.

Also, elements cannot be hidden in Revit family documents (but they can be hidden temporarily using [M:Autodesk.Revit.DB.View.HideElementsTemporary(System.Collections.Generic.ICollection`1{Autodesk.Revit.DB.ElementId})]).

To hide a group completely, you must also include all members of all groups and nested groups in your input.

Syntax
public void HideElements(
	ICollection<ElementId> elementIdSet
)
Parameters
Parameter Type Description
elementIdSet ICollection A set of ElementIds to be hidden.
Return Value
Exceptions
Exception Condition
ArgumentNullException Thrown when argument is.
ArgumentException Thrown when the set of elements to be hidden is empty or one of the elements can not be hidden. Also thrown when the set of elements to be hidden includes the view itself.
InvalidOperationException Thrown when document regeneration failed.