Mostly refactoring of the wipe tower improvements

- setting of the wipe tower parameters based od whether SE MM printer is selected is done in the WipeTowerPrusaMM constructor, so it does not distract in Print.cpp
- WipeTowerPrusaMM.cpp conditions checking for SE MM printer are now using a more descriptive const member variable, not the loading/unloading speeds (hopefully the functionality is the same)
This commit is contained in:
Lukas Matena 2019-06-12 10:54:52 +02:00
parent da1aea889f
commit 9df93c0125
3 changed files with 51 additions and 76 deletions

View file

@ -857,7 +857,7 @@ void WipeTowerPrusaMM::toolchange_Unload(
// Retraction: // Retraction:
float old_x = writer.x(); float old_x = writer.x();
float turning_point = (!m_left_to_right ? xl : xr ); float turning_point = (!m_left_to_right ? xl : xr );
if ((m_cooling_tube_retraction != 0 || m_cooling_tube_length != 0) && m_filpar[m_current_tool].unloading_speed_start != 0 && m_filpar[m_current_tool].unloading_speed != 0) { if (m_semm && (m_cooling_tube_retraction != 0 || m_cooling_tube_length != 0)) {
float total_retraction_distance = m_cooling_tube_retraction + m_cooling_tube_length/2.f - 15.f; // the 15mm is reserved for the first part after ramming float total_retraction_distance = m_cooling_tube_retraction + m_cooling_tube_length/2.f - 15.f; // the 15mm is reserved for the first part after ramming
writer.suppress_preview() writer.suppress_preview()
.retract(15.f, m_filpar[m_current_tool].unloading_speed_start * 60.f) // feedrate 5000mm/min = 83mm/s .retract(15.f, m_filpar[m_current_tool].unloading_speed_start * 60.f) // feedrate 5000mm/min = 83mm/s
@ -935,7 +935,7 @@ void WipeTowerPrusaMM::toolchange_Load(
PrusaMultiMaterial::Writer &writer, PrusaMultiMaterial::Writer &writer,
const box_coordinates &cleaning_box) const box_coordinates &cleaning_box)
{ {
if ((m_parking_pos_retraction != 0 || m_extra_loading_move != 0) && m_filpar[m_current_tool].loading_speed_start != 0 && m_filpar[m_current_tool].loading_speed != 0) { if (m_semm && (m_parking_pos_retraction != 0 || m_extra_loading_move != 0)) {
float xl = cleaning_box.ld.x + m_perimeter_width * 0.75f; float xl = cleaning_box.ld.x + m_perimeter_width * 0.75f;
float xr = cleaning_box.rd.x - m_perimeter_width * 0.75f; float xr = cleaning_box.rd.x - m_perimeter_width * 0.75f;
float oldx = writer.x(); // the nozzle is in place to do the first wiping moves, we will remember the position float oldx = writer.x(); // the nozzle is in place to do the first wiping moves, we will remember the position

View file

@ -46,26 +46,32 @@ 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(bool semm, float x, float y, float width, float rotation_angle, float cooling_tube_retraction,
float cooling_tube_length, float parking_pos_retraction, float extra_loading_move, float cooling_tube_length, float parking_pos_retraction, float extra_loading_move,
float bridging, bool set_extruder_trimpot, GCodeFlavor flavor, float bridging, bool set_extruder_trimpot, GCodeFlavor flavor,
const std::vector<std::vector<float>>& wiping_matrix, unsigned int initial_tool) : const std::vector<std::vector<float>>& wiping_matrix, unsigned int initial_tool) :
m_wipe_tower_pos(x, y), m_semm(semm),
m_wipe_tower_pos(x, y),
m_wipe_tower_width(width), m_wipe_tower_width(width),
m_wipe_tower_rotation_angle(rotation_angle), m_wipe_tower_rotation_angle(rotation_angle),
m_y_shift(0.f), m_y_shift(0.f),
m_z_pos(0.f), m_z_pos(0.f),
m_is_first_layer(false), m_is_first_layer(false),
m_cooling_tube_retraction(cooling_tube_retraction),
m_cooling_tube_length(cooling_tube_length),
m_parking_pos_retraction(parking_pos_retraction),
m_extra_loading_move(extra_loading_move),
m_bridging(bridging),
m_set_extruder_trimpot(set_extruder_trimpot),
m_gcode_flavor(flavor), m_gcode_flavor(flavor),
m_bridging(bridging),
m_current_tool(initial_tool), m_current_tool(initial_tool),
wipe_volumes(wiping_matrix) wipe_volumes(wiping_matrix)
{} {
// If this is a single extruder MM printer, we will use all the SE-specific config values.
// Otherwise, the defaults will be used to turn off the SE stuff.
if (m_semm) {
m_cooling_tube_retraction = cooling_tube_retraction;
m_cooling_tube_length = cooling_tube_length;
m_parking_pos_retraction = parking_pos_retraction;
m_extra_loading_move = extra_loading_move;
m_set_extruder_trimpot = set_extruder_trimpot;
}
}
virtual ~WipeTowerPrusaMM() {} virtual ~WipeTowerPrusaMM() {}
@ -81,21 +87,27 @@ public:
m_filpar[idx].material = material; m_filpar[idx].material = material;
m_filpar[idx].temperature = temp; m_filpar[idx].temperature = temp;
m_filpar[idx].first_layer_temperature = first_layer_temp; m_filpar[idx].first_layer_temperature = first_layer_temp;
m_filpar[idx].loading_speed = loading_speed;
m_filpar[idx].loading_speed_start = loading_speed_start; // If this is a single extruder MM printer, we will use all the SE-specific config values.
m_filpar[idx].unloading_speed = unloading_speed; // Otherwise, the defaults will be used to turn off the SE stuff.
m_filpar[idx].unloading_speed_start = unloading_speed_start; if (m_semm) {
m_filpar[idx].delay = delay; m_filpar[idx].loading_speed = loading_speed;
m_filpar[idx].cooling_moves = cooling_moves; m_filpar[idx].loading_speed_start = loading_speed_start;
m_filpar[idx].cooling_initial_speed = cooling_initial_speed; m_filpar[idx].unloading_speed = unloading_speed;
m_filpar[idx].cooling_final_speed = cooling_final_speed; m_filpar[idx].unloading_speed_start = unloading_speed_start;
m_filpar[idx].delay = delay;
m_filpar[idx].cooling_moves = cooling_moves;
m_filpar[idx].cooling_initial_speed = cooling_initial_speed;
m_filpar[idx].cooling_final_speed = cooling_final_speed;
}
if (max_volumetric_speed != 0.f) if (max_volumetric_speed != 0.f)
m_filpar[idx].max_e_speed = (max_volumetric_speed / Filament_Area); m_filpar[idx].max_e_speed = (max_volumetric_speed / Filament_Area);
m_filpar[idx].nozzle_diameter = nozzle_diameter; // to be used in future with (non-single) multiextruder MM m_filpar[idx].nozzle_diameter = nozzle_diameter; // 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 = 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_semm ? ramming_parameters : std::string()};
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;
@ -220,7 +232,8 @@ private:
const float WT_EPSILON = 1e-3f; const float WT_EPSILON = 1e-3f;
xy m_wipe_tower_pos; // Left front corner of the wipe tower in mm. bool m_semm = true; // Are we using a single extruder multimaterial printer?
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.
float m_wipe_tower_depth = 0.f; // Depth of the wipe tower float m_wipe_tower_depth = 0.f; // Depth of the wipe tower
float m_wipe_tower_rotation_angle = 0.f; // Wipe tower rotation angle in degrees (with respect to x axis) float m_wipe_tower_rotation_angle = 0.f; // Wipe tower rotation angle in degrees (with respect to x axis)

View file

@ -1789,78 +1789,40 @@ void Print::_make_wipe_tower()
} }
} }
this->throw_if_canceled(); this->throw_if_canceled();
bool semm = m_config.single_extruder_multi_material.value;
float cooling_tube_retraction = 0.0;
float cooling_tube_length = 0.0;
float parking_pos_retraction = 0.0;
bool extra_loading_move = 0.0;
bool high_current_on_filament_swap = false;
if (semm) {
cooling_tube_retraction = float(m_config.cooling_tube_retraction.value);
cooling_tube_length = float(m_config.cooling_tube_length.value);
parking_pos_retraction = float(m_config.parking_pos_retraction.value);
extra_loading_move = float(m_config.extra_loading_move.value);
high_current_on_filament_swap = m_config.high_current_on_filament_swap.value;
}
// Initialize the wipe tower. // Initialize the wipe tower.
WipeTowerPrusaMM wipe_tower( WipeTowerPrusaMM wipe_tower(
m_config.single_extruder_multi_material.value,
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), cooling_tube_retraction, float(m_config.wipe_tower_rotation_angle.value), float(m_config.cooling_tube_retraction.value),
cooling_tube_length, parking_pos_retraction, float(m_config.cooling_tube_length.value), float(m_config.parking_pos_retraction.value),
extra_loading_move, float(m_config.wipe_tower_bridging), float(m_config.extra_loading_move.value), float(m_config.wipe_tower_bridging),
high_current_on_filament_swap, m_config.gcode_flavor, wipe_volumes, m_config.high_current_on_filament_swap.value, m_config.gcode_flavor, wipe_volumes,
m_wipe_tower_data.tool_ordering.first_extruder()); m_wipe_tower_data.tool_ordering.first_extruder());
//wipe_tower.set_retract(); //wipe_tower.set_retract();
//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)
float loading_speed = 0.0;
float loading_speed_start = 0.0;
float unloading_speed = 0.0;
float unloading_speed_start = 0.0;
float toolchange_delay = 0.0;
int cooling_moves = 0;
float cooling_initial_speed = 0.0;
float cooling_final_speed = 0.0;
float max_volumetric_speed = 0.f;
std::string ramming_parameters;
if (semm) {
loading_speed = m_config.filament_loading_speed.get_at(i);
loading_speed_start = m_config.filament_loading_speed_start.get_at(i);
unloading_speed = m_config.filament_unloading_speed.get_at(i);
unloading_speed_start = m_config.filament_unloading_speed_start.get_at(i);
toolchange_delay = m_config.filament_toolchange_delay.get_at(i);
cooling_moves = m_config.filament_cooling_moves.get_at(i);
cooling_initial_speed = m_config.filament_cooling_initial_speed.get_at(i);
cooling_final_speed = m_config.filament_cooling_final_speed.get_at(i);
ramming_parameters = m_config.filament_ramming_parameters.get_at(i);
max_volumetric_speed = m_config.filament_max_volumetric_speed.get_at(i);
}
wipe_tower.set_extruder( wipe_tower.set_extruder(
i, i,
WipeTowerPrusaMM::parse_material(m_config.filament_type.get_at(i).c_str()), WipeTowerPrusaMM::parse_material(m_config.filament_type.get_at(i).c_str()),
m_config.temperature.get_at(i), m_config.temperature.get_at(i),
m_config.first_layer_temperature.get_at(i), m_config.first_layer_temperature.get_at(i),
loading_speed, m_config.filament_loading_speed.get_at(i),
loading_speed_start, m_config.filament_loading_speed_start.get_at(i),
unloading_speed, m_config.filament_unloading_speed.get_at(i),
unloading_speed_start, m_config.filament_unloading_speed_start.get_at(i),
toolchange_delay, m_config.filament_toolchange_delay.get_at(i),
cooling_moves, m_config.filament_cooling_moves.get_at(i),
cooling_initial_speed, m_config.filament_cooling_initial_speed.get_at(i),
cooling_final_speed, m_config.filament_cooling_final_speed.get_at(i),
ramming_parameters, m_config.filament_ramming_parameters.get_at(i),
max_volumetric_speed, m_config.filament_max_volumetric_speed.get_at(i),
m_config.nozzle_diameter.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));