Namespace:
Autodesk.Revit.DB
RenderingSettings
Class
Description:
Represents the rendering settings for a 3d view.
Represents the rendering settings for a 3d view.
Examples
public void GetRenderingSettingsData(View3D view3D)
{
RenderingSettings renderingSettings = view3D.GetRenderingSettings();
// get print or screen resolution data
if (renderingSettings.ResolutionTarget == ResolutionTarget.Printer) // for print resolution
{
PrinterResolution printResolution = renderingSettings.PrinterResolution;
int resolutionValue = renderingSettings.ResolutionValue;
}
else // for screen resolution
{
int resolutionValue = renderingSettings.ResolutionValue;
}
// Get the outline of the rendering region.
renderingSettings.UsesRegionRendering = true;
Outline regionOutline = renderingSettings.GetRenderingRegionOutline();
XYZ max = regionOutline.MaximumPoint;
XYZ min = regionOutline.MinimumPoint;
// get lighting information.
renderingSettings.LightingSource = LightingSource.ExteriorSun; // set lighting scheme type
// Please note that the sun setting has been exposed in View.SunAndShadowSettings property already.
SunAndShadowSettings sunSettings = view3D.SunAndShadowSettings;
// get the background setting data
switch (renderingSettings.BackgroundStyle)
{
case BackgroundStyle.Color: // for color style
ColorBackgroundSettings colorBKSettings = renderingSettings.GetBackgroundSettings() as ColorBackgroundSettings;
Color bkColor = colorBKSettings.Color;
break;
case BackgroundStyle.Image: // for image style
ImageBackgroundSettings imageBKSettings = renderingSettings.GetBackgroundSettings() as ImageBackgroundSettings;
BackgroundImageFit imageFit = imageBKSettings.BackgroundImageFit;
string filePath = imageBKSettings.FilePath;
break;
case BackgroundStyle.SkyCloudy: // for sky related styles
case BackgroundStyle.SkyFewClouds:
case BackgroundStyle.SkyNoClouds:
case BackgroundStyle.SkyVeryCloudy:
case BackgroundStyle.SkyVeryFewClouds:
SkyBackgroundSettings skyBKSettings = renderingSettings.GetBackgroundSettings() as SkyBackgroundSettings;
//float fHaze = skyBKSettings.Haze;
break;
default:
throw new InvalidOperationException("Not expected background style");
}
// Get the rendering image exposure settings
RenderingImageExposureSettings exposureSettings = renderingSettings.GetRenderingImageExposureSettings();
double imageShadows = exposureSettings.Shadows;
// Get the rendering quality settings
RenderingQualitySettings qualitySettings = renderingSettings.GetRenderingQualitySettings();
if (qualitySettings.RenderingQuality == RenderingQuality.Custom)
{
// The user can set the data only in custom quality
qualitySettings.RenderDuration = RenderDuration.ByTime;
qualitySettings.RenderTime = 10;
}
else
{
// RenderLevel property value is returned according to its rendering quality style.
// For example, it returns 1.0 for Draft quality and returns 5.0 for Medium quality.
// RenderDuration and RenderTime property values are always the same for non-custom quality.
int renderLevels = qualitySettings.RenderLevel;
}
}
RenderingSettings Class Members:
Name | Description | Inherited From |
---|---|---|
BackgroundStyle | The enum value that controls the background style for rendering. | |
IsValidObject | Specifies whether the .NET object represents a valid Revit entity. | |
LightingSource | The lighting scheme type. | |
PrinterResolution | The resolution level when using printer. | |
ResolutionTarget | The resolution target. | |
ResolutionValue | The rendering resolution in dots per inch (DPI). | |
UsesRegionRendering | The bool value that indicates whether to use region rendering. |
Name | Description | Inherited From |
---|---|---|
Dispose | Releases all resources used by the RenderingSettings | |
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object ) | Object |
GetBackgroundSettings | Returns an object that represents the rendering background settings. | |
GetHashCode | Serves as the default hash function. (Inherited from Object ) | Object |
GetRenderingImageExposureSettings | Returns an object that represents the rendering image exposure settings. | |
GetRenderingQualitySettings | Returns an object that represents the rendering quality settings. | |
GetRenderingRegionOutline | Returns the outline of the rendering region. | |
GetType | Gets the Type of the current instance. (Inherited from Object ) | Object |
SetBackgroundSettings | Changes the rendering background settings details for the current background style. | |
SetRenderingImageExposureSettings | Changes the rendering image exposure settings. | |
SetRenderingQualitySettings | Change rendering quality settings. | |
ToString | Returns a string that represents the current object. (Inherited from Object ) | Object |