use of com.willwinder.universalgcodesender.model.Position in project Universal-G-Code-Sender by winder.
the class LineSplitterTest method testDiagonalLine.
/**
* Line running across all axes.
*/
@Test
public void testDiagonalLine() throws Exception {
System.out.println("diagonalLine");
List<String> expected = Arrays.asList("G1X-0.5Y-0.5Z-0.5", "G1X0Y0Z0", "G1X0.5Y0.5Z0.5", "G1X1Y1Z1");
splitterHarness(1, new Position(-1, -1, -1, MM), "G1X1Y1Z1", expected);
}
use of com.willwinder.universalgcodesender.model.Position in project Universal-G-Code-Sender by winder.
the class LineSplitterTest method testIgnoreShortLine.
/**
* Lines shorter than the length should not modify the input command.
*/
@Test
public void testIgnoreShortLine() throws Exception {
System.out.println("shortLine");
String command = "G1X0.01";
double length = 2;
List<String> expected = Arrays.asList(command);
splitterHarness(length, new Position(0, 0, 0, MM), command, expected);
}
use of com.willwinder.universalgcodesender.model.Position in project Universal-G-Code-Sender by winder.
the class LineSplitterTest method testIgnoreNonLines.
/**
* Commands without G0/G1 should not be modified.
*/
@Test
public void testIgnoreNonLines() throws Exception {
System.out.println("ignoreNonLines");
LineSplitter instance = new LineSplitter(1.5);
String command;
GcodeState state = new GcodeState();
state.currentPoint = new Position(0, 0, 0, MM);
state.inAbsoluteMode = true;
command = "G20G2X1Y1Z1";
List<String> result = instance.processCommand(command, state);
assertThat(result).containsExactly(command);
command = "G17";
result = instance.processCommand(command, state);
assertThat(result).containsExactly(command);
}
use of com.willwinder.universalgcodesender.model.Position in project Universal-G-Code-Sender by winder.
the class LineSplitterTest method testSloppyFractionRounding.
/**
* Sloppy fractional result.
* (0,0,0, MM) -> (1,0,0, MM) line needs to split into 3 parts.
* Verify that the infinite fraction is truncated to 4 digits.
* Verify that the endpoint equals the real endpoint not the interpolated endpoint.
*/
@Test
public void testSloppyFractionRounding() throws Exception {
System.out.println("sloppyFractions");
double maxSegmentLength = 0.4;
String command = "G1X1";
List<String> expected = Arrays.asList("G1X0.3333Y0Z0", "G1X0.6667Y0Z0", "G1X1Y0Z0");
splitterHarness(maxSegmentLength, new Position(0, 0, 0, MM), command, expected);
}
use of com.willwinder.universalgcodesender.model.Position in project Universal-G-Code-Sender by winder.
the class MeshLevelerTest method testUnexpectedArc.
@Test
public void testUnexpectedArc() throws GcodeParserException {
expectedEx.expect(GcodeParserException.class);
expectedEx.expectMessage(MeshLeveler.ERROR_UNEXPECTED_ARC);
MeshLeveler ml = new MeshLeveler(0.0, BIG_FLAT_GRID_Z0, Units.MM);
GcodeState state = new GcodeState();
state.currentPoint = new Position(0, 0, 0, MM);
state.inAbsoluteMode = true;
ml.processCommand("G2X1", state);
}
Aggregations