# Modifying a Python Script to process list of objects

**URL:** <https://forum.dynamobim.com/t/modifying-a-python-script-to-process-list-of-objects/104789>\
**Category:** Developers\
**Tags:** revit, python, dynamo\
**Created:** [October 1, 2024, 11:09am UTC](https://forum.dynamobim.com/t/modifying-a-python-script-to-process-list-of-objects/104789 "2024-10-01T11:09:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hwo.osa](https://avatars.discourse-cdn.com/v4/letter/h/ac8455/32.png) [@hwo.osa](https://forum.dynamobim.com/u/hwo.osa)\
**Post date:** [October 1, 2024, 11:09am UTC](https://forum.dynamobim.com/t/modifying-a-python-script-to-process-list-of-objects/104789/1 "2024-10-01T11:09:14Z")

</div>

Hi everyone,

I’m trying to create a script which places FamilyInstances based on a list of given coordinates, rotation angles, a family symbol and a workplane. I have been pointed to a relevant code snippet [here](https://forum.dynamobim.com/t/place-family-workplane-problem/18811/2), but from my understanding this only works with one coordinate / rotation at a time as it does not expect a list as an input.

Can anyone help me out? Thanks!

---

<div class="post-metadata">

**Author:** ![hwo.osa](https://avatars.discourse-cdn.com/v4/letter/h/ac8455/32.png) [@hwo.osa](https://forum.dynamobim.com/u/hwo.osa)\
**Post date:** [October 1, 2024, 1:24pm UTC](https://forum.dynamobim.com/t/modifying-a-python-script-to-process-list-of-objects/104789/2 "2024-10-01T13:24:02Z")

</div>

Update: I found the solution. For those interested, here’s the modified code:

```auto
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])
locations = []
for i in IN[2]:
    locations.append(UnwrapElement(i).ToXyz())
referenceDirections = []
for i in IN[3]:
    referenceDirections.append(UnwrapElement(i).ToXyz())
out = []

symbol.Activate()
reference = Reference(refPlane)

TransactionManager.Instance.EnsureInTransaction(doc)

for location, direction in zip(locations, referenceDirections):
    new = doc.Create.NewFamilyInstance(reference,location,direction,symbol)
out.append(new)

TransactionManager.Instance.TransactionTaskDone()

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

```
