Search in sources :

Example 21 with Position

use of com.willwinder.universalgcodesender.model.Position 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 22 with Position

use of com.willwinder.universalgcodesender.model.Position 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 23 with Position

use of com.willwinder.universalgcodesender.model.Position 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 24 with Position

use of com.willwinder.universalgcodesender.model.Position 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)

Example 25 with Position

use of com.willwinder.universalgcodesender.model.Position in project Universal-G-Code-Sender by winder.

the class TranslatorTest method setup.

@Before
public void setup() {
    instance = new Translator(new Position(10.1, 20.2, 30.3, Units.MM));
    state = new GcodeState();
    state.units = Code.G21;
    state.inAbsoluteMode = true;
    state.inAbsoluteIJKMode = false;
    state.currentPoint = null;
}
Also used : Position(com.willwinder.universalgcodesender.model.Position) GcodeState(com.willwinder.universalgcodesender.gcode.GcodeState) Before(org.junit.Before)

Aggregations

Position (com.willwinder.universalgcodesender.model.Position)66 Test (org.junit.Test)33 GcodeState (com.willwinder.universalgcodesender.gcode.GcodeState)15 GcodeMeta (com.willwinder.universalgcodesender.gcode.GcodeParser.GcodeMeta)7 ControllerStatus (com.willwinder.universalgcodesender.listeners.ControllerStatus)6 UnitUtils (com.willwinder.universalgcodesender.model.UnitUtils)6 GcodeParserException (com.willwinder.universalgcodesender.gcode.util.GcodeParserException)5 Units (com.willwinder.universalgcodesender.model.UnitUtils.Units)5 GcodeCommand (com.willwinder.universalgcodesender.types.GcodeCommand)4 Settings (com.willwinder.universalgcodesender.utils.Settings)4 ArrayList (java.util.ArrayList)4 ProbeParameters (com.willwinder.ugs.platform.probe.ProbeService.ProbeParameters)3 GcodeParser (com.willwinder.universalgcodesender.gcode.GcodeParser)3 PlaneFormatter (com.willwinder.universalgcodesender.gcode.util.PlaneFormatter)3 UGSEvent (com.willwinder.universalgcodesender.model.UGSEvent)3 AutoLevelSettings (com.willwinder.universalgcodesender.utils.Settings.AutoLevelSettings)3 SplitCommand (com.willwinder.universalgcodesender.gcode.GcodePreprocessorUtils.SplitCommand)2 CommentProcessor (com.willwinder.universalgcodesender.gcode.processors.CommentProcessor)2 Code (com.willwinder.universalgcodesender.gcode.util.Code)2 PointSegment (com.willwinder.universalgcodesender.types.PointSegment)2