make supports bigger, improve malformations, TODO: do not support small extrusions, check part size
This commit is contained in:
parent
62c3ca5e99
commit
4eaa863ba4
3 changed files with 56 additions and 18 deletions
|
@ -419,13 +419,11 @@ void PrintObject::generate_support_spots()
|
||||||
BOOST_LOG_TRIVIAL(debug)
|
BOOST_LOG_TRIVIAL(debug)
|
||||||
<< "Searching support spots - start";
|
<< "Searching support spots - start";
|
||||||
m_print->set_status(75, L("Searching support spots"));
|
m_print->set_status(75, L("Searching support spots"));
|
||||||
|
|
||||||
if (this->m_config.support_material && !this->m_config.support_material_auto &&
|
if (this->m_config.support_material && !this->m_config.support_material_auto &&
|
||||||
std::all_of(this->model_object()->volumes.begin(), this->model_object()->volumes.end(),
|
std::all_of(this->model_object()->volumes.begin(), this->model_object()->volumes.end(),
|
||||||
[](const ModelVolume* mv){return mv->supported_facets.empty();})
|
[](const ModelVolume* mv){return mv->supported_facets.empty();})
|
||||||
) {
|
) {
|
||||||
SupportSpotsGenerator::Params params{};
|
SupportSpotsGenerator::Params params{90.001f - this->m_config.support_material_threshold, this->print()->m_config.filament_type.values};
|
||||||
params.overhang_angle_deg = 90.001f - this->m_config.support_material_threshold;
|
|
||||||
SupportSpotsGenerator::Issues issues = SupportSpotsGenerator::full_search(this, params);
|
SupportSpotsGenerator::Issues issues = SupportSpotsGenerator::full_search(this, params);
|
||||||
auto obj_transform = this->trafo_centered();
|
auto obj_transform = this->trafo_centered();
|
||||||
for (ModelVolume *model_volume : this->model_object()->volumes) {
|
for (ModelVolume *model_volume : this->model_object()->volumes) {
|
||||||
|
@ -438,7 +436,7 @@ void PrintObject::generate_support_spots()
|
||||||
Vec3f point = Vec3f(inv_transform * support_point.position);
|
Vec3f point = Vec3f(inv_transform * support_point.position);
|
||||||
Vec3f origin = Vec3f(
|
Vec3f origin = Vec3f(
|
||||||
inv_transform * Vec3f(support_point.position.x(), support_point.position.y(), 0.0f));
|
inv_transform * Vec3f(support_point.position.x(), support_point.position.y(), 0.0f));
|
||||||
selector.enforce_spot(point, origin, 0.6f);
|
selector.enforce_spot(point, origin, 1.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
model_volume->supported_facets.set(selector.selector);
|
model_volume->supported_facets.set(selector.selector);
|
||||||
|
|
|
@ -15,8 +15,8 @@
|
||||||
#include "libslic3r/ClipperUtils.hpp"
|
#include "libslic3r/ClipperUtils.hpp"
|
||||||
#include "Geometry/ConvexHull.hpp"
|
#include "Geometry/ConvexHull.hpp"
|
||||||
|
|
||||||
//#define DETAILED_DEBUG_LOGS
|
#define DETAILED_DEBUG_LOGS
|
||||||
//#define DEBUG_FILES
|
#define DEBUG_FILES
|
||||||
|
|
||||||
#ifdef DEBUG_FILES
|
#ifdef DEBUG_FILES
|
||||||
#include <boost/nowide/cstdio.hpp>
|
#include <boost/nowide/cstdio.hpp>
|
||||||
|
@ -337,6 +337,15 @@ struct ExtrusionPropertiesAccumulator {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// base function: ((e^(((1)/(x^(2)+1)))-1)/(e-1))
|
||||||
|
// checkout e.g. here: https://www.geogebra.org/calculator
|
||||||
|
float gauss(float value, float mean_x_coord, float mean_value, float falloff_speed) {
|
||||||
|
float shifted = value - mean_x_coord;
|
||||||
|
float denominator = falloff_speed * shifted * shifted + 1.0f;
|
||||||
|
float exponent = 1.0f / denominator;
|
||||||
|
return mean_value * (std::exp(exponent) - 1.0f) / (std::exp(1.0f) - 1.0f);
|
||||||
|
}
|
||||||
|
|
||||||
void check_extrusion_entity_stability(const ExtrusionEntity *entity,
|
void check_extrusion_entity_stability(const ExtrusionEntity *entity,
|
||||||
std::vector<ExtrusionLine> &checked_lines_out,
|
std::vector<ExtrusionLine> &checked_lines_out,
|
||||||
float layer_z,
|
float layer_z,
|
||||||
|
@ -407,7 +416,7 @@ void check_extrusion_entity_stability(const ExtrusionEntity *entity,
|
||||||
> params.bridge_distance / (1.0f + (bridging_acc.max_curvature
|
> params.bridge_distance / (1.0f + (bridging_acc.max_curvature
|
||||||
* params.bridge_distance_decrease_by_curvature_factor / PI));
|
* params.bridge_distance_decrease_by_curvature_factor / PI));
|
||||||
bool between_layers_condition = fabs(dist_from_prev_layer) > 3.0f*flow_width ||
|
bool between_layers_condition = fabs(dist_from_prev_layer) > 3.0f*flow_width ||
|
||||||
prev_layer_lines.get_line(nearest_line_idx).malformation > 0.6f;
|
prev_layer_lines.get_line(nearest_line_idx).malformation > 3.0f * layer_region->layer()->height;
|
||||||
|
|
||||||
if (in_layer_dist_condition && between_layers_condition) {
|
if (in_layer_dist_condition && between_layers_condition) {
|
||||||
issues.support_points.emplace_back(to_vec3f(current_line.b), 0.0f, Vec3f(0.f, 0.0f, -1.0f));
|
issues.support_points.emplace_back(to_vec3f(current_line.b), 0.0f, Vec3f(0.f, 0.0f, -1.0f));
|
||||||
|
@ -423,8 +432,8 @@ void check_extrusion_entity_stability(const ExtrusionEntity *entity,
|
||||||
}
|
}
|
||||||
if (dist_from_prev_layer > overhang_dist) {
|
if (dist_from_prev_layer > overhang_dist) {
|
||||||
malformation_acc.add_distance(current_line.len);
|
malformation_acc.add_distance(current_line.len);
|
||||||
current_line.malformation += 0.3f
|
current_line.malformation += layer_region->layer()->height * (0.5f +
|
||||||
* (0.8f + 0.2f * malformation_acc.max_curvature / (1.0f + 0.5f * malformation_acc.distance));
|
1.5f * (malformation_acc.max_curvature / PI) * gauss(malformation_acc.distance, 5.0f, 1.0f, 0.2f));
|
||||||
} else {
|
} else {
|
||||||
malformation_acc.reset();
|
malformation_acc.reset();
|
||||||
}
|
}
|
||||||
|
@ -729,7 +738,7 @@ public:
|
||||||
this->sticking_second_moment_of_area_accumulator,
|
this->sticking_second_moment_of_area_accumulator,
|
||||||
this->sticking_second_moment_of_area_covariance_accumulator,
|
this->sticking_second_moment_of_area_covariance_accumulator,
|
||||||
this->sticking_area)
|
this->sticking_area)
|
||||||
* params.bed_adhesion_yield_strength;
|
* params.get_bed_adhesion_yield_strength();
|
||||||
|
|
||||||
float bed_weight_arm = (bed_centroid.head<2>() - mass_centroid.head<2>()).norm();
|
float bed_weight_arm = (bed_centroid.head<2>() - mass_centroid.head<2>()).norm();
|
||||||
float bed_weight_torque = bed_weight_arm * weight;
|
float bed_weight_torque = bed_weight_arm * weight;
|
||||||
|
@ -759,6 +768,10 @@ public:
|
||||||
BOOST_LOG_TRIVIAL(debug)
|
BOOST_LOG_TRIVIAL(debug)
|
||||||
<< "SSG: bed_conflict_torque_arm: " << bed_conflict_torque_arm;
|
<< "SSG: bed_conflict_torque_arm: " << bed_conflict_torque_arm;
|
||||||
BOOST_LOG_TRIVIAL(debug)
|
BOOST_LOG_TRIVIAL(debug)
|
||||||
|
<< "SSG: extruded_line.malformation: " << extruded_line.malformation;
|
||||||
|
BOOST_LOG_TRIVIAL(debug)
|
||||||
|
<< "SSG: extruder_conflict_force: " << extruder_conflict_force;
|
||||||
|
BOOST_LOG_TRIVIAL(debug)
|
||||||
<< "SSG: bed_extruder_conflict_torque: " << bed_extruder_conflict_torque;
|
<< "SSG: bed_extruder_conflict_torque: " << bed_extruder_conflict_torque;
|
||||||
BOOST_LOG_TRIVIAL(debug)
|
BOOST_LOG_TRIVIAL(debug)
|
||||||
<< "SSG: total_torque: " << bed_total_torque << " layer_z: " << layer_z;
|
<< "SSG: total_torque: " << bed_total_torque << " layer_z: " << layer_z;
|
||||||
|
@ -971,6 +984,8 @@ Issues check_global_stability(SupportGridFilter supports_presence_grid,
|
||||||
for (size_t island_idx = 0; island_idx < islands_graph[layer_idx].islands.size(); ++island_idx) {
|
for (size_t island_idx = 0; island_idx < islands_graph[layer_idx].islands.size(); ++island_idx) {
|
||||||
const Island &island = islands_graph[layer_idx].islands[island_idx];
|
const Island &island = islands_graph[layer_idx].islands[island_idx];
|
||||||
ObjectPart &part = active_object_parts.access(prev_island_to_object_part_mapping[island_idx]);
|
ObjectPart &part = active_object_parts.access(prev_island_to_object_part_mapping[island_idx]);
|
||||||
|
|
||||||
|
|
||||||
IslandConnection &weakest_conn = prev_island_weakest_connection[island_idx];
|
IslandConnection &weakest_conn = prev_island_weakest_connection[island_idx];
|
||||||
#ifdef DETAILED_DEBUG_LOGS
|
#ifdef DETAILED_DEBUG_LOGS
|
||||||
weakest_conn.print_info("weakest connection info: ");
|
weakest_conn.print_info("weakest connection info: ");
|
||||||
|
|
|
@ -2,27 +2,52 @@
|
||||||
#define SRC_LIBSLIC3R_SUPPORTABLEISSUESSEARCH_HPP_
|
#define SRC_LIBSLIC3R_SUPPORTABLEISSUESSEARCH_HPP_
|
||||||
|
|
||||||
#include "libslic3r/Print.hpp"
|
#include "libslic3r/Print.hpp"
|
||||||
|
#include <boost/log/trivial.hpp>
|
||||||
|
|
||||||
namespace Slic3r {
|
namespace Slic3r {
|
||||||
|
|
||||||
namespace SupportSpotsGenerator {
|
namespace SupportSpotsGenerator {
|
||||||
|
|
||||||
struct Params {
|
struct Params {
|
||||||
|
Params(float overhang_angle_deg, const std::vector<std::string>& filament_types) : overhang_angle_deg(overhang_angle_deg)
|
||||||
|
{
|
||||||
|
if (filament_types.size() > 1) {
|
||||||
|
BOOST_LOG_TRIVIAL(warning) << "SupportSpotsGenerator does not currently handle different materials properly, only first will be used";
|
||||||
|
}
|
||||||
|
if (filament_types.empty() || filament_types[0].empty()) {
|
||||||
|
BOOST_LOG_TRIVIAL(error) << "SupportSpotsGenerator error: empty filament_type";
|
||||||
|
filament_type = std::string("PLA");
|
||||||
|
}else {
|
||||||
|
filament_type = filament_types[0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// the algorithm should use the following units for all computations: distance [mm], mass [g], time [s], force [g*mm/s^2]
|
// the algorithm should use the following units for all computations: distance [mm], mass [g], time [s], force [g*mm/s^2]
|
||||||
const float bridge_distance = 12.0f; //mm
|
const float bridge_distance = 15.0f; //mm
|
||||||
const float bridge_distance_decrease_by_curvature_factor = 5.0f; // allowed bridge distance = bridge_distance / (this factor * (curvature / PI) )
|
const float bridge_distance_decrease_by_curvature_factor = 5.0f; // allowed bridge distance = bridge_distance / (this factor * (curvature / PI) )
|
||||||
float overhang_angle_deg = 50.0f;
|
const float overhang_angle_deg = 50.0f;
|
||||||
|
|
||||||
const float min_distance_between_support_points = 3.0f; //mm
|
const float min_distance_between_support_points = 3.0f; //mm
|
||||||
const float support_points_interface_radius = 0.6f; // mm
|
const float support_points_interface_radius = 1.5f; // mm
|
||||||
|
|
||||||
|
std::string filament_type;
|
||||||
const float gravity_constant = 9806.65f; // mm/s^2; gravity acceleration on Earth's surface, algorithm assumes that printer is in upwards position.
|
const float gravity_constant = 9806.65f; // mm/s^2; gravity acceleration on Earth's surface, algorithm assumes that printer is in upwards position.
|
||||||
const float max_acceleration = 9*1000.0f; // mm/s^2 ; max acceleration of object (bed) in XY (NOTE: The max hit is received by the object in the jerk phase, so the usual machine limits are too low)
|
const float max_acceleration = 9*1000.0f; // mm/s^2 ; max acceleration of object (bed) in XY (NOTE: The max hit is received by the object in the jerk phase, so the usual machine limits are too low)
|
||||||
const float filament_density = 1.25e-3f ; // g/mm^3 ; Common filaments are very lightweight, so precise number is not that important
|
const float filament_density = 1.25e-3f ; // g/mm^3 ; Common filaments are very lightweight, so precise number is not that important
|
||||||
const float bed_adhesion_yield_strength = 0.128f * 1e6f; //MPa * 1e^6 = (g*mm/s^2)/mm^2 = g/(mm*s^2); yield strength of the bed surface
|
|
||||||
const float material_yield_strength = 33.0f * 1e6f; // (g*mm/s^2)/mm^2; 33 MPa is yield strength of ABS, which has the lowest yield strength from common materials.
|
const float material_yield_strength = 33.0f * 1e6f; // (g*mm/s^2)/mm^2; 33 MPa is yield strength of ABS, which has the lowest yield strength from common materials.
|
||||||
const float standard_extruder_conflict_force = 50.0f * gravity_constant; // force that can occasionally push the model due to various factors (filament leaks, small curling, ... );
|
const float standard_extruder_conflict_force = 20.0f * gravity_constant; // force that can occasionally push the model due to various factors (filament leaks, small curling, ... );
|
||||||
const float malformations_additive_conflict_extruder_force = 200.0f * gravity_constant; // for areas with possible high layered curled filaments
|
const float malformations_additive_conflict_extruder_force = 300.0f * gravity_constant; // for areas with possible high layered curled filaments
|
||||||
|
|
||||||
|
// MPa * 1e^6 = (g*mm/s^2)/mm^2 = g/(mm*s^2); yield strength of the bed surface
|
||||||
|
float get_bed_adhesion_yield_strength() const {
|
||||||
|
if (filament_type == "PLA"){
|
||||||
|
return 0.018f * 1e6f;
|
||||||
|
} else if (filament_type == "PET" || filament_type == "PETG") {
|
||||||
|
return 0.3f * 1e6f;
|
||||||
|
} else { //PLA default value - defensive approach, PLA has quite low adhesion
|
||||||
|
return 0.018f * 1e6f;
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SupportPoint {
|
struct SupportPoint {
|
||||||
|
@ -36,8 +61,8 @@ struct Issues {
|
||||||
std::vector<SupportPoint> support_points;
|
std::vector<SupportPoint> support_points;
|
||||||
};
|
};
|
||||||
|
|
||||||
std::vector<size_t> quick_search(const PrintObject *po, const Params ¶ms = Params { });
|
std::vector<size_t> quick_search(const PrintObject *po, const Params ¶ms);
|
||||||
Issues full_search(const PrintObject *po, const Params ¶ms = Params { });
|
Issues full_search(const PrintObject *po, const Params ¶ms);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue