Multistory stair components

#4

Try Flatten({list}) in a code block to make it a list.

#5

Hi @Paul_Wintour @Ewan_Opie

How about handling any list structure :sunglasses:

4 Likes
#6

As usual, Nicely done @Kulkul can you share the code? :pray:

#7

Ewan I got your script to work with the Flatten node. But it gives me the same result as my first Python script. This screenshot shows the issue. It is one multistory stair but it only returns two stairs. I’m guessing because L1-L2 is the same as L2-L3 is has been grouped some how. What I am after is the 3 individual stairs returned (from a selected mutistory stair). Thats why I wondering if I needed to use the MultistoryStairsId command as well/ instead.

So I’ve done some more tests and I think I’ve identified the problem but still not sure the solution. If you use all elements of category, it still only returns two stairs. But if you unpin the stairs within the multistory stair, you get three stairs. So is there a way to return all three stairs using Dynamo without unpinning?

Any thoughts?

@Kulkul

#8

@Paul_Wintour Try this For PaulWintor(Mulitple Story).dyn (3.6 KB)

@Ewan_Opie Code is up there :point_up_2:

2 Likes
#9

Sorry @Kulkul

You replied before I had a chance to edit my post.

I just tried you script and it has the same problems. There has been a similar issue but ideally I don’t want to unpin.

#10

@Paul_Wintour I was faster than you :smile:

Let me see if i can sort this out. Cheers!

1 Like
#11

@Paul_Wintour Could you please drop here rvt with some multi story stairs and dyn file?

#12

@Kulkul Revit 2018 file attached. I’m just using your Dynamo script with Dynamo 1.3.

Stair.rvt (1.5 MB)

#13

@Kulkul did you have any luck with this? I’m wondering if I need to use the GetSubelements Method

This page mentions about multi-story stairs:

This element will contain one or more Stairs elements. These can be obtained via GetAllStairsIds and GetStairsOnLevel(ElementId). Stairs elements are either a reference instance which is copied to each level covered by groups of identical stairs instances which share the same level height, or individual Stairs instances which are not connected to a group with the same level height. By default, when adding new levels to the multistory stair, new stairs will be added to the group (shown in the Revit user interface with a ‘Pin’ icon).

For groups of duplicate stairs at different levels, the instances can be found as Subelements of the Stairs element (see GetSubelements .

#14

While @Kulkul is working on a python solution, here is an alternative that may work.
Code from @Einar_Raknes here:



EDIT: Scratch that, still the same issue… @Vikram_Subbaiah seems to have a good one though :grinning:

1 Like
#15

Altering the elevation of any of the associated levels seems to expose multistory stair components.

The code below tries to do so, but it only seems to work on forcing Dynamo to re-execute by changing a value or variable (as demonstrated in the gif below)
multisoryStairs
The base Revit file is the same as the one provided above by @Paul_Wintour (Stair.rvt) and Dynamo is in Automatic Run mode

l = ElementQueries.OfCategory(Category.ByName("Levels"))[1];
a = l.GetParameterValueByName("Elevation");
b = l.SetParameterByName("Elevation",a+0.000);
c = ElementQueries.OfCategory(Category.ByName("Stairs"));
#16

A slight alteration to the above code helps avoid any manual intervention.

Before executing the code…
stairs-1

On executing the code …
stairs-2

l = ElementQueries.OfCategory(Category.ByName("Levels"))[1];
a = l.GetParameterValueByName("Elevation");
b = Transaction.End(l.SetParameterByName("Elevation",a+0.005));
c = l.SetParameterByName("Elevation",Math.Round(a));
d = ElementQueries.OfCategory(Category.ByName("Stairs"));
#17

Thanks @Vikram_Subbaiah but I’m not sure modifying levels is ideal. It opens up a whole can of worms. I was hoping to be able to use the GetSubelements method. It sounds like it should be possible. I got this far. There are no error warnings but its not returning any results.

Any suggestions? @Kulkul @awilliams @Vikram_Subbaiah

import clr

clr.AddReference(“RevitServices”)
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

clr.AddReference(“RevitNodes”)
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

clr.AddReference(“RevitAPI”)
from Autodesk.Revit.DB import *

out =
elements = UnwrapElement(IN[0])

for item in elements:
stairs = item.GetSubelements()
out.append(stairs)

OUT = out

Get subelements_2.dyn (4.5 KB)

#18

@Paul_Wintour Think I have cracked it with the GetStairOnLevel method (no unpin) :sunglasses:
Find Multistory Stair Members.dyn (6.8 KB)
ezgif-4-0130bd7219

#19

@Ewan_Opie I can’t enlarge your image but when I run the script it returns the same stair element just repeated. It is only when you unpin one of the stairs, doesn’t the element change to the instance. So I think GetSubelements is still needed

#20

Weird, now that I reopen the example Revit file it does exactly as you describe.
Here is an enlargement of the GIF from above (3 Element IDs)… Im baffled.

#21

Where the stairs unpinned when you ran it the first time?

#22

Of that I cannot be sure, I was messing about with all kinds of workflows… sorry, another dead end :frowning_face: at least we are running out of those. Hopefully @Kulkul can solve this.

#23

Not familiar with Python or the API.
Managed to get the sub-elements, but couldn’t go further :expressionless:

import clr

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

clr.AddReference('RevitAPI')
from Autodesk.Revit.DB import *

str1 = []
mstr = UnwrapElement(IN[0])
stid = mstr.GetAllStairsIds()
for i in stid:
		str1.append(doc.GetElement(i))
str2 = str1[1].GetSubelements()

OUT = str2;

Certainly not ideal, but below is an improved version of the same work around.
stairs.dyn (17.5 KB) (ver 2)

l = List.RestOfItems(ElementQueries.OfCategory(Category.ByName("Levels")));
a = l.GetParameterValueByName("Elevation");
b = Transaction.End(l.SetParameterByName("Elevation",a+(0.001..#List.Count(l)..0.0001)));
c = l.SetParameterByName("Elevation",Math.Round(a,2));
d = ElementQueries.OfCategory(Category.ByName("Stairs"));
2 Likes