private void bFit_Click(object sender, EventArgs e) { rx[0] = rx[1] / 2; if (this.Aixs == GeneralAxis.X) { HardwareOrgHelper.Instance[this.module].X = x; HardwareOrgHelper.Instance[this.module].RX = rx; HardwareOrgHelper.Instance[this.module].XPoly = new Polynomial(); } else { HardwareOrgHelper.Instance[this.module].Y = x; HardwareOrgHelper.Instance[this.module].RY = rx; HardwareOrgHelper.Instance[this.module].YPoly = new Polynomial(); } HardwareOrgHelper.Save(); poly = Polynomial.Fit(x, rx, (int)this.numPow.Value); poly.VariableName = $"{this.Aixs}"; this.argList.Items.Clear(); for (int i = 0; i < poly.Coefficients.Length; ++i) { this.argList.Items.Add(poly.Coefficients[i].ToString()); } this.bEnable.Enabled = true; }
private void bCliab_Click(object sender, EventArgs e) { try { List <AxisOffsetItem> items = new List <AxisOffsetItem>(); for (int i = 0; i < this.dGVAxisOffset.Rows.Count; ++i) { var item = new AxisOffsetItem(); item.MoveDist = double.Parse(this.dGVAxisOffset.Rows[i].Cells[0].Value.ToString()); item.Offset = double.Parse(this.dGVAxisOffset.Rows[i].Cells[1].Value.ToString()); } if (!HardwareOrgHelper.Instance.AxisOffset.ContainsKey(this.module)) { HardwareOrgHelper.Instance.AxisOffset.Add(this.module, new Dictionary <GeneralAxis, List <AxisOffsetItem> >()); } if (!HardwareOrgHelper.Instance.AxisOffset[this.module].ContainsKey(this.axis)) { HardwareOrgHelper.Instance.AxisOffset[this.module].Add(this.Axis, new List <AxisOffsetItem>()); } HardwareOrgHelper.Instance.AxisOffset[this.module][this.axis] = items; HardwareOrgHelper.Save(); MessageBox.Show("标定成功!"); } catch { MessageBox.Show("轴机械标定失败!!!"); } }
private void bClear_Click(object sender, EventArgs e) { if (MessageBox.Show($"是否初始化[{this.moduleRadio1.Module}模组]机械校验!!! Y/N", "警告", MessageBoxButtons.YesNo) == DialogResult.Yes) { HardwareOrgHelper.Instance.HardWare[this.moduleRadio1.Module] = new HardwareItem(); HardwareOrgHelper.Save(); this.moduleRadio1_ModuleChange(this, this.moduleRadio1.Module); } }
private void bEnable_Click(object sender, EventArgs e) { if (this.Aixs == GeneralAxis.X) { HardwareOrgHelper.Instance[this.module].X = x; HardwareOrgHelper.Instance[this.module].RX = rx; HardwareOrgHelper.Instance[this.module].XPoly = poly; } else { HardwareOrgHelper.Instance[this.module].Y = x; HardwareOrgHelper.Instance[this.module].RY = rx; HardwareOrgHelper.Instance[this.module].YPoly = poly; } HardwareOrgHelper.Save(); this.bEnable.Enabled = false; }
private void bUpdate_Click(object sender, EventArgs e) { var module = this.module.Module; HardwareOrgHelper.Instance[module].LeftBottom = Org; HardwareOrgHelper.Instance[module].RightBottom = RightBottom; HardwareOrgHelper.Instance[module].LeftTop = LeftTop; HardwareOrgHelper.Instance[module].RightTop = RightTop; HardwareOrgHelper.Instance[module].XYCroodAngle = (double)this.tXYAngle.Value; double deg = (HardwareOrgHelper.Instance[module].XYCroodAngle - 90) / 180.0 * Math.PI; HardwareOrgHelper.Instance[module].XRate = Math.Cos(deg); HardwareOrgHelper.Instance[module].YRate = Math.Sin(deg); //this.bUpdate.Enabled = false; HardwareOrgHelper.Save(); }