Revit - Placing families with Dynamo

Hi!

I’m trying to create a script that is supposed to place multiple elements from a parameter (number) and the coordinates of spaces in revit. Before using the “FamilyInstance.ByPointAndLevel” I need to make sure the script doesnt throw out all elements at once. Basically I want the user to use a schedule in Revit and specify the number of elements that is supposed to be created in the “space”.

Everything seems ok before the last “python script node”.

Python Code:

# Load the Python Standard and DesignScript Libraries
import sys
import clr
clr.AddReference(‘ProtoGeometry’)
*from Autodesk.DesignScript.Geometry import **

# The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN

nr = IN[0]
pts = IN[1]
out = []
for i, j in zip(nr, pts):

  • _temp = *
  • for k, l in zip(i, j):*
  •   _temp.append(k* [l])*
    
  • out.append(_temp)*

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

I get this “Error message”:
“Object cannot be intepreded as an index”

Does anyone have any suggestions how I can fix this?

Hey,

I presume because usually in Python you would put x[0] to indicate the first index of x? So if you write [l] then the interpreter thinks you want the index of something?

I’m not sure exactly what you want, but if you put _temp.Append([k, l]) then you would get sub lists? Python would understand that you wanted to append 1 list object containing 2 variables to temp.

Hopefully that helps,

Mark