当前位置: 首页>>代码示例>>C++>>正文


C++ GCodeExport::getExtruderOffset方法代码示例

本文整理汇总了C++中GCodeExport::getExtruderOffset方法的典型用法代码示例。如果您正苦于以下问题:C++ GCodeExport::getExtruderOffset方法的具体用法?C++ GCodeExport::getExtruderOffset怎么用?C++ GCodeExport::getExtruderOffset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在GCodeExport的用法示例。


在下文中一共展示了GCodeExport::getExtruderOffset方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1:

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));
    }
}
开发者ID:Latrocinium,项目名称:CuraEngine,代码行数:30,代码来源:PrimeTower.cpp

示例2: addToGcode_OLD

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));
    }
};
开发者ID:Latrocinium,项目名称:CuraEngine,代码行数:42,代码来源:PrimeTower.cpp

示例3: addToGcode

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();
}
开发者ID:alephobjects,项目名称:CuraEngine,代码行数:40,代码来源:PrimeTower.cpp


注:本文中的GCodeExport::getExtruderOffset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。