コード例 #1
0
        public void MoveToPoint(int cmdLineNo, int pointNo)
        {
            this.model.SelectedCmdLineNo = cmdLineNo;
            this.model.SelectedPointNo   = pointNo;
            this.model.NotifyObserverSelectChanged();

            //获得选中的点
            CmdLinePoint selcetedPoint = model.GetSelectedPoint();

            Machine.Instance.Robot.MovePosXY(selcetedPoint.Point.X + this.model.PatternOrigin.X, selcetedPoint.Point.Y + this.model.PatternOrigin.Y);
        }
コード例 #2
0
        public void SetSkip(int cmdLineNo, int pointNo, bool skip)
        {
            CmdLinePoint cmdLinePoint = this.model.GetPointByNo(cmdLineNo, pointNo);

            if (cmdLinePoint == null)
            {
                return;
            }
            cmdLinePoint.Skip = skip;

            this.model.NotifyObserversModelChanged();
        }
コード例 #3
0
 private void Parse(List <CmdLine> list)
 {
     for (int i = 0; i < list.Count; i++)
     {
         if (list[i] is DotCmdLine || list[i] is LineCmdLine || list[i] is ArcCmdLine || list[i] is SnakeLineCmdLine ||
             list[i] is StepAndRepeatCmdLine || list[i] is DoCmdLine || list[i] is SymbolLinesCmdLine || list[i] is DoMultiPassCmdLine)
         {
             for (int j = 0; j < list[i].PointsAndDescrie.Count; j++)
             {
                 CmdLinePoint cmdLineAndPoints = new CmdLinePoint(i, j, list[i].CmdLineName,
                                                                  list[i].PointsAndDescrie[j].Item1, list[i].PointsAndDescrie[j].Item2);
                 this.AllCmdPointsList.Add(cmdLineAndPoints);
             }
         }
     }
 }
コード例 #4
0
        public void TeachPoint(PointD point)
        {
            CmdLinePoint cmdLinePoint = this.model.GetSelectedPoint();

            if (cmdLinePoint == null)
            {
                return;
            }

            cmdLinePoint.Point.X = point.X;
            cmdLinePoint.Point.Y = point.Y;
            //如果是圆弧则要重新计算圆弧中心和弧度
            if (cmdLinePoint.CmdLineType == CmdLineType.圆弧或圆环)
            {
                ArcCmdLine arc = this.model.CmdLineList[cmdLinePoint.CmdLineNo] as ArcCmdLine;
                arc.Center = MathUtils.CalculateCircleCenter(arc.Start, arc.Middle, arc.End);
                //如果不是圆环,则要重新计算弧度
                if (arc.Degree != 360 && arc.Degree != -360)
                {
                    arc.Degree = MathUtils.CalculateDegree(arc.Start, arc.Middle, arc.End, arc.Center);
                }
            }
            this.model.NotifyObserversModelChanged();

            if (this.AutoTrack)
            {
                if (!this.NextTrack())
                {
                    MessageBox.Show("已到最后一个点");
                }
            }
            else
            {
                this.model.NotifyObserverSelectChanged();
            }
        }