Python script error on creating room

Hi all,
I am trying to merge two custom nodes together; the target is to create a custom node which gives me the ability to create a room with these inputs: Point, Level, Name, Number, Phase.

I copied this script from two different custom nodes as I mentioned; since I am very beginner in scripting so I can’t find where is the problem in this code.

I would love if anyone could help me with this.
Thank you!

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

clr.AddReference("RevitServices")
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
doccreation = doc.Create

names = IN[0]
numbers = IN[1]
phase = UnwrapElement(IN[2])
uvs =[]
for i in IN[3]:
    uvs.append(UnwrapElement(i).ToXyz())
level=UnwrapElement(IN[4])
counter = 0
elementlist = list()

TransactionManager.Instance.EnsureInTransaction(doc)
for item in uvs:
    uv=UV(item.X,item.Y)


for name in names:
    newroom = doccreation.NewRoom(phase)
    newroom.Name = name
    newroom.Number = numbers[counter]
    elementlist.append(newroom)
counter += 1

TransactionManager.Instance.TransactionTaskDone()

OUT = elementlist

This was answered here:

Sorry I don’t get it.
It was a proposal by me but unfortunately I didn’t receive replies so I tried to do it but I had errors.

my bad I thought you were actually answering the question in that previous post instead of hijacking it to ask another one. Ok, let’s hope someone answers it here, now that it has its own thread.

1 Like