Modify Floor Subelements (SlabShapeEdit) in GHPython


Just wondering if it is possible to use points from Rhino and a Floor from Revit and add those points to the Revit floor using GHPython button in Gh with RiR? I think that I am on the right track, but I also think I must be missing a couple of lines since when I flip the boolean switch, nothing happens. I have used this same code in the Python button in Dynamo with the transaction manager to do the same over there, but I don’t know if that is required in Grasshopper RiR or how to correctly obtain the document to even do that. Here’s what I have so far for the code after all of the boilerplate code and using the Revit baking code from

def CommitToDocument(doc):
    for pt in x:
        newfloor2 = doc.GetElement(z.UniqueId)
        slabshapeedit = newfloor2.SlabShapeEditor()

if y == True:

x are the points
y is the boolean switch
z is the floor

You’ve got to make sure the points are in the boundary and face of the floor element. Otherwise Revit API will silently skip them. See the files below. Rhino file contains the points, Revit model contains the floor, and the grasshopper contains the python script

Add Points to (314.3 KB)


that is not working.

Hi Ehsan,

Thank you! That is exactly what I was trying to do!

Great! I’m glad it worked

Hey. Do you get any errors?

Hi, I have been getting this error while using this script. Is it something to do with the particular floor element that I’m selecting? Edit: This error is appearing, after the script solves, on the “Geomeric Element” button that contains the referenced floor object in Revit.

  1. This object was expired because it contained obsolete Revit elements.

Also . … @kike do you know why this error is being thrown (making the script fail)?

Here is an example file that is showing me the error
add pts to floor (5.0 KB)

To close this loop, I figured out how to fix the issue, even though I don’t know exactly why this is an issue. The units in the Rhino file were Inches. I changed them to Feet, clicking Yes to scale everything, and then it worked just fine.


Hi @eirannejad
Just search and found this thread.
I haven’t try the script yet, but just wondering if it can work for the ceiling too at this moment?

Ctu6, what are you looking to do the ceiling? Adding points isn’t available in the UI.

@Japhy Ah sorry, I was thinking about sloping…

You should try it first….

No problem Ctu6, in general when trying to figure out a new workflow in Revit API (which is what Rhino.Inside.Revit is doing) is to go through the steps in Revit UI. Then figure out what you would need to do to that programmatically.

In a sloped ceiling for instance you would need to edit the shape, cycle though the boundary curves, select a particular one and assign it as sloped (and how that would be determined by a user in GH), then assign a slope angle.

Once a rough idea is set out I then look at the Revit API methods to what’s possible and what other users have done (Revit Developer forums/ Dynamo etc) to determine if it’s possible, what the obstacles are and if it’s worth scripting.

@Japhy Many thanks.

I’m currently doing material takeoff and finishing drawings for a 2000+ rooms project as other thread had described, about 60+stairs I think.

All in a sudden a request is to bulid ceilings and floors corresponding to stairs’ geometry, top and bottom. Apparently the project surface of bounding area not satisfied enoung for them.

The ‘Add points to Floor’ script I had tried and used, worked. But “they” want the floor surface exactly matches stairs’ stpe to nose… for that part I’ll try “socialize” that out tomorrow, if fortune.

Then i start thing about the bottom part of stair, which is ceiling in terms of room (with a slope). And that’s why I’m wondering if the current RIR can do something to make it happen.

This is a pretty particular workflow, how do you propose making this happen in the RiR environment? Not seeing anything in the API for the actual ceiling sketch.

1 Like

@Japhy Don’t know if its something possible;
For a flat ceiling the Slope parameter is read-only, once Defines Slope is check, it can then be modified through RiR.

There is a method for creating a ceiling with a slope, here is the constructor. I’ll add it as a new feature request.

Thanks a lot! Now I’ll try to write the script, although not my strength at all :upside_down_face:

You and me both. Here’s a go at it.

SLOPED (13.6 KB)

1 Like