DocumentPreviewSettings
Contains the settings related to the saving of preview images for a given document.
Inheritance Hierarchy
System.Object
Autodesk.Revit.DB.DocumentPreviewSettings
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public class DocumentPreviewSettings : IDisposableThe DocumentPreviewSettings type exposes the following members.
Properties
Name
Description
Public Property
IsValidObject
Specifies whether the .NET object represents a valid Revit entity.
Public Property
IsViewUpdateForced
Identifies if Revit will update the preview view if necessary.
Public Property
PreviewViewId
The view id that will be used to generate the preview.
Methods
Name
Description
Public Method
Dispose
Releases all resources used by the DocumentPreviewSettings
Public Method
Equals
Determines whether the specified object is equal to the current object.
(Inherited from Object)
Public Method
ForceViewUpdate
Sets Revit to update the preview view if necessary.
Public Method
GetHashCode
Serves as the default hash function.
(Inherited from Object)
Public Method
GetType
Gets the Type of the current instance.
(Inherited from Object)
Public Method
IsViewIdValidForPreview
Identifies if the view id is valid as a preview view id.
Public Method
ToString
Returns a string that represents the current object.
(Inherited from Object)
Example
// Get the document's preview settingsDocumentPreviewSettings settings = document.GetDocumentPreviewSettings();
// Find a candidate 3D viewFilteredElementCollector collector = new FilteredElementCollector(document);collector.OfClass(typeof(View3D));
Func<View3D, bool> isValidForPreview = v => settings.IsViewIdValidForPreview(v.Id);
View3D viewForPreview = collector.OfType<View3D>().First<View3D>(isValidForPreview);
// Set the preview settingsusing (Transaction setTransaction = new Transaction(document, "Set preview view id")){ setTransaction.Start(); settings.PreviewViewId = viewForPreview.Id; setTransaction.Commit();}
// Save the documentdocument.Save();