2027 Class
Changes 0
C

DocumentPreviewSettings

Description:
Contains the settings related to the saving of preview images for a given document.
Inheritance Hierarchy:
System.Object
  Autodesk.Revit.DB.DocumentPreviewSettings
public class DocumentPreviewSettings : IDisposable
// Get the document's preview settings
DocumentPreviewSettings settings = document.GetDocumentPreviewSettings();

// Find a candidate 3D view
FilteredElementCollector 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 settings
using (Transaction setTransaction = new Transaction(document, "Set preview view id"))
{
   setTransaction.Start();
   settings.PreviewViewId = viewForPreview.Id;
   setTransaction.Commit();
}

// Save the document
document.Save();
Name Return Type Description Inherited From
M Dispose() None Releases all resources used by the DocumentPreviewSettings
M Equals None Determines whether the specified object is equal to the current object. (Inherited from Object ) Object
M ForceViewUpdate(Boolean) None Sets Revit to update the preview view if necessary.
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 IsViewIdValidForPreview(ElementId) Boolean Identifies if the view id is valid as a preview view id.
M ToString None Returns a string that represents the current object. (Inherited from Object ) Object
Name Return Type Description Inherited From
P IsValidObject Boolean Specifies whether the .NET object represents a valid Revit entity.
P IsViewUpdateForced bool Identifies if Revit will update the preview view if necessary.
P PreviewViewId ElementId The view id that will be used to generate the preview.