Retrieving tread depth when stairs not of Stairs class

Retrieving tread depth when stairs not of Stairs class

Anonymous
Not applicable
551 Views
3 Replies
Message 1 of 4

Retrieving tread depth when stairs not of Stairs class

Anonymous
Not applicable

I'm looking at the publicly available model "210 King - Autodesk Toronto.rvt" which I upgraded from 2016 to 2018 (original 2016 version here).  When I select a stairs object in the model, it has an "Actual Tread Depth" in the Properties Panel.

I want to access this tread depth in the API.  In the sample project that ships with Revit, the stairs are of class Autodesk.Revit.DB.Architecture.Stairs (derived from Element) which has an ActualTreadDepth property.  But in this model, the stairs are all just objects of class Element.  Casting them to Stairs throws an exception.  

Two questions:
 - How can I access the tread depth?
 - Why aren't these of class Stairs? (I'm new to the Revit API)

 

 

 

 

0 Likes
Accepted solutions (1)
552 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable

Note: I also asked this question on Stack Overflow here (after this post had gotten stuck in the spam filter) which Jeremy Tammik gave a very helpful answer to. 

 

Although I did have a follow up question you can see in that link that I'm still confused about.

0 Likes
Message 3 of 4

RPTHOMAS108
Mentor
Mentor
Accepted solution

If try cast fails then you need to get parameter for tread depth via its built in parameter value, or you can just get it this way without trying to cast to a derived class:

 

Element.Parameter(STAIRS_ACTUAL_TREAD_DEPTH)

 

Finding the required parameter is easy via the lookup tool

Message 4 of 4

Anonymous
Not applicable

Thanks!  I get how that works now.

0 Likes