LightFamily Class


This class encapsulates light family information.

Namespace: Autodesk.Revit.DB.Lighting
Assembly: RevitAPI (in RevitAPI.dll) Version: 24.0.0.0 (24.0.0.0)
Since:  2013

Syntax

C#
public class LightFamily : IDisposable
Visual Basic
Public Class LightFamily _
	Implements IDisposable
Visual C++
public ref class LightFamily : IDisposable

Examples

CopyC#
public void GetLightDataInFamilyDocument(Document familyDoc)
{
    // LightFamily API should work only in light fixture family document.
    if (familyDoc.OwnerFamily.FamilyCategory.BuiltInCategory == BuiltInCategory.OST_LightingFixtures)
        return;

    // Get the light family from the static method.
    LightFamily lightFamily = LightFamily.GetLightFamily(familyDoc);

    // Get the light source shape style and distribution style
    LightShapeStyle shapeStyle = lightFamily.GetLightShapeStyle();
    LightDistributionStyle distributionStyle = lightFamily.GetLightDistributionStyle();

    // Get the light photometric for each family type
    for (int index = 0; index < lightFamily.GetNumberOfLightTypes(); index++)
    {
        string typeName = lightFamily.GetLightTypeName(index);  // the type name
        LightType lightData = lightFamily.GetLightType(index);  // the light data for each type
        // How to get and set data in LightType object, please read help document for LightType class.
    }
}
CopyVB.NET
Public Sub GetLightDataInFamilyDocument(familyDoc As Document)
   ' LightFamily API should work only in light fixture family document.
   If familyDoc.OwnerFamily.FamilyCategory.BuiltInCategory = BuiltInCategory.OST_LightingFixtures Then
      Return
   End If

   ' Get the light family from the static method.
   Dim lightFamily__1 As LightFamily = LightFamily.GetLightFamily(familyDoc)

   ' Get the light source shape style and distribution style
   Dim shapeStyle As LightShapeStyle = lightFamily__1.GetLightShapeStyle()
   Dim distributionStyle As LightDistributionStyle = lightFamily__1.GetLightDistributionStyle()

   ' Get the light photometric for each family type
   For index As Integer = 0 To lightFamily__1.GetNumberOfLightTypes() - 1
      Dim typeName As String = lightFamily__1.GetLightTypeName(index)
      ' the type name
      ' the light data for each type
      ' How to get and set data in LightType object, please read help document for LightType class.
      Dim lightData As LightType = lightFamily__1.GetLightType(index)
   Next
End Sub

Inheritance Hierarchy

SystemObject
  Autodesk.Revit.DB.LightingLightFamily

See Also

ArchiLabs

Stop fighting Revit automation.

Build repeatable BIM design and documentation workflows with scripts, data, and AI in one place, without wrestling brittle one-off automations.

Try ArchiLabs →