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?
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
Dear Paul,
Thank you for your update.
Sorry, no news yet from the development team.
I re-prompted them for a response.
Cheers,
Jeremy
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
@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
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:
The code looks like this:
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:
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
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
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
Thanks for your response. I've had some luck with this. Rather than get subelements, I did it as follows:
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?
This thread is a little old but raises similar issues.
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
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:
It seems multistory stair functionality is still very under developed. Any many requests are quite old - over 1 year.
Thanks
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
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
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
Hi Jeremy
Thanks for your reply but now I am even more confused. I think we are talking about two different issues:
http://www.revitapidocs.com/2018.1/9af6bd67-3f52-4b58-1807-c87d8805a7bf.htm
http://www.revitapidocs.com/2018.1/1f622654-786a-b8fd-1f81-278698bacd5b.htm
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
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.
Can you please check it and let us know whether this helps?
Thank you!
Cheers,
Jeremy