Revit API

Reply
Contributor
nitin.k
Posts: 25
Registered: ‎04-18-2012
Message 1 of 11 (674 Views)

How to get information about the stairs using Revit API?

674 Views, 10 Replies
04-18-2012 10:21 PM

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,

ADN Support Specialist
jeremytammik
Posts: 407
Registered: ‎08-20-2007
Message 2 of 11 (606 Views)

Re: How to get information about the stairs using Revit API?

05-08-2012 02:18 AM in reply to: nitin.k

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

Contributor
nitin.k
Posts: 25
Registered: ‎04-18-2012
Message 3 of 11 (537 Views)

Re: How to get information about the stairs using Revit API?

06-22-2012 03:41 AM in reply to: jeremytammik

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.

ADN Support Specialist
jeremytammik
Posts: 407
Registered: ‎08-20-2007
Message 4 of 11 (470 Views)

Re: How to get information about the stairs using Revit API?

08-23-2012 03:21 AM in reply to: nitin.k

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

Contributor
nitin.k
Posts: 25
Registered: ‎04-18-2012
Message 5 of 11 (406 Views)

Re: How to get information about the stairs using Revit API?

10-21-2012 09:58 PM in reply to: jeremytammik

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.

Valued Contributor
Revitalizer
Posts: 78
Registered: ‎09-07-2012
Message 6 of 11 (401 Views)

Re: How to get information about the stairs using Revit API?

10-22-2012 12:07 AM in reply to: nitin.k

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

Contributor
nitin.k
Posts: 25
Registered: ‎04-18-2012
Message 7 of 11 (385 Views)

Re: How to get information about the stairs using Revit API?

10-25-2012 04:16 AM in reply to: Revitalizer

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!

Valued Contributor
Revitalizer
Posts: 78
Registered: ‎09-07-2012
Message 8 of 11 (374 Views)

Re: How to get information about the stairs using Revit API?

10-25-2012 04:41 AM in reply to: nitin.k

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

Contributor
nitin.k
Posts: 25
Registered: ‎04-18-2012
Message 9 of 11 (369 Views)

Re: How to get information about the stairs using Revit API?

10-25-2012 05:55 AM in reply to: Revitalizer

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.

Valued Contributor
Revitalizer
Posts: 78
Registered: ‎09-07-2012
Message 10 of 11 (363 Views)

Re: How to get information about the stairs using Revit API?

10-25-2012 06:03 AM in reply to: nitin.k

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

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community


Revit Exchange Apps

Created by the community for the community, Autodesk Exchange Apps for Revit helps you achieve greater speed, accuracy, and automation from concept to manufacturing.

Connect with Revit

Twitter

Facebook

Blogs

Youtube