FIX: fix the error scale of circle compensation
jira: none Change-Id: I5c27ef8312e75666dc1c5c2c7dedf3f7e4831497
This commit is contained in:
parent
c782fbb8d9
commit
52e05ed0d9
|
@ -90,31 +90,31 @@
|
|||
"0"
|
||||
],
|
||||
"counter_coef_2": [
|
||||
"3860"
|
||||
"0.00386"
|
||||
],
|
||||
"counter_coef_3": [
|
||||
"-32000"
|
||||
"-0.032"
|
||||
],
|
||||
"hole_coef_1": [
|
||||
"0"
|
||||
],
|
||||
"hole_coef_2": [
|
||||
"-8000"
|
||||
"-0.008"
|
||||
],
|
||||
"hole_coef_3": [
|
||||
"135000"
|
||||
"0.135"
|
||||
],
|
||||
"counter_limit_min": [
|
||||
"-350000"
|
||||
"-0.35"
|
||||
],
|
||||
"counter_limit_max": [
|
||||
"330000"
|
||||
"0.33"
|
||||
],
|
||||
"hole_limit_min": [
|
||||
"880000"
|
||||
"0.88"
|
||||
],
|
||||
"hole_limit_max": [
|
||||
"2200000"
|
||||
"2.2"
|
||||
],
|
||||
"filament_start_gcode": [
|
||||
"; filament start gcode\nM145 P1 ; set airduct mode to heating mode\n"
|
||||
|
|
|
@ -99,31 +99,31 @@
|
|||
"0"
|
||||
],
|
||||
"counter_coef_2": [
|
||||
"6500"
|
||||
"0.0065"
|
||||
],
|
||||
"counter_coef_3": [
|
||||
"-32000"
|
||||
"-0.032"
|
||||
],
|
||||
"hole_coef_1": [
|
||||
"0"
|
||||
],
|
||||
"hole_coef_2": [
|
||||
"-8000"
|
||||
"-0.008"
|
||||
],
|
||||
"hole_coef_3": [
|
||||
"135000"
|
||||
"0.135"
|
||||
],
|
||||
"counter_limit_min": [
|
||||
"-350000"
|
||||
"-0.35"
|
||||
],
|
||||
"counter_limit_max": [
|
||||
"330000"
|
||||
"0.33"
|
||||
],
|
||||
"hole_limit_min": [
|
||||
"880000"
|
||||
"0.88"
|
||||
],
|
||||
"hole_limit_max": [
|
||||
"2200000"
|
||||
"2.2"
|
||||
],
|
||||
"filament_start_gcode": [
|
||||
"; filament start gcode\nM145 P0 ; set airduct mode to cooling mode\nM142 P1 R35 S40 U0.3 V0.5 ; set chamber autocooling"
|
||||
|
|
|
@ -96,31 +96,31 @@
|
|||
"0"
|
||||
],
|
||||
"counter_coef_2": [
|
||||
"5650"
|
||||
"0.00565"
|
||||
],
|
||||
"counter_coef_3": [
|
||||
"-20200"
|
||||
"-0.0202"
|
||||
],
|
||||
"hole_coef_1": [
|
||||
"0"
|
||||
],
|
||||
"hole_coef_2": [
|
||||
"-12100"
|
||||
"-0.0121"
|
||||
],
|
||||
"hole_coef_3": [
|
||||
"145000"
|
||||
"0.145"
|
||||
],
|
||||
"counter_limit_min": [
|
||||
"-350000"
|
||||
"-0.35"
|
||||
],
|
||||
"counter_limit_max": [
|
||||
"300000"
|
||||
"0.3"
|
||||
],
|
||||
"hole_limit_min": [
|
||||
"880000"
|
||||
"0.88"
|
||||
],
|
||||
"hole_limit_max": [
|
||||
"2200000"
|
||||
"2.2"
|
||||
],
|
||||
"filament_start_gcode": [
|
||||
"; filament start gcode\nM145 P0 ; set airduct mode to cooling mode\nM142 P1 R35 S40 U0.3 V0.5 ; set chamber autocooling"
|
||||
|
|
|
@ -94,31 +94,31 @@
|
|||
"0"
|
||||
],
|
||||
"counter_coef_2": [
|
||||
"8000"
|
||||
"0.008"
|
||||
],
|
||||
"counter_coef_3": [
|
||||
"-51000"
|
||||
"-0.051"
|
||||
],
|
||||
"hole_coef_1": [
|
||||
"0"
|
||||
],
|
||||
"hole_coef_2": [
|
||||
"-8000"
|
||||
"-0.008"
|
||||
],
|
||||
"hole_coef_3": [
|
||||
"151150"
|
||||
"0.15115"
|
||||
],
|
||||
"counter_limit_min": [
|
||||
"-350000"
|
||||
"-0.35"
|
||||
],
|
||||
"counter_limit_max": [
|
||||
"330000"
|
||||
"0.33"
|
||||
],
|
||||
"hole_limit_min": [
|
||||
"880000"
|
||||
"0.88"
|
||||
],
|
||||
"hole_limit_max": [
|
||||
"2200000"
|
||||
"2.2"
|
||||
],
|
||||
"filament_start_gcode": [
|
||||
"; filament start gcode\nM145 P0 ; set airduct mode to cooling mode\nM142 P1 R35 S40 U0.3 V0.5 ; set chamber autocooling"
|
||||
|
|
|
@ -84,31 +84,31 @@
|
|||
"0"
|
||||
],
|
||||
"counter_coef_2": [
|
||||
"7500"
|
||||
"0.0075"
|
||||
],
|
||||
"counter_coef_3": [
|
||||
"-52000"
|
||||
"-0.052"
|
||||
],
|
||||
"hole_coef_1": [
|
||||
"0"
|
||||
],
|
||||
"hole_coef_2": [
|
||||
"-10250"
|
||||
"-0.01025"
|
||||
],
|
||||
"hole_coef_3": [
|
||||
"197450"
|
||||
"0.19745"
|
||||
],
|
||||
"counter_limit_min": [
|
||||
"-350000"
|
||||
"-0.35"
|
||||
],
|
||||
"counter_limit_max": [
|
||||
"330000"
|
||||
"0.33"
|
||||
],
|
||||
"hole_limit_min": [
|
||||
"880000"
|
||||
"0.88"
|
||||
],
|
||||
"hole_limit_max": [
|
||||
"2200000"
|
||||
"2.2"
|
||||
],
|
||||
"filament_start_gcode": [
|
||||
"; filament start gcode\nM145 P0 ; set airduct mode to cooling mode\nM142 P1 R35 S40 U0.3 V0.5 ; set chamber autocooling"
|
||||
|
|
|
@ -199,31 +199,31 @@
|
|||
"0"
|
||||
],
|
||||
"counter_coef_2": [
|
||||
"25000"
|
||||
"0.025"
|
||||
],
|
||||
"counter_coef_3": [
|
||||
"-110000"
|
||||
"-0.11"
|
||||
],
|
||||
"hole_coef_1": [
|
||||
"0"
|
||||
],
|
||||
"hole_coef_2": [
|
||||
"-25000"
|
||||
"-0.025"
|
||||
],
|
||||
"hole_coef_3": [
|
||||
"280000"
|
||||
"0.28"
|
||||
],
|
||||
"counter_limit_min": [
|
||||
"-400000"
|
||||
"-0.4"
|
||||
],
|
||||
"counter_limit_max": [
|
||||
"500000"
|
||||
"0.5"
|
||||
],
|
||||
"hole_limit_min": [
|
||||
"800000"
|
||||
"0.8"
|
||||
],
|
||||
"hole_limit_max": [
|
||||
"2500000"
|
||||
"2.5"
|
||||
],
|
||||
"circle_compensation_speed": [
|
||||
"200"
|
||||
|
|
|
@ -13,8 +13,8 @@
|
|||
#include <map>
|
||||
|
||||
#include <boost/log/trivial.hpp>
|
||||
static const double max_deviation = 0.5 * 1e6;
|
||||
static const double max_variance = 500 * 1e6;
|
||||
static const double max_deviation = scale_(0.5);
|
||||
static const double max_variance = 5 * scale_(0.01) * scale_(0.01);
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
|
@ -72,26 +72,26 @@ void LayerRegion::auto_circle_compensation(SurfaceCollection& slices, const Auto
|
|||
int filament_idx = this->region().config().wall_filament - 1;
|
||||
|
||||
double limited_speed = auto_contour_holes_compensation_params.circle_compensation_speed[filament_idx];
|
||||
double counter_speed_coef = auto_contour_holes_compensation_params.counter_speed_coef[filament_idx] / 1e6;
|
||||
double counter_diameter_coef = auto_contour_holes_compensation_params.counter_diameter_coef[filament_idx] / 1e6;
|
||||
double counter_compensate_coef = auto_contour_holes_compensation_params.counter_compensate_coef[filament_idx];
|
||||
double counter_speed_coef = auto_contour_holes_compensation_params.counter_speed_coef[filament_idx];
|
||||
double counter_diameter_coef = auto_contour_holes_compensation_params.counter_diameter_coef[filament_idx];
|
||||
double counter_compensate_coef = scale_(auto_contour_holes_compensation_params.counter_compensate_coef[filament_idx]);
|
||||
|
||||
double hole_speed_coef = auto_contour_holes_compensation_params.hole_speed_coef[filament_idx] / 1e6;
|
||||
double hole_diameter_coef = auto_contour_holes_compensation_params.hole_diameter_coef[filament_idx] / 1e6;
|
||||
double hole_compensate_coef = auto_contour_holes_compensation_params.hole_compensate_coef[filament_idx];
|
||||
double hole_speed_coef = auto_contour_holes_compensation_params.hole_speed_coef[filament_idx];
|
||||
double hole_diameter_coef = auto_contour_holes_compensation_params.hole_diameter_coef[filament_idx];
|
||||
double hole_compensate_coef = scale_(auto_contour_holes_compensation_params.hole_compensate_coef[filament_idx]);
|
||||
|
||||
double counter_limit_min_value = auto_contour_holes_compensation_params.counter_limit_min_value[filament_idx];
|
||||
double counter_limit_max_value = auto_contour_holes_compensation_params.counter_limit_max_value[filament_idx];
|
||||
double hole_limit_min_value = auto_contour_holes_compensation_params.hole_limit_min_value[filament_idx];
|
||||
double hole_limit_max_value = auto_contour_holes_compensation_params.hole_limit_max_value[filament_idx];
|
||||
double counter_limit_min_value = scale_(auto_contour_holes_compensation_params.counter_limit_min_value[filament_idx]);
|
||||
double counter_limit_max_value = scale_(auto_contour_holes_compensation_params.counter_limit_max_value[filament_idx]);
|
||||
double hole_limit_min_value = scale_(auto_contour_holes_compensation_params.hole_limit_min_value[filament_idx]);
|
||||
double hole_limit_max_value = scale_(auto_contour_holes_compensation_params.hole_limit_max_value[filament_idx]);
|
||||
|
||||
double diameter_limit_value = auto_contour_holes_compensation_params.diameter_limit[filament_idx];
|
||||
double diameter_limit_value = scale_(auto_contour_holes_compensation_params.diameter_limit[filament_idx]);
|
||||
|
||||
for (Surface &surface : slices.surfaces) {
|
||||
Point center;
|
||||
double diameter = 0;
|
||||
if (surface.expolygon.contour.is_approx_circle(max_deviation, max_variance, center, diameter)) {
|
||||
double offset_value = counter_speed_coef * limited_speed + counter_diameter_coef * diameter + counter_compensate_coef + manual_offset;
|
||||
double offset_value = scale_(counter_speed_coef * limited_speed) + counter_diameter_coef * diameter + counter_compensate_coef + manual_offset;
|
||||
if (offset_value < counter_limit_min_value) {
|
||||
offset_value = counter_limit_min_value;
|
||||
} else if (offset_value > counter_limit_max_value) {
|
||||
|
@ -100,14 +100,14 @@ void LayerRegion::auto_circle_compensation(SurfaceCollection& slices, const Auto
|
|||
Polygons offseted_polys = offset(surface.expolygon.contour, offset_value);
|
||||
if (offseted_polys.size() == 1) {
|
||||
surface.expolygon.contour = offseted_polys[0];
|
||||
if (diameter < diameter_limit_value * 1e6)
|
||||
if (diameter < diameter_limit_value)
|
||||
surface.counter_circle_compensation = true;
|
||||
}
|
||||
}
|
||||
for (size_t i = 0; i < surface.expolygon.holes.size(); ++i) {
|
||||
Polygon &hole = surface.expolygon.holes[i];
|
||||
if (hole.is_approx_circle(max_deviation, max_variance, center, diameter)) {
|
||||
double offset_value = hole_speed_coef * limited_speed + hole_diameter_coef * diameter + hole_compensate_coef + manual_offset ;
|
||||
double offset_value = scale_(hole_speed_coef * limited_speed) + hole_diameter_coef * diameter + hole_compensate_coef + manual_offset ;
|
||||
if (offset_value < hole_limit_min_value) {
|
||||
offset_value = hole_limit_min_value;
|
||||
} else if (offset_value > hole_limit_max_value) {
|
||||
|
@ -118,7 +118,7 @@ void LayerRegion::auto_circle_compensation(SurfaceCollection& slices, const Auto
|
|||
Polygons offseted_polys = offset(hole, offset_value);
|
||||
if (offseted_polys.size() == 1) {
|
||||
hole = offseted_polys[0];
|
||||
if (diameter < diameter_limit_value * 1e6)
|
||||
if (diameter < diameter_limit_value)
|
||||
surface.holes_circle_compensation.push_back(i);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4303,62 +4303,58 @@ void PrintConfigDef::init_fff_params()
|
|||
def = this->add("counter_coef_1", coFloats);
|
||||
def->label = L("Counter Coef 1");
|
||||
def->tooltip = L("counter_coef_1");
|
||||
def->sidetext = L("/1e6");
|
||||
def->set_default_value(new ConfigOptionFloats{0});
|
||||
|
||||
def = this->add("counter_coef_2", coFloats);
|
||||
def->label = L("Contour Coef 2");
|
||||
def->tooltip = L("counter_coef_2");
|
||||
def->sidetext = L("/1e6");
|
||||
def->set_default_value(new ConfigOptionFloats{25000});
|
||||
def->set_default_value(new ConfigOptionFloats{0.025});
|
||||
|
||||
def = this->add("counter_coef_3", coFloats);
|
||||
def->label = L("Contour Coef 3");
|
||||
def->tooltip = L("counter_coef_3");
|
||||
def->sidetext = L("/1e6");
|
||||
def->set_default_value(new ConfigOptionFloats{-110000});
|
||||
def->sidetext = L("mm");
|
||||
def->set_default_value(new ConfigOptionFloats{-0.11});
|
||||
|
||||
def = this->add("hole_coef_1", coFloats);
|
||||
def->label = L("Hole Coef 1");
|
||||
def->tooltip = L("hole_coef_1");
|
||||
def->sidetext = L("/1e6");
|
||||
def->set_default_value(new ConfigOptionFloats{0});
|
||||
|
||||
def = this->add("hole_coef_2", coFloats);
|
||||
def->label = L("Hole Coef 2");
|
||||
def->tooltip = L("hole_coef_2");
|
||||
def->sidetext = L("/1e6");
|
||||
def->set_default_value(new ConfigOptionFloats{-25000});
|
||||
def->set_default_value(new ConfigOptionFloats{-0.025});
|
||||
|
||||
def = this->add("hole_coef_3", coFloats);
|
||||
def->label = L("Hole Coef 3");
|
||||
def->tooltip = L("hole_coef_3");
|
||||
def->sidetext = L("/1e6");
|
||||
def->set_default_value(new ConfigOptionFloats{280000});
|
||||
def->sidetext = L("mm");
|
||||
def->set_default_value(new ConfigOptionFloats{0.28});
|
||||
|
||||
def = this->add("counter_limit_min", coFloats);
|
||||
def->label = L("Contour limit min");
|
||||
def->tooltip = L("counter_limit_min");
|
||||
def->sidetext = L("/1e6");
|
||||
def->set_default_value(new ConfigOptionFloats{-40000});
|
||||
def->sidetext = L("mm");
|
||||
def->set_default_value(new ConfigOptionFloats{-0.04});
|
||||
|
||||
def = this->add("counter_limit_max", coFloats);
|
||||
def->label = L("Contour limit max");
|
||||
def->tooltip = L("counter_limit_max");
|
||||
def->sidetext = L("/1e6");
|
||||
def->set_default_value(new ConfigOptionFloats{50000});
|
||||
def->sidetext = L("mm");
|
||||
def->set_default_value(new ConfigOptionFloats{0.05});
|
||||
|
||||
def = this->add("hole_limit_min", coFloats);
|
||||
def->label = L("Hole limit min");
|
||||
def->tooltip = L("hole_limit_min");
|
||||
def->sidetext = L("/1e6");
|
||||
def->set_default_value(new ConfigOptionFloats{80000});
|
||||
def->sidetext = L("mm");
|
||||
def->set_default_value(new ConfigOptionFloats{0.08});
|
||||
|
||||
def = this->add("hole_limit_max", coFloats);
|
||||
def->label = L("Hole limit max");
|
||||
def->tooltip = L("hole_limit_max");
|
||||
def->sidetext = L("/1e6");
|
||||
def->set_default_value(new ConfigOptionFloats{250000});
|
||||
def->sidetext = L("mm");
|
||||
def->set_default_value(new ConfigOptionFloats{0.25});
|
||||
|
||||
def = this->add("diameter_limit", coFloats);
|
||||
def->label = L("Diameter limit");
|
||||
|
|
Loading…
Reference in New Issue