mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-20 05:07:51 -06:00
Merge branch 'master' into SoftFever
# Conflicts: # bbl/i18n/zh_cn/BambuStudio_zh_CN.po # resources/i18n/de/BambuStudio.mo # resources/i18n/en/BambuStudio.mo # resources/i18n/es/BambuStudio.mo # resources/i18n/fr/BambuStudio.mo # resources/i18n/hu/BambuStudio.mo # resources/i18n/nl/BambuStudio.mo # resources/i18n/sv/BambuStudio.mo # resources/i18n/zh_cn/BambuStudio.mo # resources/profiles/Creality.json # resources/profiles/Voron.json # resources/web/guide/3/index.html # src/libslic3r/AppConfig.cpp # src/libslic3r/GCode.cpp # src/libslic3r/GCode/GCodeProcessor.cpp # src/libslic3r/LayerRegion.cpp # src/libslic3r/Preset.cpp # src/libslic3r/Print.cpp # src/libslic3r/PrintConfig.cpp # src/libslic3r/PrintConfig.hpp # src/libslic3r/PrintObject.cpp # src/slic3r/GUI/AboutDialog.cpp # src/slic3r/GUI/BBLTopbar.cpp # src/slic3r/GUI/ConfigManipulation.cpp # src/slic3r/GUI/ConfigWizard.cpp # src/slic3r/GUI/GCodeViewer.cpp # src/slic3r/GUI/GUI_App.cpp # src/slic3r/GUI/GUI_Factories.cpp # src/slic3r/GUI/MainFrame.cpp # src/slic3r/GUI/Plater.cpp # src/slic3r/GUI/Tab.cpp # version.inc
This commit is contained in:
commit
bf8a9fee1f
689 changed files with 46784 additions and 10006 deletions
|
@ -244,6 +244,45 @@ public:
|
|||
return (*this);
|
||||
}
|
||||
|
||||
WipeTowerWriter &rectangle_fill_box(const WipeTower* wipe_tower, const Vec2f &ld, float width, float height, const float f = 0.f)
|
||||
{
|
||||
bool need_change_flow = wipe_tower->need_thick_bridge_flow(ld.y());
|
||||
|
||||
Vec2f corners[4];
|
||||
corners[0] = ld;
|
||||
corners[1] = ld + Vec2f(width, 0.f);
|
||||
corners[2] = ld + Vec2f(width, height);
|
||||
corners[3] = ld + Vec2f(0.f, height);
|
||||
int index_of_closest = 0;
|
||||
if (x() - ld.x() > ld.x() + width - x()) // closer to the right
|
||||
index_of_closest = 1;
|
||||
if (y() - ld.y() > ld.y() + height - y()) // closer to the top
|
||||
index_of_closest = (index_of_closest == 0 ? 3 : 2);
|
||||
|
||||
travel(corners[index_of_closest].x(), y()); // travel to the closest corner
|
||||
travel(x(), corners[index_of_closest].y());
|
||||
|
||||
int i = index_of_closest;
|
||||
bool flow_changed = false;
|
||||
do {
|
||||
++i;
|
||||
if (i == 4) i = 0;
|
||||
if (need_change_flow) {
|
||||
if (i == 1) {
|
||||
// using bridge flow in bridge area, and add notes for gcode-check when flow changed
|
||||
set_extrusion_flow(wipe_tower->extrusion_flow(0.2));
|
||||
append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Height) + std::to_string(0.2) + "\n");
|
||||
flow_changed = true;
|
||||
} else if (i == 2 && flow_changed) {
|
||||
set_extrusion_flow(wipe_tower->get_extrusion_flow());
|
||||
append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Height) + std::to_string(m_layer_height) + "\n");
|
||||
}
|
||||
}
|
||||
extrude(corners[i], f);
|
||||
} while (i != index_of_closest);
|
||||
return (*this);
|
||||
}
|
||||
|
||||
WipeTowerWriter& rectangle(const WipeTower::box_coordinates& box, const float f = 0.f)
|
||||
{
|
||||
rectangle(Vec2f(box.ld.x(), box.ld.y()),
|
||||
|
@ -664,7 +703,7 @@ std::vector<WipeTower::ToolChangeResult> WipeTower::prime(
|
|||
return std::vector<ToolChangeResult>();
|
||||
}
|
||||
|
||||
WipeTower::ToolChangeResult WipeTower::tool_change(size_t tool, bool extrude_perimeter)
|
||||
WipeTower::ToolChangeResult WipeTower::tool_change(size_t tool, bool extrude_perimeter, bool first_toolchange_to_nonsoluble)
|
||||
{
|
||||
size_t old_tool = m_current_tool;
|
||||
|
||||
|
@ -733,6 +772,12 @@ WipeTower::ToolChangeResult WipeTower::tool_change(size_t tool, bool extrude_per
|
|||
writer.rectangle(wt_box);
|
||||
writer.travel(initial_position);
|
||||
}
|
||||
|
||||
if (first_toolchange_to_nonsoluble) {
|
||||
writer.travel(Vec2f(0, 0));
|
||||
writer.travel(initial_position);
|
||||
}
|
||||
|
||||
toolchange_Wipe(writer, cleaning_box, wipe_length); // Wipe the newly loaded filament until the end of the assigned wipe area.
|
||||
++ m_num_tool_changes;
|
||||
} else
|
||||
|
@ -974,6 +1019,12 @@ void WipeTower::toolchange_Wipe(
|
|||
// Increase flow on first layer, slow down print.
|
||||
writer.set_extrusion_flow(m_extrusion_flow * (is_first_layer() ? 1.15f : 1.f))
|
||||
.append("; CP TOOLCHANGE WIPE\n");
|
||||
|
||||
// BBS: add the note for gcode-check, when the flow changed, the width should follow the change
|
||||
if (is_first_layer()) {
|
||||
writer.append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Width) + std::to_string(1.15 * m_perimeter_width) + "\n");
|
||||
}
|
||||
|
||||
const float& xl = cleaning_box.ld.x();
|
||||
const float& xr = cleaning_box.rd.x();
|
||||
|
||||
|
@ -1005,6 +1056,7 @@ void WipeTower::toolchange_Wipe(
|
|||
writer.travel(xl, writer.y() + dy);
|
||||
#endif
|
||||
|
||||
bool need_change_flow = false;
|
||||
// now the wiping itself:
|
||||
for (int i = 0; true; ++i) {
|
||||
if (i!=0) {
|
||||
|
@ -1014,11 +1066,24 @@ void WipeTower::toolchange_Wipe(
|
|||
else wipe_speed = std::min(target_speed, wipe_speed + 50.f);
|
||||
}
|
||||
|
||||
// BBS: check the bridging area and use the bridge flow
|
||||
if (need_change_flow || need_thick_bridge_flow(writer.y())) {
|
||||
writer.set_extrusion_flow(extrusion_flow(0.2));
|
||||
writer.append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Height) + std::to_string(0.2) + "\n");
|
||||
need_change_flow = true;
|
||||
}
|
||||
|
||||
if (m_left_to_right)
|
||||
writer.extrude(xr + 0.25f * m_perimeter_width, writer.y(), wipe_speed);
|
||||
else
|
||||
writer.extrude(xl - 0.25f * m_perimeter_width, writer.y(), wipe_speed);
|
||||
|
||||
// BBS: recover the flow in non-bridging area
|
||||
if (need_change_flow) {
|
||||
writer.set_extrusion_flow(m_extrusion_flow);
|
||||
writer.append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Height) + std::to_string(m_layer_height) + "\n");
|
||||
}
|
||||
|
||||
if (writer.y() - float(EPSILON) > cleaning_box.lu.y())
|
||||
break; // in case next line would not fit
|
||||
|
||||
|
@ -1044,6 +1109,10 @@ void WipeTower::toolchange_Wipe(
|
|||
m_left_to_right = !m_left_to_right;
|
||||
|
||||
writer.set_extrusion_flow(m_extrusion_flow); // Reset the extrusion flow.
|
||||
// BBS: add the note for gcode-check when the flow changed
|
||||
if (is_first_layer()) {
|
||||
writer.append(";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Width) + std::to_string(m_perimeter_width) + "\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1099,7 +1168,7 @@ WipeTower::ToolChangeResult WipeTower::finish_layer(bool extrude_perimeter, bool
|
|||
|
||||
// inner perimeter of the sparse section, if there is space for it:
|
||||
if (fill_box.ru.y() - fill_box.rd.y() > m_perimeter_width - WT_EPSILON)
|
||||
writer.rectangle(fill_box.ld, fill_box.rd.x() - fill_box.ld.x(), fill_box.ru.y() - fill_box.rd.y(), feedrate);
|
||||
writer.rectangle_fill_box(this, fill_box.ld, fill_box.rd.x() - fill_box.ld.x(), fill_box.ru.y() - fill_box.rd.y(), feedrate);
|
||||
|
||||
// we are in one of the corners, travel to ld along the perimeter:
|
||||
if (writer.x() > fill_box.ld.x() + EPSILON) writer.travel(fill_box.ld.x(), writer.y());
|
||||
|
@ -1241,6 +1310,10 @@ void WipeTower::plan_toolchange(float z_par, float layer_height_par, unsigned in
|
|||
float depth = 0.f;
|
||||
float width = m_wipe_tower_width - 2 * m_perimeter_width;
|
||||
|
||||
// BBS: if the wipe tower width is too small, the depth will be infinity
|
||||
if (width <= EPSILON)
|
||||
return;
|
||||
|
||||
// BBS: remove old filament ramming and first line
|
||||
#if 0
|
||||
float length_to_extrude = volume_to_length(0.25f * std::accumulate(m_filpar[old_tool].ramming_speed.begin(), m_filpar[old_tool].ramming_speed.end(), 0.f),
|
||||
|
@ -1518,7 +1591,11 @@ void WipeTower::generate(std::vector<std::vector<WipeTower::ToolChangeResult>> &
|
|||
finish_layer_tcr = finish_layer(false, layer.extruder_fill);
|
||||
}
|
||||
else {
|
||||
layer_result.emplace_back(tool_change(layer.tool_changes[i].new_tool));
|
||||
if (idx == -1 && i == 0) {
|
||||
layer_result.emplace_back(tool_change(layer.tool_changes[i].new_tool, false, true));
|
||||
} else {
|
||||
layer_result.emplace_back(tool_change(layer.tool_changes[i].new_tool));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1585,4 +1662,30 @@ WipeTower::ToolChangeResult WipeTower::only_generate_out_wall()
|
|||
return construct_tcr(writer, false, old_tool, true, 0.f);
|
||||
}
|
||||
|
||||
bool WipeTower::get_floating_area(float &start_pos_y, float &end_pos_y) const {
|
||||
if (m_layer_info == m_plan.begin() || (m_layer_info - 1) == m_plan.begin())
|
||||
return false;
|
||||
|
||||
float last_layer_fill_box_y = (m_layer_info - 1)->toolchanges_depth() + m_perimeter_width;
|
||||
float last_layer_wipe_depth = (m_layer_info - 1)->depth;
|
||||
if (last_layer_wipe_depth - last_layer_fill_box_y <= 2 * m_perimeter_width)
|
||||
return false;
|
||||
|
||||
start_pos_y = last_layer_fill_box_y + m_perimeter_width;
|
||||
end_pos_y = last_layer_wipe_depth - m_perimeter_width;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WipeTower::need_thick_bridge_flow(float pos_y) const {
|
||||
if (m_extrusion_flow >= extrusion_flow(0.2))
|
||||
return false;
|
||||
|
||||
float y_min = 0., y_max = 0.;
|
||||
if (get_floating_area(y_min, y_max)) {
|
||||
return pos_y > y_min && pos_y < y_max;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
} // namespace Slic3r
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue