more calibrations

precise wall
etc

Signed-off-by: SoftFever <softfeverever@gmail.com>
This commit is contained in:
SoftFever 2023-02-11 09:55:58 +08:00
parent b69a9663e1
commit 7fe5b84c41
34 changed files with 36895 additions and 98 deletions

View file

@ -3169,12 +3169,10 @@ void FillMonotonicLineWGapFill::fill_surface_extrusion(const Surface* surface, c
}
if (!polylines.empty() && !is_bridge(params.extrusion_role)) {
if (!surface->is_top() && !surface->is_bottom()) {
polylines.erase(std::remove_if(polylines.begin(), polylines.end(),
[&](const ThickPolyline& p) {
return p.length() < scale_(params.config->filter_out_gap_fill.value);
}), polylines.end());
}
polylines.erase(std::remove_if(polylines.begin(), polylines.end(),
[&](const ThickPolyline& p) {
return p.length() < scale_(params.config->filter_out_gap_fill.value);
}), polylines.end());
ExtrusionEntityCollection gap_fill;
variable_width(polylines, erGapFill, params.flow, gap_fill.entities);

View file

@ -170,8 +170,8 @@ bool GCode::gcode_label_objects = true;
double _wipe_speed = gcodegen.config().get_abs_value("wipe_speed");// gcodegen.writer().config.travel_speed.value * 0.8;
if(gcodegen.config().role_based_wipe_speed)
_wipe_speed = gcodegen.writer().get_current_speed() / 60.0;
if(_wipe_speed < 60)
_wipe_speed = 60;
if(_wipe_speed < 10)
_wipe_speed = 10;
// get the retraction length
double length = toolchange
@ -212,7 +212,12 @@ bool GCode::gcode_label_objects = true;
// add tag for processor
gcode += ";" + GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Wipe_Start) + "\n";
//BBS: don't need to enable cooling makers when this is the last wipe. Because no more cooling layer will clean this "_WIPE"
gcode += gcodegen.writer().set_speed(_wipe_speed * 60, "", (gcodegen.enable_cooling_markers() && !is_last) ? ";_WIPE" : "");
//Softfever:
std::string cooling_mark = "";
if (gcodegen.enable_cooling_markers() && !is_last)
cooling_mark = /*gcodegen.config().role_based_wipe_speed ? ";_EXTERNAL_PERIMETER" : */";_WIPE";
gcode += gcodegen.writer().set_speed(_wipe_speed * 60, "", cooling_mark);
for (const Line& line : wipe_path.lines()) {
double segment_length = line.length();
/* Reduce retraction length a bit to avoid effective retraction speed to be greater than the configured one
@ -1667,7 +1672,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
pa_test.set_speed(fast_speed, slow_speed);
pa_test.draw_numbers() = print.calib_params().print_numbers;
auto params = print.calib_params();
gcode += pa_test.generate_test(params.pa_start, params.pa_step, std::llround(std::ceil((params.pa_end - params.pa_start) / params.pa_step)));
gcode += pa_test.generate_test(params.start, params.step, std::llround(std::ceil((params.end - params.start) / params.step)));
file.write(gcode);
}
@ -2605,7 +2610,20 @@ GCode::LayerResult GCode::process_layer(
}
if (print.calib_mode() == CalibMode::Calib_PA_Tower) {
gcode += writer().set_pressure_advance(print.calib_params().pa_start + static_cast<int>(print_z) * print.calib_params().pa_step);
gcode += writer().set_pressure_advance(print.calib_params().start + static_cast<int>(print_z) * print.calib_params().step);
} else if (print.calib_mode() == CalibMode::Calib_Temp_Tower) {
auto offset = static_cast<unsigned int>(print_z / 10.001) * 5;
gcode += writer().set_temperature(print.calib_params().start - offset);
} else if (print.calib_mode() == CalibMode::Calib_VFA_Tower) {
auto _speed = print.calib_params().start + std::floor(print_z / 5.0) * print.calib_params().step;
DynamicConfig config;
config.set_key_value("outer_wall_speed", new ConfigOptionFloat(std::round(_speed)));
const_cast<Print*>(&print)->print_regions_mutable()[0]->config_apply_only(config, { "outer_wall_speed" });
} else if (print.calib_mode() == CalibMode::Calib_Vol_speed_Tower) {
auto _speed = print.calib_params().start + print_z * print.calib_params().step;
DynamicConfig config;
config.set_key_value("outer_wall_speed", new ConfigOptionFloat(std::round(_speed)));
const_cast<Print*>(&print)->print_regions_mutable()[0]->config_apply_only(config, { "outer_wall_speed" });
}
//BBS
@ -3142,8 +3160,8 @@ GCode::LayerResult GCode::process_layer(
m_last_obj_copy = this_object_copy;
this->set_origin(unscale(offset));
//FIXME the following code prints regions in the order they are defined, the path is not optimized in any way.
bool is_infill_first = print.config().wall_infill_order == WallInfillOrder::InfillInnerOuter ||
print.config().wall_infill_order == WallInfillOrder::InfillOuterInner;
bool is_infill_first = print.default_region_config().wall_infill_order == WallInfillOrder::InfillInnerOuter ||
print.default_region_config().wall_infill_order == WallInfillOrder::InfillOuterInner;
//BBS: for first layer, we always print wall firstly to get better bed adhesive force
//This behaviour is same with cura
if (is_infill_first && !first_layer) {
@ -3374,15 +3392,6 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou
gcode += this->_extrude(*path, description, is_small_peri ? small_peri_speed : speed);
}
//BBS: don't reset acceleration when printing first layer. During first layer, acceleration is always same value.
if (!this->on_first_layer()){
// reset acceleration
if(m_config.default_acceleration.value > 0)
gcode += m_writer.set_acceleration((unsigned int)(m_config.default_acceleration.value + 0.5));
if(m_config.default_jerk.value > 0)
gcode += m_writer.set_jerk_xy((unsigned int)(m_config.default_jerk.value + 0.5));
}
// BBS
if (m_wipe.enable) {
m_wipe.path = Polyline();
@ -3435,6 +3444,14 @@ std::string GCode::extrude_loop(ExtrusionLoop loop, std::string description, dou
gcode += m_writer.extrude_to_xy(this->point_to_gcode(pt), 0,"move inwards before travel",true);
}
//BBS: don't reset acceleration when printing first layer. During first layer, acceleration is always same value.
if (!this->on_first_layer()) {
// reset acceleration
if (m_config.default_acceleration.value > 0)
gcode += m_writer.set_acceleration((unsigned int)(m_config.default_acceleration.value + 0.5));
if (m_config.default_jerk.value > 0)
gcode += m_writer.set_jerk_xy((unsigned int)(m_config.default_jerk.value + 0.5));
}
return gcode;
}

View file

@ -998,8 +998,8 @@ float WipingExtrusions::mark_wiping_extrusions(const Print& print, unsigned int
if (!object->config().flush_into_infill && !object->config().flush_into_objects && !object->config().flush_into_support)
continue;
bool wipe_into_infill_only = !object->config().flush_into_objects && object->config().flush_into_infill;
bool is_infill_first = print.config().wall_infill_order == WallInfillOrder::InfillInnerOuter ||
print.config().wall_infill_order == WallInfillOrder::InfillOuterInner;
bool is_infill_first = print.default_region_config().wall_infill_order == WallInfillOrder::InfillInnerOuter ||
print.default_region_config().wall_infill_order == WallInfillOrder::InfillOuterInner;
if (is_infill_first != perimeters_done || wipe_into_infill_only) {
for (const ExtrusionEntity* ee : layerm->fills.entities) { // iterate through all infill Collections
auto* fill = dynamic_cast<const ExtrusionEntityCollection*>(ee);
@ -1113,8 +1113,8 @@ void WipingExtrusions::ensure_perimeters_infills_order(const Print& print)
if (!object->config().flush_into_infill && !object->config().flush_into_objects)
continue;
bool is_infill_first = print.config().wall_infill_order == WallInfillOrder::InfillInnerOuter ||
print.config().wall_infill_order == WallInfillOrder::InfillOuterInner;
bool is_infill_first = print.default_region_config().wall_infill_order == WallInfillOrder::InfillInnerOuter ||
print.default_region_config().wall_infill_order == WallInfillOrder::InfillOuterInner;
for (const ExtrusionEntity* ee : layerm->fills.entities) { // iterate through all infill Collections
auto* fill = dynamic_cast<const ExtrusionEntityCollection*>(ee);

View file

@ -636,7 +636,11 @@ void PerimeterGenerator::process_classic()
m_ext_mm3_per_mm = this->ext_perimeter_flow.mm3_per_mm();
coord_t ext_perimeter_width = this->ext_perimeter_flow.scaled_width();
coord_t ext_perimeter_spacing = this->ext_perimeter_flow.scaled_spacing();
coord_t ext_perimeter_spacing2 = scaled<coord_t>(0.5f * (this->ext_perimeter_flow.spacing() + this->perimeter_flow.spacing()));
coord_t ext_perimeter_spacing2;
if(config->precise_outer_wall)
ext_perimeter_spacing2 = scaled<coord_t>(0.5f * (this->ext_perimeter_flow.width() + this->perimeter_flow.width()));
else
ext_perimeter_spacing2 = scaled<coord_t>(0.5f * (this->ext_perimeter_flow.spacing() + this->perimeter_flow.spacing()));
// overhang perimeters
m_mm3_per_mm_overhang = this->overhang_flow.mm3_per_mm();
@ -954,16 +958,16 @@ void PerimeterGenerator::process_classic()
// we continue inwards after having finished the brim
// TODO: add test for perimeter order
bool is_outer_wall_first =
this->print_config->wall_infill_order == WallInfillOrder::OuterInnerInfill ||
this->print_config->wall_infill_order == WallInfillOrder::InfillOuterInner ||
this->print_config->wall_infill_order == WallInfillOrder::InnerOuterInnerInfill;
this->config->wall_infill_order == WallInfillOrder::OuterInnerInfill ||
this->config->wall_infill_order == WallInfillOrder::InfillOuterInner ||
this->config->wall_infill_order == WallInfillOrder::InnerOuterInnerInfill;
if (is_outer_wall_first ||
//BBS: always print outer wall first when there indeed has brim.
(this->layer_id == 0 &&
this->object_config->brim_type == BrimType::btOuterOnly &&
this->object_config->brim_width.value > 0))
{
if (this->print_config->wall_infill_order == WallInfillOrder::InnerOuterInnerInfill) {
if (this->config->wall_infill_order == WallInfillOrder::InnerOuterInnerInfill) {
if (entities.entities.size() > 1) {
std::vector<int> extPs;
for (int i = 0; i < entities.entities.size(); ++i) {
@ -1016,14 +1020,11 @@ void PerimeterGenerator::process_classic()
++ irun;
}
#endif
// SoftFever: don't filter out tiny gap fills for first and top layer. So that the print looks better :)
if (this->layer_id != 0 && this->upper_slices != nullptr)
{
polylines.erase(std::remove_if(polylines.begin(), polylines.end(),
[&](const ThickPolyline& p) {
return p.length() < scale_(config->filter_out_gap_fill.value);
}), polylines.end());
}
// SoftFever: filter out tiny gap fills
polylines.erase(std::remove_if(polylines.begin(), polylines.end(),
[&](const ThickPolyline& p) {
return p.length() < scale_(config->filter_out_gap_fill.value);
}), polylines.end());
if (! polylines.empty()) {
@ -1183,8 +1184,8 @@ void PerimeterGenerator::process_arachne()
int direction = -1;
bool is_outer_wall_first =
this->print_config->wall_infill_order == WallInfillOrder::OuterInnerInfill ||
this->print_config->wall_infill_order == WallInfillOrder::InfillOuterInner;
this->config->wall_infill_order == WallInfillOrder::OuterInnerInfill ||
this->config->wall_infill_order == WallInfillOrder::InfillOuterInner;
if (is_outer_wall_first) {
start_perimeter = 0;
end_perimeter = int(perimeters.size());
@ -1312,7 +1313,7 @@ void PerimeterGenerator::process_arachne()
}
if (this->print_config->wall_infill_order == WallInfillOrder::InnerOuterInnerInfill) {
if (this->config->wall_infill_order == WallInfillOrder::InnerOuterInnerInfill) {
if (ordered_extrusions.size() > 1) {
std::vector<int> extPs;
for (int i = 0; i < ordered_extrusions.size(); ++i) {

View file

@ -752,7 +752,7 @@ static std::vector<std::string> s_Preset_print_options {
"small_perimeter_speed", "small_perimeter_threshold","bridge_angle", "filter_out_gap_fill", "post_process", "travel_acceleration","inner_wall_acceleration",
"default_jerk", "outer_wall_jerk", "inner_wall_jerk", "infill_jerk", "top_surface_jerk", "initial_layer_jerk","travel_jerk",
"top_solid_infill_flow_ratio","bottom_solid_infill_flow_ratio","only_one_wall_first_layer",
"print_flow_ratio","seam_gap","role_based_wipe_speed","wipe_speed","accel_to_decel_enable", "accel_to_decel_factor", "wipe_on_loops", "bridge_density"
"print_flow_ratio","seam_gap","role_based_wipe_speed","wipe_speed","accel_to_decel_enable", "accel_to_decel_factor", "wipe_on_loops", "bridge_density", "precise_outer_wall"
};

View file

@ -669,7 +669,8 @@ public:
const PrintConfig& config() const { return m_config; }
const PrintObjectConfig& default_object_config() const { return m_default_object_config; }
const PrintRegionConfig& default_region_config() const { return m_default_region_config; }
const PrintRegionConfig& default_region_config() const { return m_default_region_config; }
PrintRegionConfig& default_region_config() { return m_default_region_config; }
ConstPrintObjectPtrsAdaptor objects() const { return ConstPrintObjectPtrsAdaptor(&m_objects); }
PrintObject* get_object(size_t idx) { return const_cast<PrintObject*>(m_objects[idx]); }
const PrintObject* get_object(size_t idx) const { return m_objects[idx]; }

View file

@ -716,6 +716,12 @@ void PrintConfigDef::init_fff_params()
def->mode = comAdvanced;
def->set_default_value(new ConfigOptionFloat(1));
def = this->add("precise_outer_wall",coBool);
def->label = L("Precise wall");
def->category = L("Quality");
def->tooltip = L("Improve outer wall precesion by adjusting outer wall spacing");
def->set_default_value(new ConfigOptionBool{true});
def = this->add("only_one_wall_top", coBool);
def->label = L("Only one wall on top surfaces");

View file

@ -761,6 +761,10 @@ PRINT_CONFIG_CLASS_DEFINE(
((ConfigOptionBool, role_based_wipe_speed))
((ConfigOptionFloatOrPercent, wipe_speed))
((ConfigOptionBool, wipe_on_loops))
((ConfigOptionEnum<WallInfillOrder>, wall_infill_order))
((ConfigOptionBool, precise_outer_wall))
)
@ -919,7 +923,6 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
((ConfigOptionFloat, initial_layer_infill_speed))
((ConfigOptionInts, nozzle_temperature_initial_layer))
((ConfigOptionInts, full_fan_speed_layer))
((ConfigOptionEnum<WallInfillOrder>,wall_infill_order))
((ConfigOptionInts, fan_max_speed))
((ConfigOptionFloats, max_layer_height))
((ConfigOptionInts, fan_min_speed))

View file

@ -825,7 +825,8 @@ bool PrintObject::invalidate_state_by_config_options(
|| opt_key == "detect_overhang_wall"
//BBS
|| opt_key == "enable_overhang_speed"
|| opt_key == "detect_thin_wall") {
|| opt_key == "detect_thin_wall"
|| opt_key == "precise_outer_wall") {
steps.emplace_back(posPerimeters);
steps.emplace_back(posSupportMaterial);
} else if (opt_key == "bridge_flow" || opt_key == "bridge_density") {

View file

@ -203,21 +203,5 @@ namespace Slic3r {
return gcode.str();
}
Calib_Params::Calib_Params() :pa_start(0.0), pa_end(0.1), pa_step(0.002), print_numbers(true), mode(CalibMode::Calib_None) {}
Calib_Params::Calib_Params(const Calib_Params& p) {
pa_start = p.pa_start;
pa_end = p.pa_end;
pa_step = p.pa_step;
print_numbers = p.print_numbers;
mode = p.mode;
}
Calib_Params& Calib_Params::operator =(const Calib_Params& p)
{
pa_start = p.pa_start;
pa_end = p.pa_end;
pa_step = p.pa_step;
print_numbers = p.print_numbers;
mode = p.mode;
return *this;
}
} // namespace Slic3r
Calib_Params::Calib_Params() : mode(CalibMode::Calib_None) {}
} // namespace Slic3r

View file

@ -11,13 +11,15 @@ enum class CalibMode : int {
Calib_None = 0,
Calib_PA_Line,
Calib_PA_Tower,
Calib_Temp_Tower,
Calib_Vol_speed_Tower,
Calib_VFA_Tower
};
struct Calib_Params
{
Calib_Params();
Calib_Params(const Calib_Params& p);
Calib_Params& operator =(const Calib_Params& p);
double pa_start, pa_end, pa_step;
double start, end, step;
bool print_numbers;
CalibMode mode;
};
@ -49,4 +51,4 @@ private:
double m_line_width;
bool m_draw_numbers;
};
} // namespace Slic3r
} // namespace Slic3r