Exemple #1
0
        private void Move(Axes axis, int?coordinate = null, int?speed = null, Direction?dir = null)
        {
            try
            {
                if (IsStopped)
                {
                    return;
                }

                _activeAxis = axis;

                if (coordinate == null && speed == null)
                {
                    return;
                }

                SelectCurrentComPort();

                PinnedPosition = PinnedPositions.Moving;

                if (coordinate.HasValue)
                {
                    var _speed = XemoDLL.MB_AGet((short)axis, XemoConst.Speed);
                    if (speed.HasValue)
                    {
                        XemoDLL.MB_ASet((short)axis, XemoConst.Speed, speed.Value);
                    }

                    //XemoDLL.MB_Delay(100);

                    XemoDLL.MB_Amove((short)axis, coordinate.Value);
                    XemoDLL.MB_Still((short)axis);

                    XemoDLL.MB_ASet((short)axis, XemoConst.Speed, _speed);

                    //XemoDLL.MB_Delay(1000);

                    return;
                }

                if (speed.HasValue && dir.HasValue)
                {
                    XemoDLL.MB_Jog((short)axis, (int)dir.Value * speed.Value);
                    return;
                }
            }
            catch (Exception ex)
            {
                Report.Notify(new Message(Codes.ERR_XM_MOVE_UNREG)
                {
                    DetailedText = ex.Message
                });
            }
        }
Exemple #2
0
 private int GetAxisParameter(Axes axis, short paramCode)
 {
     SelectCurrentComPort();
     return(XemoDLL.MB_AGet((short)axis, paramCode));
 }