* use config for wipetower instead of 10s of arguments

This commit is contained in:
supermerill 2019-02-14 18:08:11 +01:00
parent 568aa1d113
commit 29755d0353
2 changed files with 45 additions and 60 deletions

View File

@ -7,6 +7,7 @@
#include <utility> #include <utility>
#include <algorithm> #include <algorithm>
#include "PrintConfig.hpp"
#include "WipeTower.hpp" #include "WipeTower.hpp"
@ -44,59 +45,56 @@ public:
// y -- y coordinates of wipe tower in mm ( left bottom corner ) // y -- y coordinates of wipe tower in mm ( left bottom corner )
// width -- width of wipe tower in mm ( default 60 mm - leave as it is ) // width -- width of wipe tower in mm ( default 60 mm - leave as it is )
// wipe_area -- space available for one toolchange in mm // wipe_area -- space available for one toolchange in mm
WipeTowerPrusaMM(float x, float y, float width, float rotation_angle, float cooling_tube_retraction, WipeTowerPrusaMM(PrintConfig &config,
float cooling_tube_length, float parking_pos_retraction, float extra_loading_move, const std::vector<std::vector<float>>& wiping_matrix, unsigned int initial_tool, float first_layer_width) :
float bridging, bool set_extruder_trimpot, m_wipe_tower_pos(float(config.wipe_tower_x.value), float(config.wipe_tower_y.value)),
const std::vector<std::vector<float>>& wiping_matrix, unsigned int initial_tool, float first_layer_width) : m_wipe_tower_width(float(config.wipe_tower_width.value)),
m_wipe_tower_pos(x, y), m_wipe_tower_rotation_angle(float(config.wipe_tower_rotation_angle.value)),
m_wipe_tower_width(width), m_y_shift(0.f),
m_wipe_tower_rotation_angle(rotation_angle), m_z_pos(0.f),
m_y_shift(0.f), m_is_first_layer(false),
m_z_pos(0.f), m_cooling_tube_retraction(float(config.cooling_tube_retraction.value)),
m_is_first_layer(false), m_cooling_tube_length(float(config.cooling_tube_length.value)),
m_cooling_tube_retraction(cooling_tube_retraction), m_parking_pos_retraction(float(config.parking_pos_retraction.value)),
m_cooling_tube_length(cooling_tube_length), m_extra_loading_move(float(config.extra_loading_move.value)),
m_parking_pos_retraction(parking_pos_retraction), m_bridging(float(config.wipe_tower_bridging)),
m_extra_loading_move(extra_loading_move), m_set_extruder_trimpot(config.high_current_on_filament_swap.value),
m_bridging(bridging),
m_set_extruder_trimpot(set_extruder_trimpot),
m_current_tool(initial_tool), m_current_tool(initial_tool),
wipe_volumes(wiping_matrix), wipe_volumes(wiping_matrix),
m_brim_width(first_layer_width) m_brim_width(first_layer_width),
{} m_config(&config) {
}
virtual ~WipeTowerPrusaMM() {} virtual ~WipeTowerPrusaMM() {}
// Set the extruder properties. // Set the extruder properties.
void set_extruder(size_t idx, material_type material, int temp, int first_layer_temp, float loading_speed, float loading_speed_start, void set_extruder(size_t idx)
float unloading_speed, float unloading_speed_start, float delay, int cooling_moves,
float cooling_initial_speed, float cooling_final_speed, std::string ramming_parameters, float nozzle_diameter)
{ {
//while (m_filpar.size() < idx+1) // makes sure the required element is in the vector //while (m_filpar.size() < idx+1) // makes sure the required element is in the vector
m_filpar.push_back(FilamentParameters()); m_filpar.push_back(FilamentParameters());
m_filpar[idx].material = material; m_filpar[idx].material = WipeTowerPrusaMM::parse_material(m_config->filament_type.get_at(idx).c_str());
if (material == FLEX || material == SCAFF || material == PVA) { if (m_filpar[idx].material == FLEX || m_filpar[idx].material == SCAFF || m_filpar[idx].material == PVA) {
// MMU2 lowers the print speed using the speed override (M220) for printing of soluble PVA/BVOH and flex materials. // MMU2 lowers the print speed using the speed override (M220) for printing of soluble PVA/BVOH and flex materials.
// Therefore it does not make sense to use the new M220 B and M220 R (backup / restore). // Therefore it does not make sense to use the new M220 B and M220 R (backup / restore).
m_retain_speed_override = false; m_retain_speed_override = false;
} }
m_filpar[idx].temperature = temp; m_filpar[idx].temperature = (float) m_config->temperature.get_at(idx);
m_filpar[idx].first_layer_temperature = first_layer_temp; m_filpar[idx].first_layer_temperature = (float) m_config->first_layer_temperature.get_at(idx);
m_filpar[idx].loading_speed = loading_speed; m_filpar[idx].loading_speed = (float) m_config->filament_loading_speed.get_at(idx);
m_filpar[idx].loading_speed_start = loading_speed_start; m_filpar[idx].loading_speed_start = (float) m_config->filament_loading_speed_start.get_at(idx);
m_filpar[idx].unloading_speed = unloading_speed; m_filpar[idx].unloading_speed = (float) m_config->filament_unloading_speed.get_at(idx);
m_filpar[idx].unloading_speed_start = unloading_speed_start; m_filpar[idx].unloading_speed_start = (float) m_config->filament_unloading_speed_start.get_at(idx);
m_filpar[idx].delay = delay; m_filpar[idx].delay = (float) m_config->filament_toolchange_delay.get_at(idx);
m_filpar[idx].cooling_moves = cooling_moves; m_filpar[idx].cooling_moves = (float) m_config->filament_cooling_moves.get_at(idx);
m_filpar[idx].cooling_initial_speed = cooling_initial_speed; m_filpar[idx].cooling_initial_speed = (float) m_config->filament_cooling_initial_speed.get_at(idx);
m_filpar[idx].cooling_final_speed = cooling_final_speed; m_filpar[idx].cooling_final_speed = (float) m_config->filament_cooling_final_speed.get_at(idx);
m_filpar[idx].nozzle_diameter = nozzle_diameter; // to be used in future with (non-single) multiextruder MM m_filpar[idx].nozzle_diameter = (float) m_config->nozzle_diameter.get_at(idx); // to be used in future with (non-single) multiextruder MM
m_perimeter_width = nozzle_diameter * Width_To_Nozzle_Ratio; // all extruders are now assumed to have the same diameter m_perimeter_width = m_filpar[idx].nozzle_diameter * Width_To_Nozzle_Ratio; // all extruders are now assumed to have the same diameter
std::stringstream stream{ramming_parameters}; std::stringstream stream{ m_config->filament_ramming_parameters.get_at(idx) };
float speed = 0.f; float speed = 0.f;
stream >> m_filpar[idx].ramming_line_width_multiplicator >> m_filpar[idx].ramming_step_multiplicator; stream >> m_filpar[idx].ramming_line_width_multiplicator >> m_filpar[idx].ramming_step_multiplicator;
m_filpar[idx].ramming_line_width_multiplicator /= 100; m_filpar[idx].ramming_line_width_multiplicator /= 100;
@ -202,6 +200,7 @@ private:
const float Width_To_Nozzle_Ratio = 1.25f; // desired line width (oval) in multiples of nozzle diameter - may not be actually neccessary to adjust const float Width_To_Nozzle_Ratio = 1.25f; // desired line width (oval) in multiples of nozzle diameter - may not be actually neccessary to adjust
const float WT_EPSILON = 1e-3f; const float WT_EPSILON = 1e-3f;
PrintConfig *m_config = NULL;
xy m_wipe_tower_pos; // Left front corner of the wipe tower in mm. xy m_wipe_tower_pos; // Left front corner of the wipe tower in mm.
float m_wipe_tower_width; // Width of the wipe tower. float m_wipe_tower_width; // Width of the wipe tower.

View File

@ -1904,13 +1904,14 @@ void Print::_make_wipe_tower()
this->throw_if_canceled(); this->throw_if_canceled();
// Initialize the wipe tower. // Initialize the wipe tower.
WipeTowerPrusaMM wipe_tower( WipeTowerPrusaMM wipe_tower(m_config
float(m_config.wipe_tower_x.value), float(m_config.wipe_tower_y.value), //float(m_config.wipe_tower_x.value), float(m_config.wipe_tower_y.value),
float(m_config.wipe_tower_width.value), //float(m_config.wipe_tower_width.value),
float(m_config.wipe_tower_rotation_angle.value), float(m_config.cooling_tube_retraction.value), //float(m_config.wipe_tower_rotation_angle.value), float(m_config.cooling_tube_retraction.value),
float(m_config.cooling_tube_length.value), float(m_config.parking_pos_retraction.value), //float(m_config.cooling_tube_length.value), float(m_config.parking_pos_retraction.value),
float(m_config.extra_loading_move.value), float(m_config.wipe_tower_bridging), //float(m_config.extra_loading_move.value), float(m_config.wipe_tower_bridging),
m_config.high_current_on_filament_swap.value, wipe_volumes, //m_config.high_current_on_filament_swap.value
, wipe_volumes,
m_wipe_tower_data.tool_ordering.first_extruder(), this->brim_flow().width); m_wipe_tower_data.tool_ordering.first_extruder(), this->brim_flow().width);
@ -1918,23 +1919,8 @@ void Print::_make_wipe_tower()
//wipe_tower.set_zhop(); //wipe_tower.set_zhop();
// Set the extruder & material properties at the wipe tower object. // Set the extruder & material properties at the wipe tower object.
for (size_t i = 0; i < number_of_extruders; ++ i) for (size_t i = 0; i < number_of_extruders; ++i)
wipe_tower.set_extruder( wipe_tower.set_extruder(i);
i,
WipeTowerPrusaMM::parse_material(m_config.filament_type.get_at(i).c_str()),
m_config.temperature.get_at(i),
m_config.first_layer_temperature.get_at(i),
m_config.filament_loading_speed.get_at(i),
m_config.filament_loading_speed_start.get_at(i),
m_config.filament_unloading_speed.get_at(i),
m_config.filament_unloading_speed_start.get_at(i),
m_config.filament_toolchange_delay.get_at(i),
m_config.filament_cooling_moves.get_at(i),
m_config.filament_cooling_initial_speed.get_at(i),
m_config.filament_cooling_final_speed.get_at(i),
m_config.filament_ramming_parameters.get_at(i),
m_config.nozzle_diameter.get_at(i));
m_wipe_tower_data.priming = Slic3r::make_unique<WipeTower::ToolChangeResult>( m_wipe_tower_data.priming = Slic3r::make_unique<WipeTower::ToolChangeResult>(
wipe_tower.prime(this->skirt_first_layer_height(), m_wipe_tower_data.tool_ordering.all_extruders(), false)); wipe_tower.prime(this->skirt_first_layer_height(), m_wipe_tower_data.tool_ordering.all_extruders(), false));