LightGroup Class


Light Group Class

This class represents a set of lights grouped together for easier management of various lighting scenarios
Inheritance Hierarchy
System Object
Autodesk.Revit.DB.Lighting LightGroup

Namespace: Autodesk.Revit.DB.Lighting
Assembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntax
public class LightGroup : IDisposable

The LightGroup type exposes the following members.

Properties
Name Description
Public property Id The ElementId of the LightGroup
Public property IsValidObject Specifies whether the .NET object represents a valid Revit entity.
Public property Name The name of the LightGroup
Top
Methods
Name Description
Public method AddLight Add a new light instance to the group
Public method Dispose Releases all resources used by the LightGroup
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 GetLights Get the set of contained light instances The set of light instances
Public method GetType Gets the Type of the current instance.
(Inherited from Object )
Public method RemoveLight Remove the given light instance from the set of light instances in this group
Public method ToString Returns a string that represents the current object.
(Inherited from Object )
Top
Example
public void AddRemoveLightInGroup(LightGroup groupOne, LightGroup groupTwo, FamilyInstance lightOne, FamilyInstance lightTwo)
{
    // Add two lights into groupOne.
    groupOne.AddLight(lightOne.Id);
    groupOne.AddLight(lightTwo.Id);

    // Move a light from groupOne to groupTwo
    groupTwo.AddLight(lightOne.Id);

    // Retrieve the added lights in the group
    ICollection<ElementId> existingLightIds = groupOne.GetLights();

    // remove the light
    groupOne.RemoveLight(lightTwo.Id);
}
See Also