SetLightDistributionStyle Method


Set the light distribution style to the given shape distribution

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

Syntax

C#
public void SetLightDistributionStyle(
	LightDistributionStyle lightDistributionStyle
)
Visual Basic
Public Sub SetLightDistributionStyle ( _
	lightDistributionStyle As LightDistributionStyle _
)
Visual C++
public:
void SetLightDistributionStyle(
	LightDistributionStyle lightDistributionStyle
)

Parameters

lightDistributionStyle
Type: Autodesk.Revit.DB.Lighting LightDistributionStyle
The light distribution style to set the light distribution type to

Examples

Copy C#
public void ModifyLightDistributionStyle(Document familyDoc)
{
    // Get the light family from the static method.
    LightFamily lightFamily = LightFamily.GetLightFamily(familyDoc);

    // Set the light distribution style to PhotometricWeb
    lightFamily.SetLightDistributionStyle(LightDistributionStyle.PhotometricWeb);

    // After light shape style set to PhotometricWeb, each tyoe returns a CircleLightShape instance,
    for (int index = 0; index < lightFamily.GetNumberOfLightTypes(); index++)
    {
        LightType lightData = lightFamily.GetLightType(index);
        PhotometricWebLightDistribution lightDistribution = 
            lightData.GetLightDistribution() as PhotometricWebLightDistribution;
        lightDistribution.PhotometricWebFile = @"C:\IES\1x4 2Lamp.ies"; // input a full file path here.
        lightDistribution.TiltAngle = Math.PI / 6;    // use radian value to set
        lightData.SetLightDistribution(lightDistribution);  // set back
    }
}
Copy VB.NET
Public Sub ModifyLightDistributionStyle(familyDoc As Document)
    ' Get the light family from the static method.
    Dim lightFamily__1 As LightFamily = LightFamily.GetLightFamily(familyDoc)

    ' Set the light distribution style to PhotometricWeb
    lightFamily__1.SetLightDistributionStyle(LightDistributionStyle.PhotometricWeb)

    ' After light shape style set to PhotometricWeb, each tyoe returns a CircleLightShape instance,
    For index As Integer = 0 To lightFamily__1.GetNumberOfLightTypes() - 1
        Dim lightData As LightType = lightFamily__1.GetLightType(index)
        Dim lightDistribution As PhotometricWebLightDistribution = TryCast(lightData.GetLightDistribution(), PhotometricWebLightDistribution)
        lightDistribution.PhotometricWebFile = "C:\IES\1x4 2Lamp.ies"
        ' input a full file path here.
        lightDistribution.TiltAngle = Math.PI / 6
        ' use radian value to set
        ' set back
        lightData.SetLightDistribution(lightDistribution)
    Next
End Sub

Exceptions

Exception Condition
Autodesk.Revit.Exceptions ArgumentOutOfRangeException A value passed for an enumeration argument is not a member of that enumeration

See Also

ArchiLabs Desktop

Put AI to work inside Revit.

Give Desktop your instructions and project files to build Revit families, update model elements, and create views and schedules. Works directly in Revit and AutoCAD.

Explore Desktop →