# Creating a sloped Floor

**URL:** <https://forum.dynamobim.com/t/creating-a-sloped-floor/34168>\
**Category:** Revit\
**Created:** [March 29, 2019, 8:51pm UTC](https://forum.dynamobim.com/t/creating-a-sloped-floor/34168 "2019-03-29T20:51:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![pdrew](https://avatars.discourse-cdn.com/v4/letter/p/58956e/32.png) [@pdrew](https://forum.dynamobim.com/u/pdrew)\
**Post date:** [March 29, 2019, 8:51pm UTC](https://forum.dynamobim.com/t/creating-a-sloped-floor/34168/1 "2019-03-29T20:51:56Z")

</div>

I’m attempting to create a sloped floor in Revit using Dynamo.

It’s easy to create a flat floor using Rectangle.By.WidthLength and Floor.ByOutlineTypeAndLevel. Once this rectangle is at an angle Dynamo throws errors and refuses to draw the same thing at an angle. Seems like there should be no difference. I’ve tried projecting onto a plane and pulling to a surface (pictured below).  
Any help?

(First post, no idea the best way to show a reproduce-able code block)  
Flat Floor

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/a/5/a5ae51d21a3fb2e5b898c54b474b853c2f72c859.png)

Attempt at angled floor  
Error: Input normal vector is not perpendicular with the face constructed from input curves

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/5/9/59c95b9473d0ffc4e27fda887c14a525c2a68a52.png)

---

<div class="post-metadata">

