private void button2_Click(object sender, EventArgs e) //开始按钮 { string com = CommandCreate.TestCommand(""); Commondata.GalilControler.GProgramDownload(com); Commondata.GalilControler.GProgramUpload(); Commondata.GalilControler.GCommand("XQ#TEST"); }
private void button4_Click(object sender, EventArgs e) //复位按钮 { if (Commondata.YZeroValue == null && Commondata.ZZeroValue == null && Commondata.WZeroValue == null) { MessageBox.Show("请先定义原点!"); } else { Commondata.GalilControler.GProgramDownload(CommandCreate.ReSetCommand(Commondata.GetConfigValue("YZeroValue"), Commondata.GetConfigValue("ZZeroValue"), Commondata.GetConfigValue("WZeroValue"))); //w轴动作待定 Commondata.GalilControler.GProgramUpload(); Console.WriteLine(Commondata.WZeroValue); Commondata.GalilControler.GCommand("XQ#RSET"); } }
private bool InitPowerLand(string address) //初始化powerland { gclib gclib = null; try { gclib = new gclib(); PrintOutput("gclib version: ", PrintStyle.Normal, true); PrintOutput(gclib.GVersion(), PrintStyle.GclibData); PrintOutput("Opening connection to \"" + address + "\"... ", PrintStyle.Normal, true); gclib.GOpen(address); PrintOutput("Connected.", PrintStyle.Normal); PrintOutput("Setting AZ...", PrintStyle.Normal); gclib.GCommand(CommandCreate.AZCommand("")); PrintOutput("Complete.", PrintStyle.Normal); Commondata.GalilControler = new gclib(); PrintOutput("Connectting to Controler...", PrintStyle.Normal); Commondata.GalilControler.GOpen(Commondata.DmcC640Ip); PrintOutput("Connected.Version is " + Commondata.GalilControler.GInfo(), PrintStyle.Normal); PrintOutput("Now TP position is " + Commondata.GalilControler.GCommand("TP"), PrintStyle.Normal); Commondata.IsInit = true; return(true); } catch (Exception ex) { MessageBox.Show("PowerLand初始化失败!" + ex.Message); //MessageBox.Show(e.Message); return(false); } }
private void button1_Click(object sender, EventArgs e) //选择产品按钮 { Form1 IForm1 = (Form1)this.Owner; string model; try { if (dataGridView1.SelectedRows.Count > 1) { MessageBox.Show("请选择一行数据!"); } else { if (Commondata.GetConfigValue("YZeroValue") == "" && Commondata.GetConfigValue("ZZeroValue") == "" && Commondata.GetConfigValue("WZeroValue") == "") { Console.WriteLine(Commondata.GetConfigValue("YZeroValue") + "wtf" + Commondata.GetConfigValue("ZZeroValue") + Commondata.GetConfigValue("WZeroValue")); MessageBox.Show("请设置零点!"); } else { model = dataGridView1.CurrentRow.Cells["Model"].Value.ToString(); IForm1.SetProductValue(model); UploadCommand = CommandCreate.TestCommand(model); //UpLoadCommand(UploadCommand); System.IO.File.WriteAllText(Commondata.commandtxt, UploadCommand); MessageBox.Show("命令已生成,点击命令查看按钮以查看。"); this.Dispose(); } } } catch (Exception e1) { MessageBox.Show(e1.Message); return; } }