Hi!
I have got a bunch of objects in the scene named Row, Row.001, … Row.008
So I was doing something like this
row_obj_000= scene.objects['Row']
row_000 = RowOfAtoms.RowOfAtoms(row_obj_000)
row_obj_001= scene.objects['Row.001']
row_001 = RowOfAtoms.RowOfAtoms(row_obj_001)
....
and I was working with class RowOfAtoms objects row_000, row_001, …
Everything worked fine!
Then I decided to make a list of gameobjects and a list of RowOfAtoms class
objectlist = []
rowsofatoms = []
for o in sce.objects:
if 'Row' in o.name: # If you find an object with starting with 'Row'
objectlist.append(o) # Add the object reference to the list
rowsofatoms.append(RowOfAtoms.RowOfAtoms(o))
print(objectlist) # Print out the list of objects
print gives correct object list of [‘Row’, ‘Row.001’, … etc]
The problem is that this line
rowsofatoms.append(RowOfAtoms.RowOfAtoms(o))
gives errors. I mean I do not understand why appending the class instance based on the gameobject does not work!
Please, help!