private void SetZeroPositionToolStripMenuItem_Click(object sender, EventArgs e) //定义原点 { if (Commondata.IsInit) { string YZeroValue, ZZeroValue, WZeroValue; YZeroValue = Commondata.GalilControler.GCommand("TPY"); ZZeroValue = Commondata.GalilControler.GCommand("TPZ"); WZeroValue = Commondata.GalilControler.GCommand("TPW"); bool resY = Commondata.SetConfigValue("YZeroValue", YZeroValue.ToString()); bool resZ = Commondata.SetConfigValue("ZZeroValue", ZZeroValue.ToString()); bool resW = Commondata.SetConfigValue("WZeroValue", WZeroValue.ToString()); if (resY && resZ && resW) { MessageBox.Show("原点设置成功!"); Commondata.IsInitZero = true; return; } else { MessageBox.Show("原点设置错误!"); } } else { MessageBox.Show("请先初始化设备!"); } }
private void button1_Click(object sender, EventArgs e) { if (Commondata.SetConfigValue("YAZ", Convert.ToString(numericUpDown1.Value)) && Commondata.SetConfigValue("ZAZ", Convert.ToString(numericUpDown2.Value)) && Commondata.SetConfigValue("WAZ", Convert.ToString(numericUpDown3.Value)) && Commondata.SetConfigValue("TransmissionRatioY", Convert.ToString(numericUpDown4.Value)) && Commondata.SetConfigValue("HelicalPitchZ", Convert.ToString(numericUpDown5.Value)) && Commondata.SetConfigValue("TransmissionRatioW", Convert.ToString(numericUpDown6.Value)) && Commondata.SetConfigValue("SpeedY", Convert.ToString(numericUpDown9.Value)) && Commondata.SetConfigValue("SpeedZ", Convert.ToString(numericUpDown8.Value)) && Commondata.SetConfigValue("SpeedW", Convert.ToString(numericUpDown7.Value))) { MessageBox.Show("参数设置成功!"); } else { MessageBox.Show("参数设置失败!"); return; } }