LightType
Description:
This class encapsulates light information.
This class encapsulates light information.
Inheritance Hierarchy:
System.Object
Autodesk.Revit.DB.Lighting.LightType
System.Object
Autodesk.Revit.DB.Lighting.LightType
public class LightType : IDisposable
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;
}
}
| Name | Return Type | Description | Inherited From |
|---|---|---|---|
| Dispose() | None | Releases all resources used by the LightType | |
| Equals | None | Determines whether the specified object is equal to the current object. (Inherited from Object ) | Object |
| GetHashCode | None | Serves as the default hash function. (Inherited from Object ) | Object |
| GetInitialColor() | InitialColor | Return a copy of an object derived from InitialColor | |
| GetInitialIntensity() | InitialIntensity | Return a copy of an object derived from InitialIntensity | |
| GetLightDistribution() | LightDistribution | Return a copy of an object derived from LightDistribution | |
| GetLightShape() | LightShape | Return a copy of an object derived from LightShape | |
| GetLightType(Document, ElementId) | LightType | Creates a light type object from the given document and family type ID | |
| GetLightTypeFromInstance(Document, ElementId) | LightType | Creates a light type object from the given document and element ID | |
| GetLossFactor() | LossFactor | Return a copy of an object derived from LossFactor | |
| GetType | None | Gets the Type of the current instance. (Inherited from Object ) | Object |
| SetInitialColor(InitialColor) | None | Replace the current initial color object with the given object | |
| SetInitialIntensity(InitialIntensity) | None | Replace the current initial intensity object with the given object | |
| SetLightDistribution(LightDistribution) | None | Replace the current LightDistribution object with the given object | |
| SetLightShape(LightShape) | None | Replace the current LightShape object with the given object | |
| SetLossFactor(LossFactor) | None | Replace the current loss factor object with the given object | |
| ToString | None | Returns a string that represents the current object. (Inherited from Object ) | Object |
| Name | Return Type | Description | Inherited From |
|---|---|---|---|
| ColorFilter | Color | The light filter color. | |
| DimmingColor | LightDimmingColor | The dimming temperature value in Kelvins. | |
| IsValidObject | Boolean | Specifies whether the .NET object represents a valid Revit entity. |