SetInitialColor Method


Light Type Set Initial Color Method

Replace the current initial color object with the given object

Namespace: Autodesk.Revit.DB.Lighting
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public void SetInitialColor(
	InitialColor initialColor
)

Parameters

initialColor InitialColor
An object derived from an InitialColor object The object pointed to is cloned internally
Exceptions
Exception Condition
ArgumentNullException A non-optional argument was null
Remarks
The argument object is cloned
Example
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);

    }
}
See Also