Esempio n. 1
0
 public override bool FormLoadReady()
 {
     base.FormLoadReady();
     this.UnderBar.BtList[5].UsedLed = true;
     pausePos = Globals.AxisPoint;//暂停时对准位置
     seg      = Globals.Segment;
     if (pausePos.X <= 0 || pausePos.Y <= 0)
     {
         pausePos   = Globals.Channel.PausePos;
         pausePos.Y = Globals.Channel.PausePos.Y + Globals.KniefAdj;//划切位置+偏移位置
     }
     if (CHs.Contains(Globals.Channel))
     {
         for (int i = 0; i < CHs.Count; i++)
         {
             if (CHs[i] == Globals.Channel)
             {
                 ChannlIndex = i;
                 SetCurrentChannel();
                 break;
             }
         }
     }
     LoadDefaultValue(seg);
     return(true);
 }
Esempio n. 2
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];
         }
     }
 }
Esempio n. 3
0
 private void LoadDefaultValue(CutSegment s)
 {
     if (!Group.Multiple)
     {
         Chip.Text = "Chip1";
     }
     else
     {
         Chip.Text = s.CH.Chip.Name;
     }
     curName.Text  = s.CH.Name;
     cutStep.Text  = s.CutStep.ToString(format);
     cutLine.Text  = s.Lines.Count.ToString();
     cutSpeed.Text = s.Speed.ToString();
     if (s.Dual)
     {
         cutDeapth.Text = s.ReDepth2.ToString();
     }
     else
     {
         cutDeapth.Text = s.ReDepth.ToString();
     }
     cutProcess.StringFormat = string.Format("{0}/{1}", s.CuttingIndex, s.Lines.Count) + "{0}%";
     cutProcess.Value        = (int)(s.CuttingIndex / s.Lines.Count);
     cutLineWidth.Text       = CaptureView.GuidesLineWidth.ToString(format);
 }
Esempio n. 4
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();
        }
Esempio n. 5
0
        private void button3_Click_1(object sender, EventArgs e)
        {
            bmp = new Bitmap(481, 481);
            seg = new CutSegment();
            timer1.Stop();
            seg.Length    = 480;
            seg.Dir       = true;
            seg.SinDir    = false;
            seg.Speed     = 50;
            seg.BackSpeed = 200;
            seg.Fixed     = false;
            seg.Forward   = true;
            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();
            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();
        }
Esempio n. 6
0
 private void LoadCutSegmentData(CutSegment s)
 {
     this.Enabled    = s.Enable;
     cutSpeed.Value  = s.Speed;
     cutLeave.Value  = s.ReDepth;
     cutLeave2.Value = s.ReDepth2;
     cutStep.Value   = s.IndexStep;
     cutLine.Value   = s.TotalLine;
 }
Esempio n. 7
0
 private void LoadChannelData(CutSegment seg, bool isChannel = false)
 {
     ClearAdjData();
     if (!isChannel)
     {
         segName.Text = seg.Name;
     }
     else
     {
         segName.Text = "None";
     }
     this.seg = seg;
     cutProcess.StringFormat = string.Format(userFormat, 0, seg.Lines.Count) + sysFormat;
     cutProcess.Value        = 0;
     cutLeaveLines.Text      = seg.WaitCutNum.ToString();
     cutSpeed.Text           = seg.Speed.ToString();
     cutDeapth.Text          = seg.Dual ? seg.ReDepth2.ToString() : seg.ReDepth.ToString();
     cutStep.Text            = seg.IndexStep.ToString();
 }
Esempio n. 8
0
        }//划切线

        public static bool RunSegmentCut(CutSegment s)
        {
            bool flag = true;

            Globals.Segment = s;
            for (int i = 0; i < s.Count; i++)//划切每一分度
            {
                s.Cutting = true;
                if (!s[i].Complate)
                {
                    Globals.Line = s[i];
                    if (RunLineCut(s[i], Globals.PreCut))
                    {
                        s.CuttingIndex++;
                    }
                    else
                    {
                        if (s[i].CutStep < CutStep.STEnd)                //如果当前非正常划切完成 暂停的情况为等于STEnd
                        {
                            if (s[i].CutStep > CutStep.ST1 && !s[i].Abs) //如果Y已经移动清除当前步进的移动位置
                            {
                                s[i].StartPos.Y = 0;
                            }
                            s[i].CutStep = CutStep.Ready;//其他情况该刀需要重新划切
                        }
                        flag = false;
                        break;
                    }
                }
                flag &= s[i].Complate;
            }
            if (flag)                                   //如果当前分度划切完成
            {
                if (s is CutChannel == false)           //如果当前位CutChannel模式
                {
                    ReportCmdKeyProgress(CmdKey.P0108); //当前分度划切完成
                    ReportWorkingProgress(ProcessCmd.CutSegEndCmd, s);
                }
                s.Cutting = false;
            }
            s.Complate = flag;
            return(s.Complate);
        }//划切分度
Esempio n. 9
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;
            }
        }
