Multistory stair components


#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"));

#24

@Vikram_Subbaiah hmm interesting. Not sure what to do with an autodesk.revit.db.subelement. I wonder if we need to use the GetReference method? Not sure what that does though.

Or get the ID of the subelement then select element based on the ID (from Archi-lab)?

Btw, this class looks like it is a new feature in the API.


#25

Can get the UniqueId of the sub-elements. But unable to get elements from them.
GetElement returns nulls


#26

Looks like you need to remove the numbers after the = symbol before using the ElementSelector in Designscript.
Can you confirm? @Vikram_Subbaiah


#28

This should work…


MultiStoryStairs1.dyn (6.2 KB) (ver 2)

The Python code is certainly crude, kindly review and refine

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 *

mstr1 = UnwrapElement(IN[0])

def strs(mstr):
	lvl1 = []
	levl = mstr.GetAllConnectedLevels()
	for i in levl:
		lvl1.append(i)
	del lvl1[-1]
	str1 = []
	for l in lvl1:
		TransactionManager.Instance.EnsureInTransaction(doc)
		str1.append(mstr.Unpin(l));
		TransactionManager.Instance.TransactionTaskDone()
	return str1

OUT = map(strs, mstr1);

#29

Ha, I had been looking for the Pinned property under the Stairs Class and completely missed that they were methods for MultistoryStairs Class :woman_facepalming:

Bit of an odd one here, but it appears if you Unpin > Pin > Unpin using the API, you’ll lose the railings on the in between levels. I’m guessing its because the Railing’s host ID is essentially deleted and recreated when the stairs are repinned. Just something to be aware of.


#30

That’s great @Vikram_Subbaiah. And I guess the stair instances can be repinned at a later date to return them back to the original state.


#31

Hi @awilliams. Do you mind sharing the code you used to re-pin the stairs.

What I am trying to do is: Unpin the stairs first, add a bunch of dimensions (of which I need faces to landings, runs etc), and then want to re-pin the stairs but I will have a mixed list of normal stairs and multistory stairs which have been unpinned. Its just the re-pinning I need help with. I assume there is some way to filter out stairs to get just the ones to be re-pinned back into a multistory stair?

Thanks


#32

Actually I just manually re-pinned a stair and all the dimensions dropped off. Is there any way to get the sub elements (stair runs and landings) without unpinning the multistory stair stairs?


#33

@Vikram_Subbaiah

I’m revisiting this (!) and I when I copy your code exactly I get an error message:

Warning: IronPythonEvaluator.EvaluateIronPythonScript operation failed. Traceback (most recent call last): File “”, line 22, in IndexError: index out of range: 1

Line 22 is as shown below. Does this have something to do with the indenting? I have a single multistorey element (the same as you) as the input.

Thanks again for your help


#34

@Paul_Wintour Actually my earlier response itself was a stretch on my non existent Python knowledge :stuck_out_tongue:
Apologies for the delayed response. Hope you found a solution.