View Single Post
  #1  
Old 10-23-2009, 12:27 PM
sircedric4 sircedric4 is offline
Member
 
Join Date: Aug 2009
Posts: 22
Array, concatenate, multiple path help please

Maybe I'm thick, but I am still learning Python. I am trying to setup multiple paths for different models that I am incorporating into my program. In the past I was doing this the clunky way by introducing a separate variable for each path:

Example:
path1 = viz.add(viz.ANIMATION_PATH) )
path2= viz.add(viz.ANIMATION_PATH) )
path3 = viz.add(viz.ANIMATION_PATH) )
etc...

Then when I wanted to adjust it I would do things like:
path1.speed(1)
path1.loop(viz.CIRCULAR)
path2.speed(1)
path2.loop(viz.CIRCULAR)
path3.speed(1)
path3.loop(viz.CIRCULAR)

Needless to say this in very clunky, and I want to setup a more default program that doesn't have each path spelled out since I won't always know how many paths I am playing with. I am sure there is some way to do this with for (do-loop) statements.

I guess I don't understand why I can't seem to use an array to do this job. I've tried path[0], path[1], etc... but when I goto tweak the path[0].speed it says no such attribute exists. I believe this is because arrays can't be set to do viz.adds or something. I think arrays can only be certain types and what I am trying to do doesn't fall under that type.

Is there a way to concatenate strings in python? (I come from VB where there is that capability) So for example I could
path + 'someinteger' = viz.add(viz.ANIMATION_PATH) )

and then use that same left hand side wherever to change things
(path + 'someinteger' ).speed(1)

I've tried searching for the means to do this all over the internet and I am hoping someone more familiar with python can tell me the easiest way to do what I am trying to do. I just want variables that I can adjust with a do-loop without having to manually add a bunch of numbered variables. This simple capability is really holding me back on several programs, help please.
Reply With Quote