Represents a stairs element in Autodesk Revit.
Namespace:
Autodesk.Revit.DB.Architecture
Assembly:
RevitAPI
(in RevitAPI.dll) Version: 18.0.0.0 (18.0.0.420)
Since:
2013
Syntax
Remarks
This element may represent a standalone Stairs element, or a member of a MultistoryStairs element.
Use
MultistoryStairsId
to identify if this Stairs element is a part of a MultistoryStairs.
Examples
Copy
C#
private Stairs GetStairInfo(Document document)
{
Stairs stairs = null;
FilteredElementCollector collector = new FilteredElementCollector(document);
ICollection<ElementId> stairsIds = collector.WhereElementIsNotElementType().OfCategory(BuiltInCategory.OST_Stairs).ToElementIds();
foreach (ElementId stairId in stairsIds)
{
if (Stairs.IsByComponent(document, stairId) == true)
{
stairs = document.GetElement(stairId) as Stairs;
// Format the information
String info = "\nNumber of stories: " + stairs.NumberOfStories;
info += "\nHeight of stairs: " + stairs.Height;
info += "\nNumber of treads: " + stairs.ActualTreadsNumber;
info += "\nTread depth: " + stairs.ActualTreadDepth;
// Show the information to the user.
TaskDialog.Show("Revit", info);
}
}
return stairs;
}
Copy
VB.NET
Private Function GetStairInfo(document As Document) As Stairs
Dim stairs__1 As Stairs = Nothing
Dim collector As New FilteredElementCollector(document)
Dim stairsIds As ICollection(Of ElementId) = collector.WhereElementIsNotElementType().OfCategory(BuiltInCategory.OST_Stairs).ToElementIds()
For Each stairId As ElementId In stairsIds
If Stairs.IsByComponent(document, stairId) = True Then
stairs__1 = TryCast(document.GetElement(stairId), Stairs)
' Format the information
Dim info As [String] = vbLf & "Number of stories: " + stairs__1.NumberOfStories
info += vbLf & "Height of stairs: " + stairs__1.Height
info += vbLf & "Number of treads: " + stairs__1.ActualTreadsNumber
info += vbLf & "Tread depth: " + stairs__1.ActualTreadDepth
' Show the information to the user.
TaskDialog.Show("Revit", info)
End If
Next
Return stairs__1
End Function