/// <summary> /// 配置单位脉冲数 /// 返回3 成功; /// 返回4 失败 /// </summary> /// <param name="handle">设备句柄</param> /// <param name="StepsPerUnit">单位脉冲数</param> /// <returns></returns> public static int AsuMotion_SetStepsPerUnit(IntPtr handle, ref AsuMotionAxisDataInt StepsPerUnit) { AsuMotionError ret = AsuMotionSetStepsPerUnit(handle, ref StepsPerUnit); switch (ret) { case AsuMotionError.AsuMotion_True: LogHelper.WriteLog("配置单位脉冲数 成功"); return(3); default: LogHelper.WriteLog("配置单位脉冲数 失败" + "---" + AsuMotion_GetErrorMessage(4)); return(4); // AsuMotion_False } }
/// <summary> /// 当前机器坐标位置脉冲数获取 /// 目前直接返回 AsuMotion_True,但不确定之后的sdk失败会返回什么,所以按如下返回: /// 返回3 成功; /// 返回4 失败 /// </summary> /// <param name="handle">设备句柄</param> /// <param name="steps">一个存储各轴脉冲数的结构体</param> /// <returns></returns> public static int AsuMotion_GetSteps(IntPtr handle, out AsuMotionAxisDataInt steps) { AsuMotionError ret = AsuMotionGetSteps(handle, out steps); switch (ret) { case AsuMotionError.AsuMotion_True: LogHelper.WriteLog("当前机器坐标位置脉冲数获取 成功"); return(3); default: LogHelper.WriteLog("当前机器坐标位置脉冲数获取 失败" + "---" + AsuMotion_GetErrorMessage(4)); return(4); // AsuMotion_False } }
/// <summary> /// 配置工作偏移 /// 返回3 成功; /// 返回4 失败 /// </summary> /// <param name="handle">设备句柄</param> /// <param name="WorkOffset">工作偏移</param> /// <returns></returns> public static int AsuMotion_SetWorkOffset(IntPtr handle, ref AsuMotionAxisDataInt WorkOffset) { AsuMotionError ret = AsuMotionSetWorkOffset(handle, ref WorkOffset); switch (ret) { case AsuMotionError.AsuMotion_True: LogHelper.WriteLog("配置工作偏移 成功"); return(3); default: LogHelper.WriteLog("配置工作偏移 失败" + "---" + AsuMotion_GetErrorMessage(4)); return(4); // AsuMotion_False } }
public static extern AsuMotionError AsuMotionSetWorkOffset(IntPtr AsuMotion, ref AsuMotionAxisDataInt WorkOffset);
public static extern AsuMotionError AsuMotionSetStepsPerUnit(IntPtr AsuMotion, ref AsuMotionAxisDataInt StepsPerUnit);
public static extern AsuMotionError AsuMotionGetSteps(IntPtr AsuMotion, out AsuMotionAxisDataInt Steps);