Represents the rendering settings for a 3d view.
Namespace: Autodesk.Revit.DB
Assembly: RevitAPI (in RevitAPI.dll) Version: 18.0.0.0 (18.2.0.0)
Since:
2013
Syntax
Visual Basic |
---|
Public Class RenderingSettings _
Implements IDisposable |
Visual C++ |
---|
public ref class RenderingSettings : IDisposable |
Examples
CopyC#
public void GetRenderingSettingsData(View3D view3D)
{
RenderingSettings renderingSettings = view3D.GetRenderingSettings();
if (renderingSettings.ResolutionTarget == ResolutionTarget.Printer)
{
PrinterResolution printResolution = renderingSettings.PrinterResolution;
int resolutionValue = renderingSettings.ResolutionValue;
}
else
{
int resolutionValue = renderingSettings.ResolutionValue;
}
renderingSettings.UsesRegionRendering = true;
Outline regionOutline = renderingSettings.GetRenderingRegionOutline();
XYZ max = regionOutline.MaximumPoint;
XYZ min = regionOutline.MinimumPoint;
renderingSettings.LightingSource = LightingSource.ExteriorSun;
SunAndShadowSettings sunSettings = view3D.SunAndShadowSettings;
switch (renderingSettings.BackgroundStyle)
{
case BackgroundStyle.Color:
ColorBackgroundSettings colorBKSettings = renderingSettings.GetBackgroundSettings() as ColorBackgroundSettings;
Color bkColor = colorBKSettings.Color;
break;
case BackgroundStyle.Image:
ImageBackgroundSettings imageBKSettings = renderingSettings.GetBackgroundSettings() as ImageBackgroundSettings;
BackgroundImageFit imageFit = imageBKSettings.BackgroundImageFit;
string filePath = imageBKSettings.FilePath;
break;
case BackgroundStyle.SkyCloudy:
case BackgroundStyle.SkyFewClouds:
case BackgroundStyle.SkyNoClouds:
case BackgroundStyle.SkyVeryCloudy:
case BackgroundStyle.SkyVeryFewClouds:
SkyBackgroundSettings skyBKSettings = renderingSettings.GetBackgroundSettings() as SkyBackgroundSettings;
break;
default:
throw new InvalidOperationException("Not expected background style");
}
RenderingImageExposureSettings exposureSettings = renderingSettings.GetRenderingImageExposureSettings();
double imageShadows = exposureSettings.Shadows;
RenderingQualitySettings qualitySettings = renderingSettings.GetRenderingQualitySettings();
if (qualitySettings.RenderingQuality == RenderingQuality.Custom)
{
qualitySettings.RenderDuration = RenderDuration.ByTime;
qualitySettings.RenderTime = 10;
}
else
{
int renderLevels = qualitySettings.RenderLevel;
}
}
CopyVB.NET
Public Sub GetRenderingSettingsData(view3D As View3D)
Dim renderingSettings As RenderingSettings = view3D.GetRenderingSettings()
If renderingSettings.ResolutionTarget = ResolutionTarget.Printer Then
Dim printResolution As PrinterResolution = renderingSettings.PrinterResolution
Dim resolutionValue As Integer = renderingSettings.ResolutionValue
Else
Dim resolutionValue As Integer = renderingSettings.ResolutionValue
End If
renderingSettings.UsesRegionRendering = True
Dim regionOutline As Outline = renderingSettings.GetRenderingRegionOutline()
Dim max As XYZ = regionOutline.MaximumPoint
Dim min As XYZ = regionOutline.MinimumPoint
renderingSettings.LightingSource = LightingSource.ExteriorSun
Dim sunSettings As SunAndShadowSettings = view3D.SunAndShadowSettings
Select Case renderingSettings.BackgroundStyle
Case BackgroundStyle.Color
Dim colorBKSettings As ColorBackgroundSettings = TryCast(renderingSettings.GetBackgroundSettings(), ColorBackgroundSettings)
Dim bkColor As Color = colorBKSettings.Color
Exit Select
Case BackgroundStyle.Image
Dim imageBKSettings As ImageBackgroundSettings = TryCast(renderingSettings.GetBackgroundSettings(), ImageBackgroundSettings)
Dim imageFit As BackgroundImageFit = imageBKSettings.BackgroundImageFit
Dim filePath As String = imageBKSettings.FilePath
Exit Select
Case BackgroundStyle.SkyCloudy, BackgroundStyle.SkyFewClouds, BackgroundStyle.SkyNoClouds, BackgroundStyle.SkyVeryCloudy, BackgroundStyle.SkyVeryFewClouds
Dim skyBKSettings As SkyBackgroundSettings = TryCast(renderingSettings.GetBackgroundSettings(), SkyBackgroundSettings)
Exit Select
Case Else
Throw New InvalidOperationException("Not expected background style")
End Select
Dim exposureSettings As RenderingImageExposureSettings = renderingSettings.GetRenderingImageExposureSettings()
Dim imageShadows As Double = exposureSettings.[Shadows]
Dim qualitySettings As RenderingQualitySettings = renderingSettings.GetRenderingQualitySettings()
If qualitySettings.RenderingQuality = RenderingQuality.[Custom] Then
qualitySettings.RenderDuration = RenderDuration.ByTime
qualitySettings.RenderTime = 10
Else
Dim renderLevels As Integer = qualitySettings.RenderLevel
End If
End Sub
Inheritance Hierarchy
See Also