public static URCoordinates str2urc(string str) { try { if (str.IndexOf("p") == -1)//是URJoint的 { return(null); } str = str.Substring(str.IndexOf("p[") + 2, str.IndexOf("]") - (str.IndexOf("p[") + 2)); string[] pos = str.Split(','); URCoordinates rtn = new URCoordinates(); rtn.X.M = pos[0].toFloat(); rtn.Y.M = pos[1].toFloat(); rtn.Z.M = pos[2].toFloat(); rtn.Rx.rad = pos[3].toFloat(); rtn.Ry.rad = pos[4].toFloat(); rtn.Rz.rad = pos[5].toFloat(); return(rtn); } catch { return(null); } }
//public URCoordinates(float _x, float _y, float _z, float _Rx, float _Ry, float _Rz, byte _G = 0, string unit = "M") //{ // if (unit == "M") // { // X = new Unit(_x); // Y = new Unit(_y); // Z = new Unit(_z); // Rx = new Angle(_Rx); // Ry = new Angle(_Ry); // Rz = new Angle(_Rz); // Grip = _G; // } //} //public URCoordinates(double _x, double _y, double _z, double _Rx, double _Ry, double _Rz, byte _G = 0, string unit = "M") //{ // if (unit == "M") // { // X = new Unit(_x); // Y = new Unit(_y); // Z = new Unit(_z); // Rx = new Angle(_Rx); // Ry = new Angle(_Ry); // Rz = new Angle(_Rz); // Grip = _G; // } //} public URCoordinates(URCoordinates input) { X = input.X; Y = input.Y; Z = input.Z; Rx = input.Rx; Ry = input.Ry; Rz = input.Rz; }