Python Script : AttributeError: List[object]

Hi,

Trying to feed a List in a Python Script. For one item the code will run. But not with a List.

The Script is for Placing Elements on Level

import clr
clr.AddReference(‘RevitNodes’)
import Revit
clr.ImportExtensions(Revit.GeometryConversion)
from Revit.Elements import *
clr.AddReference(‘System’)
from System.Collections.Generic import *
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
uiapp = DocumentManager.Instance.CurrentUIApplication
app = uiapp.Application
#The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN
symbol = UnwrapElement(IN[0])
refPlane = UnwrapElement(IN[1])
location = UnwrapElement(IN[2])
referenceDirection = UnwrapElement(IN[3])
out =

symbol.Activate()
reference = Reference(refPlane)

TransactionManager.Instance.EnsureInTransaction(doc)

new = doc.Create.NewFamilyInstance(reference,location.ToXyz(),referenceDirection.ToXyz(),symbol)

TransactionManager.Instance.TransactionTaskDone()

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

This is because you need to iterate over the items within the inputted list via a for loop. Some examples can be found within the below link, though note that it is your symbols that you need to iterate over.

https://www.w3schools.com/python/python_for_loops.asp

2 Likes