You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
217 lines
5.7 KiB
C#
217 lines
5.7 KiB
C#
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 固高1
|
|
|
|
/// <summary>
|
|
/// 上料X轴
|
|
/// </summary>
|
|
public static IAxis LoadX
|
|
{
|
|
get
|
|
{
|
|
return GugaoPulseCardManager.Instance.GetCard(0).GetAxis(nameof(LoadX));
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 上料Y轴
|
|
/// </summary>
|
|
public static IAxis LoadY1
|
|
{
|
|
get
|
|
{
|
|
return GugaoPulseCardManager.Instance.GetCard(0).GetAxis(nameof(LoadY1));
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 周转X轴
|
|
/// </summary>
|
|
public static IAxis LoadY2
|
|
{
|
|
get
|
|
{
|
|
return GugaoPulseCardManager.Instance.GetCard(0).GetAxis(nameof(LoadY2));
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 周转Y轴
|
|
/// </summary>
|
|
public static IAxis TakeTrayX
|
|
{
|
|
get
|
|
{
|
|
return GugaoPulseCardManager.Instance.GetCard(0).GetAxis(nameof(TakeTrayX));
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 周转Z轴
|
|
/// </summary>
|
|
public static IAxis StockZ1
|
|
{
|
|
get
|
|
{
|
|
return GugaoPulseCardManager.Instance.GetCard(0).GetAxis(nameof(StockZ1));
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 测试Z
|
|
/// </summary>
|
|
public static IAxis StockZ2
|
|
{
|
|
get
|
|
{
|
|
return GugaoPulseCardManager.Instance.GetCard(0).GetAxis(nameof(StockZ2));
|
|
}
|
|
}
|
|
|
|
public static IAxis StockZ3
|
|
{
|
|
get
|
|
{
|
|
return GugaoPulseCardManager.Instance.GetCard(0).GetAxis(nameof(StockZ3));
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 固高2
|
|
public static IAxis NozzleZ1
|
|
{
|
|
get
|
|
{
|
|
return GugaoPulseCardManager.Instance.GetCard(1).GetAxis(nameof(NozzleZ1));
|
|
}
|
|
}
|
|
public static IAxis NozzleZ2
|
|
{
|
|
get
|
|
{
|
|
return GugaoPulseCardManager.Instance.GetCard(1).GetAxis(nameof(NozzleZ2));
|
|
}
|
|
}
|
|
public static IAxis NozzleZ3
|
|
{
|
|
get
|
|
{
|
|
return GugaoPulseCardManager.Instance.GetCard(1).GetAxis(nameof(NozzleZ3));
|
|
}
|
|
}
|
|
public static IAxis NozzleZ4
|
|
{
|
|
get
|
|
{
|
|
return GugaoPulseCardManager.Instance.GetCard(1).GetAxis(nameof(NozzleZ4));
|
|
}
|
|
}
|
|
|
|
|
|
#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));
|
|
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));
|
|
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));
|
|
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));
|
|
axis.Stop();
|
|
}
|
|
}
|
|
}
|
|
}
|