**Author:** ![jacob.small](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/jacob.small/32/161030_2.png) [@jacob.small](https://forum.dynamobim.com/u/jacob.small)\
**Post date:** [March 31, 2019, 10:21am UTC](https://forum.dynamobim.com/t/creating-a-sloped-floor/34168/2 "2019-03-31T10:21:45Z")

</div>

Floors have to be level on creation, and then have the shapes edited.

---

<div class="post-metadata">

**Author:** ![Kulkul](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/kulkul/32/49801_2.png) [@Kulkul](https://forum.dynamobim.com/u/Kulkul)\
**Post date:** [March 31, 2019, 6:03pm UTC](https://forum.dynamobim.com/t/creating-a-sloped-floor/34168/3 "2019-03-31T18:03:37Z")

</div>

Hi @pdrew

Floors are sketch-based, and the sketch must be planar, perpendicular to the Z-Axis (on a level). So, to create it from Dynamo, you’ll have to build the curves onto a planeXY. However you can create sloped after placing them on a plane like this:

 ![RoofExtrusion](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/0/c0f6e4978a6d9fa2195074b2bcec2afb393abceb.gif)

Cheers!

---

<div class="post-metadata">

**Author:** ![Konrad\_K\_Sobon](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/konrad_k_sobon/32/8838_2.png) [@Konrad\_K\_Sobon](https://forum.dynamobim.com/u/Konrad_K_Sobon)\
**Post date:** [March 31, 2019, 10:45pm UTC](https://forum.dynamobim.com/t/creating-a-sloped-floor/34168/4 "2019-03-31T22:45:41Z")

</div>

@Kulkul great answer.

There is also another way, using Slope Arrow instead of editing the points in the slab. It uses this API method: [https://apidocs.co/apps/revit/2017/983a7045-e2c0-db60-61b7-9e37749f1c6a.htm](https://apidocs.co/apps/revit/2017/983a7045-e2c0-db60-61b7-9e37749f1c6a.htm)

Here’s an example:

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/4/5/45705a056ebf123f3a8a7c029d260a80ed5c38d8.png)

It was created with this Dynamo script:

 ![Capture](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/c/d/cdecd3a18391789d19a3424bf68a1fcacbf21d6f.png)

The code for the Python node is the following:

```auto
# Copyright(c) 2019, Konrad K Sobon
# @arch_laboratory, http://archi-lab.net

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

# Import Element wrapper extension methods
clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.Elements)

# Import geometry conversion extension methods
clr.ImportExtensions(Revit.GeometryConversion)

# Import DocumentManager and TransactionManager
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument

# Import RevitAPI
clr.AddReference("RevitAPI")
import Autodesk
from Autodesk.Revit.DB import *

import System
from System import Array
from System.Collections.Generic import *

import sys
pyt_path = r'C:\Program Files (x86)\IronPython 2.7\Lib'
sys.path.append(pyt_path)

#The inputs to this node will be stored as a list in the IN variable.
dataEnteringNode = IN

def ProcessList(_func, _list):
    return map( lambda x: ProcessList(_func, x) if type(x)==list else _func(x), _list )

def ProfileToCrvArray(profile):
	crvArr = CurveArray()
	for crv in profile.Curves():
		startPt = crv.PointAtParameter(0).ToXyz()
		endPt = crv.PointAtParameter(1).ToXyz()
		rvtLine = Line.CreateBound(startPt, endPt)
		crvArr.Append(rvtLine)
	return crvArr

def LineToRvtLine(crv):
	startPt = crv.PointAtParameter(0).ToXyz()
	endPt = crv.PointAtParameter(1).ToXyz()
	rvtLine = Line.CreateBound(startPt, endPt)
	return rvtLine
	
def CreateRamp(profile, level, slopedArrow, slope, isStr):
	crvArray = ProfileToCrvArray(profile)
	slopeLine = LineToRvtLine(slopedArrow)
	newFloor = doc.Create.NewSlab(crvArray, level, slopeLine, slope, isStr)	
	return newFloor

profiles = IN[0]
level = UnwrapElement(IN[1])
slopeLines = IN[2]
slopes = IN[3]
isStructural = IN[4]
floorType = UnwrapElement(IN[5])
RunIt = IN[6]

if RunIt:
	try:
		errorReport = None
		TransactionManager.Instance.EnsureInTransaction(doc)
		
		output = []
		for i, j, k in zip(profiles, slopeLines, slopes):
			newFloor = CreateRamp(i, level, j, k, isStructural)
			if newFloor != None:
				newFloor.FloorType = floorType
			output.append(newFloor)

		TransactionManager.Instance.TransactionTaskDone()
	except:
		import traceback
		errorReport = traceback.format_exc()
else:
	errorReport = "Please set RunIt to True."

if errorReport == None:
	OUT = output
else:
	OUT = errorReport

```

---

<div class="post-metadata">

**Author:** ![Yousra](https://avatars.discourse-cdn.com/v4/letter/y/a87d85/32.png) [@Yousra](https://forum.dynamobim.com/u/Yousra)\
**Post date:** [April 11, 2019, 4:11pm UTC](https://forum.dynamobim.com/t/creating-a-sloped-floor/34168/5 "2019-04-11T16:11:44Z")

</div>

I’ve tried your dynamo script for creating a sloped floor but for some reason It doesn’t work for me.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/d/8/d82733d8b5f7ba0681ca238bd9403f2d4f24661a.png)

---

<div class="post-metadata">

**Author:** ![Kulkul](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/kulkul/32/49801_2.png) [@Kulkul](https://forum.dynamobim.com/u/Kulkul)\
**Post date:** [April 11, 2019, 4:58pm UTC](https://forum.dynamobim.com/t/creating-a-sloped-floor/34168/6 "2019-04-11T16:58:18Z")

</div>

Hi @Yousra

Could you please start new topic showing full graph with all previews visible. This topic has already solution.

---

<div class="post-metadata">

**Author:** ![Kulkul](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/kulkul/32/49801_2.png) [@Kulkul](https://forum.dynamobim.com/u/Kulkul)\
**Post date:** [April 11, 2019, 4:58pm UTC](https://forum.dynamobim.com/t/creating-a-sloped-floor/34168/7 "2019-04-11T16:58:24Z")

</div>

Closed on April 11, 2019, 4:58pm UTC


