예제 #1
0
 public HostarSpeed this[Shceme shc, GeneralAxis axis]
 {
     get
     {
         return(this.Scheme[shc][axis].Clone() as HostarSpeed);
     }
 }
예제 #2
0
        public short RGoAngle(double angle, Nozzle nozzle, Shceme shceme = Shceme.ManualNormal)
        {
            short rtn = 0;

            rtn += this.MachineAxis.R[(int)nozzle].GoPos(angle, SpeedDefine.Instance[Module][shceme, GeneralAxis.U]);
            return(rtn);
        }
예제 #3
0
 /// <summary>
 /// XY到安全位置
 /// </summary>
 /// <param name="shceme"></param>
 public void XYGoSafePt(Shceme shceme = Shceme.ManualNormal)
 {
     if (this.ZGoSafeTillStop(Shceme.ManualNormal) == 0)
     {
         this.XYGoPosTillStop(this.MachineConfig.ReadyPoint, shceme);
     }
 }
예제 #4
0
        public short YGoPos(double y, Shceme shceme = Shceme.ManualNormal)
        {
            PointF curPos = this.XYPos;

            curPos.Y = (float)y;
            return(this.XYGoPos(curPos, shceme));
        }
예제 #5
0
        /// <summary>
        /// XY运动到指定位置,直到到位
        /// </summary>
        /// <param name="wrold"></param>
        /// <param name="shceme"></param>
        /// <returns></returns>
        public short XYGoPosTillStop(PointF wrold, Shceme shceme = Shceme.ManualNormal)
        {
            if (this.SafeCheck(shceme))
            {
                Task <short> task = Task <short> .Factory.StartNew(() => {
                    Stopwatch watch = new Stopwatch();
                    watch.Start();
                    short rtn = this.XYGoPos(wrold, shceme);
                    while (rtn == 0 && !this.XYReach(wrold))
                    {
                        CommonHelper.DoEvent(50);
                        if (watch.ElapsedMilliseconds > ConstDefine.iActionTimeout)
                        {
                            rtn = -1;
                        }
                    }
                    return(rtn);
                });

                task.Wait();
                return(task.Result);
            }

            return(-1);
        }
예제 #6
0
        /// <summary>
        /// XY到指定区域
        /// </summary>
        /// <param name="wrold"></param>
        /// <param name="shceme"></param>
        /// <returns></returns>
        public short XYGoPos(PointF wrold, Shceme shceme = Shceme.ManualNormal)
        {
            PointF curPos = this.XYPos;

            if (SafeCheck(shceme) && LimitCheck(wrold))
            {
                short rtn = 0;
                if (curPos.X != wrold.X)
                {
                    var sdX = SpeedDefine.Instance[Module][curPos.X, wrold.X, shceme, GeneralAxis.X];
                    rtn += this.MachineAxis.X.GoPos(wrold.X, sdX);
                }

                float Y = wrold.Y;
                if (curPos.Y != wrold.Y && SystemEntiy.Instance.CanMoveY(this.Module, ref Y))
                {
                    wrold.Y = Y;
                    var sdY = SpeedDefine.Instance[Module][curPos.Y, wrold.Y, shceme, GeneralAxis.Y];
                    rtn += this.MachineAxis.Y.GoPos(wrold.Y, sdY);
                }

                return(rtn);
            }

            return(-1);
        }
예제 #7
0
        /// <summary>
        /// 安全检查
        /// </summary>
        /// <param name="shceme"></param>
        /// <returns></returns>
        public bool SafeCheck(Shceme shceme = Shceme.ManualNormal)
        {
            // 如果不在安全高度
            if (!this.ZReachSafe)
            {
                this.ZGoSafe(shceme);
                return(false);
            }

            // 判断离谁最近,到最近的位置
            double trunPos = this.MachineAxis.Trun.Pos;
            double d1      = Math.Abs(trunPos - this.MachineConfig.TrunPasteAngle);
            double d2      = Math.Abs(trunPos - this.MachineConfig.TrunSuckAngle);

            if (d1 < d2)
            {
                if (d1 > 1)
                {
                    this.TurnGoPaste(shceme);
                    return(false);
                }
            }
            else
            {
                if (d2 > 1)
                {
                    this.TurnGoSuck(shceme);
                    return(false);
                }
            }

            return(true);
        }
예제 #8
0
 public HostarSpeed this[double curPos, double endPos, Shceme shc, GeneralAxis axis]
 {
     get
     {
         return(this.GetSpeed(curPos, endPos, this.Scheme[shc][axis]));
     }
 }
예제 #9
0
        public short RGoAngleTillStop(double angle, Nozzle nozzle, Shceme shceme = Shceme.ManualNormal)
        {
            short  rtn    = 0;
            double curPos = this.MachineAxis.R[(int)nozzle].Pos;

            rtn += this.MachineAxis.R[(int)nozzle].GoPosTillStop(ConstDefine.iActionTimeout, angle, SpeedDefine.Instance[Module][curPos, angle, shceme, GeneralAxis.U]);
            return(rtn);
        }
예제 #10
0
        public short ZGoPosTillStop(Nozzle nozzle, double pos, Shceme shceme = Shceme.ManualNormal)
        {
            short  rtn    = 0;
            double curPos = this.MachineAxis.Z[(int)nozzle].Pos;

            rtn += this.MachineAxis.Z[(int)nozzle].GoPosTillStop(ConstDefine.iActionTimeout, pos, SpeedDefine.Instance[Module][curPos, pos, shceme, GeneralAxis.Z]);
            return(rtn);
        }
