How to assign slope to created floor

Hi all,

I have created floor by outlines but wanted to give some slope (1:50 or 0.02 both are same). But when I try to give slope by setting element parameters such as slope, it is giving me an error like slope is read only parameters.

Please let me know how to give slope to the created floor through dynamo. If it required python to read read only parameters then please let me know.

Dont think its possible,you could try make slope with your floor sketchline but not sure it will gonna work… but you can add floor points and move floorpoints

1 Like

@shashank.baganeACM I suggest you check the following:


to get a sloped floor:

But I guess @sovitek approach by adding points will work better for a non-uniform floor as same as the one you are showing.


Hi @tradelie

I am trying using python but I am not getting where went wrong. Can you please suggest me on this ?

Floor by boundary lines.dyn (34.5 KB)

trail project.rvt (1.6 MB)

Take a look at your warning…it expect curves !

@sovitek Even after feeding the curves to input node it gives me an error as below.

something here works for me…


PS…dont understand why you build your floor by modelscurve and then generate a floor, instead of just build the floor…just a thought :wink:

Thank you so much @sovitek I got it but only one change is that I wanted to have slope like shown in below image

Now I am getting slope like this

How to change the direction of sloping ? Please let me know

1 Like

@shashank.baganeACM the line variable is getting the slope direction from the curve array, check which curve is parallel to the desired direction you want your slope and specify the right index: line = ca[1 or 2 or 3 or…]


Yes got it @tradelie Thank you very much


try as Elie say…or try shift indicies…

1 Like

Got it @sovitek Thank you so much

1 Like

you are welcome :wink:

1 Like

Hi @sovitek If I want to have flexibility to select the line along which the slope is needed, like as shown

Either I want slope along the slope arrow direction then how to do that ? I am trying but added one input to take the reference of marked sloped arrow line and I am not getting how to assign slope along the line which we want.

The python script that I am trying to develop is

1 Like

hello @shashank.baganeACM …i dont want edit the code…i would try with some intersecting and start the curve array from there…im not in revit at the moment i take a look later :wink: happy new year

1 Like

Okay @sovitek Please let me know once you get the solution

Rather than picking an edge via list manipulation, it might be better to ask the user to specify a vector, as otherwise the floor could slope backwards (up instead of down), though along the right path.

This does require manipulating the code to some extent, but it’s not to the point where you can’t recognize the initial concept.

import clr #imports the common language runtime to the Iron Python environment
clr.AddReference('RevitAPI') #adds the Revit API library to the CLR
from Autodesk.Revit.DB import Floor, CurveArray #imports the Floor and Curve array modules to the Iron Python environment
clr.AddReference('RevitNodes') #adds the DynamoForRevit library to the CLR
import Revit #imports the Dynamo for Revit module to the Iron Python environment
clr.ImportExtensions(Revit.GeometryConversion) #imports the geometry conversion module to the Iron Python environment
clr.AddReference('RevitServices') #adds the Revit services module to the CLR
import RevitServices #imports the Revit services module to the Iron Python environment
from RevitServices.Persistence import DocumentManager #imports the Revit DocumentManager to the Iron Python Environment
from RevitServices.Transactions import TransactionManager #imports the Revit TransactionManager to the Iron Python environment

clr.AddReference('ProtoGeometry') #addds the geometry library to the CLR
from Autodesk.DesignScript.Geometry import * #imports the dynamo geometry library to the Iron Python environment

doc = DocumentManager.Instance.CurrentDBDocument #sets the doc variable to the current document
outlineLoop = IN[0] #sets the outlineLoop variable to the contents of IN[0] from the Dynamo environment
level = UnwrapElement(IN[1]) #unwraps the contents of IN[1] from the Dynamo environment so it can be used in the Revit API directly and sets the result to the level variable 
slopeVector = IN[2] #converts the contents of IN[2] to the associated Revit content and sets the result to the slopeLine variable 
slope = IN[3] #sets the slope variable to the contents of IN[2] from the Dynamo environment
floorType = UnwrapElement(IN[4]) #unwraps the contents of IN[4] from the Dynamo environment so it can be used int he Revit API directly, and sets the result to the floorType variable
x = [] #creates an empty list as the x variable
y = [] #creates an empty list as the y variable
z = [] #creates an empty list as the z variable

TransactionManager.Instance.EnsureInTransaction(doc) #starts a new transaction so we can modify the document in the doc variable
ca = CurveArray() #sets a new curve array as an empty CurveArray
for c in outlineLoop: #for each curve int he outlineLoop, perform the offset action below
   ca.Append(c.ToRevitType()) #converts the curve to the associated Revit type, and appends it to the curve ca variable
   sp = c.StartPoint #gets the start point of each curve
   x.append(sp.X) #appends the start point's X value to the x variable
   y.append(sp.Y) #appends the start point's Y value to the y vairable
   z.append(sp.Z) #appends the start point's Z value to the z vairable
x = sum(x)/len(x) #sets the x variable to the average of the start point values
y = sum(y)/len(y) #sets the y variable to the average of the start point values
z = sum(z)/len(z) #sets the z variable to the average of the start point values
slopeLine = Line.ByStartPointDirectionLength(Point.ByCoordinates(x,y,z),slopeVector,10).ToRevitType() #builds a new line 10 unit long line from the average start point on the given vector and converts to a Revit line to use in the floor creation
floor = doc.Create.NewSlab(ca, level, slopeLine, slope, True) #creates a new floor in the document stored in the doc variable, using the ca, level, slopeLine, and slope variable, and setting the 'is structural' override to true, setting the result to the floor variable
floor.FloorType = floorType #sets the floor type to the contents of the floorType variable
TransactionManager.Instance.TransactionTaskDone() #closes the Revit transaction

OUT = floor #sends the contents of the floor variable to the Dynamo environment