Example #1
0
void PrimeTower::addToGcode3(SliceDataStorage& storage, GCodePlanner& gcodeLayer, GCodeExport& gcode, int layer_nr, int prev_extruder, bool prime_tower_dir_outward, bool wipe, int* last_prime_tower_poly_printed)
{
    if (layer_nr > storage.max_object_height_second_to_last_extruder + 1)
    {
        return;
    }
    
    int new_extruder = gcodeLayer.getExtruder();

    
    Polygons& pattern = patterns_per_extruder[new_extruder][layer_nr % 2];

    
    GCodePathConfig& config = config_per_extruder[new_extruder];
    int start_idx = 0; // TODO: figure out which idx is closest to the far right corner
    gcodeLayer.addPolygon(ground_poly.back(), start_idx, &config);
    gcodeLayer.addLinesByOptimizer(pattern, &config, SpaceFillType::Lines);
    
    last_prime_tower_poly_printed[new_extruder] = layer_nr;

    if (CommandSocket::isInstantiated())
    {
        CommandSocket::getInstance()->sendPolygons(PrintFeatureType::Support, layer_nr, pattern, config.getLineWidth());
    }

    if (wipe)
    { //Make sure we wipe the old extruder on the prime tower.
        gcodeLayer.addTravel(storage.wipePoint - gcode.getExtruderOffset(prev_extruder) + gcode.getExtruderOffset(new_extruder));
    }
}
Example #2
0
void PrimeTower::addToGcode_OLD(SliceDataStorage& storage, GCodePlanner& gcodeLayer, GCodeExport& gcode, int layer_nr, int prev_extruder, bool prime_tower_dir_outward, bool wipe, int* last_prime_tower_poly_printed)
{
    if (layer_nr > storage.max_object_height_second_to_last_extruder + 1)
    {
        return;
    }
    
    int new_extruder = gcodeLayer.getExtruder();

    int64_t offset = -config_per_extruder[new_extruder].getLineWidth(); 
    if (layer_nr > 0)
        offset *= 2;
    
    //If we changed extruder, print the wipe/prime tower for this nozzle;
    std::vector<Polygons> insets;
    { // generate polygons
        if ((layer_nr % 2) == 1)
            insets.push_back(storage.primeTower.ground_poly.offset(offset / 2));
        else
            insets.push_back(storage.primeTower.ground_poly);
        while(true)
        {
            Polygons new_inset = insets[insets.size() - 1].offset(offset);
            if (new_inset.size() < 1)
                break;
            insets.push_back(new_inset);
        }
    }
    
    
    for(unsigned int n=0; n<insets.size(); n++)
    {
        GCodePathConfig& config = config_per_extruder[new_extruder];
        gcodeLayer.addPolygonsByOptimizer(insets[(prime_tower_dir_outward)? insets.size() - 1 - n : n], &config);
    }
    last_prime_tower_poly_printed[new_extruder] = layer_nr;
    
    if (wipe)
    { //Make sure we wipe the old extruder on the prime tower.
        gcodeLayer.addTravel(storage.wipePoint - gcode.getExtruderOffset(prev_extruder) + gcode.getExtruderOffset(new_extruder));
    }
};
Example #3
0
void PrimeTower::addToGcode(const SliceDataStorage& storage, LayerPlan& gcode_layer, const GCodeExport& gcode, const int prev_extruder, const int new_extruder) const
{
    if (!enabled)
    {
        return;
    }
    if (gcode_layer.getPrimeTowerIsPlanned())
    { // don't print the prime tower if it has been printed already
        return;
    }

    if (gcode_layer.getLayerNr() > storage.max_print_height_second_to_last_extruder + 1)
    {
        return;
    }

    bool pre_wipe = storage.meshgroup->getExtruderTrain(new_extruder)->getSettingBoolean("dual_pre_wipe");
    bool post_wipe = storage.meshgroup->getExtruderTrain(prev_extruder)->getSettingBoolean("prime_tower_wipe_enabled");

    if (prev_extruder == new_extruder)
    {
        pre_wipe = false;
        post_wipe = false;
    }
    // pre-wipe:
    if (pre_wipe)
    {
        preWipeAndPurge(storage, gcode_layer, new_extruder);
    }

    addToGcode_denseInfill(storage, gcode_layer, new_extruder);

    // post-wipe:
    if (post_wipe)
    { //Make sure we wipe the old extruder on the prime tower.
        gcode_layer.addTravel(post_wipe_point - gcode.getExtruderOffset(prev_extruder) + gcode.getExtruderOffset(new_extruder));
    }

    gcode_layer.setPrimeTowerIsPlanned();
}