Hello, i need a litte help. Maybe just a syntax error.I want to do some little vector math.Pre-Logic Script Codeimport sys def GetVector(shape): x0 = 1 y0 = 2 x1 = 3 y1 = 4 a = [x0, y0] b = [x1, y1] vecsum = [a[0]+b[0], a[1]+b[1] ] return vecsum[1]
Assignment CodeGetVector( !Shape!)
This works. But i want to use field values, stored in the shape file, for the variables. As one example i tried this:Pre-Logic Script Codeimport sys def GetVector(shape): x0 = !xorigin! y0 = 2 x1 = 3 y1 = 4 a = [x0, y0] b = [x1, y1] vecsum = [a[0]+b[0], a[1]+b[1] ] return vecsum[1]
which gives a syntax error. What is wrong? In the Shape file there is a field named "xorigin" (type double) with a value of 3773506,87592.