NewFootPrintRoof Troubles

#1

I feel I’m close on this. As is, I get this error;

Commenting out the “footprintRoof” Iine gets me this;

I don’t understand why the value is null in that final line given that all of the components return values. Maybe the DB.Line in the List?

I’m still really new to Python so it could very well be something ovious.

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

import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

clr.AddReference("RevitNodes")
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
clr.ImportExtensions(Revit.Elements)

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager

doc = DocumentManager.Instance.CurrentDBDocument
outline = IN[0]
level = UnwrapElement(IN[1])
roofType = UnwrapElement(IN[2])

TransactionManager.Instance.EnsureInTransaction(doc)

for o in outline:
    loop = CurveArray()
 loop.Append(o.ToRevitType())
	footprint=loop

footPrintToModelCurveMapping = StrongBox[ModelCurveArray]()
footprintRoof = doc.Create.NewFootPrintRoof(footprint, level, roofType, footPrintToModelCurveMapping )

TransactionManager.Instance.TransactionTaskDone()

OUT =footprint, level, roofType, footPrintToModelCurveMapping

Thanks.

#2

Hate bumping but I’m at a standstill on this.

#3

You’re half way there. This is one of those parts of c# that are not easily convertible to iron python. Try the below instead:

footprint = CurveArray()
for o in outline:
    footprint.Append(o.ToRevitType(True) )
TransactionManager.Instance.EnsureInTransaction(doc)

roofCurves = StrongBox[ModelCurveArray](ModelCurveArray() )
footprintRoof = doc.Create.NewFootPrintRoof(footprint, level, roofType, roofCurves)

TransactionManager.Instance.TransactionTaskDone()

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

3 Likes
How to get the sketch lines of the roof
Convert Model Lines to Detail lines
Did someone succeed to make (Roof By Outline Elevation Type And Level) work?
Roof Slope script
#4

So close, and yet, so far away. :slight_smile:

Thanks, Dimitar!