LightTypeGetLightType Method |
Creates a light type object from the given document and family type ID
Namespace: Autodesk.Revit.DB.LightingAssembly: RevitAPI (in RevitAPI.dll) Version: 25.0.0.0 (25.0.0.0)
Syntaxpublic static LightType GetLightType(
Document document,
ElementId typeId
)
Public Shared Function GetLightType (
document As Document,
typeId As ElementId
) As LightType
public:
static LightType^ GetLightType(
Document^ document,
ElementId^ typeId
)
static member GetLightType :
document : Document *
typeId : ElementId -> LightType
Parameters
- document Document
-
The document the typeId is from
- typeId ElementId
-
The ID of the light family type
Return Value
LightType
The newly created LightType object
ExceptionsException | Condition |
---|
ArgumentException |
The ElementId is the argument that is being validated
The ElementId is not valid because it is not for a light element.
|
ArgumentNullException |
A non-optional argument was null
|
Examplepublic 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);
}
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
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
See Also