LightType Class


Light Type Class

This class encapsulates light information.
Inheritance Hierarchy
System Object
Autodesk.Revit.DB.Lighting LightType

Namespace: Autodesk.Revit.DB.Lighting
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public class LightType : IDisposable

The LightType type exposes the following members.

Properties
Name Description
Public property ColorFilter The light filter color.
Public property DimmingColor The dimming temperature value in Kelvins.
Public property IsValidObject Specifies whether the .NET object represents a valid Revit entity.
Top
Methods
Name Description
Public method Dispose Releases all resources used by the LightType
Public method Equals Determines whether the specified object is equal to the current object.
(Inherited from Object )
Public method GetHashCode Serves as the default hash function.
(Inherited from Object )
Public method GetInitialColor Return a copy of an object derived from InitialColor
Public method GetInitialIntensity Return a copy of an object derived from InitialIntensity
Public method GetLightDistribution Return a copy of an object derived from LightDistribution
Public method GetLightShape Return a copy of an object derived from LightShape
Public method Static member Code example GetLightType Creates a light type object from the given document and family type ID
Public method Static member Code example GetLightTypeFromInstance Creates a light type object from the given document and element ID
Public method GetLossFactor Return a copy of an object derived from LossFactor
Public method GetType Gets the Type of the current instance.
(Inherited from Object )
Public method Code example SetInitialColor Replace the current initial color object with the given object
Public method Code example SetInitialIntensity Replace the current initial intensity object with the given object
Public method SetLightDistribution Replace the current LightDistribution object with the given object
Public method SetLightShape Replace the current LightShape object with the given object
Public method SetLossFactor Replace the current loss factor object with the given object
Public method ToString Returns a string that represents the current object.
(Inherited from Object )
Top
Example
public void GetLightData(Document document)
{
    // This code demonstrates how to get light information from project and family document
    LightType lightData = null;
    if (document.IsFamilyDocument)
    {
        // In family document, get LightType via LightFamily.GetLightType(int) method. 
        LightFamily lightFamily = LightFamily.GetLightFamily(document);
        for (int index = 0; index < lightFamily.GetNumberOfLightTypes(); index++)
        {
            lightData = lightFamily.GetLightType(index);
        }
    }
    else
    {
        // In family document, get LightType via GetLightTypeFromInstance or GetLightType method.
        // In order to get the light information, please get a light fixture instance first
        FilteredElementCollector collector = new FilteredElementCollector(document);
        collector.OfClass(typeof(FamilyInstance)).OfCategory(BuiltInCategory.OST_LightingFixtures);
        FamilyInstance lightFixture = collector.Cast<FamilyInstance>().First<FamilyInstance>();
        if (lightFixture == null)    // check null reference
            return;

        // Get the LightType for given light fixture
        lightData = LightType.GetLightTypeFromInstance(document, lightFixture.Id);
    }

    // Get the light data via LightType
    Color filterColor = lightData.ColorFilter;  // get the ColorFilter property
    LossFactor lossFactor = lightData.GetLossFactor();  // get the loss factor
    if (lossFactor is AdvancedLossFactor)
    {
        AdvancedLossFactor advancedFactor = lossFactor as AdvancedLossFactor;
        double luminaireValue = advancedFactor.LuminaireDirtDepreciation;
    }
}
See Also