Ejemplo n.º 1
0
 private void LoadChannelDataValue(CutChannel c, bool load = true)
 {
     saved = false;
     for (int i = c.Segs.Count; i < 10; i++)
     {
         CutSegment s = new CutSegment();
         s.Enable = false;
         c.Add(s);
     }
     if (load)
     {
         ch = c;
         chIndex.SelectedIndex   = c.Index;
         yOffset.Value           = c.YPosAdj;
         tOffset.Value           = c.TPosAdj;
         tStartPos.Value         = c.TRoatePos;
         cycTicks.Value          = c.CycleCount;
         pauseLine.Value         = c.PauseTick;
         pauseMode.SelectedIndex = c.PauseMode;
         cutDir.SelectedIndex    = (int)c.Style;
         for (int i = 0; i < 10; i++)
         {
             ctrs[i].Seg = c.Segs[i];
         }
     }
 }
Ejemplo n.º 2
0
        //private void button5_Click(object sender, EventArgs e)
        //{
        //    timer1.Stop();
        //    seg.PreWidth = 0;
        //    seg.Length = 480;
        //    seg.Dual = false;
        //    seg.Dir = true;
        //    seg.SinDir = false;
        //    seg.Speed = 50;
        //    seg.BackSpeed = 200;
        //    seg.Fixed = false;
        //    seg.Forward = false;
        //    seg.Abs = true;
        //    seg.IndexStep = 4.8f;
        //    seg.Center = new PointF(240, 240);
        //    if (seg.Forward)
        //    {
        //        seg.StartPos = new PointF(0, 0);
        //    }
        //    else
        //    {
        //        seg.StartPos = new PointF(0, 480);

        //    }
        //    seg.TotalLine = 100;
        //    seg.InitCutRunData();
        //    bmp = BitmapHelper.RotateImg(bmp, 30);

        //    pictureBox1.Image = bmp;
        //    i = 0;
        //    timer1.Start();
        //}
        private void button5_Click(object sender, EventArgs e)
        {
            CutChannel seg1 = new CutChannel();

            bmp             = new Bitmap(481, 481);
            seg1.AlignPoint = new PointF(240, 240);
            seg1.Style      = CutStyle.FrontToBack;
            seg1.Width      = 480;
            seg1.YPosAdj    = 20;
            timer1.Stop();
            seg           = seg1;
            seg.Length    = 200;
            seg.SinDir    = false;
            seg.Dir       = false;
            seg.Speed     = 50;
            seg.BackSpeed = 200;
            seg.Fixed     = false;
            seg.Forward   = false;
            seg.Abs       = true;
            seg.IndexStep = 4.8f;
            seg.Center    = new PointF(240, 240);

            seg.TotalLine = 101;
            seg.InitCutRunData();
            using (Graphics g = Graphics.FromImage(bmp))
            {
                g.Clear(pictureBox1.BackColor);
                g.DrawEllipse(drawPen, new Rectangle(0, 0, 480, 480));
            }
            pictureBox1.Image = bmp;
            i = 0;
            timer1.Start();
        }
Ejemplo n.º 3
0
 public static bool RunChannelCut(CutChannel c) //通道
 {
     c.Complate = RunningChannelCut(c);         //划切当前
     if (c.Complate)                            //如果划切完成
     {
         for (; c.CycleTick < c.CycleCount;)    //判断是否需要循环操作
         {
             float st = 0;
             c.CycleTick++;
             if (c.IndexStep2 > 0)
             {
                 st = c.Forward ? c.IndexStep2 : -c.IndexStep2; //Y轴向前移动固定距离2
             }
             else
             {
                 st = c.Forward ? c.IndexStep : -c.IndexStep; //Y轴向前移动固定距离1
             }
             c.StartPos.Y = Y_Axis.RealPos + st;              //重新开始计算划切起始位置
             c.InitCutRunningData(true, false);               //清除切割完成标志
             if (!RunningChannelCut(c))                       //划切暂停或者失败返回
             {
                 return(false);
             }
         }
     }
     return(c.Complate);
 }
Ejemplo n.º 4
0
 private void LoadCutChannelData(CutChannel c)
 {
     this.Enabled            = c.Enable;
     cutSpeed.Value          = c.Speed;
     cutLeave.Value          = c.ReDepth;
     cutLeave2.Value         = c.ReDepth2;
     cutStep.Value           = c.IndexStep;
     cutLine.Value           = c.TotalLine;
     yOffset.Value           = c.YPosAdj;
     tOffset.Value           = c.TPosAdj;
     tStartPos.Value         = c.TRoatePos;
     pauseLine.Value         = c.PauseTick;
     pauseMode.SelectedIndex = c.PauseMode;
     cutDir.SelectedIndex    = (int)c.Style;//0 向后  1 向前
 }
