/** * gets the first G1 from a layer, returns the position of X, Y, Z axes * * @param l * @return */ private Point5d getFirstPosition(final Layer l) { final List<String> search = l.getCommands(); GCodeCommand gcode; for (int i = 0; i < search.size(); i++) { gcode = new GCodeCommand(search.get(i)); if (gcode.getCodeValue('G') == 1) { Point5d result = new Point5d(); result.setX(gcode.getCodeValue('X')); result.setY(gcode.getCodeValue('Y')); result.setZ(gcode.getCodeValue('Z')); return result; } } return null; }