2025 Class
Changes 3
C

TemporaryViewModes

Description:
A data structure containing data related to temporary view modes.
Remarks:

The class contains methods and properties to manipulate states of various temporary view modes that may or may not be avilable in any of visible views of a Revit document. The temporary modes are enumerated in the TemporaryViewMode class.

Every view that supports temporary view modes owns an instance of this TemporaryViewModes class, which can be obtained by accessing the TemporaryViewModes property of the View class. Note that views which do not support temporary modes will have that property's value be Null.

Multiple temporary view modes can coexist. Also, TemporaryViewProperties mode can be customized to display custom title and custom color. Setting custom title and color affects only TemporaryViewProperties mode for the specific view.

Inheritance Hierarchy:
System.Object
  Autodesk.Revit.DB.APIObject
    Autodesk.Revit.DB.TemporaryViewModes
public class TemporaryViewModes : APIObject
public bool RevealHiddenElementsInView(View view)
{
    bool hiddenRevealed = false;
    TemporaryViewModes viewModes = view.TemporaryViewModes;

    if (viewModes == null)
    {
        TaskDialog.Show("Invalid View", "This view does not support temporary view modes.");
    }
    else
    {
        // Mode must be available and enabled to be activated
        if (viewModes.IsModeEnabled(TemporaryViewMode.RevealHiddenElements) && viewModes.IsModeAvailable(TemporaryViewMode.RevealHiddenElements))
        {
            viewModes.RevealHiddenElements = true;
            hiddenRevealed = viewModes.RevealHiddenElements;
        }
    }

    return hiddenRevealed;
}
Name Return Type Description Inherited From
M DeactivateAllModes() None Deactivates all temporary modes that are currently active.
M DeactivateMode(TemporaryViewMode) None Deactivates the given temporary mode.
M Dispose() None Causes the object to release immediately any resources it may be utilizing. (Inherited from APIObject ) APIObject
M Equals None Determines whether the specified object is equal to the current object. (Inherited from Object ) Object
M GetCaption(TemporaryViewMode) String A text caption to use for the given mode.
M GetHashCode None Serves as the default hash function. (Inherited from Object ) Object
M GetType None Gets the Type of the current instance. (Inherited from Object ) Object
M IsCustomized() Boolean Identifies if a custom temporary view mode is currently active. A custom mode is active if there is a non-empty string set for CustomTitle .
M IsModeActive(TemporaryViewMode) Boolean Tests whether a given mode is currently active or not.
M IsModeAvailable(TemporaryViewMode) Boolean Tests whether a temporary view mode is currently available in the associated view.
M IsModeEnabled(TemporaryViewMode) Boolean Tests whether a temporary view mode is currently enabled in the associated view.
M IsValidState(PreviewFamilyVisibilityMode) Boolean Tests whether the given state is valid for the associated view and the context the view is currently in.
M RemoveCustomization() None Removes all customized values for the TemporaryViewProperties mode.
M ToString None Returns a string that represents the current object. (Inherited from Object ) Object
Name Return Type Description Inherited From
P CustomColor Color Custom color for the TemporaryViewProperties mode.
P CustomTitle string Custom title for the TemporaryViewProperties mode.
P IsReadOnly bool Identifies if the object is read-only or modifiable. (Inherited from APIObject ) APIObject
P IsValidObject Boolean Specifies whether the .NET object represents a valid Revit entity.
P PreviewFamilyVisibility PreviewFamilyVisibilityMode The current state of the PreviewFamilyVisibility mode in the associated view.
P PreviewFamilyVisibilityDefaultOnState bool Controls the default state of the PreviewFamilyVisibility mode in all views.
P PreviewFamilyVisibilityDefaultUncutState bool Controls the default type of the On state of the PreviewFamilyVisibility mode in cut-able views.
P RevealConstraints bool The current state of the RevealConstraints mode in the associated view.
P RevealHiddenElements bool The current state of the RevealHiddenElements mode in the associated view.
P WorksharingDisplay WorksharingDisplayMode The current state of the WorksharingDisplay mode in the associated view.