Wipe tower generator should now work for more than 4 extruders (actual number extracted from wiping_volumes_matrix)

This commit is contained in:
Lukas Matena 2018-03-20 15:45:11 +01:00
parent a782424d5f
commit 0fc2da5a32
2 changed files with 23 additions and 20 deletions

View File

@ -69,19 +69,19 @@ public:
m_cooling_tube_retraction(cooling_tube_retraction),
m_cooling_tube_length(cooling_tube_length),
m_parking_pos_retraction(parking_pos_retraction),
m_current_tool(initial_tool),
m_bridging(bridging)
m_bridging(bridging),
m_current_tool(initial_tool)
{
const unsigned int number_of_extruders = int(sqrt(wiping_matrix.size())+WT_EPSILON);
for (unsigned int i = 0; i<number_of_extruders; ++i)
wipe_volumes.push_back(std::vector<float>(wiping_matrix.begin()+i*number_of_extruders,wiping_matrix.begin()+(i+1)*number_of_extruders));
for (size_t i = 0; i < 4; ++ i) {
/*for (size_t i = 0; i < number_of_extruders; ++ i) {
// Extruder specific parameters.
m_filpar[i].material = PLA;
m_filpar[i].material = PLA;
m_filpar[i].temperature = 0;
m_filpar[i].first_layer_temperature = 0;
}
}*/
}
virtual ~WipeTowerPrusaMM() {}
@ -97,6 +97,8 @@ public:
void set_extruder(size_t idx, material_type material, int temp, int first_layer_temp, float loading_speed,
float unloading_speed, float delay, int cooling_time, std::string ramming_parameters)
{
while (m_filpar.size() < idx+1) // makes sure the required element is in the vector
m_filpar.push_back(FilamentParameters());
m_filpar[idx].material = material;
m_filpar[idx].temperature = temp;
m_filpar[idx].first_layer_temperature = first_layer_temp;
@ -226,20 +228,20 @@ private:
struct FilamentParameters {
material_type material;
int temperature;
int first_layer_temperature;
float loading_speed;
float unloading_speed;
float delay;
int cooling_time;
float ramming_line_width_multiplicator;
float ramming_step_multiplicator;
material_type material = PLA;
int temperature = 0;
int first_layer_temperature = 0;
float loading_speed = 0.f;
float unloading_speed = 0.f;
float delay = 0.f ;
int cooling_time = 0;
float ramming_line_width_multiplicator = 0.f;
float ramming_step_multiplicator = 0.f;
std::vector<float> ramming_speed;
};
// Extruder specific parameters.
FilamentParameters m_filpar[4];
std::vector<FilamentParameters> m_filpar;
// State of the wiper tower generator.

View File

@ -1037,21 +1037,22 @@ void Print::_make_wipe_tower()
}
}
// Get wiping matrix to get number of extruders and convert vector<double> to vector<float>:
std::vector<float> wiping_volumes((this->config.wiping_volumes_matrix.values).begin(),(this->config.wiping_volumes_matrix.values).end());
// Initialize the wipe tower.
WipeTowerPrusaMM wipe_tower(
float(this->config.wipe_tower_x.value), float(this->config.wipe_tower_y.value),
float(this->config.wipe_tower_width.value), float(this->config.wipe_tower_per_color_wipe.value),
float(this->config.wipe_tower_rotation_angle.value), float(this->config.cooling_tube_retraction.value),
float(this->config.cooling_tube_length.value), float(this->config.parking_pos_retraction.value),
float(this->config.wipe_tower_bridging),
std::vector<float>((this->config.wiping_volumes_matrix.values).begin(),(this->config.wiping_volumes_matrix.values).end()),
m_tool_ordering.first_extruder());
float(this->config.wipe_tower_bridging), wiping_volumes, m_tool_ordering.first_extruder());
//wipe_tower.set_retract();
//wipe_tower.set_zhop();
// Set the extruder & material properties at the wipe tower object.
for (size_t i = 0; i < 4; ++ i)
for (size_t i = 0; i < (int)(sqrt(wiping_volumes.size())+EPSILON); ++ i)
wipe_tower.set_extruder(
i,
WipeTowerPrusaMM::parse_material(this->config.filament_type.get_at(i).c_str()),