コード例 #1
0
 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];
     }
 }
コード例 #2
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);
        }
コード例 #3
0
        public Result LoadTxt()
        {
            Result res       = Result.OK;
            int    dataStart = 0;

            this.CompList.Clear();
            this.CompListStanded.Clear();
            this.layOuts.Clear();
            if ((midXIndex == -1) || (midYIndex == -1) || ((rotationIndex == -1)))
            {
                return(Result.FAILED);
            }

            for (int i = dataStart + 1; i < this.Lines.Length; i++)
            {
                if (!String.IsNullOrEmpty(this.Lines[i]))
                {
                    string[] splits = this.Lines[i].Split(this.seperatorTxtList.ToArray());
                    if (splits.Length < 3)
                    {
                        continue;
                    }
                    //对分割的字符串数组进行处理 去掉前后的空格 ,将 X Y rot 其他的去掉0-9 . - +
                    string disgn = " ";
                    if (this.designIndex == -1)
                    {
                        disgn = " ";
                    }
                    else
                    {
                        disgn = splits[this.designIndex];
                    }
                    string comp = " ";
                    if (this.compIndex != -1)
                    {
                        comp = splits[compIndex].Trim();
                    }
                    if (!unitFind)
                    {
                        if (splits[midXIndex].Contains("mm") && splits[midYIndex].Contains("mm"))
                        {
                            this.UnitScale = 1;
                            unitFind       = true;
                        }
                        else if (splits[midXIndex].Contains("mil") && splits[midYIndex].Contains("mil"))
                        {
                            this.UnitScale = 0.0254;
                            unitFind       = true;
                        }
                        //Log.Dprint(i.ToString());
                        if (!unitFind)
                        {
                            if (i == this.Lines.Length - 2)
                            {
                                MessageBox.Show("there is no unit flay in this trajectory file");
                                return(Result.FAILED);
                            }
                            continue;
                        }
                    }
                    double midX     = this.getValue(splits[midXIndex]);
                    double midY     = this.getValue(splits[midYIndex]);
                    double rotation = this.getValue(splits[rotationIndex]);
                    string layout;
                    if (this.layOutIndex == -1)
                    {
                        layout = " ";
                    }
                    else
                    {
                        layout = splits[layOutIndex];
                    }
                    this.AddlayOuts(layout);
                    PointD       p            = new PointD(midX, midY);
                    CompProperty compProperty = new CompProperty(disgn, comp, p, rotation, layout);
                    CompList.Add(compProperty);
                }
            }

            this.CompListStanded.AddRange(this.CompList);
            return(res);
        }