LightGroupManager Class


This class represents a set of light groups that are used 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 LightGroupManager : IDisposable
Visual Basic
Public Class LightGroupManager _
	Implements IDisposable
Visual C++
public ref class LightGroupManager : IDisposable

Examples

CopyC#
public void AddRemoveLightGroupInManager(Document document, FamilyInstance lightOne, FamilyInstance lightTwo)
{
    if (document.IsFamilyDocument)   // it supports project document only.
        return;
    LightGroupManager groupMgr = LightGroupManager.GetLightGroupManager(document);

    // Add a light group with a light
    LightGroup lightGroup = groupMgr.CreateGroup("Group_One");
    lightGroup.AddLight(lightOne.Id);
    // Add another light group with another light.
    lightGroup = groupMgr.CreateGroup("Group_Two");
    lightGroup.AddLight(lightTwo.Id);

    // Retrieve the added light group in the manager.
    IList<LightGroup> existingGroups = groupMgr.GetGroups();
    foreach (LightGroup group in existingGroups)
    {
        string groupName = group.Name;
    }

    // Remove one light group from the manager.
    groupMgr.DeleteGroup(existingGroups[0].Id);
}
CopyVB.NET
Public Sub AddRemoveLightGroupInManager(document As Document, lightOne As FamilyInstance, lightTwo As FamilyInstance)
   If document.IsFamilyDocument Then
      ' it supports project document only.
      Return
   End If
   Dim groupMgr As LightGroupManager = LightGroupManager.GetLightGroupManager(document)

   ' Add a light group with a light
   Dim lightGroup As LightGroup = groupMgr.CreateGroup("Group_One")
   lightGroup.AddLight(lightOne.Id)
   ' Add another light group with another light.
   lightGroup = groupMgr.CreateGroup("Group_Two")
   lightGroup.AddLight(lightTwo.Id)

   ' Retrieve the added light group in the manager.
   Dim existingGroups As IList(Of LightGroup) = groupMgr.GetGroups()
   For Each group As LightGroup In existingGroups
      Dim groupName As String = group.Name
   Next

   ' Remove one light group from the manager.
   groupMgr.DeleteGroup(existingGroups(0).Id)
End Sub

Inheritance Hierarchy

SystemObject
  Autodesk.Revit.DB.LightingLightGroupManager

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 →