예제 #11
0
 /// <summary>
 /// Y Jog运动
 /// </summary>
 /// <param name="nozzle"></param>
 /// <param name="pos"></param>
 /// <param name="shceme"></param>
 /// <returns></returns>
 public short YJog(bool dir, Shceme shceme = Shceme.ManualNormal)
 {
     if (SafeCheck(shceme))
     {
         return(this.MachineAxis.Y.Jog(SpeedDefine.Instance[Module][shceme, GeneralAxis.Y], dir));
     }
     else
     {
         return(-1);
     }
 }
 private void bTurn_Mode_ContextMenuStripChanged(object sender, EventArgs e)
 {
     if (MoveFunc == MoveFunc.Jog)
     {
         TurnSpeedMode = GetShceme(this.bTurn_Mode.Text);
     }
     else
     {
         TurnMoveDist = double.Parse(this.bTurn_Mode.Text);
     }
 }
예제 #13
0
 public short TurnJog(bool dir, Shceme shceme = Shceme.ManualNormal)
 {
     if (this.ZReachSafe)
     {
         return(this.MachineAxis.Trun.Jog(SpeedDefine.Instance[Module][shceme, GeneralAxis.TRUN], dir));
     }
     else
     {
         this.ZGoSafe();
         return(-1);
     }
 }
예제 #14
0
 public short TurnGoPos(double pos, Shceme shceme = Shceme.ManualNormal)
 {
     if (this.ZReachSafe)
     {
         return(this.MachineAxis.Trun.GoPos(pos, SpeedDefine.Instance[Module][shceme, GeneralAxis.TRUN]));
     }
     else
     {
         this.ZGoSafe();
         return(-1);
     }
 }
예제 #15
0
        /// <summary>
        /// R轴到初始化角度(慎用)
        /// </summary>
        /// <param name="nozzle"></param>
        /// <param name="shceme"></param>
        /// <returns></returns>
        public short RGoInit(Nozzle nozzle, Shceme shceme = Shceme.ManualNormal)
        {
            short         rtn = 0;
            Axis_RunParam r   = MachineAxis.R[(int)nozzle];

            rtn += r.GoPosTillStop(ConstDefine.iActionTimeout, this.MachineConfig.NozzleMap[nozzle].RInit, SpeedDefine.Instance[Module][shceme, GeneralAxis.U]);
            r.Stop();
            Thread.Sleep(100);
            r.ClearAxisSts();
            r.ZeroAxis();
            return(rtn);
        }
예제 #16
0
        public short ZGoSafe(Shceme shceme = Shceme.ManualNormal)
        {
            short rtn = 0;

            foreach (Nozzle nozzle in Enum.GetValues(typeof(Nozzle)))
            {
                if (nozzle == Nozzle.Nz1 || nozzle == Nozzle.Nz4)
                {
                    rtn += this.ZGoSafe(nozzle, shceme);
                }
            }
            return(rtn);
        }
예제 #17
0
        public short XYGoPosUI(PointF xyPos, Shceme sheme = Shceme.ManualNormal)
        {
            Stopwatch sw = new Stopwatch();

            sw.Restart();
            short rtn = this.XYGoPos(xyPos);

            while (!this.XYReach(xyPos) && sw.ElapsedMilliseconds < 5000)
            {
                CommonHelper.DoEvent(50);
            }
            if (sw.ElapsedMilliseconds > 5000)
            {
                rtn += -1;
            }
            return(rtn);
        }
예제 #18
0
        public short ZGoSafeTillStop(Shceme shceme = Shceme.ManualNormal)
        {
            List <Task <short> > tasks = new List <Task <short> >();

            foreach (Nozzle nozzle in Enum.GetValues(typeof(Nozzle)))
            {
                tasks.Add(Task <short> .Factory.StartNew(() => {
                    return(this.ZGoPosTillStop(nozzle, this.MachineConfig[nozzle].SafeHeight, shceme));
                }));
            }

            Task.WaitAll(tasks.ToArray());
            short rtn = 0;

            for (int i = 0; i < tasks.Count; ++i)
            {
                rtn += tasks[i].Result;
            }

            return(rtn);
        }
예제 #19
0
 public short RJog(Nozzle nozzle, bool dir, Shceme shceme = Shceme.ManualNormal)
 {
     return(this.MachineAxis.R[(int)nozzle].Jog(SpeedDefine.Instance[Module][shceme, GeneralAxis.U], dir));
 }
 private void cbSpeedMode_SelectedIndexChanged(object sender, EventArgs e)
 {
     this.ManualSpeed = (Shceme)this.cbSpeedMode.SelectedIndex;
 }
예제 #21
0
 public short TurnGoSuck(Shceme shceme = Shceme.ManualNormal)
 {
     return(this.TurnGoPos(this.MachineConfig.TrunSuckAngle, shceme));
 }
예제 #22
0
 public short ZGoThrow(Nozzle nozzle, Shceme shceme = Shceme.ManualNormal, double pos = 0)
 {
     return(this.ZGoPos(nozzle, (MachineConfig.NozzleMap[nozzle].DropHeight + pos), shceme));
 }
예제 #23
0
 public short ZGoSafe(Nozzle nozzle, Shceme shceme = Shceme.ManualNormal)
 {
     return(this.ZGoPos(nozzle, MachineConfig.NozzleMap[nozzle].SafeHeight, shceme));
 }
 private void cb_Select_SelectedIndexChanged(object sender, EventArgs e)
 {
     this.selectShceme = (Shceme)this.cb_Select.SelectedIndex;
     UpdateToUI();
 }