public void DoSystemRead(define_system.TConfigReader reader) { //控制位置 //控制轴 for (int axis = 0; axis < Items.Length; axis++) { define_motion.MotionItem item = Items[axis]; item.AxisCard = reader.GetUshort(wp_axis_card + axis.ToString()); item.AxisCode = reader.GetUshort(wp_axis_code + axis.ToString()); item.AxisMask = (uint)1 << axis;//相应轴位置为1,取轴状态 item.isLimit = reader.GetBool(wp_axis_limit + axis.ToString()); item.isServo = reader.GetBool(wp_axis_servo + axis.ToString()); item.AxisCode = reader.GetUshort(wp_axis_code + axis.ToString()); //item.AxisScale = reader.GetFloat(wp_axis_scale + axis.ToString()); item.SlowSpeed = reader.GetInt(wp_axis_slow + axis.ToString()); item.HomeSpeed = reader.GetInt(wp_axis_home + axis.ToString()); item.FastSpeed = reader.GetInt(wp_axis_fast + axis.ToString()); item.WorkSpeed = reader.GetInt(wp_axis_work + axis.ToString()); item.AccTime = reader.GetInt(wp_axis_acc + axis.ToString()); item.OrginOff = reader.GetInt(wp_axis_ogoff + axis.ToString()); item.OrginMov = reader.GetInt(wp_axis_ormov + axis.ToString()); item.LimitNeg = reader.GetInt(wp_axis_ppneg + axis.ToString()); item.LimitPos = reader.GetInt(wp_axis_pppos + axis.ToString()); } }
public void DoSystemRead(string filepath) { mSysPath = Path.GetDirectoryName(filepath) + "\\"; mSysFile = mSysPath + "系统基础参数.cfg"; define_system.TConfigReader reader = new define_system.TConfigReader(); try { reader.DoOpen(mSysFile); pMotion.DoSystemRead(reader); reader.DoClose(); } catch { //提醒 MessageBox.Show("配置文件读取错误"); } }