mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-15 22:35:58 +08:00
Wipe tower: Use perimeter_speed and infill_speed instead of the hardcoded values
This commit is contained in:
parent
3571812a3d
commit
3ab20de3c0
@ -516,7 +516,7 @@ WipeTower::ToolChangeResult WipeTower::construct_tcr(WipeTowerWriter& writer,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
WipeTower::WipeTower(const PrintConfig& config, const std::vector<std::vector<float>>& wiping_matrix, size_t initial_tool) :
|
WipeTower::WipeTower(const PrintConfig& config, const PrintRegionConfig& default_region_config, const std::vector<std::vector<float>>& wiping_matrix, size_t initial_tool) :
|
||||||
m_semm(config.single_extruder_multi_material.value),
|
m_semm(config.single_extruder_multi_material.value),
|
||||||
m_wipe_tower_pos(config.wipe_tower_x, config.wipe_tower_y),
|
m_wipe_tower_pos(config.wipe_tower_x, config.wipe_tower_y),
|
||||||
m_wipe_tower_width(float(config.wipe_tower_width)),
|
m_wipe_tower_width(float(config.wipe_tower_width)),
|
||||||
@ -530,6 +530,8 @@ WipeTower::WipeTower(const PrintConfig& config, const std::vector<std::vector<fl
|
|||||||
m_no_sparse_layers(config.wipe_tower_no_sparse_layers),
|
m_no_sparse_layers(config.wipe_tower_no_sparse_layers),
|
||||||
m_gcode_flavor(config.gcode_flavor),
|
m_gcode_flavor(config.gcode_flavor),
|
||||||
m_travel_speed(config.travel_speed),
|
m_travel_speed(config.travel_speed),
|
||||||
|
m_infill_speed(default_region_config.infill_speed),
|
||||||
|
m_perimeter_speed(default_region_config.perimeter_speed),
|
||||||
m_current_tool(initial_tool),
|
m_current_tool(initial_tool),
|
||||||
wipe_volumes(wiping_matrix)
|
wipe_volumes(wiping_matrix)
|
||||||
{
|
{
|
||||||
@ -541,6 +543,13 @@ WipeTower::WipeTower(const PrintConfig& config, const std::vector<std::vector<fl
|
|||||||
if (m_first_layer_speed == 0.f) // just to make sure autospeed doesn't break it.
|
if (m_first_layer_speed == 0.f) // just to make sure autospeed doesn't break it.
|
||||||
m_first_layer_speed = default_speed / 2.f;
|
m_first_layer_speed = default_speed / 2.f;
|
||||||
|
|
||||||
|
// Autospeed may be used...
|
||||||
|
if (m_infill_speed == 0.f)
|
||||||
|
m_infill_speed = 80.f;
|
||||||
|
if (m_perimeter_speed == 0.f)
|
||||||
|
m_perimeter_speed = 80.f;
|
||||||
|
|
||||||
|
|
||||||
// If this is a single extruder MM printer, we will use all the SE-specific config values.
|
// 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.
|
// Otherwise, the defaults will be used to turn off the SE stuff.
|
||||||
if (m_semm) {
|
if (m_semm) {
|
||||||
@ -1034,7 +1043,7 @@ void WipeTower::toolchange_Wipe(
|
|||||||
float x_to_wipe = volume_to_length(wipe_volume, m_perimeter_width, m_layer_height);
|
float x_to_wipe = volume_to_length(wipe_volume, m_perimeter_width, m_layer_height);
|
||||||
float dy = m_extra_spacing*m_perimeter_width;
|
float dy = m_extra_spacing*m_perimeter_width;
|
||||||
|
|
||||||
const float target_speed = is_first_layer() ? m_first_layer_speed * 60.f : 4800.f;
|
const float target_speed = is_first_layer() ? m_first_layer_speed * 60.f : m_infill_speed * 60.f;
|
||||||
float wipe_speed = 0.33f * target_speed;
|
float wipe_speed = 0.33f * target_speed;
|
||||||
|
|
||||||
// if there is less than 2.5*m_perimeter_width to the edge, advance straightaway (there is likely a blob anyway)
|
// if there is less than 2.5*m_perimeter_width to the edge, advance straightaway (there is likely a blob anyway)
|
||||||
@ -1103,7 +1112,7 @@ WipeTower::ToolChangeResult WipeTower::finish_layer()
|
|||||||
|
|
||||||
// Slow down on the 1st layer.
|
// Slow down on the 1st layer.
|
||||||
bool first_layer = is_first_layer();
|
bool first_layer = is_first_layer();
|
||||||
float feedrate = first_layer ? m_first_layer_speed * 60.f : 2900.f;
|
float feedrate = first_layer ? m_first_layer_speed * 60.f : m_infill_speed * 60.f;
|
||||||
float current_depth = m_layer_info->depth - m_layer_info->toolchanges_depth();
|
float current_depth = m_layer_info->depth - m_layer_info->toolchanges_depth();
|
||||||
box_coordinates fill_box(Vec2f(m_perimeter_width, m_layer_info->depth-(current_depth-m_perimeter_width)),
|
box_coordinates fill_box(Vec2f(m_perimeter_width, m_layer_info->depth-(current_depth-m_perimeter_width)),
|
||||||
m_wipe_tower_width - 2 * m_perimeter_width, current_depth-m_perimeter_width);
|
m_wipe_tower_width - 2 * m_perimeter_width, current_depth-m_perimeter_width);
|
||||||
@ -1203,7 +1212,7 @@ WipeTower::ToolChangeResult WipeTower::finish_layer()
|
|||||||
// First generate vector of annotated point which form the boundary.
|
// First generate vector of annotated point which form the boundary.
|
||||||
std::vector<std::pair<Vec2f, Type>> pts = {{wt_box.ru, Corner}};
|
std::vector<std::pair<Vec2f, Type>> pts = {{wt_box.ru, Corner}};
|
||||||
if (double alpha_start = std::asin((0.5*w)/r); ! std::isnan(alpha_start) && r > 0.5*w+0.01) {
|
if (double alpha_start = std::asin((0.5*w)/r); ! std::isnan(alpha_start) && r > 0.5*w+0.01) {
|
||||||
for (double alpha = alpha_start; alpha < M_PI-alpha_start+0.001; alpha+=(M_PI-2*alpha_start) / 20.)
|
for (double alpha = alpha_start; alpha < M_PI-alpha_start+0.001; alpha+=(M_PI-2*alpha_start) / 40.)
|
||||||
pts.emplace_back(Vec2f(center.x() + r*std::cos(alpha)/support_scale, center.y() + r*std::sin(alpha)), alpha == alpha_start ? ArcStart : Arc);
|
pts.emplace_back(Vec2f(center.x() + r*std::cos(alpha)/support_scale, center.y() + r*std::sin(alpha)), alpha == alpha_start ? ArcStart : Arc);
|
||||||
pts.back().second = ArcEnd;
|
pts.back().second = ArcEnd;
|
||||||
}
|
}
|
||||||
@ -1285,6 +1294,8 @@ WipeTower::ToolChangeResult WipeTower::finish_layer()
|
|||||||
return poly;
|
return poly;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
feedrate = first_layer ? m_first_layer_speed * 60.f : m_perimeter_speed * 60.f;
|
||||||
|
|
||||||
// outer contour (always)
|
// outer contour (always)
|
||||||
bool infill_cone = first_layer && m_wipe_tower_width > 2*spacing && m_wipe_tower_depth > 2*spacing;
|
bool infill_cone = first_layer && m_wipe_tower_width > 2*spacing && m_wipe_tower_depth > 2*spacing;
|
||||||
Polygon poly = supported_rectangle(wt_box, feedrate, infill_cone);
|
Polygon poly = supported_rectangle(wt_box, feedrate, infill_cone);
|
||||||
|
@ -14,6 +14,7 @@ namespace Slic3r
|
|||||||
|
|
||||||
class WipeTowerWriter;
|
class WipeTowerWriter;
|
||||||
class PrintConfig;
|
class PrintConfig;
|
||||||
|
class PrintRegionConfig;
|
||||||
enum GCodeFlavor : unsigned char;
|
enum GCodeFlavor : unsigned char;
|
||||||
|
|
||||||
|
|
||||||
@ -129,7 +130,10 @@ 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
|
||||||
WipeTower(const PrintConfig& config, const std::vector<std::vector<float>>& wiping_matrix, size_t initial_tool);
|
WipeTower(const PrintConfig& config,
|
||||||
|
const PrintRegionConfig& default_region_config,
|
||||||
|
const std::vector<std::vector<float>>& wiping_matrix,
|
||||||
|
size_t initial_tool);
|
||||||
|
|
||||||
|
|
||||||
// Set the extruder properties.
|
// Set the extruder properties.
|
||||||
@ -269,6 +273,8 @@ private:
|
|||||||
size_t m_max_color_changes = 0; // Maximum number of color changes per layer.
|
size_t m_max_color_changes = 0; // Maximum number of color changes per layer.
|
||||||
int m_old_temperature = -1; // To keep track of what was the last temp that we set (so we don't issue the command when not neccessary)
|
int m_old_temperature = -1; // To keep track of what was the last temp that we set (so we don't issue the command when not neccessary)
|
||||||
float m_travel_speed = 0.f;
|
float m_travel_speed = 0.f;
|
||||||
|
float m_infill_speed = 0.f;
|
||||||
|
float m_perimeter_speed = 0.f;
|
||||||
float m_first_layer_speed = 0.f;
|
float m_first_layer_speed = 0.f;
|
||||||
size_t m_first_layer_idx = size_t(-1);
|
size_t m_first_layer_idx = size_t(-1);
|
||||||
|
|
||||||
|
@ -1453,7 +1453,7 @@ void Print::_make_wipe_tower()
|
|||||||
this->throw_if_canceled();
|
this->throw_if_canceled();
|
||||||
|
|
||||||
// Initialize the wipe tower.
|
// Initialize the wipe tower.
|
||||||
WipeTower wipe_tower(m_config, wipe_volumes, m_wipe_tower_data.tool_ordering.first_extruder());
|
WipeTower wipe_tower(m_config, m_default_region_config, wipe_volumes, m_wipe_tower_data.tool_ordering.first_extruder());
|
||||||
|
|
||||||
//wipe_tower.set_retract();
|
//wipe_tower.set_retract();
|
||||||
//wipe_tower.set_zhop();
|
//wipe_tower.set_zhop();
|
||||||
|
@ -814,15 +814,15 @@ bool PrintObject::invalidate_state_by_config_options(
|
|||||||
|| opt_key == "overhang_speed_2"
|
|| opt_key == "overhang_speed_2"
|
||||||
|| opt_key == "overhang_speed_3"
|
|| opt_key == "overhang_speed_3"
|
||||||
|| opt_key == "external_perimeter_speed"
|
|| opt_key == "external_perimeter_speed"
|
||||||
|| opt_key == "infill_speed"
|
|
||||||
|| opt_key == "perimeter_speed"
|
|
||||||
|| opt_key == "small_perimeter_speed"
|
|| opt_key == "small_perimeter_speed"
|
||||||
|| opt_key == "solid_infill_speed"
|
|| opt_key == "solid_infill_speed"
|
||||||
|| opt_key == "top_solid_infill_speed") {
|
|| opt_key == "top_solid_infill_speed") {
|
||||||
invalidated |= m_print->invalidate_step(psGCodeExport);
|
invalidated |= m_print->invalidate_step(psGCodeExport);
|
||||||
} else if (
|
} else if (
|
||||||
opt_key == "wipe_into_infill"
|
opt_key == "wipe_into_infill"
|
||||||
|| opt_key == "wipe_into_objects") {
|
|| opt_key == "wipe_into_objects"
|
||||||
|
|| opt_key == "infill_speed"
|
||||||
|
|| opt_key == "perimeter_speed") {
|
||||||
invalidated |= m_print->invalidate_step(psWipeTower);
|
invalidated |= m_print->invalidate_step(psWipeTower);
|
||||||
invalidated |= m_print->invalidate_step(psGCodeExport);
|
invalidated |= m_print->invalidate_step(psGCodeExport);
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user