In Revit 2018 API there is a new kind of pin for multi story stair. Unfortunately pinning prevents modify the stair parameters with dynamo.
The standard Element.SetPinnedStatus node seems like does nothing in this case.
Can anyone support me with a python script or node that unpins the elements of a multi story stair?
import clr
#Import the Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
#Import DocumentManager and TransactionManager
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
#Reference the active Document and application
doc = DocumentManager.Instance.CurrentDBDocument
#Start scripting here:
element = UnwrapElement(IN[0])
lvl = UnwrapElement(IN[1]).Id
#Transaction start:
TransactionManager.Instance.EnsureInTransaction(doc)
unPinned = element.Unpin(lvl)
#Transaction end:
TransactionManager.Instance.TransactionTaskDone()
#Assign your output to the OUT variable.
OUT = unPinned
#Import the Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
#Import DocumentManager and TransactionManager
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
#Reference the active Document and application
doc = DocumentManager.Instance.CurrentDBDocument
def unpinAll(lvl):
return element.Unpin(lvl)
#Start scripting here:
element = UnwrapElement(IN[0])
lvl = [i.Id for i in UnwrapElement(IN[1])]
#Transaction start:
TransactionManager.Instance.EnsureInTransaction(doc)
unPinned = []
for i in lvl:
unPinned.append(unpinAll(i))
#Transaction end:
TransactionManager.Instance.TransactionTaskDone()
#Assign your output to the OUT variable.
OUT = unPinned
@daninet
It is always possible to try something, to gather and share some useful information and to analyse and discuss the solution that has been given in order to understand it, so that your next request can be more elaborated than the previous one
In general the problem with the API’s unpin is that it require the multi story stair to be selected and input the levels also. We have around 100 staircase in 12 levels (big project). There are multi story and not multi story stairs, levels are kind of “random”. Some stair is going from lvl 02-08 others are from 00 to 10.
The problem here is multi layered:
-I found it hard to separate multi story and not MS stairs as no parameter refers to their state. The upper level stairs of the MS stairs are simply ignored by dynamo and the first bottom instance is selected.
-I have to input the correct levels I want to unpin. This is pretty much different for every MS staircase.
The whole gymnastics I’m trying to get done is to get the messed up thread numbering sorted on all staircase all across the model. The starting number parameter is locked until the stair is pinned.
Ideally I would need a node that unpins all MS stair in the model.
You can use the Element Types node to get all in the project, or you can use the python part.
I don’t know why you can’t use the Category node though, since there actually is a category called OST_MultistoryStairs :-).
The rest of what you are describing is a bit more complicated I guess, and I don’t have time to investigate this now, but perhaps you can get a step farther yourself now?