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)

1 Like

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.

1 Like