LightType Class

This class encapsulates light information.
Inheritance Hierarchy
SystemObject
  Autodesk.Revit.DB.LightingLightType

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
 NameDescription
Public propertyColorFilter The light filter color.
Public propertyDimmingColor The dimming temperature value in Kelvins.
Public propertyIsValidObject Specifies whether the .NET object represents a valid Revit entity.
Top
Methods
 NameDescription
Public methodDisposeReleases all resources used by the LightType
Public methodEqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
Public methodGetHashCodeServes as the default hash function.
(Inherited from Object)
Public methodGetInitialColor Return a copy of an object derived from InitialColor
Public methodGetInitialIntensity Return a copy of an object derived from InitialIntensity
Public methodGetLightDistribution Return a copy of an object derived from LightDistribution
Public methodGetLightShape Return a copy of an object derived from LightShape
Public methodStatic memberCode exampleGetLightType Creates a light type object from the given document and family type ID
Public methodStatic memberCode exampleGetLightTypeFromInstance Creates a light type object from the given document and element ID
Public methodGetLossFactor Return a copy of an object derived from LossFactor
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodCode exampleSetInitialColor Replace the current initial color object with the given object
Public methodCode exampleSetInitialIntensity Replace the current initial intensity object with the given object
Public methodSetLightDistribution Replace the current LightDistribution object with the given object
Public methodSetLightShape Replace the current LightShape object with the given object
Public methodSetLossFactor Replace the current loss factor object with the given object
Public methodToStringReturns 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