public Tuple <short, string> GetParaReferencePosition(ushort flib, int type, short axis, ref double data) { if (type < 1 || type > 4) { return(new Tuple <short, string>(-100, $"获得参考点数据失败,参数设定错误")); } Focas1.IODBPSD param = new Focas1.IODBPSD(); short number = (short)(1239 + type); var ret = Focas1.cnc_rdparam3(flib, number, axis, 12, 1, param); if (ret != 0) { if (ret == 2) { return(new Tuple <short, string>(ret, $"获得参考点数据失败,功能调用错误")); } if (ret == 3) { return(new Tuple <short, string>(ret, $"获得参考点数据失败,参数号错误")); } if (ret == 4) { return(new Tuple <short, string>(ret, $"获得参考点数据失败,轴号错误")); } return(new Tuple <short, string>(ret, $"获得参考点数据失败,{GetGeneralErrorMessage(ret)}")); } data = param.u.rdatas[0].prm_val * Math.Pow(-10, param.u.rdatas[0].dec_val); return(new Tuple <short, string>(0, null)); }
//查询参数 #region cnc_rdparam short IMachineFanuc.GetParameter(short para, out int res) { short ret; Focas1.IODBPSD iod = new Focas1.IODBPSD(); ret = Focas1.cnc_rdparam(mFlibhndl, para, 0, 8, iod); res = iod.u.idata; return(ret); }
public Tuple <short, string> WriteParaReferencePosition(ushort flib, int type, short axis, double data) { if (type < 1 || type > 4) { return(new Tuple <short, string>(-100, "写入参考点数据失败,参数设定错误")); } var temp_rdata = data.GetDecimals(); Focas1.IODBPSD param = new Focas1.IODBPSD(); param.datano = (short)(1239 + type); param.type = axis; param.u.rdatas[0].prm_val = temp_rdata.Item1; param.u.rdatas[0].dec_val = temp_rdata.Item2; var ret = Focas1.cnc_wrparam(flib, 12, param); if (ret != 0) { if (ret == 2) { return(new Tuple <short, string>(ret, $"写入参考点数据失败,功能调用错误")); } if (ret == 3) { return(new Tuple <short, string>(ret, $"写入参考点数据失败,参数号错误")); } if (ret == 4) { return(new Tuple <short, string>(ret, $"写入参考点数据失败,轴号错误")); } if (ret == 6) { return(new Tuple <short, string>(ret, $"写入参考点数据失败,选项功能错误")); } if (ret == 7) { return(new Tuple <short, string>(ret, $"写入参考点数据失败,写操作禁止")); } if (ret == 17) { return(new Tuple <short, string>(ret, $"写入参考点数据失败,写入数据被保护")); } return(new Tuple <short, string>(ret, $"写入参考点数据失败,{GetGeneralErrorMessage(ret)}")); } return(new Tuple <short, string>(0, null)); }
public Tuple <short, string> ReadWorkpartNum(ushort flib, ref ReadWorkpartNumResultModel data) { Focas1.IODBPSD param3 = new Focas1.IODBPSD(); var ret = Focas1.cnc_rdparam(flib, 6711, 0, 8, param3); if (ret == 0) { data.Value = param3.u.ldata; return(new Tuple <short, string>(0, null)); } else { return(new Tuple <short, string>(ret, $"读取加工工件信息错误,返回:{ret}")); } }
public Tuple <short, string> ReadCycleTime(ushort flib, ref ReadCycleTimeResultModel data) { Focas1.IODBPSD param1 = new Focas1.IODBPSD(); var ret_cy1 = Focas1.cnc_rdparam(flib, 6757, -1, 8, param1); Focas1.IODBPSD param2 = new Focas1.IODBPSD(); var ret_cy2 = Focas1.cnc_rdparam(flib, 6758, -1, 8, param2); if (ret_cy1 == 0 && ret_cy2 == 0) { data.Value = param1.u.ldata / 1000 + param2.u.ldata * 60; return(new Tuple <short, string>(0, null)); } else { return(new Tuple <short, string>(ret_cy1, $"读取加工工件信息错误,返回:{ret_cy1}(1),{ret_cy2}(2)")); } }