mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-12-11 07:48:47 -07:00
Working prototype - 2
Code is now finally working - external perimeters are slowed down as needed when there is likelyhood of curling up. ToDo: 1. Reslicing the model causes the algorithm not to run - need to find where this fails to trigger the call for this. 2. Slowdown of internal perimeters not working yet.
This commit is contained in:
parent
a2ac701645
commit
be523b926e
5 changed files with 23 additions and 7 deletions
|
|
@ -351,9 +351,9 @@ namespace AABBTreeLines {
|
||||||
return dist;
|
return dist;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<size_t> all_lines_in_radius(const Vec<2, typename LineType::Scalar>& point, Floating radius)
|
std::vector<size_t> all_lines_in_radius(const Vec<2, Scalar> &point, Floating radius)
|
||||||
{
|
{
|
||||||
return AABBTreeLines::all_lines_in_radius(this->lines, this->tree, point, radius * radius); //.template cast<Floating>()
|
return AABBTreeLines::all_lines_in_radius(this->lines, this->tree, point.template cast<Floating>(), radius * radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <bool sorted>
|
template <bool sorted>
|
||||||
|
|
|
||||||
|
|
@ -270,6 +270,7 @@ public:
|
||||||
float ext_perimeter_speed,
|
float ext_perimeter_speed,
|
||||||
float original_speed)
|
float original_speed)
|
||||||
{
|
{
|
||||||
|
//printf("Estimate extrusion quality triggered \n");
|
||||||
size_t speed_sections_count = std::min(overlaps.values.size(), speeds.values.size());
|
size_t speed_sections_count = std::min(overlaps.values.size(), speeds.values.size());
|
||||||
std::vector<std::pair<float, float>> speed_sections;
|
std::vector<std::pair<float, float>> speed_sections;
|
||||||
|
|
||||||
|
|
@ -374,8 +375,11 @@ public:
|
||||||
float extrusion_speed = std::min(calculate_speed(curr.distance+artificial_distance_to_curled_lines), calculate_speed(next.distance+artificial_distance_to_curled_lines));
|
float extrusion_speed = std::min(calculate_speed(curr.distance+artificial_distance_to_curled_lines), calculate_speed(next.distance+artificial_distance_to_curled_lines));
|
||||||
float overlap = std::min(1 - curr.distance * width_inv, 1 - next.distance * width_inv);
|
float overlap = std::min(1 - curr.distance * width_inv, 1 - next.distance * width_inv);
|
||||||
|
|
||||||
if(artificial_distance_to_curled_lines>0 ) printf("Found curls\n"); // Temporary debug messages
|
/*printf("artificial_distance_to_curled_lines %f, curr.distance %f, next.distance %f, calculate_speed(curr.distance)%f,calculate_speed(next.distance) %f, new A%f, new B%f \n",artificial_distance_to_curled_lines, curr.distance,next.distance, calculate_speed(curr.distance),calculate_speed(next.distance),
|
||||||
if(old_extrusion_speed>extrusion_speed ) printf("Reduced speed. Original: %f, New: %f\n",old_extrusion_speed,extrusion_speed); // Temporary debug messages
|
calculate_speed(curr.distance+artificial_distance_to_curled_lines), calculate_speed(next.distance+artificial_distance_to_curled_lines) );*/
|
||||||
|
|
||||||
|
//if(artificial_distance_to_curled_lines>0 ) {printf("Found curls. Artificial distance: %f\n",artificial_distance_to_curled_lines ); /*extrusion_speed=500;*/}// Temporary debug messages
|
||||||
|
//if(old_extrusion_speed>extrusion_speed ) printf("Reduced speed. Original: %f, New: %f\n",old_extrusion_speed,extrusion_speed); // Temporary debug messages
|
||||||
|
|
||||||
processed_points.push_back({ scaled(curr.position), extrusion_speed, overlap });
|
processed_points.push_back({ scaled(curr.position), extrusion_speed, overlap });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -502,10 +502,12 @@ void PrintObject::generate_support_material()
|
||||||
void PrintObject::estimate_curled_extrusions()
|
void PrintObject::estimate_curled_extrusions()
|
||||||
{
|
{
|
||||||
if (this->set_started(posEstimateCurledExtrusions)) {
|
if (this->set_started(posEstimateCurledExtrusions)) {
|
||||||
|
//printf("Estimating curled Extrusions \n");
|
||||||
if ( std::any_of(this->print()->m_print_regions.begin(), this->print()->m_print_regions.end(),
|
if ( std::any_of(this->print()->m_print_regions.begin(), this->print()->m_print_regions.end(),
|
||||||
[](const PrintRegion *region) { return region->config().enable_overhang_speed.getBool(); })) {
|
[](const PrintRegion *region) { return region->config().enable_overhang_speed.getBool(); })) {
|
||||||
|
|
||||||
// Estimate curling of support material and add it to the malformaition lines of each layer
|
// Estimate curling of support material and add it to the malformaition lines of each layer
|
||||||
|
//printf("Estimating curling of support material and add it to the malformaition lines of each layer \n");
|
||||||
float support_flow_width = support_material_flow(this, this->config().layer_height).width();
|
float support_flow_width = support_material_flow(this, this->config().layer_height).width();
|
||||||
SupportSpotsGenerator::Params params{this->print()->m_config.filament_type.values,
|
SupportSpotsGenerator::Params params{this->print()->m_config.filament_type.values,
|
||||||
float(this->print()->m_config.inner_wall_acceleration.getFloat()),
|
float(this->print()->m_config.inner_wall_acceleration.getFloat()),
|
||||||
|
|
|
||||||
|
|
@ -105,10 +105,15 @@ float estimate_curled_up_height(
|
||||||
float curled_up_height = 0;
|
float curled_up_height = 0;
|
||||||
if (fabs(distance) < 3.0 * flow_width) {
|
if (fabs(distance) < 3.0 * flow_width) {
|
||||||
curled_up_height = std::max(prev_line_curled_height - layer_height * 0.75f, 0.0f);
|
curled_up_height = std::max(prev_line_curled_height - layer_height * 0.75f, 0.0f);
|
||||||
|
//printf("If 1 %d\n",curled_up_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//printf("distance %f, params.malformation_distance_factors.first %f, params.malformation_distance_factors.second %f, flow_width %f\n", distance, params.malformation_distance_factors.first, params.malformation_distance_factors.second, flow_width);
|
||||||
|
//printf("distance %f,params.malformation_distance_factors.first * flow_width %f, params.malformation_distance_factors.second * flow_width %f\n", distance, params.malformation_distance_factors.first * flow_width, params.malformation_distance_factors.second * flow_width);
|
||||||
|
|
||||||
if (distance > params.malformation_distance_factors.first * flow_width &&
|
if (distance > params.malformation_distance_factors.first * flow_width &&
|
||||||
distance < params.malformation_distance_factors.second * flow_width) {
|
distance < params.malformation_distance_factors.second * flow_width) {
|
||||||
|
|
||||||
// imagine the extrusion profile. The part that has been glued (melted) with the previous layer will be called anchored section
|
// imagine the extrusion profile. The part that has been glued (melted) with the previous layer will be called anchored section
|
||||||
// and the rest will be called curling section
|
// and the rest will be called curling section
|
||||||
// float anchored_section = flow_width - point.distance;
|
// float anchored_section = flow_width - point.distance;
|
||||||
|
|
@ -171,6 +176,11 @@ void estimate_malformations(LayerPtrs &layers, const Params ¶ms)
|
||||||
line_out.curled_up_height = estimate_curled_up_height(middle_distance * sign, 0.5 * (a.curvature + b.curvature),
|
line_out.curled_up_height = estimate_curled_up_height(middle_distance * sign, 0.5 * (a.curvature + b.curvature),
|
||||||
l->height, flow_width, bottom_line.curled_up_height, params);
|
l->height, flow_width, bottom_line.curled_up_height, params);
|
||||||
|
|
||||||
|
/*printf("middle_distance %f, sign %f , curvature %f , l->height %f, flow_width %f, bottom_line.curled_up_height%f\n",
|
||||||
|
middle_distance, sign , 0.5 * (a.curvature + b.curvature), l->height, flow_width, bottom_line.curled_up_height);*/
|
||||||
|
|
||||||
|
//printf("Curled up height: %f\n", line_out.curled_up_height);
|
||||||
|
|
||||||
current_layer_lines.push_back(line_out);
|
current_layer_lines.push_back(line_out);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ struct Params
|
||||||
BrimType brim_type;
|
BrimType brim_type;
|
||||||
const float brim_width;
|
const float brim_width;
|
||||||
|
|
||||||
const std::pair<float,float> malformation_distance_factors = std::pair<float, float> { 0.5, 1.1 };
|
const std::pair<float,float> malformation_distance_factors = std::pair<float, float> { 0.2, 1.1 };
|
||||||
const float max_curled_height_factor = 10.0f;
|
const float max_curled_height_factor = 10.0f;
|
||||||
const float curling_tolerance_limit = 0.1f;
|
const float curling_tolerance_limit = 0.1f;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue