Creating Roof with Python

I have been receiving this error when running my python script to generate a roof form:

rvt error

Any ideas why?

I am running Dynamo 1.3 on Revit 2016 on a Windows 10 machine. It’d be great to at least see if it runs on someone else’s machine.

Attached is my DYN file & Python script, as well as screenshots of both.

Thanks

pydyn node

py node

test_create_ceiling_py.dyn (4.1 KB)
pycode.txt (1.4 KB)

I’ve also attempted this route using dynamo nodes to receive the same error:
dyn nodetest_create_ceiling.dyn (14.3 KB)

I would prefer a solution in python, but something using nodes could suffice.

Thanks

Hi, I just started using Python and I am still confused, but I’ve tried this script and didn’t give any error. If might be of help for you…

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 *

# 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

#Create Curve Array
cArray = CurveArray()
mcArray = clr.StrongBox[ModelCurveArray](ModelCurveArray())		
#Loop through lines
for line in lines:
	cArray.Append(line)
		
#Start Transaction
TransactionManager.Instance.EnsureInTransaction(doc)

#Create Roof
roof = doc.Create.NewFootPrintRoof(cArray, level, type, mcArray)
output.append(roof.ToDSType(False))

#End Transaction
TransactionManager.Instance.TransactionTaskDone()

#Assign your output to the OUT variable.
OUT = output