private void moveAxisAbs(ZaberBinaryDevice axis, int pos) { if (axis != null && !probeInContact()) { axis.MoveAbsolute(pos); } }
private void moveAbsoluteDistance(TextBox txtDist, TextBox txtResult, ZaberBinaryDevice axis) { if (axis != null) { try { int dist = convertToInternalUnits(Convert.ToDouble(txtDist.Text)); moveAxisAbs(axis, dist); txtResult.Text = convertToMM(axis.GetPosition()).ToString(); updateErrorState(InternalErrorState.NoError); } catch (FormatException ex) { updateErrorState(InternalErrorState.WrongNumberFormat); } catch (OverflowException ex) { updateErrorState(InternalErrorState.WrongNumberFormat); } catch (UnexpectedReplyReceivedException ex) { updateErrorState(InternalErrorState.RequestOutOfRange); } } }
private void initializeZaberDevice() { string selectedPort = txtCOMPort.Text; if (selectedPort == null) { selectedPort = "COM1"; } zaberPort = new ZaberBinaryPort(selectedPort); try { zaberPort.Open(); List <IZaberAxis> axes = zaberPort.FindAxes(); if (axes.Count() == 3) { axisX = new ZaberBinaryDevice(zaberPort, 2); axisY = new ZaberBinaryDevice(zaberPort, 3); axisZ = new ZaberBinaryDevice(zaberPort, 1); updateAxesPos(); lblInitialized.Text = "Initialized"; } } catch { updateErrorState(InternalErrorState.COMPortNotOpened); } }
private void initializeZaberDevice() { string selectedPort = txtComPort.Text; if (selectedPort == null) { selectedPort = "COM1"; } zaberPort = new ZaberBinaryPort(selectedPort); try { zaberPort.Open(); List <IZaberAxis> axes = zaberPort.FindAxes(); if (axes.Count() == 3) { axisX = new ZaberBinaryDevice(zaberPort, 2); axisY = new ZaberBinaryDevice(zaberPort, 3); axisZ = new ZaberBinaryDevice(zaberPort, 1); updateAxesPos(); cmdInitialize.BackColor = Color.LawnGreen; } } catch (Exception ex) { cmdInitialize.BackColor = Color.Red; } }
private void moveRelativeDistance(TextBox txtDist, TextBox txtResult, ZaberBinaryDevice axis, int dir, bool ignoreProbeContact) { if (axis != null) { try { updateCurrentState(getAxisMoving(axis)); int dist = dir * convertToInternalUnits(Convert.ToDouble(txtDist.Text)); moveAxisRel(axis, dist, ignoreProbeContact); txtResult.Text = convertToMM(axis.GetPosition()).ToString(); updateErrorState(InternalErrorState.NoError); } catch (FormatException ex) { updateErrorState(InternalErrorState.WrongNumberFormat); } catch (OverflowException ex) { updateErrorState(InternalErrorState.WrongNumberFormat); } catch (UnexpectedReplyReceivedException ex) { updateErrorState(InternalErrorState.RequestOutOfRange); } } }
private double getAxisPos(ZaberBinaryDevice axis) { if (axis != null) { return(convertToMM(axis.GetPosition())); } return(-1); }
private void moveAxisRel(ZaberBinaryDevice axis, int dist) { if (axis != null) { axis.MoveRelative(dist); axis.PollUntilIdle(); } }
private void moveAxisAbs(ZaberBinaryDevice axis, int pos) { if (axis != null) { axis.MoveAbsolute(pos); axis.PollUntilIdle(); } }
private void moveAxisRel(ZaberBinaryDevice axis, int dist, bool ignoreProbeContact) { if (axis != null) { if (ignoreProbeContact) { axis.MoveRelative(dist); } else if (!probeInContact()) { axis.MoveRelative(dist); } } }
private CurrentState getAxisMoving(ZaberBinaryDevice axis) { CurrentState state = CurrentState.Idle; if (axis != null) { if (axis == axisX) { state = CurrentState.MovingXAxis; } if (axis == axisY) { state = CurrentState.MovingYAxis; } if (axis == axisZ) { state = CurrentState.MovingZAxis; } } return(state); }
private void moveAbsoluteDistance(MaskedTextBox txtDist, MaskedTextBox txtResult, ZaberBinaryDevice axis) { if (axis != null) { try { int dist = convertToInternalUnits(Convert.ToDouble(txtDist.Text)); moveAxisAbs(axis, dist); txtResult.Text = convertToMM(axis.GetPosition()).ToString(); } catch (Exception ex) { } } }