Skip to content

Commit

Permalink
Merge pull request #979 from winder/edge
Browse files Browse the repository at this point in the history
Simplify the probe module.
  • Loading branch information
winder committed Mar 31, 2018
2 parents ffefe76 + 9b75058 commit e38325f
Show file tree
Hide file tree
Showing 9 changed files with 293 additions and 637 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2017 Will Winder
Copyright 2017-2018 Will Winder
This file is part of Universal Gcode Sender (UGS).
Expand Down Expand Up @@ -34,7 +34,7 @@ This file is part of Universal Gcode Sender (UGS).
import com.willwinder.ugs.nbp.lib.services.LocalizingService;
import static com.willwinder.ugs.nbp.lib.services.LocalizingService.lang;
import com.willwinder.ugs.nbp.lib.services.TopComponentLocalizer;
import com.willwinder.ugs.platform.probe.ProbeService.ProbeContext;
import com.willwinder.ugs.platform.probe.ProbeService.ProbeParameters;
import com.willwinder.ugs.platform.probe.renderable.CornerProbePathPreview;
import com.willwinder.ugs.platform.probe.renderable.ZProbePathPreview;
import com.willwinder.universalgcodesender.i18n.Localization;
Expand Down Expand Up @@ -230,7 +230,7 @@ public ProbeTopComponent() {
settingsRetractAmount = new SpinnerNumberModel(15., 10, largeSpinner, 1.);

measureXYZ.addActionListener(e -> {
ProbeContext pc = new ProbeContext(
ProbeParameters pc = new ProbeParameters(
getDouble(settingsProbeDiameter), backend.getMachinePosition(),
getDouble(xyzXDistanceModel), getDouble(xyzYDistanceModel), getDouble(xyzZDistanceModel),
getDouble(xyzXOffsetModel), getDouble(xyzYOffsetModel), getDouble(xyzZOffsetModel),
Expand All @@ -241,7 +241,7 @@ public ProbeTopComponent() {
});

measureOutside.addActionListener(e -> {
ProbeContext pc = new ProbeContext(
ProbeParameters pc = new ProbeParameters(
getDouble(settingsProbeDiameter), backend.getMachinePosition(),
getDouble(outsideXDistanceModel), getDouble(outsideYDistanceModel), 0.,
getDouble(outsideXOffsetModel), getDouble(outsideYOffsetModel), 0.,
Expand All @@ -261,7 +261,7 @@ public ProbeTopComponent() {
*/

zProbeButton.addActionListener(e -> {
ProbeContext pc = new ProbeContext(
ProbeParameters pc = new ProbeParameters(
getDouble(settingsProbeDiameter), backend.getMachinePosition(),
0., 0., getDouble(zProbeDistance),
0., 0., getDouble(zProbeOffset),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2017 Will Winder
Copyright 2017-2018 Will Winder
This file is part of Universal Gcode Sender (UGS).
Expand All @@ -18,13 +18,12 @@ This file is part of Universal Gcode Sender (UGS).
*/
package com.willwinder.ugs.platform.probe.renderable;

import com.jogamp.opengl.GL;
import com.jogamp.opengl.GL2;
import com.jogamp.opengl.GLAutoDrawable;
import com.jogamp.opengl.util.gl2.GLUT;
import com.willwinder.ugs.nbm.visualizer.options.VisualizerOptions;
import com.willwinder.ugs.nbm.visualizer.shared.Renderable;
import com.willwinder.ugs.platform.probe.ProbeService.ProbeContext;
import com.willwinder.ugs.platform.probe.ProbeService.ProbeParameters;
import com.willwinder.ugs.platform.probe.renderable.ProbeRenderableHelpers.Side;
import static com.willwinder.ugs.platform.probe.renderable.ProbeRenderableHelpers.Side.NEGATIVE;
import static com.willwinder.ugs.platform.probe.renderable.ProbeRenderableHelpers.Side.POSITIVE;
Expand All @@ -37,17 +36,11 @@ This file is part of Universal Gcode Sender (UGS).
* @author wwinder
*/
public class CornerProbePathPreview extends Renderable {
private Point3d spacing = new Point3d(0, 0, 0);
private Point3d thickness = new Point3d(0, 0, 0);
/*
private Double xSpacing = null;
private Double ySpacing = null;
private Double xThickness = null;
private Double yThickness = null;
*/
private final Point3d spacing = new Point3d(0, 0, 0);
private final Point3d thickness = new Point3d(0, 0, 0);
private Point3d startWork = null;
private Point3d startMachine = null;
private ProbeContext pc = null;
private ProbeParameters pc = null;

private final GLUT glut;

Expand All @@ -56,7 +49,7 @@ public CornerProbePathPreview(String title) {
glut = new GLUT();
}

public void setContext(ProbeContext pc, Point3d startWork, Point3d startMachine) {
public void setContext(ProbeParameters pc, Point3d startWork, Point3d startMachine) {
this.pc = pc;
this.startWork = startWork;
this.startMachine = startMachine;
Expand Down Expand Up @@ -188,19 +181,17 @@ public void draw(GLAutoDrawable drawable, boolean idle, Point3d workCoord, Point

GL2 gl = drawable.getGL().getGL2();

if (startWork != null) {
// After the probe, move it back to the original location
if (pc != null && pc.xWcsOffset != null && pc.yWcsOffset != null && pc.zWcsOffset != null) {
//Point3d originalOffset = new Point3d(this.startMachine);
//originalOffset.sub(this.startWork);
gl.glTranslated(
pc.xWcsOffset,
pc.yWcsOffset,
pc.zWcsOffset);
} else {
if (startWork != null && pc.endPosition == null) {
// The WCS is reset at the start of these operations.
if (pc.startPosition != null) {
}
// Follow tool.
else {
gl.glTranslated(startWork.x, startWork.y, startWork.z);
}
} else {
}
// Follow tool.
else {
gl.glTranslated(workCoord.x, workCoord.y, workCoord.z);
}

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

0 comments on commit e38325f

Please sign in to comment.