|
|
|
|
using log4net.Util;
|
|
|
|
|
using Rs.Motion.Base;
|
|
|
|
|
using Rs.Motion.GugaoEcat;
|
|
|
|
|
using Rs.Motion.GugaoPulse;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Reflection;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace Rs.MotionPlat.Flow
|
|
|
|
|
{
|
|
|
|
|
public class AxisControl
|
|
|
|
|
{
|
|
|
|
|
public static IAxis GetAxis(string axisname)
|
|
|
|
|
{
|
|
|
|
|
Type type = typeof(AxisControl);
|
|
|
|
|
PropertyInfo[] pis = type.GetProperties(System.Reflection.BindingFlags.Static | BindingFlags.Public);
|
|
|
|
|
foreach (var item in pis)
|
|
|
|
|
{
|
|
|
|
|
if (item.Name == axisname)
|
|
|
|
|
{
|
|
|
|
|
IAxis axis =(IAxis) item.GetValue(null);
|
|
|
|
|
return axis;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static List<IAxis> GetAllAxis()
|
|
|
|
|
{
|
|
|
|
|
List<IAxis> allAxis = new List<IAxis>();
|
|
|
|
|
Type type = typeof(AxisControl);
|
|
|
|
|
PropertyInfo[] pis = type.GetProperties(System.Reflection.BindingFlags.Static | BindingFlags.Public);
|
|
|
|
|
foreach (var item in pis)
|
|
|
|
|
{
|
|
|
|
|
IAxis axis = (IAxis)item.GetValue(null);
|
|
|
|
|
allAxis.Add(axis);
|
|
|
|
|
}
|
|
|
|
|
return allAxis;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 固高
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 上料X轴
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static IAxis LoadX
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return GugaoCardManager.Instance.GetCard(0).GetAxis(nameof(LoadX));
|
|
|
|
|
//return GugaoPulseCardManager.Instance.GetCard(0).GetAxis(nameof(LoadX));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 上料Y轴
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static IAxis LoadY
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return GugaoCardManager.Instance.GetCard(0).GetAxis(nameof(LoadY));
|
|
|
|
|
//return GugaoPulseCardManager.Instance.GetCard(0).GetAxis(nameof(LoadY));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 周转Y轴
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static IAxis TurnoverY
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return GugaoCardManager.Instance.GetCard(0).GetAxis(nameof(TurnoverY));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 周转Z轴
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static IAxis TurnoverZ
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return GugaoCardManager.Instance.GetCard(0).GetAxis(nameof(TurnoverZ));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 测试Z
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static IAxis PressZ
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return GugaoCardManager.Instance.GetCard(0).GetAxis(nameof(PressZ));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 吸嘴Z
|
|
|
|
|
public static IAxis NozzleZ1
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return ZtmCardManager.Instance.GetCard(1).GetAxis(nameof(NozzleZ1));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public static IAxis NozzleZ2
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return ZtmCardManager.Instance.GetCard(1).GetAxis(nameof(NozzleZ2));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 吸嘴R
|
|
|
|
|
public static IAxis NozzleR1
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return ZtmCardManager.Instance.GetCard(1).GetAxis(nameof(NozzleR1));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public static IAxis NozzleR2
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return ZtmCardManager.Instance.GetCard(1).GetAxis(nameof(NozzleR2));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 全部使能
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 全部使能
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static void AllEnable()
|
|
|
|
|
{
|
|
|
|
|
Type type = typeof(AxisControl);
|
|
|
|
|
PropertyInfo[] pis = type.GetProperties(System.Reflection.BindingFlags.Static | BindingFlags.Public);
|
|
|
|
|
foreach (var item in pis)
|
|
|
|
|
{
|
|
|
|
|
IAxis axis = ((IAxis)item.GetValue(null));
|
|
|
|
|
if(axis != null)
|
|
|
|
|
{
|
|
|
|
|
axis.Stop();
|
|
|
|
|
axis.Enable();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region 全部轴去使能
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 全部轴去使能
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static void AllDisable()
|
|
|
|
|
{
|
|
|
|
|
Type type = typeof(AxisControl);
|
|
|
|
|
PropertyInfo[] pis = type.GetProperties(System.Reflection.BindingFlags.Static | BindingFlags.Public);
|
|
|
|
|
foreach (var item in pis)
|
|
|
|
|
{
|
|
|
|
|
IAxis axis = ((IAxis)item.GetValue(null));
|
|
|
|
|
if(axis!=null)
|
|
|
|
|
{
|
|
|
|
|
axis.Stop();
|
|
|
|
|
Thread.Sleep(10);
|
|
|
|
|
axis.Disable();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
public static void AllAbortHome()
|
|
|
|
|
{
|
|
|
|
|
Type type = typeof(AxisControl);
|
|
|
|
|
PropertyInfo[] pis = type.GetProperties(System.Reflection.BindingFlags.Static | BindingFlags.Public);
|
|
|
|
|
foreach (var item in pis)
|
|
|
|
|
{
|
|
|
|
|
IAxis axis = ((IAxis)item.GetValue(null));
|
|
|
|
|
if(axis!=null)
|
|
|
|
|
{
|
|
|
|
|
axis.Abort_Go_Home();
|
|
|
|
|
Thread.Sleep(10);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 全部停止
|
|
|
|
|
/// </summary>
|
|
|
|
|
public static void AllStop()
|
|
|
|
|
{
|
|
|
|
|
Type type = typeof(AxisControl);
|
|
|
|
|
PropertyInfo[] pis = type.GetProperties(System.Reflection.BindingFlags.Static | BindingFlags.Public);
|
|
|
|
|
foreach (var item in pis)
|
|
|
|
|
{
|
|
|
|
|
IAxis axis = ((IAxis)item.GetValue(null));
|
|
|
|
|
if(axis!=null) {
|
|
|
|
|
axis.Stop();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|