I cannot assign a value to a struct using ironpython.
[Serializable] public struct matrix3x3 {public double XX; // public double XY; // public double xz; // public double Yx; // public double YY; // public double YZ; // public double ZX; // public double ZY; // public double ZZ; Public override string tostring ();}
Element1 = matrix3x3 () element1.xx = x. X element1.xy = x.y element1.xz = x. Z element1.yx = y. X element1.yy = y.y element1.yz = y.z element1.zx = z. X element1.zy = z. Y element1.zz = z. Z theui. nxmessagebox. show ("error", nxmessagebox. dialogtype. warning, X. x. tostring () theui. nxmessagebox. show ("error", nxmessagebox. dialogtype. warning, element1.xx. tostring () theui. nxmessagebox. show ("error", nxmessagebox. dialogtype. warning, STR (type (X. x) theui. nxmessagebox. show ("error", nxmessagebox. dialogtype. warning, STR (type (element1.xx )))
X. x. tostring () is a real number, but element1.xx. tostring () is always 0
Both types are <float>
I spent the whole morning and afternoon working on it. How many days can my life be !!!
Finally, a similar post was posted on stackoverflow:
Http://stackoverflow.com/questions/2664381/how-to-handle-value-types-when-embedding-ironpython-in-c
Just change it to the following:
Element1 = matrix3x3 (xx = x. x, xy = x.y, xz = x. z, YX = y. x, YY = y.y, YZ = y.z, zx = z. x, ZY = z. y, ZZ = z. z)
Originally, the property of the value type must be assigned in the constructor; otherwise, a copy is obtained !!!!
It's too unreasonable!