/// <summary>選用的 Device 選項變動</summary> /// <param name="sender"></param> /// <param name="e"></param> private void CmbBoxDeviceName_SelectedIndexChanged(object sender, EventArgs e) { try { // Display Position File I this.DisplayCurrentPathFileItems(); // Display Device IP this.DisplayCurrentDeviceInfoIP(); #if NO_DEVICE #else groupBox1.Enabled = false; ldd = new MvaFanucRobotLdd(); this.ldd.RobotIp = this.RobotPathFileConfigSet.GetCurrentConfig(CmbBoxDeviceName.Text).DeviceIP; if (ldd.ConnectTry() != 0) { throw new Exception("無法連接裝置"); } ldd.ExecutePNS("PNS0101"); groupBox1.Enabled = true; #endif } catch (Exception ex) { MessageBox.Show(ex.Message + " (尚未完初始化,無法繼續操作)"); } // NumUdpSn.Value = this.GetPositionInstancesNextSn(); // this.Enabled = true; this.PositionInstances = new List <PositionInfo>(); RefreshPositionInfoList(); TxtBxDevicePath.Text = string.Empty; NumUdpSn.Value = this.GetPositionInstancesNextSn(); }
public void TestPosReg() { using (var ldd = new MvaFanucRobotLdd()) { ldd.RobotIp = "192.168.0.51"; if (ldd.ConnectTry() != 0) { Console.WriteLine("Connection Fail"); } var robotInfo = ldd.ReadPosReg(1); robotInfo.x += 1; ldd.SetPosRegXyzWpr(1, robotInfo); robotInfo = ldd.ReadPosReg(1); Console.WriteLine(robotInfo.x); } }