I have a program in which part of its code has to be modified constantly:
VAR = 'math.sin(x*y)*math.sin(x*y)'
while (x <= vfinal) and (y <= vfinal):
v1 = bm.verts.new((round(x,3),round(y,3),VAR))
x = x + precision
v2 = bm.verts.new((round(x,3),round(y,3),VAR))
y = y + precision
x = x - precision
v3 = bm.verts.new((round(x,3),round(y,3),VAR))
x = x + precision
v4 = bm.verts.new((round(x,3),round(y,3),VAR))
bm.faces.new((v1,v2,v4,v3))
y = y - precision
if (round(x,1) == vfinal):
y = y + precision
x = vinicial
Since math.sin(x*y)*math.sin(x*y) appears 4 times (possibly more once I expand the program), I want to easily change the program by changing whats stored in VAR.
So far I tried making VAR a string, which gives an error because bm.verts.new wont accept strings. Also tried removing the ' ' in VAR, to make it a number, but this won't give the desired result further down because x and y change constantly. The only thing that worked was writing math.sin(x*y)math.sin(xy) 4 times, but its tedious and im lazy.
Is there any way to do what I want? if not, what should I do?