Create Roof by Face of a mass family

Hello,

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
image

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
clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager

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

clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *
clr.AddReference("RevitAPIUI")
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:
	uiapp.PostCommand(pCmd)
	result = 'Success'
else :
	result = 'set run it to true'
OUT = result
1 Like