public RollPosition(LableCode label, string side, PanelState pnlState, decimal x, decimal y, decimal z, decimal rz) { this.LabelCode = label.LCode; PanelNo = label.PanelNo; Floor = label.Floor; Status = label.Status; FloorIndex = label.FloorIndex; // 布卷按长度调整板上位置, 以确定坐标偏移。 var adj = AdjustPosByRollLength(x, clsSetting.SplintWidth, label.Length); //X = x; //Y = y; X = x + (side == "B" ? -adj.offsetx : adj.offsetx); Y = y + (side == "B" ? -adj.offsety : adj.offsety); Z = z; Rz = rz; // if (robotChangeAngle.Contains(RealLocation)) { ChangeAngle = x < 0 || y > 0;//3\4\5\9\10\11标签朝外 } else { ChangeAngle = x > 0 || y < 0; } RealLocation = label.RealLocation; ToLocation = label.ToLocation; diameter = label.Diameter; // Index = CalculateBaseIndex(label.ToLocation, x, y); Index = CalculateBaseIndex(RealLocation, x, y); // LocationNo = int.Parse(label.ToLocation.Substring(1, 2)); // LocationNo改为getLocationNo. // BaseIndex = 4 * (GetLocationNo() - 1) + Index + 1; BaseIndex = 4 * (GetRealLocationNo() - 1) + Index + 1; Side = side; PnlState = pnlState; // var tmp = int.Parse(label.ToLocation.Substring(1, 2)); var tmp = GetRealLocationNo(); var origin = RobotParam.GetOrigin(tmp); var point = RobotParam.GetPoint(tmp, Index); Base1 = origin.Base; Base2 = point.Base; XOffSet = GetXOffSet(origin.Base, point.Base); X = X + XOffSet; Origin = new PostionVar(XOffSet, 0, 1700, origin.Rx, origin.Ry, origin.Rz + rz); Target = new PostionVar(X, Y, Z, origin.Rx, origin.Ry, origin.Rz + rz); }
/// <summary> /// 写位置变量 /// </summary> /// <param name="pv">位置</param> /// <param name="ptype">todo: describe ptype parameter on SetPostion</param> /// <param name="pvIndex">todo: describe pvIndex parameter on SetPostion</param> /// <param name="pt">todo: describe pt parameter on SetPostion</param> /// <param name="toolNo">todo: describe toolNo parameter on SetPostion</param> /// <param name="userFrameNo">todo: describe userFrameNo parameter on SetPostion</param> /// <returns></returns> public bool SetPostion(PosVarType ptype, PostionVar pv, int pvIndex, PosType pt, int toolNo, int userFrameNo) { int nConfig; nConfig = (int)pt; nConfig |= (pv.NoFlip ? 1 : 0) << 8; nConfig |= (pv.LowArm ? 1 : 0) << 9; nConfig |= (pv.Back ? 1 : 0) << 10; nConfig |= (pv.RGt180 ? 1 : 0) << 11; nConfig |= (pv.TGt180 ? 1 : 0) << 12; nConfig |= toolNo << 16; nConfig |= userFrameNo << 22; var cmd = string.Format("cmd={0};usType={1};usIndex={2};nConfig={3};ulValue1={4};ulValue2={5};ulValue3={6};ulValue4={7};ulValue5={8};ulValue6={9};ulValue7={10};ulValue8={11};", Commands.CMD_MpPutPosVarData, (int)ptype, pvIndex, nConfig, pv.sOrX, pv.lOrY, pv.uOrZ, pv.bOrRx, pv.rOrRy, pv.tOrRz, 0, 0); Send(cmd); var s = ReadSck(); return(s.Contains("OK")); }