1
$\begingroup$

Basic question but I'm new to Python and I'd like to create an array of vectors. Unfortunately arr.append() isn't working...

Here's what I have:

for i, p in enumerate( someArr ):
    if x < y:
        locationArr = []
        location = obj.particle_systems[0].particles[i].location
        locationArr.append(location)
    return locationArr

Not sure what the location vector at obj.particle_systems[0].particles[i].location is ... object? Array? Output for an example is: Vector((1.0000001192092896, 0.9654528498649597, -0.4224875271320343))

Thanks.

$\endgroup$
1
$\begingroup$

Duh, was defining the array in the for-loop

$\endgroup$
  • $\begingroup$ Yep. Duh. Reminds me of my very first scientific job right out of high school, at the Geophysical Institute. Landsat images came down so fast it was striped across 4x 9-track tape drives then they sent us the tapes. So on my first day they handed me a 3-inch stack of that 14 inch green-bar sprocket-fed line printer output of the FORTRAN program that put it all together into a single file. And there was one particular situation where an entire line would take on the same value. It took an hour, but I found a variable being initialized right after the DO loop statement instead of before it. $\endgroup$ – SDsolar Jun 15 '17 at 1:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.