Ejemplo n.º 5
0
 private void SaveChannelDataValue(CutChannel c)
 {
     c.Enable     = true;
     c.YPosAdj    = yOffset.Value;
     c.TPosAdj    = tOffset.Value;
     c.TRoatePos  = tStartPos.Value;
     c.CycleCount = cycTicks.Int;
     c.PauseTick  = pauseLine.Int;
     c.PauseMode  = pauseMode.SelectedIndex;
     c.Style      = (CutStyle)cutDir.SelectedIndex;
     foreach (var item in ctrs)
     {
         item.SaveCutSegmentData();
     }
 }
Ejemplo n.º 6
0
 public void LoadChannelDataValue(CutChannel c)
 {
     this.Enabled             = ch.Enable;
     cutSpeed.Value           = ch.Speed;
     rotatePos.Value          = ch.TRoatePos;
     pauseValue.Value         = ch.PauseTick;
     pauseStyle.SelectedIndex = ch.PauseMode;
     stepEdit.Value           = ch.IndexStep;
     stepEdit2.Value          = ch.IndexStep2;
     cutNum.Value             = ch.TotalLine;
     cycleTime.Value          = ch.CycleCount;
     yOffset.Value            = ch.YPosAdj;
     tOffset.Value            = ch.TPosAdj;
     cutStyle.SelectedIndex   = (int)ch.Style;
 }
Ejemplo n.º 7
0
 private void SetCurrentChannel(CutChannel c)
 {
     channelNum.Enabled = c.Index == 0;
     if (c.Index <= channelNum.SelectedIndex)
     {
         if (ch != c)
         {
             if (repair & saved)
             {
                 SaveChannelDataValue(ch);
             }
             LoadChannelDataValue(c);
         }
     }
     else
     {
         Common.ReportCmdKeyProgress(CmdKey.F0046);
     }
 }
Ejemplo n.º 8
0
 private void LoadCutChipData(CutChip c)
 {
     ctrs.Add(channelCtrList1);
     ctrs.Add(channelCtrList2);
     ctrs.Add(channelCtrList3);
     ctrs.Add(channelCtrList4);
     ctrs.Add(channelCtrList5);
     ctrs.Add(channelCtrList6);
     ctrs.Add(channelCtrList7);
     ctrs.Add(channelCtrList8);
     ctrs.Add(channelCtrList9);
     ctrs.Add(channelCtrList10);
     for (int i = c.Count; i < 10; i++)//增加模板
     {
         CutChannel ch = new CutChannel();
         ch.Enable = false;
         c.Add(ch);
     }
     for (int i = 0; i < 10; i++)
     {
         ctrs[i].CH = c.CHs[i];
     }
 }
Ejemplo n.º 9
0
 private void LoadChipDataValue(CutChip ch)
 {
     startCount = ch.Count;
     if (startCount < 2)
     {
         startCount = 2;
     }
     if (ch.Count < channelNum.Items.Count)
     {
         channelNum.SelectedIndex = ch.Count - 1;
     }
     else
     {
         channelNum.SelectedIndex = 3;
     }
     for (int i = ch.Count; i < channelNum.Items.Count; i++)
     {
         CutChannel c = new CutChannel();
         c.Enable = false;
         LoadChannelDataValue(c, false);
         ch.Add(c);
     }
     LoadChannelDataValue(ch[0]);
 }
Ejemplo n.º 10
0
 private void CutPauseManager_ChangeCutChannelHander(object sender, CutChannel e)
 {
     Common.ReportCmdKeyProgress(CmdKey.S0036);//不支持当前操作 暂停模式下 不支持通道切换操作
 }