Esempio n. 10
0
        public static bool RepairCutChannelValue(CutSegment seg, int mode, float inc)
        {
            if (seg == null)
            {
                Common.ReportCmdKeyProgress(CmdKey.P0120);
                return(false);
            }
            if (!Globals.Cutting || !seg.Cutting || seg.Complate)//不在切割状态 或者切割完成
            {
                Common.ReportCmdKeyProgress(CmdKey.P0120);
                return(false);
            }
            if (inc == 0)
            {
                Common.ReportCmdKeyProgress(CmdKey.P0119);
                return(true);
            }
            switch (mode)
            {
            case 0:                 //改变速度
            {
                if (Globals.PreCut) //需要手动关闭预划切后才能进行速度调节
                {
                    Common.ReportCmdKeyProgress(CmdKey.P0136);
                    return(false);
                }
                float value = seg.Speed + inc;
                if (Math.Abs(inc) > Globals.DevData.MaxSpeedAdj)
                {
                    Common.ReportCmdKeyProgress(CmdKey.P0121);
                }
                if (value <= 0 || value >= 500)
                {
                    Common.ReportCmdKeyProgress(CmdKey.P0111);
                    return(false);
                }
                seg.RepairCutSpeed(value);
                Common.ReportCmdKeyProgress(CmdKey.P0115);
            }
            break;

            case 1:    //改变刀数
            {
                int value = (int)inc + seg.Count;
                if (Math.Abs(value * seg.IndexStep) > Globals.TabData.UsedTabSize.Width)
                {
                    Common.ReportCmdKeyProgress(CmdKey.P0135);
                }
                if (value < seg.CuttingIndex)        //小于当前已经划切刀数
                {
                    Common.ReportCmdKeyProgress(CmdKey.P0112);
                    return(false);
                }
                //需要重新进行数据有效性判定
                seg.RepairCutLines(value);
                Common.ReportCmdKeyProgress(CmdKey.P0116);
            }
            break;

            case 2:    //改变深度
            {
                float value  = seg.Dual ? seg.ReDepth2 : seg.ReDepth;
                float height = seg.SelfPos - Globals.TestHeightValue - Globals.MacData.ZSelfPos; //获取到当前工件的有效厚度
                value += inc;
                if (Math.Abs(inc) > Globals.DevData.OnceHeightAdj)                               //单次变更值大于0.1
                {
                    Common.ReportCmdKeyProgress(CmdKey.P0123);
                    return(false);
                }
                height -= value;
                if (height > 0 && height > Globals.BldData.SafetyRemainder)        //可划切但是超出刀具安全值
                {
                    Common.ReportCmdKeyProgress(CmdKey.P0125);
                    return(false);
                }
                else
                {
                    if (height < 0 && Math.Abs(height) > Globals.MacData.ZSelfPos)        //划切不到且超过抬刀位置
                    {
                        Common.ReportCmdKeyProgress(CmdKey.P0113);
                        return(false);
                    }
                    else
                    {
                        seg.RepairCutDeapth(value);
                        Common.ReportCmdKeyProgress(CmdKey.P0117);
                    }
                }
            }
            break;

            case 3:    //改变分度
            {
                float value = seg.IndexStep + inc;
                if (Math.Abs(inc) > Globals.DevData.MaxStepAdj)
                {
                    Common.ReportCmdKeyProgress(CmdKey.P0124);
                    return(false);
                }
                if (value > 300)
                {
                    Common.ReportCmdKeyProgress(CmdKey.P0114);
                }
                seg.RepairCutIndexStep(value);        //变更分度值
                Common.ReportCmdKeyProgress(CmdKey.P0118);
            }
            break;

            case 4:                                        //基准线矫正
            {
                if (Globals.DoubleCap && !Globals.HighCCD) //双镜头模式只支持在高倍下设置
                {
                    Common.ReportCmdKeyProgress(CmdKey.P0128);
                    return(false);
                }
                if (inc > Globals.DevData.OnceAlignLineAdj)
                {
                    Common.ReportCmdKeyProgress(CmdKey.P0131);
                    return(false);
                }
                float adjPos = Globals.BldData.KnifeMarksOffsetHi;        //需要统一规则 选择高倍
                adjPos += inc;
                if (adjPos > Globals.DevData.MaxAlignLineAdj)
                {
                    Common.ReportCmdKeyProgress(CmdKey.P0130);
                    return(false);
                }
                Globals.KniefAdj += inc;        //调节对准线
                Common.ReportCmdKeyProgress(CmdKey.P0134);
            }
            break;

            case 5:                                        //位置调整
            {
                if (Globals.DoubleCap && !Globals.HighCCD) //双镜头模式只支持在高倍镜下设置
                {
                    Common.ReportCmdKeyProgress(CmdKey.P0129);
                    return(false);
                }
                if (Math.Abs(inc) > Globals.DevData.MaxPosAdj)
                {
                    Common.ReportCmdKeyProgress(CmdKey.P0130);
                    return(false);
                }
                if (seg.CH != null && seg.CH.Cutting)
                {
                    float offset = 0;
                    if (seg.WaitCutNum > 0)        //当前方案为减去offset 可替换为变更Y的对准位置为0
                    {
                        offset = seg[seg.CuttingIndex].StartPos.Y;
                    }
                    seg.CH.PausePos.Y = Common.Y_Axis.RealPos - Globals.KniefAdj - offset;
                    Common.ReportCmdKeyProgress(CmdKey.P0133);
                }
                else
                {
                    Common.ReportCmdKeyProgress(CmdKey.P0120);
                }
            }
            break;

            default:
            {
                return(false);
            }
            }
            return(true);
        }