Exemple #1
0
        private void BT_MouseUp(object sender, MouseEventArgs e)
        {
            ButtonEx bt = sender as ButtonEx;

            if (bt != null && bt.Tag != null)
            {
                IAmpCProvider provider = bt.Tag as IAmpCProvider;
                if (provider != null)
                {
                    if (BT5.Pressed)
                    {
                        Common.AxisJogStep(provider, bt.Flag);
                    }
                    else
                    {
                        if (wait)
                        {
                            provider.JogInc(provider.Param.JogVelSlow, provider.Param.JogAccSlow, 0.001f * bt.Flag);
                            wait = false;
                        }
                        else
                        {
                            provider.JogStop();//停止移动
                        }
                    }
                }
            }
        }
Exemple #2
0
 public static bool WaitAxisMoveDone(IAmpCProvider ampC, int timeout = 600)
 {
     if (ampC == null)
     {
         return(false);
     }
     do
     {
         if (Globals.EMG)
         {
             return(false);
         }
         //if (ampC.AmpCFault)
         //{
         //    return false;
         //}
         if (timeout != -1 && timeout-- < 0)
         {
             ReportCmdKeyProgress(CmdKey.S0094);
             return(false);
         }
         Thread.Sleep(50);
     } while (!ampC.IsInPosition);
     return(true);
 }
Exemple #3
0
        private void AxisSlowJogStop(object sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Left)
            {
                return;
            }
            ButtonEx bt = sender as ButtonEx;

            if (bt != null && bt.Tag != null)
            {
                IAmpCProvider provider = bt.Tag as IAmpCProvider;
                if (provider != null)
                {
                    if (wait)
                    {
                        provider.JogInc(provider.Param.JogVelSlow, provider.Param.JogAccSlow, 0.001f * bt.Flag);
                        wait = false;
                    }
                    else
                    {
                        provider.JogStop();//停止移动
                    }
                }
            }
        }
Exemple #4
0
 public static bool AxisJogStep(IAmpCProvider ampC, int dir)
 {
     if (ampC != null && ampC.IsInPosition)
     {
         return(ampC.AxisJogIncWork(ampC.Param.StepPos * dir));//向前或向后移动固定距离 后期进行更改
     }
     else
     {
         return(false);
     }
 }
Exemple #5
0
 public bool InitAxisSystemParam()
 {
     foreach (var item in hwLib.Values)
     {
         IAmpCProvider provider = item as IAmpCProvider;
         if (provider != null)
         {
             provider.InitSystemParam();
         }
     }
     return(true);
 }
Exemple #6
0
        static bool InitAxisSystemParam()
        {
            bool flag = true;

            foreach (var item in hwProvider.HwLib.Values)
            {
                IAmpCProvider provider = item as IAmpCProvider;
                if (provider != null)
                {
                    flag &= provider.InitSystemParam();
                }
            }
            Globals.AppFunState = SysFunState.IDIE;
            return(flag);
        }
Exemple #7
0
        private void AxisSlowJogDone(object sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Left)
            {
                return;
            }
            ButtonEx bt = sender as ButtonEx;

            if (bt != null)
            {
                provider = bt.Tag as IAmpCProvider;
                dir      = bt.Flag;
                wait     = true;
                waitTick = 0;
            }
        }
Exemple #8
0
        private void BT_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Left)
            {
                return;
            }
            ButtonEx bt = sender as ButtonEx;

            if (bt != null && bt.Tag != null)
            {
                if (!BT5.Pressed)//低倍步进值
                {
                    provider = bt.Tag as IAmpCProvider;
                    dir      = bt.Flag;
                    wait     = true;
                    waitTick = 0;
                }
            }
        }
Exemple #9
0
        private void ProcessAxisBtClick(ButtonEx bt, bool dirMode)
        {
            IAmpCProvider ampC = bt.Tag as IAmpCProvider;

            if (ampC != null)
            {
                if (dirMode)
                {
                    ampC.JogStop();
                }
                else
                {
                    if (ampC.IsInPosition)
                    {
                        Common.AxisJogStep(ampC, bt.Flag);
                    }
                }
            }
        }
Exemple #10
0
        private void AxisBt_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Left)
            {
                return;
            }
            if (modeBt.Pressed)
            {
                return;
            }
            ButtonEx bt = sender as ButtonEx;

            if (bt != null)
            {
                provider = bt.Tag as IAmpCProvider;
                if (provider != null)
                {
                    provider.AxisJogDir(bt.Flag);
                }
            }
        }
