Roof Slope script

See if this makes sense :slight_smile:

Think I got lost along the way, but tried to show two approaches (both using the "while statement and the approach originally by @Dimitar_Venkov) in this post NewFootPrintRoof Troubles :wink:

import clr
#Import Revit Nodes
clr.AddReference('RevitNodes')
import Revit
clr.ImportExtensions(Revit.Elements)
clr.ImportExtensions(Revit.GeometryConversion)

# Import RevitAPI
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
from clr import StrongBox

# Import DocumentManager and TransactionManager
clr.AddReference('RevitServices')
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

#The inputs to this node will be stored as a list in the IN variables.
lines = IN[0].ToRevitType()
level = UnwrapElement(IN[1])
type = UnwrapElement(IN[2])
output = []

doc = DocumentManager.Instance.CurrentDBDocument

footprint = CurveArray()
for o in lines:
    footprint.Append(o )
TransactionManager.Instance.EnsureInTransaction(doc)

roofCurves = StrongBox[ModelCurveArray](ModelCurveArray() )
type = UnwrapElement(IN[2])
footprintRoof = doc.Create.NewFootPrintRoof(footprint, level, type, roofCurves)

TransactionManager.Instance.TransactionTaskDone()

ftprintRoof = footprintRoof

iterator = roofCurves.ForwardIterator()
iterator.Reset()
while iterator.MoveNext():
    line = iterator.Current
    ftprintRoof.set_DefinesSlope( line, True )
    ftprintRoof.set_SlopeAngle( line, 0.5 )

OUT = footprintRoof.ToDSType(False), roofCurves.Value, ftprintRoof

image