Share

LightFamily Class

This class encapsulates light family information.

Inheritance Hierarchy

System.Object
  Autodesk.Revit.DB.Lighting.LightFamily


Namespace: Autodesk.Revit.DB.Lighting
Assembly: RevitAPI (in RevitAPI.dll) Version: 26.1.0.0 (26.1.0.34)

Syntax

C#

public class LightFamily : IDisposable

The LightFamily type exposes the following members.

Properties

 NameDescription
Public propertyIsValidObject Specifies whether the .NET object represents a valid Revit entity.

Methods

 NameDescription
Public methodDisposeReleases all resources used by the LightFamily
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 methodGetLightDistributionStyle Returns a LightDistributionStyle value for the light distribution
Public methodStatic memberGetLightFamily Creates a light family object from the given family document
Public methodGetLightShapeStyle Returns a LightShapeStyle value for the light shape
Public methodGetLightSourceTransform Returns a Transform value for the transform of light source.
Public methodGetLightType Return a LightType object for the light type at the given index
Public methodGetLightTypeName Return the name for the light type at the given index
Public methodGetNumberOfLightTypes Return the number of light types contained in this light family
Public methodGetTypeGets the Type of the current instance.
(Inherited from Object)
Public methodCode exampleSetLightDistributionStyle Set the light distribution style to the given shape distribution
Public methodCode exampleSetLightShapeStyle Set the light shape style to the given shape style
Public methodToStringReturns a string that represents the current object.
(Inherited from Object)

Example

C#

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

VB

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

See Also

Reference

Was this information helpful?