How to get information about the stairs using Revit API?

Anonymous

How to get information about the stairs using Revit API?

Anonymous
Not applicable

I have a multiple floor building having stairs in it, but I am unable to get the stairs information using Revit API.

 

 

Method i am using to get the stairs information:

----------------------------------------------------------------------------------------------------------

public static void Save(ElementSet stairs)
        {
            try
            {
                DataSet dsStairs = BALStairs.GetStairs(BOCommon.ProjectId);
                foreach (Element tempStairs in stairs)
                {
                    DataRow drCurrent = dsStairs.Tables["Stairs"].NewRow();
                    //get the levels for the stairs.
                    if (tempStairs.Level != null && BOCommon.ProjectId != -1)
                    {
                        BALRoom.GetLevelId(BOCommon.ProjectId, tempStairs.Level.Name);
                    }
                    //inserted on 20 oct
                    if (BOCommon.ProjectId != -1)
                        drCurrent["ProjectId"] = BOCommon.ProjectId;
                    if (BOCommon.LevelId != -1)
                        drCurrent["LevelId"] = BOCommon.LevelId;
                    if (BOCommon.ProjectId != -1)
                        drCurrent["ProjectId"] = BOCommon.ProjectId;
                    if (BOCommon.LevelId != -1)
                        drCurrent["LevelId"] = BOCommon.LevelId;
                    string famName;
                    try
                    {
                        //assiging the values of the stairs elements to null.
                        drCurrent["TopLevel"] = DBNull.Value;
                        drCurrent["BaseLevel"] = DBNull.Value;
                        drCurrent["ActualNumRiser"] = DBNull.Value;
                        drCurrent["ActualRiserHeight"] = DBNull.Value;
                        drCurrent["TreadWidth"] = DBNull.Value;
                        drCurrent["TreadDepth"] = DBNull.Value;
                        drCurrent["Name"] = DBNull.Value;
                        drCurrent["TypeName"] = DBNull.Value;
                        drCurrent["FamilyName"] = DBNull.Value;

 

-----------------------------------------------------------------------------------------------------

 

But API returns the emply value for stairs.

 

Please review and send us the valuable feedback.

 

Thanks,

0 Likes
Reply
3,257 Views
10 Replies
Replies (10)

jeremytammik
Autodesk
Autodesk

Dear Nitin,

Stairs are not exposed in the Revit API prior to 2013.

Please look at

http://thebuildingcoder.typepad.com/blog/2012/03/revit-2013-and-its-api.html#4
http://thebuildingcoder.typepad.com/blog/2012/04/developer-center-and-sdk-update.html#23

Best regards,

Jeremy
--
Jeremy Tammik
Autodesk Developer Network -- http://www.autodesk.com/joinadn
The Building Coder -- http://thebuildingcoder.typepad.com



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

Anonymous
Not applicable

Dear Jeremytammik,

 

We have upgraded our revit API to 2013 from 2011 but still we unable to find the stair location.

 

Can you please help us regarding getting stairs information.

 

Thanks,

Nitin.

0 Likes

jeremytammik
Autodesk
Autodesk

Dear Nitin, the pre-2013 stairs continue to lack access to full location and geometry information. Only post-2013 stairs provide it. Sorry about that.



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes

Anonymous
Not applicable

Dear Jeremy Tammik,

 

I have few drawings created in revit 2011 and 2012 having stairs and i am trying to get their information using Revit API 2013.


 I able to get few information like "Name, TypeName, FamilyName, TopLevel, BaseLevel, ActualNumRiser, ActualRiserHeight ,TreadWidth, TreadDepth, TravelDistance" etc.


But actually, what i need is gemoatry information like location points.

 

Is there any method to get the location information and the rooms associated with stairs???

 

Thanks in advance.

 

Regards,

Nitin.

0 Likes

Revitalizer
Advisor
Advisor

Hi nitin.k,

 

you could calculate location points in by different ways.

 

First, you could get the BoundingBoxXYZ of your stair. Using this, you could calculate its lower-most center point as your desired location point.

 

Second, you could browse your stairs' geometry, also seaching for the bottom-most point. For this, you need to browse all its Solids and Faces.

 

Third, there is a Sketch assigned to non-FamilyInstance based stairs.

You can get it this way:

http://thebuildingcoder.typepad.com/blog/2011/11/undocumented-elementid-relationships.html

 

Having calculated a proper point, you could use Document.GetRoomAtPoint(XYZ) method to find a proper room, and you could compare the elevations of your Levels to find the one which fits your location point.

 

Hope this helps.

 

Cheers,

Revitalizer




Rudolf Honke
Software Developer
Mensch und Maschine





Anonymous
Not applicable

Hi Revitalizer,

 

Thanks for the information!

 

But by using BoundingBoxXYZ we can get only the Max and Min point of stairs Bounding Box. But, what i want is the location point of landing or floor at the top and bottom of each stairway.

 

From BoundingBoxXYZ how can we get these location points?

 

Also when i try to find the room name using document.GetRoomAtPoint() it returns Null value. What should be the reason regarding it?

 

Please help!

0 Likes

Revitalizer
Advisor
Advisor

Hi nitin.k,

 

GetRoomAtPoint needs a point that is inside the room's volume, and it may be useful to make sure that the point you test is not located directly at the volume border (because of tolerances; point may be calculated as *slightly* outside, falsely).

 

LocationPoint from BoundingBoxXYZ:

What I meant was that you could calculate the point that is in the lower center of the bounding box, meaning on the bottom.

Add one meter to its z value (this making sure to be inside the *3D body* of the room) to calculate a point that you can use to GetRoomAtPoint().

 

To calculate the landing and floor location points, you could analyze the stair's geometry, meaning that you need to interprete it.

 

 

Best regards,

Rudolf




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes

Anonymous
Not applicable

Is it possible to analyze the stair's geometry for the Revit file created prior to 2013?

 

And is it posible to find the stairs geomatry information if the stairs are created by Sketch and not by component?

 

Thanks and Regards,

Nitin.

0 Likes

Revitalizer
Advisor
Advisor

Hi nitin.k,

 

In the comments section of the TBC posting I mentioned above, I wrote:

 

"But even if we cannot *modify* a stair this way, we can get *more* information than we would get if we just read the stair's parameters or properties.

For example, using the longest CurveArray in the Sketch.Profile of a stair, we can combine it with the number of steps and in the result, we can get the 3D data of each step's front side.
The Curves in the profile won't give us the correct z data because the sketch is just a projection, but using the stair's height and number of steps, we can get the z distances for each step.
The steps' 3D LocationCurves."

 

So, of course you only can get "stupid" geometry, just lines, faces and solids.

If you combine it with the parameter values, you could *calculate* the information you want.

I must admit that there is no common approach for each type of stairs, but the point is how to obtain information *at all*.

 

Best Regards,

Revitalizer/Rudolf




Rudolf Honke
Software Developer
Mensch und Maschine





0 Likes

Anonymous
Not applicable

Hi,

 

I have converted my stairs from "Stair by sketch" to "stairs by component". Now i am able to find the stairs components.

I am able to find the stairs landing. But still location becomes null for stairs and also for landing.

 

I want the location point of the landing also the exact point from where the stairs started and ground level to the ends at the top level. Is it possible to find the exact position?

 

Thanks and Regards,

Nitin.

0 Likes