Creates a light type object from the given document and family type ID
Namespace: Autodesk.Revit.DB.Lighting
Assembly: RevitAPI (in RevitAPI.dll) Version: 23.0.0.0 (23.1.0.0)
Since:
2013
Syntax
Return Value
The newly created LightType object
Examples
CopyC#
public LightType GetLightTypeFromLightSymbol(Document document)
{
if (document.IsFamilyDocument)
return null;
FilteredElementCollector collector = new FilteredElementCollector(document);
collector.OfClass(typeof(FamilySymbol)).OfCategory(BuiltInCategory.OST_LightingFixtures);
FamilySymbol lightSymbo = collector.Cast<FamilySymbol>().First<FamilySymbol>();
if (lightSymbo == null)
return null;
return LightType.GetLightType(document, lightSymbo.Id);
}
CopyVB.NET
Public Function GetLightTypeFromLightSymbol(document As Document) As LightType
If document.IsFamilyDocument Then
Return Nothing
End If
Dim collector As New FilteredElementCollector(document)
collector.OfClass(GetType(FamilySymbol)).OfCategory(BuiltInCategory.OST_LightingFixtures)
Dim lightSymbo As FamilySymbol = collector.Cast(Of FamilySymbol)().First()
If lightSymbo Is Nothing Then
Return Nothing
End If
Return LightType.GetLightType(document, lightSymbo.Id)
End Function
Exceptions
See Also