Implemented an initial priming line for a single-material print
on a Prusa Multi-Material printer.
This commit is contained in:
parent
29d9a1e810
commit
2c5304a520
@ -219,6 +219,19 @@ std::string WipeTowerIntegration::prime(GCode &gcodegen)
|
||||
return gcode;
|
||||
}
|
||||
|
||||
std::string WipeTowerIntegration::prime_single_color_print(const Print & /* print */, unsigned int initial_tool, GCode & /* gcodegen */)
|
||||
{
|
||||
std::string gcode = "\
|
||||
G1 Z0.250 F7200.000\n\
|
||||
G1 X50.0 E80.0 F1000.0\n\
|
||||
G1 X160.0 E20.0 F1000.0\n\
|
||||
G1 Z0.200 F7200.000\n\
|
||||
G1 X220.0 E13 F1000.0\n\
|
||||
G1 X240.0 E0 F1000.0\n\
|
||||
G1 E-4 F1000.0\n";
|
||||
return gcode;
|
||||
}
|
||||
|
||||
std::string WipeTowerIntegration::tool_change(GCode &gcodegen, int extruder_id, bool finish_layer)
|
||||
{
|
||||
std::string gcode;
|
||||
@ -673,10 +686,12 @@ bool GCode::_do_export(Print &print, FILE *file)
|
||||
// All extrusion moves with the same top layer height are extruded uninterrupted.
|
||||
std::vector<std::pair<coordf_t, std::vector<LayerToPrint>>> layers_to_print = collect_layers_to_print(print);
|
||||
// Prusa Multi-Material wipe tower.
|
||||
if (print.has_wipe_tower() &&
|
||||
! tool_ordering.empty() && tool_ordering.front().wipe_tower_partitions > 0) {
|
||||
m_wipe_tower.reset(new WipeTowerIntegration(print.config, *print.m_wipe_tower_priming.get(), print.m_wipe_tower_tool_changes, *print.m_wipe_tower_final_purge.get()));
|
||||
write(file, m_wipe_tower->prime(*this));
|
||||
if (print.has_wipe_tower()) {
|
||||
if (tool_ordering.has_wipe_tower()) {
|
||||
m_wipe_tower.reset(new WipeTowerIntegration(print.config, *print.m_wipe_tower_priming.get(), print.m_wipe_tower_tool_changes, *print.m_wipe_tower_final_purge.get()));
|
||||
write(file, m_wipe_tower->prime(*this));
|
||||
} else
|
||||
write(file, WipeTowerIntegration::prime_single_color_print(print, initial_extruder_id, *this));
|
||||
}
|
||||
// Extrude the layers.
|
||||
for (auto &layer : layers_to_print) {
|
||||
|
@ -90,6 +90,7 @@ public:
|
||||
m_brim_done(false) {}
|
||||
|
||||
std::string prime(GCode &gcodegen);
|
||||
static std::string WipeTowerIntegration::prime_single_color_print(const Print & /* print */, unsigned int initial_tool, GCode & /* gcodegen */);
|
||||
void next_layer() { ++ m_layer_idx; m_tool_change_idx = 0; }
|
||||
std::string tool_change(GCode &gcodegen, int extruder_id, bool finish_layer);
|
||||
std::string finalize(GCode &gcodegen);
|
||||
|
@ -121,7 +121,7 @@ void ToolOrdering::collect_extruders(const PrintObject &object)
|
||||
LayerTools &layer_tools = this->tools_for_layer(layer->print_z);
|
||||
// What extruders are required to print this object layer?
|
||||
for (size_t region_id = 0; region_id < object.print()->regions.size(); ++ region_id) {
|
||||
const LayerRegion *layerm = layer->regions[region_id];
|
||||
const LayerRegion *layerm = (region_id < layer->regions.size()) ? layer->regions[region_id] : nullptr;
|
||||
if (layerm == nullptr)
|
||||
continue;
|
||||
const PrintRegion ®ion = *object.print()->regions[region_id];
|
||||
|
@ -71,6 +71,7 @@ public:
|
||||
const LayerTools& back() const { return m_layer_tools.back(); }
|
||||
bool empty() const { return m_layer_tools.empty(); }
|
||||
const std::vector<LayerTools>& layer_tools() const { return m_layer_tools; }
|
||||
bool has_wipe_tower() const { return ! m_layer_tools.empty() && m_first_printing_extruder != (size_t)-1 && m_layer_tools.front().wipe_tower_partitions > 0; }
|
||||
|
||||
private:
|
||||
void initialize_layers(std::vector<coordf_t> &zs);
|
||||
|
@ -388,7 +388,11 @@ WipeTower::ToolChangeResult WipeTowerPrusaMM::prime(float first_layer_height, st
|
||||
this->m_num_layer_changes = 0;
|
||||
this->m_current_tool = tools.front();
|
||||
|
||||
box_coordinates cleaning_box(xy(0.f, - 4.0f), m_wipe_tower_width, wipe_area);
|
||||
// The Prusa i3 MK2 has a working space of [0, -2.2] to [250, 210].
|
||||
// Due to the XYZ calibration, this working space may shrink slightly from all directions,
|
||||
// therefore the homing position is shifted inside the bed by 0.2 in the firmware to [0.2, -2.0].
|
||||
// box_coordinates cleaning_box(xy(0.5f, - 1.5f), m_wipe_tower_width, wipe_area);
|
||||
box_coordinates cleaning_box(xy(5.f, 0.f), m_wipe_tower_width, wipe_area);
|
||||
|
||||
PrusaMultiMaterial::Writer writer;
|
||||
writer.set_extrusion_flow(m_extrusion_flow)
|
||||
@ -401,9 +405,10 @@ WipeTower::ToolChangeResult WipeTowerPrusaMM::prime(float first_layer_height, st
|
||||
.speed_override(100);
|
||||
|
||||
// Always move to the starting position.
|
||||
writer.travel(cleaning_box.ld, 7200);
|
||||
writer.set_initial_position(xy(0.f, 0.f))
|
||||
.travel(cleaning_box.ld, 7200)
|
||||
// Increase the extruder driver current to allow fast ramming.
|
||||
writer.set_extruder_trimpot(750);
|
||||
.set_extruder_trimpot(750);
|
||||
|
||||
if (purpose == PURPOSE_EXTRUDE || purpose == PURPOSE_MOVE_TO_TOWER_AND_EXTRUDE) {
|
||||
for (size_t idx_tool = 0; idx_tool < tools.size(); ++ idx_tool) {
|
||||
|
@ -971,7 +971,7 @@ void Print::_make_wipe_tower()
|
||||
// Let the ToolOrdering class know there will be initial priming extrusions at the start of the print.
|
||||
m_tool_ordering = ToolOrdering(*this, (unsigned int)-1, true);
|
||||
unsigned int initial_extruder_id = m_tool_ordering.first_extruder();
|
||||
if (initial_extruder_id == (unsigned int)-1 || m_tool_ordering.front().wipe_tower_partitions == 0)
|
||||
if (! m_tool_ordering.has_wipe_tower())
|
||||
// Don't generate any wipe tower.
|
||||
return;
|
||||
|
||||
|
@ -950,6 +950,9 @@ void _3DScene::_load_wipe_tower_toolpaths(
|
||||
const std::vector<std::string> &tool_colors_str,
|
||||
bool use_VBOs)
|
||||
{
|
||||
if (print->m_wipe_tower_tool_changes.empty())
|
||||
return;
|
||||
|
||||
std::vector<float> tool_colors = parse_colors(tool_colors_str);
|
||||
|
||||
struct Ctxt
|
||||
@ -978,8 +981,10 @@ void _3DScene::_load_wipe_tower_toolpaths(
|
||||
|
||||
ctxt.print = print;
|
||||
ctxt.tool_colors = tool_colors.empty() ? nullptr : &tool_colors;
|
||||
ctxt.priming.emplace_back(*print->m_wipe_tower_priming.get());
|
||||
ctxt.final.emplace_back(*print->m_wipe_tower_final_purge.get());
|
||||
if (print->m_wipe_tower_priming)
|
||||
ctxt.priming.emplace_back(*print->m_wipe_tower_priming.get());
|
||||
if (print->m_wipe_tower_final_purge)
|
||||
ctxt.final.emplace_back(*print->m_wipe_tower_final_purge.get());
|
||||
|
||||
BOOST_LOG_TRIVIAL(debug) << "Loading wipe tower toolpaths in parallel - start";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user