Node to create stair

Hello!

I’m using Revit 2018.2 and dynamo V1.3.2.2480.
I’m trying to create stairs going from a bottom line that would be on a given slab to another higher level with the stair family system of Revit but I can’t find a node that would help me.
I’ve been searching for a solution but there are hardly no propositions on the net.
If you know any nodes or other solutions that would get around my problem, could you please tell me.
I’m a beginner in coding with Python but if it is a solution I’m ready to try ;).

Related topic without a final solution: Nodes to create stair

Find some info :point_down:
Seems you need to create stair components separately.

1 Like

Oh ok, thank you for this interesting link. I will see what I can manage to do with there exemple.

Hi All,
I am using the same references as @Thom - see below for what examples I’m trying to pull from. I have gotten passed most visible errors - but the stairs do not stay / commit. This seemed to be other users problems but my commit lines don’t seem to be working.

Thanks in advance to anyone with advice.

current code:

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
clr.AddReference('RevitNodes')
import Revit

clr.AddReference('RevitAPIUI')

from Autodesk.Revit.UI import TaskDialog
clr.AddReference('RevitAPI')
import Autodesk

from Autodesk.Revit.DB import IFailuresPreprocessor
from Autodesk.Revit.DB import StairsEditScope
from Autodesk.Revit.DB import *
from Autodesk.Revit.DB import Parameter
from Autodesk.Revit.DB.Architecture import StairsRun
from Autodesk.Revit.DB.Architecture import *

class StairsFailurePreprocessor( IFailuresPreprocessor ):
	def PreprocessFailures(failuresAccessor):
		return FailureProcessingResult.Continue

baseLevel = UnwrapElement(IN[0])
nextLevel = UnwrapElement(IN[5])

doc = DocumentManager.Instance.CurrentDBDocument
a = StairsFailurePreprocessor()

trans = Autodesk.Revit.DB.Transaction(doc, 'Stair Transaction')
newStairsScope = StairsEditScope(doc, "New Stairs")
newStairsId = newStairsScope.Start( baseLevel.Id, nextLevel.Id)
trans.Start()


#TransactionManager.Instance.EnsureInTransaction(doc)


stairArray = CurveArray()
pt5 = XYZ(0,0,0)
pt6 = XYZ(15,0,0)
pt7 = XYZ(0,10,0)
pt8 = XYZ(15,10,0)


bdryCurves = list()
riserCurves = list()
pathCurves = list()

bdryCurves.append(Line.CreateBound(pt5, pt6))
bdryCurves.append(Line.CreateBound(pt7, pt8))

#riser curves
riserNum = 17
for ii in range(0, 18):

	end0 = (pt5 + pt6) * ii / float(riserNum)
	end1 = (pt7 + pt8) * ii / float(riserNum)
	end2 = XYZ(end1.X, 10, 0)
	riserCurves.append(Line.CreateBound(end0,end2))

pathEnd0 = (pt5 + pt7) / 2.0
pathEnd1 = (pt6 + pt8) / 2.0
pathCurves.append(Line.CreateBound(pathEnd0, pathEnd1))

newRun1 = StairsRun.CreateSketchedRun(doc, newStairsId , baseLevel.Elevation , bdryCurves, riserCurves, pathCurves )


#TransactionManager.Instance.TransactionTaskDone()

trans.Commit()
#trans.Dispose()


newStairsScope.Commit(a)
#newStairsScope.Commit(new StairsFailurePreprocessor() )
#newStairsScope.Dispose()

OUT = newStairsId

-M

references:

Creating and Editing Stairs

1 Like