Skip to content

LightType

Public 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

The light filter color.


Public Property

The dimming temperature value in Kelvins.


Public Property
IsValidObject

Specifies whether the .NET object represents a valid Revit entity.


Methods

Name

Description


Public Method

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

Return a copy of an object derived from InitialColor


Public Method

Return a copy of an object derived from InitialIntensity


Public Method

Return a copy of an object derived from LightDistribution


Public Method

Return a copy of an object derived from LightShape


Public Method
Static Member
Code Example

Creates a light type object from the given document and family type ID


Public Method
Static Member
Code Example

Creates a light type object from the given document and element ID


Public Method

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)


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;
}
}