private void btnRecordSnapPos_Click(object sender, EventArgs e) { if (ifConnected) { CurrentPosInt = GetPose(); CurrentPosStr = GetPoseString(CurrentPosInt); //写入控件,也写入配置文件 txtCurrentSnapPos.Text = CurrentPosStr; ConfigController.INIWrite("UR运动参数", "BaseSnapPos", CurrentPosStr, DefaultINIPath); } else { MessageBox.Show("请确认目标UR已连接"); } }
//保存其实就是改写这个INI文件 private void btnSave_Click(object sender, EventArgs e) { ConfigController.INIWrite("UR控制参数", "RemoteIP", Remote_IP.Text, DefaultINIFilePath); ConfigController.INIWrite("UR控制参数", "RemoteControlPort", Control_Port.Text, DefaultINIFilePath); ConfigController.INIWrite("UR运动参数", "BasicSpeed", Basic_Speed.Text, DefaultINIFilePath); ConfigController.INIWrite("UR运动参数", "BasicAcceleration", Basic_Acceleration.Text, DefaultINIFilePath); ConfigController.INIWrite("UR运动参数", "BasicRefreshRate", Data_RefreshRate.Text, DefaultINIFilePath); if (AutoConnect.Checked == true) { ConfigController.INIWrite("UR控制参数", "IfAutoConnect", "YES", DefaultINIFilePath); } else { ConfigController.INIWrite("UR控制参数", "IfAutoConnect", "NO", DefaultINIFilePath); } this.Close(); }
//把Pose1记录并作为相对参考原点 private void btnPos1_Relative_Click(object sender, EventArgs e) { if (ifConnected) { PosInt1 = GetPose(); txtPose1.Text = GetPoseString(PosInt1); HomeVector = txtPose1.Text; HomeX = PosInt1[0]; HomeY = PosInt1[1]; HomeZ = PosInt1[2]; HomeU = PosInt1[3]; HomeV = PosInt1[4]; HomeW = PosInt1[5]; ConfigController.INIWrite("UR运动参数", "BasePos1", txtPose1.Text, DefaultINIPath); } else { MessageBox.Show("请确认目标UR已连接"); } }