Create Roof by Face of a mass family


I am trying to create Revit system family of ROOFS by Revit faces using a mass family as reference.

With the code below essentially it runs Roof model by Face

but I have to select the geometry in screen anyway, I would like to automate the selection of faces of the mass family to create the roofs:

import clr
import RevitServices
from RevitServices.Persistence import DocumentManager

app = DocumentManager.Instance.CurrentUIApplication.Application
uiapp = DocumentManager.Instance.CurrentUIApplication

from Autodesk.Revit.DB import *
from Autodesk.Revit.UI import *

result = []

# find out version number of Revit
if int(app.VersionNumber) == 2021: 
	pCmd = RevitCommandId.LookupPostableCommandId(PostableCommand.RoofByFace)

# runs if true is fed into the node
if IN[0] == True:
	result = 'Success'
else :
	result = 'set run it to true'
OUT = result
1 Like