TemporaryViewModesPreviewFamilyVisibility Property

The current state of the PreviewFamilyVisibility mode in the associated view.

Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public PreviewFamilyVisibilityMode PreviewFamilyVisibility { get; set; }

Property Value

PreviewFamilyVisibilityMode
Exceptions
ExceptionCondition
ArgumentException When setting this property: The given PreviewFamilyVisibilityMode is not applicable in the associated view.
ArgumentOutOfRangeException When setting this property: A value passed for an enumeration argument is not a member of that enumeration
InvalidOperationException When setting this property: The PreviewFamilyVisibility mode is either disabled or inapplicable in the associated view.
Remarks

The state of the PreviewFamilyVisibility mode can be set only if the mode is currently available and enabled in the view. Even in such a condition, however, not all states are valid in all views. To ensure that the state to be applied is valid in the view, call the IsValidState(PreviewFamilyVisibilityMode) method first.

Even views which generally support temporary modes will have this particular mode available only when the document of the view is in the environment of the family editor.

This property affect only the view associated with this instance of TemporaryViewModes. When a view is opened for the first time, its state of the PreviewFamilyVisibility mode is determined based on the default settings which is controlled through the properties PreviewFamilyVisibilityDefaultOnState and PreviewFamilyVisibilityDefaultUncutState.

Example
public void TurnOffFamilyVisibilityMode(View view)
{
    TemporaryViewModes viewModes = view.TemporaryViewModes;

    if (viewModes != null)
    {
        if (viewModes.IsModeAvailable(TemporaryViewMode.PreviewFamilyVisibility) && viewModes.IsModeEnabled(TemporaryViewMode.PreviewFamilyVisibility))
        {
            if (viewModes.IsValidState(PreviewFamilyVisibilityMode.Off))
            {
                viewModes.PreviewFamilyVisibility = PreviewFamilyVisibilityMode.Off;
            }
        }
    }
}
See Also