Revit API Forum
Welcome to Autodesk’s Revit API Forums. Share your knowledge, ask questions, and explore popular Revit API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

multistorey stair subements

25 REPLIES 25
Reply
Message 1 of 26
ParametricMonkey
1114 Views, 25 Replies

multistorey stair subements

Hi

 

Is there any way to get the subelements (stairs, stair runs, landings, etc) of a multistory stair? 'GetAllStairsIds' only seems to return one instance of the stair, not all the instances.

 

The only way I have managed to do this is to unpin the stair (as documented here: https://forum.dynamobim.com/t/multistory-stair-components/23767/29). But the problem with this method is that when the stair is re-pinned, any associated dimensions drop off.

 

How can I get all the subelements of a multistorey stair without unpinning each individual stair?

25 REPLIES 25
Message 2 of 26

Dear Paul,

 

Thank you for your query and for raising it here in the public forum after our private linkedin discussion.

 

I passed it on to the development team for you and will let you know as soon as I hear back from them.

 

Best regards,

 

Jeremy

 



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

Message 3 of 26

Hi Jeremy

 

Did you have any luck with this?

 

thanks

Message 4 of 26

Dear Paul,

 

Thank you for your update.

 

Sorry, no news yet from the development team.

 

I re-prompted them for a response.

 

Cheers,

 

Jeremy

 



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

Message 5 of 26

Dear Paul,

 

I heard back now from the development team.

 

They suggest more or less what I would have guessed from the API documentation I mentioned in my initial reply:

 

Please don't unpin the stair; that will make each subelement (stairs instance) become a stand-alone element (a single stair) which will change data.

 

Just get the stairs ids from the `GetAllStairsIds` method and then call `Element.GetSubelements` to get the stair subelements.

 

I hope this helps.

 

Cheers,

 

Jeremy

 



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

Message 6 of 26

Thanks Jeremy for your help! Good to know a method exists.

Any ideas how to do this via Python in Dynamo. I though this
would
work but I am getting an error message.
Message 7 of 26

@jeremytammik Can you please ask the Revit api team what can be done once I have the sub elements.

 

This post describes the issues I am having in greater detail:

 

https://forum.dynamobim.com/t/python-help-get-subelements/27909/18

 

But to summarise, I can get the db.subelements and also their uniqueId. But then what?  It isn’t really clear from the documentation how they can be used. I can’t use the Id to select an element and thus I can’t get the nested stair runs and landings which is my only objective. How can this be done. It doesn’t seem possible.

 

Thanks

Message 8 of 26

Dear Paul,

 

Thank you for your renewed prompt and the pointer to the DynamoBIM discussion thread.

 

Just as you say, ‘Then what’, indeed.

 

I took a look at the dynamo discussion thread and am sorry to say that that is all gobbledygook to me.

 

I therefore implemented a new test command in The Building Coder samples that executes the calls to GetAllStairsIds and GetSubelements.

 

Now I understand the problem you are facing.

 

My rather horrid multistory stair looks like this:

 multistorystair.png

 

 

 

The code looks like this:

  

  • Select element
  • Print out number of multistory stairs selected
  • For each multistory stair:
    • Call GetAllStairsIds
    • Print out number of stair instances
    • For each instance:
      • Call GetSubelements
      • Print out number of subelements

 

I added this code to The Building Coder samples in the new module CmdMultiStoryStairSubelements.cs, so you can refer to that for the exact implementation:

 

https://github.com/jeremytammik/the_building_coder_samples/blob/master/BuildingCoder/BuildingCoder/C...

 

The printout generated by this instance looks like this:

 

1 multi story stair selected:
Multi story stair 'MultistoryStairs Multistory Stairs <305957 Multistory Stairs>' has 1 stair instance:
Multi story stair instance 'Stairs Stairs <305678 Stair>' has 2 subelements:
Subelement a1358810-6f42-4442-aef0-4196d1c4e84f-0004aa0e=00000000 of type 204881
Subelement a1358810-6f42-4442-aef0-4196d1c4e84f-0004aa0e=00000001 of type 204881

 

By looking at this, we see that both of the two stair parts contained in the multistory stair are considered one single instance.

 

The two subelements are obviously the two stair parts.

 

The subelement unique id is valid, but differs from a normal document element unique id:

 

se.UniqueId = "a1358810-6f42-4442-aef0-4196d1c4e84f-0004aa0e=00000000"

 

No corresponding document element can be retrieved for that unique id, since no valid document element exists at that level.

 

To access the subelements that you are asking for, i.e., stair runs, landings, etc., we apparently need to access the sub-subelements.

 

Now that this is understood, I'll ask the development team again for further guidance.

 

Best regards,

 

Jeremy

 



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

Message 9 of 26

Dear Paul,

 

The sample code and prompt for further explanation produced a new answer from the development team that really explains:

 

The API does not provide access sub-subelements. This is to say - given an instance (subelement) of a stair, we cannot get the runs or landings in it for now.

 

Currently, for a single stair, we combine its landings and runs into one single model GRep. If it has multiple instances, we copy and translate the model GRep to other levels. Thus, an API user cannot get the subelements of runs and landings in stair instances.

 

However, an API user can get the data indirectly, as long as she can retrieve the landings and runs in the original stair. The geometry of landings/runs in the instance should be the same as the ones in original stair. All other properties can be calculated using the original stair information plus the subelement data.

 

I hope this clarifies.

 

Best regards,

 

Jeremy

 



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

Message 10 of 26

Hi Jeremy



Thanks for looking into that. It is starting to become clearer but I just
have a few more questions:



- Since the multistorey stair is combined into a single GRep, are you
suggesting that in order to get the individual components, I should first
get the topology of the landings and stair runs of the standard stair, and
then physically copy these up to their subelement positions? Is this
what you mean by indirect way? Subelement.GetGeometryObject() will only
return the stair geometry (landings and stair runs combined) correct?



- I see that there is a Number system method

to work for multistorey stairs. What about Tagging

stair runs of the subelements. This looks as though it works with
subelements but in the case of multistorey stairs the subelement is the
individual stairs, not the stair runs. How can I tag stair runs in a
multistorey stair.



Thanks



Paul
Message 11 of 26

Dear Paul,

 

Thank you for your update and new questions.

 

Regarding the geometrical representation, I cannot say off-hand.

 

I suggest you retrieve and analyse the geometry yourself and see what it contains and what information you can glean from that.

 

From the discussion so far, I am uncertain whether the geometry returned via the API represents one single instance, and you have to copy it to the other instances, or whether it includes all the instances, and you have to pick it apart again to get at the individual components.

 

I rather suspect the latter, and I am pretty sure nobody can say for sure without researching the matter.

 

Furthermore, even if someone would make a statement about that, I would not trust it unless they showed me how the information was obtained.

 

I do not understand your question about tagging, so I hope the answer above covers that as well.

 

Best regards,

 

Jeremy

 



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

Message 12 of 26

@jeremytammik

 

Thanks for your response. I've had some luck with this. Rather than get subelements, I did it as follows:

 

  1. Get multistory stair
  2. Get the standardStairsId (this is the main instance)
  3. Get all connected levels (to work out other instance locations)
  4. Get landings and stair runs of the standard stair and their topology
  5. Physically copy up the landings and stair runs geometry to its other instance locations (which is what I was hoping the subelements method would return but it didn't)
  6. Filter out desired faces to be dimensioned 
  7. Get topology of the standard stair (This is returned as one big, multistory stair)
  8. Match the faces to be dimensioned with faces from the standard stair
  9. Create dimensions referenced to the standard stair 

It's not very elegant but I'm guessing since the subelement method didn't work this is the only way forward.

 

The problem I am having how is how to tag the stair runs. It you tab select the main stair instance, you can drill down and get the stair run. This can then be tagged.

 

However, for all other instances within the mutistory stair, you don't seem to be able to tab select and get to the stair run. Given that this isn't possible manually within Revit, does this mean there is no API method for tagging stair runs within a multistory stair? This was the question I posed previously which you didn't understand. Hopefully the issue is a little clearer now.

 

It seems odd as there is a dedicated number system method for multistorey stairs which differs to just a normal stair, but I can't find one for stair run tags. Any thoughts?

 

stair error.JPG

 

This thread is a little old but raises similar issues.

 

 

Message 13 of 26

Dear Paul,

 

Thank you for your update and clarification.

 

I passed on your question to the development team.

 

Seeing as you say this cannot be achieved manually in the user interface, and other people have discussed similar needs, have you checked the Revit Idea Station for any existing wish list items related to this?

 

From what you say, there might be a need for both user interface and API enhancements in this area.

 

Please check, add if needed, vote and let us know.

 

Thank you!

 

Best regards,

 

Jeremy

 



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

Message 14 of 26

Hi Jeremy

 

Did the API team get back to you with a response? Just keen for confirmation if it is possible or not. 

 

I did find any similar issues on the Revit ideas site, including this one:

https://forums.autodesk.com/t5/revit-ideas/tagging-and-scheduling-stairs-in-a-multistory-stair/idi-p...

 

It seems multistory stair functionality is still very under developed. Any many requests are quite old - over 1 year.

 

Thanks

Message 15 of 26

Dear Paul,

 

Thank you for your update and pointer to the wish list item.

 

Based on that, it would appear that no solution is currently known for what you are after.

 

By the way, can you achieve what you want in the user interface?

 

Please be aware that the Revit API hardly ever supports any functionality that is not also available in the user interface.

 

Therefore, if the UI does not support this, the API will probably not do so either.

 

Still, I asked the development team again for a response.

 

Cheers,

 

Jeremy

 



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

Message 16 of 26

Dear Paul,

 

I continued discussing this with the development team, and they reply:

 

This should be possible, right?

 

Yes. You could pass the level of instance to `LinkElementId placementLevelId` to create the number system.

 

The API should be able to find the corresponding instance of the run `elementId` on the placement level and tag it.

 

I hope this helps.

 

I would love to see a running sample of this to share, once you have it sorted out.

 

Thank you!

 

Cheers,

 

Jeremy

 



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

Message 17 of 26

Dear Paul,

 

Here is a sample code snippet:

 

  ICollection<ElementId> runIds = stairs.GetStairsRuns();
  foreach (ElementId runId in runIds)
  {
    StairsNumberSystemReferenceOption option
      = StairsNumberSystemReferenceOption.LeftQuarter;
      
    LinkElementId hostId = new LinkElementId(runId);
    LinkElementId linkedLevelId = new LinkElementId(level.Id);
    
    NumberSystem.Create(RevitDoc,
      level.FindAssociatedPlanViewId(), hostId, option,
      linkedLevelId);
  }

 

I hope this helps.

 

Cheers,

 

Jeremy

 



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

Message 18 of 26

Hi Jeremy

 

Thanks for your reply but now I am even more confused. I think we are talking about two different issues:

 

  • Number system - This CAN be done via Create Method (Document, ElementId, LinkElementId, StairsNumberSystemReferenceOption, LinkElementId). Which I think is what your snippet shows?

http://www.revitapidocs.com/2018.1/9af6bd67-3f52-4b58-1807-c87d8805a7bf.htm

 

  • Stair run tags - This is my main issue. I thought it wasn't possible because it can't be done via the UI but the Revit API team are saying that it can be done? Are they saying get the elementID of the instances and its corresponding placement level and then use the Create method?

http://www.revitapidocs.com/2018.1/1f622654-786a-b8fd-1f81-278698bacd5b.htm

Message 19 of 26

Dear Paul,

 

Please bear in mind that the people I am talking with are developers with a bunch of other stuff to do.

 

When I pass them a question, they read that one single question, nothing else. No history, no memory, no context.

 

Therefore, you should not be surprised or confused if they answer something different than what you think.

 

They will only answer what they think your question is.

 

Sorry about that.

 

So, it helps to make each question completely minimal and self-contained.

 

Shall we start from scratch on that premise?

 

Would you like to formulate one single minimal and self-contained question for me to pass on to them?

 

Thank you!

 

Cheers,

 

Jeremy

 



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

Message 20 of 26

Dear Paul,

 

The development team came back with another answer that maybe helps more than the previous one, and better addresses your need.

 

They say: Here is the Revit 2018 model with a macro that shows how to add tread numbers for all the runs in the section view.

 

  • TestNumberSystemInMultistoryStairs_macro.rvt

 

Can you please check it and let us know whether this helps?

 

Thank you!

 

Cheers,

 

Jeremy

 



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

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Rail Community