Search in sources :

Example 1 with OutlineToolPath

use of com.willwinder.ugs.nbp.designer.io.gcode.toolpaths.OutlineToolPath in project Universal-G-Code-Sender by winder.

the class SimpleGcodeRouter method getGcodePathFromCuttables.

private GcodePath getGcodePathFromCuttables(List<Cuttable> cuttables) {
    GcodePath gcodePath = new GcodePath();
    int index = 0;
    for (Cuttable cuttable : cuttables) {
        index++;
        gcodePath.addSegment(new Segment(" " + cuttable.getName() + " - " + cuttable.getCutType().getName() + " (" + index + "/" + cuttables.size() + ")"));
        switch(cuttable.getCutType()) {
            case POCKET:
                PocketToolPath simplePocket = new PocketToolPath(cuttable);
                simplePocket.setStartDepth(cuttable.getStartDepth());
                simplePocket.setTargetDepth(cuttable.getTargetDepth());
                simplePocket.setToolDiameter(toolDiameter);
                simplePocket.setDepthPerPass(depthPerPass);
                simplePocket.setSafeHeight(safeHeight);
                simplePocket.setStepOver(toolStepOver);
                gcodePath.appendGcodePath(simplePocket.toGcodePath());
                break;
            case OUTSIDE_PATH:
                OutlineToolPath simpleOutsidePath = new OutlineToolPath(cuttable);
                simpleOutsidePath.setOffset(toolDiameter / 2d);
                simpleOutsidePath.setStartDepth(cuttable.getStartDepth());
                simpleOutsidePath.setTargetDepth(cuttable.getTargetDepth());
                simpleOutsidePath.setToolDiameter(toolDiameter);
                simpleOutsidePath.setDepthPerPass(depthPerPass);
                simpleOutsidePath.setSafeHeight(safeHeight);
                gcodePath.appendGcodePath(simpleOutsidePath.toGcodePath());
                break;
            case INSIDE_PATH:
                OutlineToolPath simpleInsidePath = new OutlineToolPath(cuttable);
                simpleInsidePath.setOffset(-toolDiameter / 2d);
                simpleInsidePath.setStartDepth(cuttable.getStartDepth());
                simpleInsidePath.setTargetDepth(cuttable.getTargetDepth());
                simpleInsidePath.setToolDiameter(toolDiameter);
                simpleInsidePath.setDepthPerPass(depthPerPass);
                simpleInsidePath.setSafeHeight(safeHeight);
                gcodePath.appendGcodePath(simpleInsidePath.toGcodePath());
                break;
            case ON_PATH:
                OutlineToolPath simpleOnPath = new OutlineToolPath(cuttable);
                simpleOnPath.setStartDepth(cuttable.getStartDepth());
                simpleOnPath.setTargetDepth(cuttable.getTargetDepth());
                simpleOnPath.setToolDiameter(toolDiameter);
                simpleOnPath.setDepthPerPass(depthPerPass);
                simpleOnPath.setSafeHeight(safeHeight);
                gcodePath.appendGcodePath(simpleOnPath.toGcodePath());
                break;
            case CENTER_DRILL:
                DrillCenterToolPath drillToolPath = new DrillCenterToolPath(cuttable);
                drillToolPath.setStartDepth(cuttable.getStartDepth());
                drillToolPath.setTargetDepth(cuttable.getTargetDepth());
                drillToolPath.setToolDiameter(toolDiameter);
                drillToolPath.setDepthPerPass(depthPerPass);
                drillToolPath.setSafeHeight(safeHeight);
                gcodePath.appendGcodePath(drillToolPath.toGcodePath());
                break;
            default:
        }
    }
    return gcodePath;
}
Also used : DrillCenterToolPath(com.willwinder.ugs.nbp.designer.io.gcode.toolpaths.DrillCenterToolPath) GcodePath(com.willwinder.ugs.nbp.designer.io.gcode.path.GcodePath) Cuttable(com.willwinder.ugs.nbp.designer.entities.cuttable.Cuttable) OutlineToolPath(com.willwinder.ugs.nbp.designer.io.gcode.toolpaths.OutlineToolPath) Segment(com.willwinder.ugs.nbp.designer.io.gcode.path.Segment) PocketToolPath(com.willwinder.ugs.nbp.designer.io.gcode.toolpaths.PocketToolPath)

Aggregations

Cuttable (com.willwinder.ugs.nbp.designer.entities.cuttable.Cuttable)1 GcodePath (com.willwinder.ugs.nbp.designer.io.gcode.path.GcodePath)1 Segment (com.willwinder.ugs.nbp.designer.io.gcode.path.Segment)1 DrillCenterToolPath (com.willwinder.ugs.nbp.designer.io.gcode.toolpaths.DrillCenterToolPath)1 OutlineToolPath (com.willwinder.ugs.nbp.designer.io.gcode.toolpaths.OutlineToolPath)1 PocketToolPath (com.willwinder.ugs.nbp.designer.io.gcode.toolpaths.PocketToolPath)1