# Node to create stair

**URL:** https://forum.dynamobim.com/t/node-to-create-stair/25747
**Category:** Geometry
**Tags:** revit, python, geometry, dynamo
**Created:** [September 10, 2018, 4:44pm UTC](https://forum.dynamobim.com/t/node-to-create-stair/25747 "2018-09-10T16:44:06Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Thom](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/thom/32/55621_2.png) [@Thom](https://forum.dynamobim.com/u/Thom)
#### Post date: [September 10, 2018, 4:44pm UTC](https://forum.dynamobim.com/t/node-to-create-stair/25747/1 "2018-09-10T16:44:06Z")

</div>

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](https://forum.dynamobim.com/t/nodes-to-create-stair/17041)

---

<div class="post-metadata">

### Author: ![jshial](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jshial/32/91559_2.png) [@jshial](https://forum.dynamobim.com/u/jshial)
#### Post date: [September 11, 2018, 9:08am UTC](https://forum.dynamobim.com/t/node-to-create-stair/25747/2 "2018-09-11T09:08:10Z")

</div>

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

> **[Creating and Editing Stairs | Search | Autodesk Knowledge Network](https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2015/ENU/Revit-API/files/GUID-C60041FB-069E-4C89-BE67-A0593E790995-htm.html)**
>
> Creating and Editing Stairs StairsEditScope As with other types of elements in the Revit document, a Transaction is necessary to edit stairs and stairs components. However, to create new components such as runs and landings, or to create new stairs...

---

<div class="post-metadata">

### Author: ![Thom](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/thom/32/55621_2.png) [@Thom](https://forum.dynamobim.com/u/Thom)
#### Post date: [September 11, 2018, 9:22am UTC](https://forum.dynamobim.com/t/node-to-create-stair/25747/3 "2018-09-11T09:22:51Z")

</div>

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

---

<div class="post-metadata">

### Author: ![MikeD](https://avatars.discourse-cdn.com/v4/letter/m/ed655f/32.png) [@MikeD](https://forum.dynamobim.com/u/MikeD)
#### Post date: [March 2, 2019, 8:52pm UTC](https://forum.dynamobim.com/t/node-to-create-stair/25747/4 "2019-03-02T20:52:54Z")

</div>

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](https://knowledge.autodesk.com/search-result/caas/CloudHelp/cloudhelp/2015/ENU/Revit-API/files/GUID-C60041FB-069E-4C89-BE67-A0593E790995-htm.html)

> [@Python and Stairs](https://forum.dynamobim.com/t/python-and-stairs/2136/3):
>
> I tried this code: newStairsScope = StairsEditScope(doc, “New Stairs”) newStairsId = newStairsScope.Start( getLevelId(int(levelBot)), getLevelId(int(levelTop)) ) TransactionManager.Instance.EnsureInTransaction(doc) bdryCurves = list() riserCurves = list() pathCurves = list() pnt1 = XYZ(0,0,0) pnt2 = XYZ(15,0,0) pnt3 = XYZ(0,10,0) pnt4 = XYZ(15,10,0) #boundary bdryCurves.append(Line.CreateBound(pnt1, pnt2)) bdryCurves.append(Line.CreateBound(pnt3, pnt4)) #riser curves riserNum = 20 …

> [@Create stairs with python script,use revitapi,proplem of newStairsScope.IsPermitted and warnings](https://forum.dynamobim.com/t/create-stairs-with-python-script-use-revitapi-proplem-of-newstairsscope-ispermitted-and-warnings/29726):
>
> I use the follow code to create stairs in revit by dynamo.It seems work but not work well.I have met two problem. 1、It’s very strange that newStairsScope.IsPermitted 's value is false,I just open a new file and run my script,I think it don’t have the condition like“StairsEditScope is not permitted to start at this moment for one of the following reasons: The document is in read-only state, or the document is currently modifiable, or there already is a stairs edit mode active in the document. ” …

> [@Create Spiral stairs using Revit API/Python](https://forum.dynamobim.com/t/create-spiral-stairs-using-revit-api-python/29559):
>
> Dear All, I have been trying to create a spiral Stair using the code below. I am feeding in the data as coordinates by using a json file. Even though the drawing created from the data looks correct I am still getting an error message: Cannot finish run sketch. Run sketch cannot have a riser segment intersecting the boundary at more than 2 points. Any ideas what is going wrong?
