| | |
| | | |
| | | public IDevice Device { get; set; } |
| | | |
| | | public MotionCardOperationConfigBase MotionCardOperationConfig { get; set; } |
| | | public MovingOption MotionCardMovingOption { get; set; } = new MovingOption(); |
| | | |
| | | /// <summary> |
| | | /// 当前板卡实例 |
| | |
| | | { |
| | | foreach (var axisConfig in MotionCard.IConfig.AxisSettings.FindAll(u => u.IsAxisEnabled)) |
| | | { |
| | | var axisMovingStatus = MotionCard.AxisMovingOptionValues.FirstOrDefault(u => u.AxisIndex == axisConfig.AxisIndex); |
| | | if (axisMovingStatus != null) |
| | | { |
| | | CtrlMotionCardAxisOperation axisOperation = new CtrlMotionCardAxisOperation(axisMovingStatus.AxisIndex, axisMovingStatus.AxisName); |
| | | axisOperation.Dock = DockStyle.Fill; |
| | | flowLayoutPanel1.Controls.Add(axisOperation); |
| | | } |
| | | CtrlMotionCardAxisOperation axisOperation = new CtrlMotionCardAxisOperation(Device, axisConfig.AxisIndex, axisConfig.AxisName); |
| | | //axisOperation.Dock = DockStyle.Fill; |
| | | flowLayoutPanel1.Controls.Add(axisOperation); |
| | | |
| | | } |
| | | |
| | | MotionCardMovingOption.SetAxisSetting(MotionCard.IConfig.AxisSettings); |
| | | propGrid.SelectedObject = MotionCardMovingOption; |
| | | } |
| | | |
| | | private void buttonClearStatus_Click(object sender, EventArgs e) |
| | | { |
| | | |
| | | MotionCard.ClearStatus(1, MotionCard.IConfig.AxisSettings.FindAll(u => u.IsAxisEnabled).Count); |
| | | } |
| | | |
| | | private void buttonServoEnable_Click(object sender, EventArgs e) |
| | | { |
| | | |
| | | int sts = MotionCard.GetAxisStatus(MotionCardMovingOption.AxisIndex); |
| | | if ((sts & 0x200) == 0)//关闭状态 |
| | | { |
| | | MotionCard.AxisOnAsync(MotionCardMovingOption.AxisIndex); |
| | | buttonServoEnable.Text = "伺服已开启"; |
| | | } |
| | | else |
| | | { |
| | | MotionCard.AxisOffAsync(MotionCardMovingOption.AxisIndex); |
| | | buttonServoEnable.Text = "伺服已关闭"; |
| | | } |
| | | } |
| | | |
| | | private void buttonPositionReset_Click(object sender, EventArgs e) |
| | | { |
| | | |
| | | var res = MotionCard.PositionReset(MotionCardMovingOption.AxisIndex, 1); |
| | | } |
| | | |
| | | private void btnStart_Click(object sender, EventArgs e) |
| | | { |
| | | |
| | | MotionCard.SingleAxisMoving(MotionCardMovingOption).Start(); |
| | | } |
| | | |
| | | private void buttonSmoothStop_Click(object sender, EventArgs e) |
| | | { |
| | | |
| | | MotionCard.MoveStop(MotionCardMovingOption.AxisIndex, 0); |
| | | } |
| | | |
| | | private void buttonEmergencyStop_Click(object sender, EventArgs e) |
| | | { |
| | | |
| | | MotionCard.MoveStop(MotionCardMovingOption.AxisIndex, 1); |
| | | } |
| | | |
| | | } |