Mass expression assignment via python?

Hello All!

I have several rectangle tops who’s rotate value I’d like to drive via a math chop which goes from 0 to 360.

I was successfully able to assign the rotate param to each rectangleTOP manually with this line
op(‘/project1/math1’)[0]

But I’d prefer to do this much faster in a For loop, but can’t figure out how!
This line of code attempts to assign index zero of the math chop to the rotate parameter and gets me no errors, but does nothing…

op(‘/project1/math1’)[0] == op(‘/project1/rectangle1’).par.rotate

You can use the same reference in all of the objects. Are you looking to quickly copy this reference to all of your target objects?

Hey Matt,

Just figured it out!

What happened was I would write (for example)

                  op('rectangle1').par.fillcolorb = str( op('lfo1')[0] )

into a textDAT and run it. And whatever value lfo1 was at that time slice it would place into the fill of color of blue rather than continuously linking lfo1[0] to rectangle1 fill colorb

So instead of a textDAT I used a Chop execute which executes on value change.
I then put this into a for loop to allow me to change values en mass

def onValueChange(channel, sampleIndex, val, prev):
adv = 0
for x in range (1, 21 ):
op(‘rectangle’ + str(x) ).par.sizex = str( op(‘math1’)[0] )
op(‘rectangle’ + str(x) ).par.fillcolorr = str( op(‘math2’)[0] )
op(‘rectangle’ + str(x) ).par.fillcolorg = str( op(‘math2’)[0] )
op(‘rectangle’ + str(x) ).par.fillcolorb = str( op(‘math2’)[0] )
op(‘rectangle’ + str (x) ).par.resolutionw = 1024
op(‘rectangle’ + str (x) ).par.resolutionh = 768
op(‘rectangle’ + str (x) ).par.sizey = 1.5
op(‘rectangle’ + str (x) ).par.rotate = str( op(‘math4’)[0] )
op(‘rectangle’ + str (x) ).par.centerx = -.8 + adv
adv = adv+ op(‘math3’)[0]
return