/// <summary> /// 加载pattern文件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnLoad_Click(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.InitialDirectory = Application.StartupPath; openFileDialog.Filter = "PATTERN|*.pattern"; if (openFileDialog.ShowDialog() != DialogResult.OK) { return; } this.currPath = openFileDialog.FileName; this.txtFile.Text = this.currPath; if (!this.LoadPatternInfo(this.currPath)) { MessageBox.Show("加载轨迹文件失败"); return; } this.listViewLoadData(this.currPInfo.CompsReversed); if (CreatePatternPrm.DEFAULT.PatternPath != null && CreatePatternPrm.DEFAULT.PatternPath.Equals(this.currPath)) { if (CreatePatternPrm.DEFAULT.Comp1 == null || CreatePatternPrm.DEFAULT.Comp2 == null || CreatePatternPrm.DEFAULT.Comp1Pos == null || CreatePatternPrm.DEFAULT.Comp1Pos == null) { return; } this.markComp1 = CreatePatternPrm.DEFAULT.Comp1; this.markComp2 = CreatePatternPrm.DEFAULT.Comp2; this.mark1 = CreatePatternPrm.DEFAULT.Comp1Pos; this.mark2 = CreatePatternPrm.DEFAULT.Comp2Pos; this.updateOrgSetting(); } }
private void lswComponents_SelectedIndexChanged(object sender, EventArgs e) { if (this.lswComponents.SelectedIndices.Count > 0 && this.lswComponents.SelectedIndices[0] > -1) { this.currentComp = this.currPInfo.CompsReversed[this.lswComponents.SelectedIndices[0]]; this.currentIndex = this.lswComponents.SelectedIndices[0]; } }
private void btnNext_Click(object sender, EventArgs e) { if (this.currentIndex == this.currPInfo.CompsReversed.Count - 1) { this.currentIndex = this.currPInfo.CompsReversed.Count - 1; } else { this.currentIndex++; } this.currentComp = this.currPInfo.CompsReversed[this.currentIndex]; PointD transformed = this.coordinateTransformer.Transform(new PointD(this.currentComp.Mid.X, this.currentComp.Mid.Y).ToMachine()); Machine.Instance.Robot.ManualMovePosXYAndReply(transformed.X, transformed.Y); }