Creating roof with dynamo 2.6.1 in Revit 2021 with Python

I need your help on this code, because I tried to replicate the code for the revit 2021 version and it is not working for me.
The Phyton code is:

import clr

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

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

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

# Current doc/app/ui
doc = DocumentManager.Instance.CurrentDBDocument

# Define list/unwarp list funtions
def uwlist(input):
	resul = input if isinstance(input, list) else [input]
	return UnwrapElement(input)

# Preparing input from dynamo to revit
roomset = IN[0]
types = uwlist(IN[1])
levels = uwlist (IN[2])

floors = []

# Do some action in a transaction
TransactionManager.Instance.EnsureInTransaction(doc)

for rm,f,l in zip(roomset,types,levels):
	curveloops = []
	for crv_setd in rm:
		crv_setr = []
		for crv_d in crv_setd:
			crv_setr.append(crv_d.ToRevitType())
		curveloop = CurveLoop.Create(crv_setr)
		curveloops.append(curveloop)
	flr = Ceiling.Create(doc, curveloops, f.Id, l.Id)
	floors.append(flr)
				
TransactionManager.Instance.TransactionTaskDone()

# Preparing out put to dynamo
OUT = floors

I get the following error:

AttributeError: ‘type’ object has no attribute ‘Create’

I would appreciate if you could help me find a solution or alternative to the version

1 Like

Hi Steve, welcome

Unfortunately you are out of luck, Ceilings were not able to be created with the API until Revit 2022

Please note you can post blocks of code using the code format </> in the menu
image

or by placing the code between sets of triple backticks like this
```
code…
```
You can also note the code language (no space after backticks) if you like, which helps syntax highlighting
```python
code…
```

1 Like

Thanks, I already corrected the format of the code for the query in the forum, but I think it is worth solving this code

1 Like

I agree, however there is no way to create a ceiling in Revit 2021. So if you want that you’ll need to request a Revit feature. However I wouldn’t recommend bothering with such as Revit 2021 will be unsupported in about 5 months, at which point no further updates will be provided, and adding the feature to Revit to support this is a LOT of work.

1 Like

Not to mention Autodesk doesn’t really go back and update non-essential API for anything but the latest build since… pretty much as far as I can recall. It’s hotfixes at best in my xp otherwise. Maybe an exception here and there if it was a monumental issue.

@steveingcvl as everyone mentioned R22+ is required to create roofs by sketch. Roofs exist in the API as a class in 2021, but the sketch changes are only present in 2022 onwards.

This is the specific method:

2 Likes