Merge branch 'CI' into dev

This commit is contained in:
supermerill 2020-10-04 23:01:44 +02:00
commit 72dd10eba4
6 changed files with 62 additions and 65 deletions

View File

@ -3552,8 +3552,6 @@ std::string GCode::extrude_loop(const ExtrusionLoop &original_loop, const std::s
// extrude along the path // extrude along the path
std::string gcode; std::string gcode;
for (ExtrusionPaths::iterator path = paths.begin(); path != paths.end(); ++path) { for (ExtrusionPaths::iterator path = paths.begin(); path != paths.end(); ++path) {
// description += ExtrusionLoop::role_to_string(loop.loop_role());
// description += ExtrusionEntity::role_to_string(path->role);
path->simplify(SCALED_RESOLUTION); path->simplify(SCALED_RESOLUTION);
gcode += this->_extrude(*path, description, speed); gcode += this->_extrude(*path, description, speed);
} }
@ -3649,8 +3647,6 @@ std::string GCode::extrude_multi_path(const ExtrusionMultiPath &multipath, const
// extrude along the path // extrude along the path
std::string gcode; std::string gcode;
for (ExtrusionPath path : multipath.paths) { for (ExtrusionPath path : multipath.paths) {
// description += ExtrusionLoop::role_to_string(loop.loop_role());
// description += ExtrusionEntity::role_to_string(path->role);
path.simplify(SCALED_RESOLUTION); path.simplify(SCALED_RESOLUTION);
gcode += this->_extrude(path, description, speed); gcode += this->_extrude(path, description, speed);
} }
@ -3725,24 +3721,24 @@ void GCode::use(const ExtrusionEntityCollection &collection) {
std::string extrusion_role_2_string(const ExtrusionRole &er) { std::string extrusion_role_2_string(const ExtrusionRole &er) {
switch (er) { switch (er) {
case erNone: return " none"; case erNone: return "none";
case erPerimeter: return " perimeter"; case erPerimeter: return "perimeter";
case erExternalPerimeter: return " perimeter external"; case erExternalPerimeter: return "perimeter external";
case erOverhangPerimeter: return " perimeter overhang"; case erOverhangPerimeter: return "perimeter overhang";
case erInternalInfill: return " infill internal"; case erInternalInfill: return "infill internal";
case erSolidInfill: return " infill solid"; case erSolidInfill: return "infill solid";
case erTopSolidInfill: return " infill solid top"; case erTopSolidInfill: return "infill solid top";
case erBridgeInfill: return " infill bridge"; case erBridgeInfill: return "infill bridge";
case erThinWall: return " thin_wall"; case erThinWall: return "thin_wall";
case erGapFill: return " gap_fill"; case erGapFill: return "gap_fill";
case erSkirt: return " skirt"; case erSkirt: return "skirt";
case erSupportMaterial: return " support_material"; case erSupportMaterial: return "support_material";
case erSupportMaterialInterface: return " support_material_interface"; case erSupportMaterialInterface: return "support_material_interface";
case erWipeTower: return " wipe_tower"; case erWipeTower: return "wipe_tower";
case erMilling: return " milling"; case erMilling: return "milling";
case erCustom: return " custom"; case erCustom: return "custom";
case erMixed: return " mixed"; case erMixed: return "mixed";
case erCount: return " count"; case erCount: return "count";
} }
return " unkown"; return " unkown";
} }
@ -3902,7 +3898,7 @@ void GCode::_write(FILE* file, const char *what)
//const char * gcode_pp = _post_process(what).c_str(); //const char * gcode_pp = _post_process(what).c_str();
std::string str_preproc{ what }; std::string str_preproc{ what };
//_post_process(str_preproc); _post_process(str_preproc);
const std::string str_ana = m_analyzer.process_gcode(str_preproc); const std::string str_ana = m_analyzer.process_gcode(str_preproc);
@ -3980,7 +3976,7 @@ std::string GCode::_extrude(const ExtrusionPath &path, const std::string &descri
double e_per_mm = path.mm3_per_mm double e_per_mm = path.mm3_per_mm
* m_writer.tool()->e_per_mm3() * m_writer.tool()->e_per_mm3()
* this->config().print_extrusion_multiplier.get_abs_value(1); * this->config().print_extrusion_multiplier.get_abs_value(1);
if (this->m_layer_index <= 0) e_per_mm *= this->config().first_layer_flow_ratio.get_abs_value(1); if (std::abs(this->m_layer->height - this->m_layer->print_z) < EPSILON) e_per_mm *= this->config().first_layer_flow_ratio.get_abs_value(1);
if (m_writer.extrusion_axis().empty()) e_per_mm = 0; if (m_writer.extrusion_axis().empty()) e_per_mm = 0;
if (path.polyline.lines().size() > 0) { if (path.polyline.lines().size() > 0) {
//get last direction //TODO: save it //get last direction //TODO: save it
@ -4009,7 +4005,7 @@ std::string GCode::_extrude(const ExtrusionPath &path, const std::string &descri
// the coeff is below 0.01 i the angle is higher than 125, so it's not useful // the coeff is below 0.01 i the angle is higher than 125, so it's not useful
if (idx_angle > 60) { if (idx_angle > 60) {
//don't compensate if the angle is under 35, as it's already a 50% compensation, it's enough! //don't compensate if the angle is under 35, as it's already a 50% compensation, it's enough!
if (idx_angle > 144) angle = 144; if (idx_angle > 144) idx_angle = 144;
//surface extruded in path.width is path.width * path.width //surface extruded in path.width is path.width * path.width
// define R = path.width/2 and a = angle/2 // define R = path.width/2 and a = angle/2
// then i have to print only 4RR + RR(2a-sin(2a))/2 - RR*sina*sina*tana if i want to remove the bits out of the external curve, if the internal overlap go to the exterior. // then i have to print only 4RR + RR(2a-sin(2a))/2 - RR*sina*sina*tana if i want to remove the bits out of the external curve, if the internal overlap go to the exterior.
@ -4020,7 +4016,7 @@ std::string GCode::_extrude(const ExtrusionPath &path, const std::string &descri
//double removed = std::sin(A); removed = removed * removed * std::tan(A) / 4; //double removed = std::sin(A); removed = removed * removed * std::tan(A) / 4;
//double coeff = 1. + added - removed; //double coeff = 1. + added - removed;
//we have to remove coeff percentage on path.width length //we have to remove coeff percentage on path.width length
double coeff = cut_corner_cache[idx_angle]; double coeff = cut_corner_cache[idx_angle-30];
//the length, do half of the work on width/4 and the other half on width/2 //the length, do half of the work on width/4 and the other half on width/2
coordf_t length1 = (path.width) / 4; coordf_t length1 = (path.width) / 4;
coordf_t line_length = unscaled(line.length()); coordf_t line_length = unscaled(line.length());

View File

@ -545,6 +545,8 @@ std::string GCodeWriter::_retract(double length, double restart_extra, const std
} }
double dE = m_tool->retract(length, restart_extra); double dE = m_tool->retract(length, restart_extra);
assert(dE >= 0);
assert(dE < 10000000);
if (dE != 0) { if (dE != 0) {
if (this->config.use_firmware_retraction) { if (this->config.use_firmware_retraction) {
if (FLAVOR_IS(gcfMachinekit)) if (FLAVOR_IS(gcfMachinekit))
@ -573,6 +575,8 @@ std::string GCodeWriter::unretract()
gcode << "M101 ; extruder on\n"; gcode << "M101 ; extruder on\n";
double dE = m_tool->unretract(); double dE = m_tool->unretract();
assert(dE >= 0);
assert(dE < 10000000);
if (dE != 0) { if (dE != 0) {
if (this->config.use_firmware_retraction) { if (this->config.use_firmware_retraction) {
if (FLAVOR_IS(gcfMachinekit)) if (FLAVOR_IS(gcfMachinekit))

View File

@ -280,7 +280,6 @@ void PerimeterGenerator::process()
if (!unsupported_filtered.empty()) { if (!unsupported_filtered.empty()) {
//add this directly to the infill list. //add this directly to the infill list.
// this will avoid to throw wrong offsets into a good polygons // this will avoid to throw wrong offsets into a good polygons
this->fill_surfaces->append( this->fill_surfaces->append(
@ -308,9 +307,7 @@ void PerimeterGenerator::process()
} else { } else {
surface->expolygon = last[0]; surface->expolygon = last[0];
for (size_t idx = 1; idx < last.size(); idx++) { for (size_t idx = 1; idx < last.size(); idx++) {
Surface new_surf = *surface; all_surfaces.emplace_back(*surface, last[idx]);
new_surf.expolygon = last[idx];
all_surfaces.push_back(new_surf);
} }
} }
} }
@ -438,7 +435,7 @@ void PerimeterGenerator::process()
// look for thin walls // look for thin walls
if (this->config->thin_walls) { if (this->config->thin_walls) {
// detect edge case where a curve can be split in multiple small chunks. // detect edge case where a curve can be split in multiple small chunks.
std::vector<float> divs = {2.2f,1.75f,1.5f}; //don't go too far, it's not possible to print thinw wall after that std::vector<float> divs = { 2.1f, 1.9f, 2.2f, 1.75f, 1.5f}; //don't go too far, it's not possible to print thin wall after that
size_t idx_div = 0; size_t idx_div = 0;
while (next_onion.size() > last.size() && idx_div < divs.size()) { while (next_onion.size() > last.size() && idx_div < divs.size()) {
float div = divs[idx_div]; float div = divs[idx_div];
@ -447,7 +444,7 @@ void PerimeterGenerator::process()
last, last,
-(float)((ext_perimeter_width / 2) + (ext_min_spacing / div) - 1), -(float)((ext_perimeter_width / 2) + (ext_min_spacing / div) - 1),
+(float)((ext_min_spacing / div) - 1)); +(float)((ext_min_spacing / div) - 1));
if (next_onion.size() > next_onion_secondTry.size() * 1.2 || next_onion.size() - next_onion_secondTry.size() > 3) { if (next_onion.size() > next_onion_secondTry.size() * 1.2 && next_onion.size() > next_onion_secondTry.size() + 2) {
next_onion = next_onion_secondTry; next_onion = next_onion_secondTry;
} }
idx_div++; idx_div++;

View File

@ -1839,7 +1839,7 @@ void PrintConfigDef::init_fff_params()
def->enum_labels.push_back(L("Automatic, only for small areas")); def->enum_labels.push_back(L("Automatic, only for small areas"));
def->enum_labels.push_back(L("Anchored")); def->enum_labels.push_back(L("Anchored"));
def->mode = comAdvanced; def->mode = comAdvanced;
def->set_default_value(new ConfigOptionEnum<DenseInfillAlgo>(dfaAutomatic)); def->set_default_value(new ConfigOptionEnum<DenseInfillAlgo>(dfaAutoNotFull));
def = this->add("infill_extruder", coInt); def = this->add("infill_extruder", coInt);
def->label = L("Infill extruder"); def->label = L("Infill extruder");

View File

@ -112,25 +112,25 @@ inline bool equal_layering(const SlicingParameters &sp1, const SlicingParameters
assert(sp2.valid); assert(sp2.valid);
return sp1.base_raft_layers == sp2.base_raft_layers && return sp1.base_raft_layers == sp2.base_raft_layers &&
sp1.interface_raft_layers == sp2.interface_raft_layers && sp1.interface_raft_layers == sp2.interface_raft_layers &&
sp1.base_raft_layer_height == sp2.base_raft_layer_height && std::abs(sp1.base_raft_layer_height - sp2.base_raft_layer_height) < EPSILON &&
sp1.interface_raft_layer_height == sp2.interface_raft_layer_height && std::abs(sp1.interface_raft_layer_height - sp2.interface_raft_layer_height) < EPSILON &&
sp1.contact_raft_layer_height == sp2.contact_raft_layer_height && std::abs(sp1.contact_raft_layer_height - sp2.contact_raft_layer_height) < EPSILON &&
sp1.contact_raft_layer_height_bridging == sp2.contact_raft_layer_height_bridging && sp1.contact_raft_layer_height_bridging == sp2.contact_raft_layer_height_bridging &&
sp1.layer_height == sp2.layer_height && std::abs(sp1.layer_height - sp2.layer_height) < EPSILON &&
sp1.min_layer_height == sp2.min_layer_height && std::abs(sp1.min_layer_height - sp2.min_layer_height) < EPSILON &&
sp1.max_layer_height == sp2.max_layer_height && std::abs(sp1.max_layer_height - sp2.max_layer_height) < EPSILON &&
// sp1.max_suport_layer_height == sp2.max_suport_layer_height && // sp1.max_suport_layer_height == sp2.max_suport_layer_height &&
sp1.first_print_layer_height == sp2.first_print_layer_height && std::abs(sp1.first_print_layer_height - sp2.first_print_layer_height) < EPSILON &&
sp1.first_object_layer_height == sp2.first_object_layer_height && std::abs(sp1.first_object_layer_height - sp2.first_object_layer_height) < EPSILON &&
sp1.first_object_layer_bridging == sp2.first_object_layer_bridging && sp1.first_object_layer_bridging == sp2.first_object_layer_bridging &&
sp1.soluble_interface == sp2.soluble_interface && sp1.soluble_interface == sp2.soluble_interface &&
sp1.gap_raft_object == sp2.gap_raft_object && std::abs(sp1.gap_raft_object - sp2.gap_raft_object) < EPSILON &&
sp1.gap_object_support == sp2.gap_object_support && std::abs(sp1.gap_object_support - sp2.gap_object_support) < EPSILON &&
sp1.gap_support_object == sp2.gap_support_object && std::abs(sp1.gap_support_object - sp2.gap_support_object) < EPSILON &&
sp1.raft_base_top_z == sp2.raft_base_top_z && std::abs(sp1.raft_base_top_z - sp2.raft_base_top_z) < EPSILON &&
sp1.raft_interface_top_z == sp2.raft_interface_top_z && std::abs(sp1.raft_interface_top_z - sp2.raft_interface_top_z) < EPSILON &&
sp1.raft_contact_top_z == sp2.raft_contact_top_z && std::abs(sp1.raft_contact_top_z - sp2.raft_contact_top_z) < EPSILON &&
sp1.object_print_z_min == sp2.object_print_z_min; std::abs(sp1.object_print_z_min - sp2.object_print_z_min) < EPSILON;
} }
typedef std::pair<coordf_t,coordf_t> t_layer_height_range; typedef std::pair<coordf_t,coordf_t> t_layer_height_range;