Hi all,
Is that possible to use RIR to add a sloped floor?
In Revit there is 2 steps to make it, I wonder if we can do it in RIR as well
Thanks
Hi all,
Is that possible to use RIR to add a sloped floor?
Hi @Jack_Zeng
Yes its possible. Please try the following python code.
import clr
clr.AddReference("RhinoCommon") # Rhino API
clr.AddReference("RevitAPI") # Revit Core API
clr.AddReference("RevitAPIUI") # Revit UI API
clr.AddReference("RhinoInside.Revit") # Rhino.Inside.Revit Integration
from RhinoInside.Revit import Revit
from RhinoInside.Revit.Convert.Geometry import GeometryEncoder
from Autodesk.Revit import DB
doc = Revit.ActiveDBDocument
db_curves = [GeometryEncoder.ToCurve(rc) for rc in Curves]
curve_loop = DB.CurveLoop.Create(db_curves)
floor_types = list(DB.FilteredElementCollector(doc).OfClass(DB.FloorType))
floor_type = floor_types[0]
levels = list(DB.FilteredElementCollector(doc).OfClass(DB.Level))
if not levels:
raise Exception("No Level found in the document.")
level = levels[0]
slope_arrow_line = GeometryEncoder.ToCurve(Slope_Arrow)
if Create == 1:
t = DB.Transaction(doc, "Create Slope Floor")
t.Start()
try:
new_floor = DB.Floor.Create(
doc,
[curve_loop],
floor_type.Id,
level.Id,
False,
slope_arrow_line,
2
)
t.Commit()
print("Slope floor created successfully.")
except Exception as e:
print("Error creating slope floor:", e)
t.RollBack()