Extrusion flow calculation based on nozzle diameter etc

This commit is contained in:
Lukas Matena 2017-12-07 11:59:14 +01:00
parent c34fd10e23
commit 87c67636df
2 changed files with 24 additions and 10 deletions

View File

@ -406,7 +406,7 @@ WipeTower::ToolChangeResult WipeTowerPrusaMM::prime(
float e_length = this->tool_change(0, false, PURPOSE_EXTRUDE).total_extrusion_length_in_plane();
// Shrink wipe_area by the amount of extrusion extruded by the finish_layer().
// Y stepping of the wipe extrusions.
float dy = m_perimeter_width * 0.8f;
float dy = m_line_width;
// Number of whole wipe lines, that would be extruded to wipe as much material as the finish_layer().
// Minimum wipe area is 5mm wide.
//FIXME calculate the purge_lines_width precisely.
@ -453,7 +453,7 @@ WipeTower::ToolChangeResult WipeTowerPrusaMM::prime(
if (last_wipe_inside_wipe_tower) {
// Shrink the last wipe area to the area of the other purge areas,
// remember the last initial wipe width to be purged into the 1st layer of the wipe tower.
this->m_initial_extra_wipe = std::max(0.f, wipe_area - (y_end + 0.5f * 0.85f * m_perimeter_width - cleaning_box.ld.y));
this->m_initial_extra_wipe = std::max(0.f, wipe_area - (y_end + 0.5f * m_line_width - cleaning_box.ld.y));
cleaning_box.lu.y -= this->m_initial_extra_wipe;
cleaning_box.ru.y -= this->m_initial_extra_wipe;
}
@ -524,7 +524,7 @@ WipeTower::ToolChangeResult WipeTowerPrusaMM::tool_change(unsigned int tool, boo
}
// Shrink wipe_area by the amount of extrusion extruded by the finish_layer().
// Y stepping of the wipe extrusions.
float dy = m_perimeter_width * 0.8f;
float dy = m_line_width;
// Number of whole wipe lines, that would be extruded to wipe as much material as the finish_layer().
float num_lines_extruded = floor(e_length / m_wipe_tower_width);
// Minimum wipe area is 5mm wide.
@ -645,7 +645,6 @@ WipeTower::ToolChangeResult WipeTowerPrusaMM::toolchange_Brim(Purpose purpose, b
.set_layer_height(m_layer_height)
.set_initial_tool(m_current_tool)
.set_rotation(m_wipe_tower_pos, m_wipe_tower_width, m_wipe_tower_depth, m_wipe_tower_rotation_angle)
//.set_offset(xy(-))
.append(
";-------------------------------------\n"
"; CP WIPE TOWER FIRST LAYER BRIM START\n");
@ -867,7 +866,7 @@ void WipeTowerPrusaMM::toolchange_Load(
writer.extrude(xr, writer.y(), 1600);
bool colorInit = false;
size_t pass = colorInit ? 1 : 2;
float dy = ((m_current_shape == SHAPE_NORMAL) ? 1.f : -1.f) * m_perimeter_width * 0.85f;
float dy = ((m_current_shape == SHAPE_NORMAL) ? 1.f : -1.f) * m_line_width;
for (int i = 0; i < pass; ++ i) {
writer.travel (xr, writer.y() + dy, 7200);
writer.extrude(xl, writer.y(), 2200);
@ -896,7 +895,7 @@ void WipeTowerPrusaMM::toolchange_Wipe(
float wipe_speed_inc = 50.f;
float wipe_speed_max = 4800.f;
// Y increment per wipe line.
float dy = ((m_current_shape == SHAPE_NORMAL) ? 1.f : -1.f) * m_perimeter_width * 0.8f;
float dy = ((m_current_shape == SHAPE_NORMAL) ? 1.f : -1.f) * m_line_width;
for (bool p = true;
// Next wipe line fits the cleaning box.
((m_current_shape == SHAPE_NORMAL) ?

View File

@ -8,6 +8,18 @@
#include "WipeTower.hpp"
// Following is used to calculate extrusion flow - should be taken from config in future
constexpr float Filament_Diameter = 1.75f; // filament diameter in mm
constexpr float Nozzle_Diameter = 0.4f; // nozzle diameter in mm
// desired line width (oval) in multiples of nozzle diameter - may not be actually neccessary to adjust
constexpr float Width_To_Nozzle_Ratio = 1.f;
// m_perimeter_width was hardcoded until now as 0.5 (for 0.4 nozzle and 0.2 layer height)
// Konst = 1.25 implies same result
constexpr float Konst = 1.25f;
constexpr float m_perimeter_width = Nozzle_Diameter * Width_To_Nozzle_Ratio * Konst;
namespace Slic3r
{
@ -63,7 +75,7 @@ public:
// _zHop - z hop value in mm
void set_zhop(float zhop) { m_zhop = zhop; }
// Set the extruder properties.
void set_extruder(size_t idx, material_type material, int temp, int first_layer_temp)
{
@ -101,9 +113,12 @@ public:
// Extrusion rate for an extrusion aka perimeter width 0.35mm.
// Clamp the extrusion height to a 0.2mm layer height, independent of the nozzle diameter.
// m_extrusion_flow = std::min(0.2f, layer_height) * 0.145f;
// Use a strictly
m_extrusion_flow = layer_height * 0.145f;
//m_extrusion_flow = layer_height * 0.145f;
// Calculates extrusion flow from desired line width, nozzle diameter, filament diameter and layer_height
m_extrusion_flow = 4.f * layer_height * ( Width_To_Nozzle_Ratio * Nozzle_Diameter - layer_height * (1-M_PI/4.f)) /
(M_PI * pow(Filament_Diameter,2.f));
}
// Return the wipe tower position.
@ -174,7 +189,7 @@ private:
float m_zhop = 0.5f;
float m_retract = 4.f;
// Width of an extrusion line, also a perimeter spacing for 100% infill.
float m_perimeter_width = 0.5f;
float m_line_width = Nozzle_Diameter * Width_To_Nozzle_Ratio;
// Extrusion flow is derived from m_perimeter_width, layer height and filament diameter.
float m_extrusion_flow = 0.029f;