Search in sources :

Example 6 with GcodeState

use of com.willwinder.universalgcodesender.gcode.GcodeState in project Universal-G-Code-Sender by winder.

the class MeshLevelerTest method testMultipleCommandsWithLine.

@Test
public void testMultipleCommandsWithLine() throws GcodeParserException {
    expectedEx.expect(GcodeParserException.class);
    expectedEx.expectMessage(Localization.getString("parser.processor.general.multiple-commands"));
    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("G1X1G20", state);
}
Also used : GcodeState(com.willwinder.universalgcodesender.gcode.GcodeState) Position(com.willwinder.universalgcodesender.model.Position) Test(org.junit.Test)

Example 7 with GcodeState

use of com.willwinder.universalgcodesender.gcode.GcodeState in project Universal-G-Code-Sender by winder.

the class MeshLevelerTest method testUnevenSurface.

@Test
public void testUnevenSurface() throws GcodeParserException {
    /*
                   10
      z=-10 *         |         * z=10
                      |
                      |
        -10 --------------------- 10
                      |
                      |
      z=-10 *         |         * z=10
                   -10
        */
    Position[][] grid = { { new Position(-10, -10, -10, MM), new Position(-10, 10, -10, MM) }, { new Position(10, -10, 10, MM), new Position(10, 10, 10, MM) } };
    MeshLeveler ml = new MeshLeveler(0.0, grid, Units.MM);
    GcodeState state = new GcodeState();
    state.currentPoint = new Position(-10, -10, 0, MM);
    state.inAbsoluteMode = true;
    // Moving along Y axis on flat line
    sendCommandExpectResult(ml, state, "G1Y-5", "G1X-10Y-5Z-10");
    sendCommandExpectResult(ml, state, "G1Y0", "G1X-10Y0Z-10");
    sendCommandExpectResult(ml, state, "G1Y5", "G1X-10Y5Z-10");
    sendCommandExpectResult(ml, state, "G1Y10", "G1X-10Y10Z-10");
    // Moving along X axis up slope
    sendCommandExpectResult(ml, state, "G1X-5", "G1X-5Y-10Z-5");
    sendCommandExpectResult(ml, state, "G1X0", "G1X0Y-10Z0");
    sendCommandExpectResult(ml, state, "G1X5", "G1X5Y-10Z5");
    sendCommandExpectResult(ml, state, "G1X10", "G1X10Y-10Z10");
    // Moving up slope along X/Y
    sendCommandExpectResult(ml, state, "G1X-5Y-5", "G1X-5Y-5Z-5");
    sendCommandExpectResult(ml, state, "G1X0Y0", "G1X0Y0Z0");
    sendCommandExpectResult(ml, state, "G1X5Y5", "G1X5Y5Z5");
    sendCommandExpectResult(ml, state, "G1X10Y10", "G1X10Y10Z10");
}
Also used : Position(com.willwinder.universalgcodesender.model.Position) GcodeState(com.willwinder.universalgcodesender.gcode.GcodeState) Test(org.junit.Test)

Example 8 with GcodeState

use of com.willwinder.universalgcodesender.gcode.GcodeState in project Universal-G-Code-Sender by winder.

the class MeshLevelerTest method testNoZChangesWithFlatMeshOnSurface.

@Test
public void testNoZChangesWithFlatMeshOnSurface() throws GcodeParserException {
    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;
    sendCommandExpectResult(ml, state, "G1X5", "G1X5Y0Z0");
}
Also used : GcodeState(com.willwinder.universalgcodesender.gcode.GcodeState) Position(com.willwinder.universalgcodesender.model.Position) Test(org.junit.Test)

Example 9 with GcodeState

use of com.willwinder.universalgcodesender.gcode.GcodeState in project Universal-G-Code-Sender by winder.

the class MeshLevelerTest method testFlatMeshOnSurfaceOffSurface.

@Test
public void testFlatMeshOnSurfaceOffSurface() throws GcodeParserException {
    MeshLeveler ml = new MeshLeveler(1.0, BIG_FLAT_GRID_Z1, Units.MM);
    GcodeState state = new GcodeState();
    state.currentPoint = new Position(0, 0, 0, MM);
    state.inAbsoluteMode = true;
    sendCommandExpectResult(ml, state, "G1X5", "G1X5Y0Z0");
}
Also used : GcodeState(com.willwinder.universalgcodesender.gcode.GcodeState) Position(com.willwinder.universalgcodesender.model.Position) Test(org.junit.Test)

Example 10 with GcodeState

use of com.willwinder.universalgcodesender.gcode.GcodeState in project Universal-G-Code-Sender by winder.

the class MeshLevelerTest method testNegativeOffset.

@Test
public void testNegativeOffset() throws GcodeParserException {
    // The probe will be at 1.0 instead of 0.9 which means the end point needs to be raised 0.1
    MeshLeveler ml = new MeshLeveler(0.9, BIG_FLAT_GRID_Z1, Units.MM);
    GcodeState state = new GcodeState();
    state.currentPoint = new Position(0, 0, 0, MM);
    state.inAbsoluteMode = true;
    sendCommandExpectResult(ml, state, "G1X5", "G1X5Y0Z0.1");
}
Also used : GcodeState(com.willwinder.universalgcodesender.gcode.GcodeState) Position(com.willwinder.universalgcodesender.model.Position) Test(org.junit.Test)

Aggregations

GcodeState (com.willwinder.universalgcodesender.gcode.GcodeState)18 Position (com.willwinder.universalgcodesender.model.Position)15 Test (org.junit.Test)15 GcodeParserException (com.willwinder.universalgcodesender.gcode.util.GcodeParserException)1 Before (org.junit.Before)1