Exemple #11
0
        private IAmpCProvider CreateSigleAmpCObject(XmlNode node, HardwareType hw)
        {
            if (node == null)
            {
                return(null);
            }
            XmlNode item = node.SelectSingleNode(hw.ToString());

            if (item == null)
            {
                return(null);
            }
            if (hwLib.ContainsKey(hw) && hwLib[hw] is IAmpCProvider)
            {
                return((IAmpCProvider)hwLib[hw]);
            }
            try
            {
                XmlAttribute  attr     = item.Attributes["Type"];
                Type          type     = Type.GetType(attr.Value, false);//反射获取对象类型
                IAmpCProvider provider = Activator.CreateInstance(type) as IAmpCProvider;
                if (provider != null)
                {
                    int     dev = 0;
                    XmlNode n   = item.SelectSingleNode("Params");
                    int.TryParse(n.Attributes["Driver"].Value, out dev);
                    provider.DevIndex = dev;
                    int.TryParse(n.Attributes["Index"].Value, out dev);
                    provider.AmpCIndex = dev;
                    provider.Param     = Serialize.XmlDeSerialize(n) as AxisParams;
                    hwLib.Add(hw, provider);
                }
                return(provider);
            }
            catch (Exception ex)
            {
                LogHelper.WriteDebugException(ex);
                return(null);
            }
        }
Exemple #12
0
        private void AxisButton_MouseDown(object sender, MouseEventArgs e)
        {
            ButtonEx bt = sender as ButtonEx;
            IAmpCProvider ampc = bt.Tag as IAmpCProvider;
            if (ampc == Common.X_Axis)
            {
                if (!xStepMode)
                {
                    ampc.JogDir(xSpeed.Value,xAcc.Value,bt.Flag);
                }
            }
            else if (ampc == Common.Y_Axis)
            {
                if (!yStepMode)
                {
                    ampc.JogDir(ySpeed.Value, yAcc.Value, bt.Flag);
                }
            }
            else if (ampc == Common.Z_Axis)
            {
                if (!zStepMode)
                {
                    ampc.JogDir(zSpeed.Value, zAcc.Value, bt.Flag);
                }
            }
            else if (ampc == Common.T_Axis)
            {
                if (!tStepMode)
                {
                    ampc.JogDir(tSpeed.Value, tAcc.Value, bt.Flag);
                }
            }
            else
            {

            }
        }
Exemple #13
0
        private XmlNode SaveSingleAmpCObject(HardwareType hwType, IAmpCProvider item, XmlDocument document)
        {
            if (item == null)
            {
                return(null);
            }
            XmlNode      ampC = document.CreateElement(hwType.ToString());
            XmlAttribute attr = document.CreateAttribute("Type");

            attr.Value = item.GetType().FullName;
            ampC.Attributes.Append(attr);
            XmlNode amp = document.CreateElement("Params");

            attr       = document.CreateAttribute("Driver");
            attr.Value = item.DevIndex.ToString();
            amp.Attributes.Append(attr);

            attr       = document.CreateAttribute("Index");
            attr.Value = item.AmpCIndex.ToString();
            amp.Attributes.Append(attr);
            Serialize.XmlSerialize(item.Param, amp);
            ampC.AppendChild(amp);
            return(ampC);
        }
Exemple #14
0
        private void AxisButton_MouseUp(object sender, MouseEventArgs e)
        {
            ButtonEx bt = sender as ButtonEx;
            IAmpCProvider ampc = bt.Tag as IAmpCProvider;
            if (ampc == Common.X_Axis)
            {
                if (!xStepMode)
                {
                    ampc.JogStop();
                }
                else
                {
                    if (ampc.IsInPosition)
                    {
                        ampc.JogInc(xSpeed.Value, xAcc.Value, xStep.Value);
                    }
                    else
                    {
                        Common.ReportCmdKeyProgress(CmdKey.S0014);
                    }
                }
            }
            else if (ampc == Common.Y_Axis)
            {
                if (!yStepMode)
                {
                    ampc.JogStop();
                }
                else
                {
                    if (ampc.IsInPosition)
                    {
                        ampc.JogInc(ySpeed.Value, yAcc.Value, yStep.Value);
                    }
                    else
                    {
                        Common.ReportCmdKeyProgress(CmdKey.S0014);
                    }
                }
            }
            else if (ampc == Common.Z_Axis)
            {
                if (!zStepMode)
                {
                    ampc.JogStop();
                }
                else
                {
                    if (ampc.IsInPosition)
                    {
                        ampc.JogInc(zSpeed.Value, zAcc.Value, zStep.Value);
                    }
                    else
                    {
                        Common.ReportCmdKeyProgress(CmdKey.S0014);
                    }
                }
            }
            else if (ampc == Common.T_Axis)
            {
                if (!tStepMode)
                {
                    ampc.JogStop();
                }
                else
                {
                    if (ampc.IsInPosition)
                    {
                        ampc.JogInc(tSpeed.Value, tAcc.Value, tStep.Value);
                    }
                    else
                    {
                        Common.ReportCmdKeyProgress(CmdKey.S0014);
                    }
                }
            }
            else
            {

            }
        }