//设置轴当前位置 public override bool SetAxisCurrestPosition(int Axis, int Position, int AccEnable, int PulseMode, out string ErrorMessage) { int State = -1; if (Dmc1000_Dll.d1000_check_done(Axis) == 0) { ErrorMessage = Convert.ToString(Axis) + "轴正在运行"; return(false); } State = Dmc1000_Dll.d1000_set_sd(Axis, AccEnable);//设置减速开关是否有效 if (State != ERR_NoError) { ErrorMessage = Convert.ToString(Axis) + "轴设置减速信号使能失败"; return(false); } else { ErrorMessage = Convert.ToString(Axis) + "轴设置减速信号使能成功"; } State = Dmc1000_Dll.d1000_set_pls_outmode(Axis, PulseMode);//设置控制卡脉冲输出模式 if (State != ERR_NoError) { ErrorMessage = Convert.ToString(Axis) + "轴设置控制卡脉冲输出模式失败"; return(false); } else { ErrorMessage = Convert.ToString(Axis) + "轴设置控制卡脉冲输出模式成功"; } State = Dmc1000_Dll.d1000_set_command_pos(Axis, Position); if (State != ERR_NoError) { ErrorMessage = Convert.ToString(Axis) + "轴当前位置设置失败"; return(false); } else { ErrorMessage = Convert.ToString(Axis) + "轴当前位置设置成功"; } return(true); }