Ejemplo n.º 11
0
        private void BackWorker_ProgressChanged(object sender, ProgressChangedEventArgs e)
        {
            switch (e.ProgressPercentage)
            {
            case ProcessCmd.CutLineCmd:
            {
                ProcessCutLineStep(e.UserState as CutLine);
            }
            break;

            case ProcessCmd.CutSegStartCmd:    //划切当前步距值
            {
                CutSegment seg = e.UserState as CutSegment;
                if (seg != null)
                {
                    LoadChannelData(seg);
                }
            }
            break;

            case ProcessCmd.CutSegEndCmd:    //当前步距划切结束
            {
                CutSegment seg = e.UserState as CutSegment;
                if (seg != null)
                {
                    cutLeaveLines.Text      = seg.WaitCutNum.ToString();   //剩余刀数更新
                    cutProcess.StringFormat = string.Format(userFormat, seg.Lines.Count, seg.Lines.Count) + sysFormat;
                    cutProcess.Value        = 100;
                }
            }
            break;

            case ProcessCmd.CutChStartCmd:    //划切当前通道
            {
                CutChannel ch = e.UserState as CutChannel;
                if (ch != null)
                {
                    RotateImageAngle(ch.AlignT + ch.TPosAdj);
                    if (ch.Chip != null)
                    {
                        chipName.Text = ch.Chip.Name;
                    }
                    else
                    {
                        chipName.Text = "Chip1";
                    }
                    curName.Text = ch.Name;
                    LoadChannelData(ch, true);
                }
            }
            break;

            case ProcessCmd.CutChEndCmd:    //当前通道划切结束
            {
                CutChannel ch = e.UserState as CutChannel;
                if (ch != null)
                {
                    cutLeaveLines.Text      = ch.WaitCutNum.ToString(); //剩余刀数更新
                    cutProcess.StringFormat = string.Format(userFormat, ch.Lines.Count, ch.Lines.Count) + sysFormat;
                    cutProcess.Value        = 100;                      //划切进度更新
                }
            }
            break;

            case ProcessCmd.CutPieceCmd:    //暂时保留
            {
                //
            }
            break;

            case ProcessCmd.CutGroupCmd:    //开始进行划切
            {
            }
            break;

            case ProcessCmd.CutPauseCmd:
            {
                watch.Stop();
                if (ParentForm != null)
                {
                    ParentForm.PushChildForm(new CutPauseManager());        //进入暂停界面
                }
            } break;

            case ProcessCmd.CutSopCmd:
            {
                if (ParentForm != null)
                {
                    ParentForm.PopChildForm(this);
                }
            } break;

            default:
                break;
            }
        }
Ejemplo n.º 12
0
        }//划切分度

        private static bool RunningChannelCut(CutChannel c)
        {
            bool flag = true;

            Globals.Channel = c;
            Z_Axis.AxisJogAbsWork(c.SelfPos);             //Z轴移动到安全位置
            WaitAxisMoveDone(Z_Axis);
            T_Axis.AxisJogAbsWork(c.AlignT + c.TPosAdj);  //T轴移动到偏移位置
            X_Axis.AxisJogAbsWork(c.PausePos.X);          //X轴移动到暂停位置
            Y_Axis.AxisJogAbsWork(c.PausePos.Y);          //Y轴移动到暂停位置(第一次划切默认为起始位置)
            WaitAxisMoveDone();                           //等待各轴运动成功
            c.Cutting = true;
            if (!c.Rotated)
            {
                ReportWorkingProgress(ProcessCmd.CutChStartCmd, c); //开始划切当前通道
                c.Rotated = true;
            }
            if (c.StandMode)
            {
                flag = RunSegmentCut(c);//标准模式划切
            }
            else
            {
                foreach (var item in c.Segs)
                {
                    if (!item.Complate)
                    {
                        ReportWorkingProgress(ProcessCmd.CutSegStartCmd, c); //进行通道划切完成
                        item.Complate = RunSegmentCut(item);
                        if (item.Complate)
                        {
                            c.CuttingIndex += item.Count;
                        }
                        else
                        {
                            flag = false;
                            break;//退出当前循环
                        }
                    }
                    flag &= item.Complate;
                }
            }
            if (flag)
            {
                c.Cutting = false;
                ReportCmdKeyProgress(CmdKey.P0109);
                ReportWorkingProgress(ProcessCmd.CutChEndCmd, c); //当前通道划切完成
            }
            else
            {
                c.PausePos.Y = Y_Axis.RealPos;               //设置Y暂停位置为当前的位置
                c.PausePos.X = Globals.ViewCenter.X;         //设置X暂停位置为显微镜中心位置
                Z_Axis.AxisJogAbsWork(c.SelfPos);            //Z轴移动到安全位置
                WaitAxisMoveDone(Z_Axis);
                X_Axis.AxisJogAbsWork(Globals.ViewCenter.X); //移动到显微镜视野
                Y_Axis.AxisJogIncWork(Globals.KniefAdj);     //划切位置+刀痕偏移值 将线移动到显微镜下面
                WaitAxisMoveDone();                          //等待移动停止
                if (!Globals.CutStop)                        //判断是因为暂停导致的返回
                {
                    ReportWorkingProgress(ProcessCmd.CutPauseCmd, c);
                }
            }
            c.Complate = flag;
            return(c.Complate);
        }