SetInitialColor Method


Replace the current initial color object with the given object

Namespace: Autodesk.Revit.DB.Lighting
Assembly: RevitAPI (in RevitAPI.dll) Version: 2015.0.0.0 (2015.0.0.0)
Since: 2013

Syntax

C#
public void SetInitialColor(
	InitialColor initialColor
)
Visual Basic
Public Sub SetInitialColor ( _
	initialColor As InitialColor _
)
Visual C++
public:
void SetInitialColor(
	InitialColor^ initialColor
)

Parameters

initialColor
Type: Autodesk.Revit.DB.Lighting InitialColor
An object derived from an InitialColor object The object pointed to is cloned internally

Remarks

The argument object is cloned

Examples

Copy C#
public void SetInitialColorProperty(LightType lightType)
{
    InitialColor initialColor = lightType.GetInitialColor();
    if (initialColor is CustomInitialColor)
    {
        CustomInitialColor custom = initialColor as CustomInitialColor;
        double colorTemperature = custom.Temperature;

        // Set new value for color temperature and set modified initial color to LightType.
        custom.Temperature = 3450.0;
        lightType.SetInitialColor(custom);

        // Create a PresetInitialColor and set it to LightType.
        PresetInitialColor preset = new PresetInitialColor(ColorPreset.Halogen);
        lightType.SetInitialColor(preset);

    }
}
Copy VB.NET
Public Sub SetInitialColorProperty(lightType As LightType)
    Dim initialColor As InitialColor = lightType.GetInitialColor()
    If TypeOf initialColor Is CustomInitialColor Then
        Dim [custom] As CustomInitialColor = TryCast(initialColor, CustomInitialColor)
        Dim colorTemperature As Double = [custom].Temperature

        ' Set new value for color temperature and set modified initial color to LightType.
        [custom].Temperature = 3450.0
        lightType.SetInitialColor([custom])

        ' Create a PresetInitialColor and set it to LightType.
        Dim preset As New PresetInitialColor(ColorPreset.Halogen)

        lightType.SetInitialColor(preset)
    End If
End Sub

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentNullException A non-optional argument was NULL

See Also

ArchiLabs Desktop

Put AI to work inside Revit.

Give Desktop your instructions and project files to build Revit families, update model elements, and create views and schedules. Works directly in Revit and AutoCAD.

Explore Desktop →