mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-23 08:41:11 -06:00
Improved retract handling on bowden extruders:
Separated deretract speed from a retract speed, allowed a partial retract before wipe.
This commit is contained in:
parent
8bd3dec331
commit
70db88dd90
20 changed files with 246 additions and 108 deletions
|
@ -27,6 +27,8 @@ static void collect_extruders(const PrintObject &object, std::vector<LayerTools>
|
|||
it_layer->extruders.push_back(extruder_support);
|
||||
if (has_interface)
|
||||
it_layer->extruders.push_back(extruder_interface);
|
||||
if (has_support || has_interface)
|
||||
it_layer->has_support = true;
|
||||
}
|
||||
// Collect the object extruders.
|
||||
for (auto layer : object.layers) {
|
||||
|
@ -38,9 +40,11 @@ static void collect_extruders(const PrintObject &object, std::vector<LayerTools>
|
|||
if (layerm == nullptr)
|
||||
continue;
|
||||
const PrintRegion ®ion = *object.print()->regions[region_id];
|
||||
if (! layerm->perimeters.entities.empty())
|
||||
if (! layerm->perimeters.entities.empty()) {
|
||||
it_layer->extruders.push_back(region.config.perimeter_extruder.value);
|
||||
bool has_infill = false;
|
||||
it_layer->has_object = true;
|
||||
}
|
||||
bool has_infill = false;
|
||||
bool has_solid_infill = false;
|
||||
for (const ExtrusionEntity *ee : layerm->fills.entities) {
|
||||
// fill represents infill extrusions of a single island.
|
||||
|
@ -55,6 +59,8 @@ static void collect_extruders(const PrintObject &object, std::vector<LayerTools>
|
|||
it_layer->extruders.push_back(region.config.solid_infill_extruder);
|
||||
if (has_infill)
|
||||
it_layer->extruders.push_back(region.config.infill_extruder);
|
||||
if (has_solid_infill || has_infill)
|
||||
it_layer->has_object = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -137,6 +143,10 @@ static void fill_wipe_tower_partitions(std::vector<LayerTools> &layers)
|
|||
// Propagate the wipe tower partitions down to support the upper partitions by the lower partitions.
|
||||
for (int i = int(layers.size()) - 2; i >= 0; -- i)
|
||||
layers[i].wipe_tower_partitions = std::max(layers[i + 1].wipe_tower_partitions, layers[i].wipe_tower_partitions);
|
||||
|
||||
//FIXME this is a hack to get the ball rolling.
|
||||
for (LayerTools < : layers)
|
||||
lt.has_wipe_tower = lt.has_object;
|
||||
}
|
||||
|
||||
// For the use case when each object is printed separately
|
||||
|
|
|
@ -11,14 +11,25 @@ namespace ToolOrdering {
|
|||
|
||||
struct LayerTools
|
||||
{
|
||||
LayerTools(const coordf_t z) : print_z(z), wipe_tower_partitions(0) {}
|
||||
LayerTools(const coordf_t z) :
|
||||
print_z(z),
|
||||
has_object(false),
|
||||
has_support(false),
|
||||
has_wipe_tower(false),
|
||||
wipe_tower_partitions(0) {}
|
||||
|
||||
bool operator< (const LayerTools &rhs) const { return print_z < rhs.print_z; }
|
||||
bool operator==(const LayerTools &rhs) const { return print_z == rhs.print_z; }
|
||||
|
||||
coordf_t print_z;
|
||||
bool has_object;
|
||||
bool has_support;
|
||||
// Zero based extruder IDs, ordered to minimize tool switches.
|
||||
std::vector<unsigned int> extruders;
|
||||
// Will there be anything extruded on this layer for the wipe tower?
|
||||
// Due to the support layers possibly interleaving the object layers,
|
||||
// wipe tower will be disabled for some support only layers.
|
||||
bool has_wipe_tower;
|
||||
// Number of wipe tower partitions to support the required number of tool switches
|
||||
// and to support the wipe tower partitions above this one.
|
||||
size_t wipe_tower_partitions;
|
||||
|
|
|
@ -30,6 +30,9 @@ public:
|
|||
// Return the wipe tower position.
|
||||
virtual const xy& position() const = 0;
|
||||
|
||||
// Return the wipe tower width.
|
||||
virtual float width() const = 0;
|
||||
|
||||
// The wipe tower is finished, there should be no more tool changes or wipe tower prints.
|
||||
virtual bool finished() const = 0;
|
||||
|
||||
|
|
|
@ -348,11 +348,24 @@ std::pair<std::string, WipeTower::xy> WipeTowerPrusaMM::tool_change(int tool, Pu
|
|||
// Wipe the newly loaded filament until the end of the assigned wipe area.
|
||||
toolchange_Wipe(writer, cleaning_box);
|
||||
// Draw a perimeter around cleaning_box and wipe.
|
||||
toolchange_Done(writer, cleaning_box);
|
||||
box_coordinates box = cleaning_box;
|
||||
if (m_current_shape == SHAPE_REVERSED) {
|
||||
std::swap(box.lu, box.ld);
|
||||
std::swap(box.ru, box.rd);
|
||||
}
|
||||
// Draw a perimeter around cleaning_box.
|
||||
writer.travel(box.lu, 7000)
|
||||
.extrude(box.ld, 3200).extrude(box.rd)
|
||||
.extrude(box.ru).extrude(box.lu);
|
||||
// Wipe the nozzle.
|
||||
if (purpose == PURPOSE_MOVE_TO_TOWER_AND_EXTRUDE)
|
||||
writer.travel(box.ru, 7200)
|
||||
.travel(box.lu);
|
||||
}
|
||||
|
||||
// Reset the extruder current to a normal value.
|
||||
writer.set_extruder_trimpot(550)
|
||||
.feedrate(6000)
|
||||
.flush_planner_queue()
|
||||
.reset_extruder()
|
||||
.append("; CP TOOLCHANGE END\n"
|
||||
|
@ -423,11 +436,15 @@ std::pair<std::string, WipeTower::xy> WipeTowerPrusaMM::toolchange_Brim(Purpose
|
|||
}
|
||||
}
|
||||
|
||||
// Move to the front left corner and wipe along the front edge.
|
||||
writer.travel(wipeTower_box.ld, 7000)
|
||||
.travel(wipeTower_box.rd)
|
||||
.travel(wipeTower_box.ld)
|
||||
.append("; CP WIPE TOWER FIRST LAYER BRIM END\n"
|
||||
// Move to the front left corner.
|
||||
writer.travel(wipeTower_box.ld, 7000);
|
||||
|
||||
if (purpose == PURPOSE_MOVE_TO_TOWER_AND_EXTRUDE)
|
||||
// Wipe along the front edge.
|
||||
writer.travel(wipeTower_box.rd)
|
||||
.travel(wipeTower_box.ld);
|
||||
|
||||
writer.append("; CP WIPE TOWER FIRST LAYER BRIM END\n"
|
||||
";-----------------------------------\n");
|
||||
|
||||
// Mark the brim as extruded.
|
||||
|
@ -616,26 +633,6 @@ void WipeTowerPrusaMM::toolchange_Wipe(
|
|||
writer.set_extrusion_flow(m_extrusion_flow);
|
||||
}
|
||||
|
||||
// Draw a perimeter around cleaning_box and wipe.
|
||||
void WipeTowerPrusaMM::toolchange_Done(
|
||||
PrusaMultiMaterial::Writer &writer,
|
||||
const box_coordinates &cleaning_box)
|
||||
{
|
||||
box_coordinates box = cleaning_box;
|
||||
if (m_current_shape == SHAPE_REVERSED) {
|
||||
std::swap(box.lu, box.ld);
|
||||
std::swap(box.ru, box.rd);
|
||||
}
|
||||
// Draw a perimeter around cleaning_box.
|
||||
writer.travel(box.lu, 7000)
|
||||
.extrude(box.ld, 3200).extrude(box.rd)
|
||||
.extrude(box.ru).extrude(box.lu)
|
||||
// Wipe the nozzle.
|
||||
.travel(box.ru, 7200)
|
||||
.travel(box.lu)
|
||||
.feedrate(6000);
|
||||
}
|
||||
|
||||
std::pair<std::string, WipeTower::xy> WipeTowerPrusaMM::finish_layer(Purpose purpose)
|
||||
{
|
||||
// This should only be called if the layer is not finished yet.
|
||||
|
@ -720,11 +717,16 @@ std::pair<std::string, WipeTower::xy> WipeTowerPrusaMM::finish_layer(Purpose pur
|
|||
writer.extrude(fill_box.ru + xy(- m_perimeter_width * 6, - m_perimeter_width), 2900 * speed_factor)
|
||||
.extrude(fill_box.ru + xy(- m_perimeter_width * 3, - m_perimeter_width))
|
||||
.extrude(fill_box.rd + xy(- m_perimeter_width * 3, m_perimeter_width))
|
||||
.extrude(fill_box.rd + xy(- m_perimeter_width, m_perimeter_width))
|
||||
// Wipe along the front side of the current wiping box.
|
||||
.travel(fill_box.ld + xy( m_perimeter_width, m_perimeter_width / 2), 7200)
|
||||
.travel(fill_box.rd + xy(- m_perimeter_width, m_perimeter_width / 2))
|
||||
.append("; CP EMPTY GRID END\n"
|
||||
.extrude(fill_box.rd + xy(- m_perimeter_width, m_perimeter_width));
|
||||
|
||||
if (purpose == PURPOSE_MOVE_TO_TOWER_AND_EXTRUDE)
|
||||
// Wipe along the front side of the current wiping box.
|
||||
writer.travel(fill_box.ld + xy( m_perimeter_width, m_perimeter_width / 2), 7200)
|
||||
.travel(fill_box.rd + xy(- m_perimeter_width, m_perimeter_width / 2));
|
||||
else
|
||||
writer.feedrate(7200);
|
||||
|
||||
writer.append("; CP EMPTY GRID END\n"
|
||||
";------------------\n\n\n\n\n\n\n");
|
||||
|
||||
// Indicate that this wipe tower layer is fully covered.
|
||||
|
|
|
@ -105,6 +105,8 @@ public:
|
|||
|
||||
// Return the wipe tower position.
|
||||
virtual const xy& position() const { return m_wipe_tower_pos; }
|
||||
// Return the wipe tower width.
|
||||
virtual float width() const { return m_wipe_tower_width; }
|
||||
// The wipe tower is finished, there should be no more tool changes or wipe tower prints.
|
||||
virtual bool finished() const { return m_max_color_changes == 0; }
|
||||
|
||||
|
@ -228,10 +230,6 @@ private:
|
|||
PrusaMultiMaterial::Writer &writer,
|
||||
const box_coordinates &cleaning_box);
|
||||
|
||||
void toolchange_Done(
|
||||
PrusaMultiMaterial::Writer &writer,
|
||||
const box_coordinates &cleaning_box);
|
||||
|
||||
void toolchange_Perimeter();
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue