LightGroup Class


This class represents a set of lights grouped together for easier management of various lighting scenarios

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 LightGroup : IDisposable
Visual Basic
Public Class LightGroup _
	Implements IDisposable
Visual C++
public ref class LightGroup : IDisposable

Examples

CopyC#
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);
}
CopyVB.NET
Public Sub AddRemoveLightInGroup(groupOne As LightGroup, groupTwo As LightGroup, lightOne As FamilyInstance, lightTwo As FamilyInstance)
   ' 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
   Dim existingLightIds As ICollection(Of ElementId) = groupOne.GetLights()

   ' remove the light
   groupOne.RemoveLight(lightTwo.Id)
End Sub

Inheritance Hierarchy

SystemObject
  Autodesk.Revit.DB.LightingLightGroup

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 →