CuraEngine中相关gcode的打印速度相关的类:PathConfigStorage、 MeshPathConfigs、 GCodePathConfig
的相关关系
class PathConfigStorage
{
private:
const size_t support_infill_extruder_nr;
const size_t support_roof_extruder_nr;
const size_t support_bottom_extruder_nr;
const ExtruderTrain& adhesion_extruder_train;
const ExtruderTrain& support_infill_train;
const ExtruderTrain& support_roof_train;
const ExtruderTrain& support_bottom_train;
const std::vector<Ratio> line_width_factor_per_extruder;
static std::vector<Ratio> getLineWidthFactorPerExtruder(const LayerIndex& layer_nr);
public:
class MeshPathConfigs
{
public:
GCodePathConfig inset0_config;
GCodePathConfig insetX_config;
GCodePathConfig bridge_inset0_config;
GCodePathConfig bridge_insetX_config;
GCodePathConfig skin_config;
GCodePathConfig bridge_skin_config; // used for first bridge layer
GCodePathConfig bridge_skin_config2; // used for second bridge layer
GCodePathConfig bridge_skin_config3; // used for third bridge layer
GCodePathConfig roofing_config;
std::vector<GCodePathConfig> infill_config;
GCodePathConfig ironing_config;
GCodePathConfig perimeter_gap_config;
MeshPathConfigs(const SliceMeshStorage& mesh, const coord_t layer_thickness, const LayerIndex& layer_nr, const std::vector<Ratio>& line_width_factor_per_extruder);
void smoothAllSpeeds(GCodePathConfig::SpeedDerivatives first_layer_config, const LayerIndex& layer_nr, const LayerIndex& max_speed_layer);
};
GCodePathConfig raft_base_config;
GCodePathConfig raft_interface_config;
GCodePathConfig raft_surface_config;
std::vector<GCodePathConfig> travel_config_per_extruder; //!< The config used for travel moves (only speed is set!)
std::vector<GCodePathConfig> skirt_brim_config_per_extruder; //!< Configuration for skirt and brim per extruder.
std::vector<GCodePathConfig> prime_tower_config_per_extruder; //!< Configuration for the prime tower per extruder.
std::vector<GCodePathConfig> support_infill_config; //!< The config used to print the normal support, rather than the support interface
GCodePathConfig support_roof_config; //!< The config used to print the dense roofs of support.
GCodePathConfig support_bottom_config; //!< The config to use to print the dense bottoms of support
std::vector<MeshPathConfigs> mesh_configs; //!< For each meash the config for all its feature types
/*!
* \warning Note that the layer_nr might be below zero for raft (filler) layers
*/
PathConfigStorage(const SliceDataStorage& storage, const LayerIndex& layer_nr, const coord_t layer_thickness);
private:
void handleInitialLayerSpeedup(const SliceDataStorage& storage, const LayerIndex& layer_nr, const size_t initial_speedup_layer_count);
};
构造函数:
/**
- @brief 构造函数,用于初始化MeshPathConfigs对象。
- 此构造函数根据给定的参数,为不同打印特征(如外壁、内壁、桥接、皮肤等)配置路径设置对应参数值。
- 它通过从SliceMeshStorage中提取设置信息,并结合层厚度、线宽因子和层号,为每种打印特征创建相应的GCodePathConfig对象。
- @param mesh 提供打印设置和几何信息的SliceMeshStorage对象。
- @param layer_thickness 当前层的厚度。
- @param layer_nr 当前层的编号。
- @param line_width_factor_per_extruder 每个extruder的线宽因子,用于调整打印线宽。
*/
PathConfigStorage::MeshPathConfigs::MeshPathConfigs(const SliceMeshStorage& mesh, const coord_t layer_thickness, const LayerIndex& layer_nr, const std::vector<Ratio>& line_width_factor_per_extruder)
: inset0_config(
PrintFeatureType::OuterWall
, mesh.settings.get<coord_t>("wall_line_width_0") * line_width_factor_per_extruder[mesh.settings.get<ExtruderTrain&>("wall_0_extruder_nr").extruder_nr]
, layer_thickness
, mesh.settings.get<Ratio>("wall_0_material_flow") * ((layer_nr == 0) ? mesh.settings.get<Ratio>("material_flow_layer_0") : Ratio(1.0))
, GCodePathConfig::SpeedDerivatives{mesh.settings.get<Velocity>("speed_wall_0"), mesh.settings.get<Acceleration>("acceleration_wall_0"), mesh.settings.get<Velocity>("jerk_wall_0")}
)
, insetX_config(
PrintFeatureType::InnerWall
, mesh.settings.get<coord_t>("wall_line_width_x") * line_width_factor_per_extruder[mesh.settings.get<ExtruderTrain&>("wall_x_extruder_nr").extruder_nr]
, layer_thickness
, mesh.settings.get<Ratio>("wall_x_material_flow") * ((layer_nr == 0) ? mesh.settings.get<Ratio>("material_flow_layer_0") : Ratio(1.0))
, GCodePathConfig::SpeedDerivatives{mesh.settings.get<Velocity>("speed_wall_x"), mesh.settings.get<Acceleration>("acceleration_wall_x"), mesh.settings.get<Velocity>("jerk_wall_x")}
)
, bridge_inset0_config(
PrintFeatureType::OuterWall
, mesh.settings.get<coord_t>("wall_line_width_0") * line_width_factor_per_extruder[mesh.settings.get<ExtruderTrain&>("wall_0_extruder_nr").extruder_nr]
, layer_thickness
, mesh.settings.get<Ratio>("bridge_wall_material_flow")
, GCodePathConfig::SpeedDerivatives{mesh.settings.get<Velocity>("bridge_wall_speed"), mesh.settings.get<Acceleration>("acceleration_wall_0"), mesh.settings.get<Velocity>("jerk_wall_0")}
, true // is_bridge_path
, mesh.settings.get<Ratio>("bridge_fan_speed") * 100.0
)
, bridge_insetX_config(
PrintFeatureType::InnerWall
, mesh.settings.get<coord_t>("wall_line_width_x") * line_width_factor_per_extruder[mesh.settings.get<ExtruderTrain&>("wall_x_extruder_nr").extruder_nr]
, layer_thickness
, mesh.settings.get<Ratio>("bridge_wall_material_flow")
, GCodePathConfig::SpeedDerivatives{mesh.settings.get<Velocity>("bridge_wall_speed"), mesh.settings.get<Acceleration>("acceleration_wall_x"), mesh.settings.get<Velocity>("jerk_wall_x")}
, true // is_bridge_path
, mesh.settings.get<Ratio>("bridge_fan_speed") * 100.0
)
, skin_config(
PrintFeatureType::Skin
, mesh.settings.get<coord_t>("skin_line_width") * line_width_factor_per_extruder[mesh.settings.get<ExtruderTrain&>("top_bottom_extruder_nr").extruder_nr]
, layer_thickness
, mesh.settings.get<Ratio>("skin_material_flow") * ((layer_nr == 0) ? mesh.settings.get<Ratio>("material_flow_layer_0") : Ratio(1.0))
, GCodePathConfig::SpeedDerivatives{mesh.settings.get<Velocity>("speed_topbottom"), mesh.settings.get<Acceleration>("acceleration_topbottom"), mesh.settings.get<Velocity>("jerk_topbottom")}
)
, bridge_skin_config( // use bridge skin flow, speed and fan
PrintFeatureType::Skin
, mesh.settings.get<coord_t>("skin_line_width") * line_width_factor_per_extruder[mesh.settings.get<ExtruderTrain&>("top_bottom_extruder_nr").extruder_nr]
, layer_thickness
, mesh.settings.get<Ratio>("bridge_skin_material_flow")
, GCodePathConfig::SpeedDerivatives{mesh.settings.get<Velocity>("bridge_skin_speed"), mesh.settings.get<Acceleration>("acceleration_topbottom"), mesh.settings.get<Velocity>("jerk_topbottom")}
, true // is_bridge_path
, mesh.settings.get<Ratio>("bridge_fan_speed") * 100.0
)
, bridge_skin_config2( // use bridge skin 2 flow, speed and fan
PrintFeatureType::Skin
, mesh.settings.get<coord_t>("skin_line_width") * line_width_factor_per_extruder[mesh.settings.get<ExtruderTrain&>("top_bottom_extruder_nr").extruder_nr]
, layer_thickness
, mesh.settings.get<Ratio>("bridge_skin_material_flow_2")
, GCodePathConfig::SpeedDerivatives{mesh.settings.get<Velocity>("bridge_skin_speed_2"), mesh.settings.get<Acceleration>("acceleration_topbottom"), mesh.settings.get<Velocity>("jerk_topbottom")}
, true // is_bridge_path
, mesh.settings.get<Ratio>("bridge_fan_speed_2") * 100.0
)
, bridge_skin_config3( // use bridge skin 3 flow, speed and fan
PrintFeatureType::Skin
, mesh.settings.get<coord_t>("skin_line_width") * line_width_factor_per_extruder[mesh.settings.get<ExtruderTrain&>("top_bottom_extruder_nr").extruder_nr]
, layer_thickness
, mesh.settings.get<Ratio>("bridge_skin_material_flow_3")
, GCodePathConfig::SpeedDerivatives{mesh.settings.get<Velocity>("bridge_skin_speed_3"), mesh.settings.get<Acceleration>("acceleration_topbottom"), mesh.settings.get<Velocity>("jerk_topbottom")}
, true // is_bridge_path
, mesh.settings.get<Ratio>("bridge_fan_speed_3") * 100.0
)
, roofing_config(
PrintFeatureType::Skin
, mesh.settings.get<coord_t>("roofing_line_width")
, layer_thickness
, mesh.settings.get<Ratio>("roofing_material_flow") * ((layer_nr == 0) ? mesh.settings.get<Ratio>("material_flow_layer_0") : Ratio(1.0))
, GCodePathConfig::SpeedDerivatives{mesh.settings.get<Velocity>("speed_roofing"), mesh.settings.get<Acceleration>("acceleration_roofing"), mesh.settings.get<Velocity>("jerk_roofing")}
)
, ironing_config(
PrintFeatureType::Skin
, mesh.settings.get<coord_t>("skin_line_width")
, layer_thickness
, mesh.settings.get<Ratio>("ironing_flow")
, GCodePathConfig::SpeedDerivatives{mesh.settings.get<Velocity>("speed_ironing"), mesh.settings.get<Acceleration>("acceleration_ironing"), mesh.settings.get<Velocity>("jerk_ironing")}
)
, perimeter_gap_config(createPerimeterGapConfig(mesh, layer_thickness, layer_nr))
{
infill_config.reserve(MAX_INFILL_COMBINE);
for (int combine_idx = 0; combine_idx < MAX_INFILL_COMBINE; combine_idx++)
{
infill_config.emplace_back(
PrintFeatureType::Infill
, mesh.settings.get<coord_t>("infill_line_width") * (combine_idx + 1) * line_width_factor_per_extruder[mesh.settings.get<ExtruderTrain&>("infill_extruder_nr").extruder_nr]
, layer_thickness
, mesh.settings.get<Ratio>("infill_material_flow") * ((layer_nr == 0) ? mesh.settings.get<Ratio>("material_flow_layer_0") : Ratio(1.0))
, GCodePathConfig::SpeedDerivatives{mesh.settings.get<Velocity>("speed_infill"), mesh.settings.get<Acceleration>("acceleration_infill"), mesh.settings.get<Velocity>("jerk_infill")}
);
}
}