most extreme fiber is now taken from the current island.. this is not correct, but

from all aproximations it gives best results
This commit is contained in:
PavelMikus 2022-07-27 17:15:23 +02:00
parent ff73cd253e
commit 2401556193
2 changed files with 24 additions and 18 deletions

View File

@ -649,6 +649,7 @@ public:
float compute_elastic_section_modulus( float compute_elastic_section_modulus(
const Vec2f &line_dir, const Vec2f &line_dir,
const Vec3f &extreme_point,
const Vec3f &centroid_accumulator, const Vec3f &centroid_accumulator,
const Vec2f &second_moment_of_area_accumulator, const Vec2f &second_moment_of_area_accumulator,
const float &second_moment_of_area_covariance_accumulator, const float &second_moment_of_area_covariance_accumulator,
@ -673,11 +674,13 @@ public:
BOOST_LOG_TRIVIAL(debug) BOOST_LOG_TRIVIAL(debug)
<< "directional_xy_variance: " << directional_xy_variance; << "directional_xy_variance: " << directional_xy_variance;
#endif #endif
if (directional_xy_variance < EPSILON) { if (directional_xy_variance < EPSILON) {
return 0.0f; return 0.0f;
} }
float extreme_fiber_dist = sqrt(area/PI);
float extreme_fiber_dist = line_alg::distance_to(
Linef(centroid.head<2>().cast<double>(), (centroid.head<2>() + Vec2f(line_dir.y(), -line_dir.x())).cast<double>()),
extreme_point.head<2>().cast<double>());
float elastic_section_modulus = area * directional_xy_variance / extreme_fiber_dist; float elastic_section_modulus = area * directional_xy_variance / extreme_fiber_dist;
#ifdef DETAILED_DEBUG_LOGS #ifdef DETAILED_DEBUG_LOGS
@ -693,11 +696,11 @@ public:
float is_stable_while_extruding( float is_stable_while_extruding(
const IslandConnection &connection, const IslandConnection &connection,
const ExtrusionLine &extruded_line, const ExtrusionLine &extruded_line,
const Vec3f &extreme_point,
float layer_z, float layer_z,
const Params &params) const { const Params &params) const {
Vec2f line_dir = (extruded_line.b - extruded_line.a).normalized(); Vec2f line_dir = (extruded_line.b - extruded_line.a).normalized();
const Vec3f &mass_centroid = this->volume_centroid_accumulator / this->volume; const Vec3f &mass_centroid = this->volume_centroid_accumulator / this->volume;
float mass = this->volume * params.filament_density; float mass = this->volume * params.filament_density;
float weight = mass * params.gravity_constant; float weight = mass * params.gravity_constant;
@ -715,6 +718,7 @@ public:
Vec3f bed_centroid = this->sticking_centroid_accumulator / this->sticking_area; Vec3f bed_centroid = this->sticking_centroid_accumulator / this->sticking_area;
float bed_yield_torque = compute_elastic_section_modulus( float bed_yield_torque = compute_elastic_section_modulus(
line_dir, line_dir,
extreme_point,
this->sticking_centroid_accumulator, this->sticking_centroid_accumulator,
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,
@ -764,8 +768,13 @@ public:
return 1.0f; return 1.0f;
Vec3f conn_centroid = connection.centroid_accumulator / connection.area; Vec3f conn_centroid = connection.centroid_accumulator / connection.area;
if (layer_z - conn_centroid.z() < 3.0f) {
return -1.0f;
}
float conn_yield_torque = compute_elastic_section_modulus( float conn_yield_torque = compute_elastic_section_modulus(
line_dir, line_dir,
extreme_point,
connection.centroid_accumulator, connection.centroid_accumulator,
connection.second_moment_of_area_accumulator, connection.second_moment_of_area_accumulator,
connection.second_moment_of_area_covariance_accumulator, connection.second_moment_of_area_covariance_accumulator,
@ -933,7 +942,8 @@ Issues check_global_stability(SupportGridFilter supports_presence_grid,
transfered_weakest_connection.print_info("transfered_weakest_connection"); transfered_weakest_connection.print_info("transfered_weakest_connection");
#endif #endif
if (estimate_conn_strength(transfered_weakest_connection) > estimate_conn_strength(new_weakest_connection)) { if (estimate_conn_strength(transfered_weakest_connection)
> estimate_conn_strength(new_weakest_connection)) {
transfered_weakest_connection = new_weakest_connection; transfered_weakest_connection = new_weakest_connection;
} }
next_island_weakest_connection.emplace(island_idx, transfered_weakest_connection); next_island_weakest_connection.emplace(island_idx, transfered_weakest_connection);
@ -959,8 +969,7 @@ Issues check_global_stability(SupportGridFilter supports_presence_grid,
#ifdef DETAILED_DEBUG_LOGS #ifdef DETAILED_DEBUG_LOGS
weakest_conn.print_info("weakest connection info: "); weakest_conn.print_info("weakest connection info: ");
#endif #endif
std::vector<ExtrusionLine> dummy { }; LinesDistancer island_lines_dist(island.external_lines);
LinesDistancer island_lines_dist(dummy);
float unchecked_dist = params.min_distance_between_support_points + 1.0f; float unchecked_dist = params.min_distance_between_support_points + 1.0f;
for (const ExtrusionLine &line : island.external_lines) { for (const ExtrusionLine &line : island.external_lines) {
@ -969,11 +978,6 @@ Issues check_global_stability(SupportGridFilter supports_presence_grid,
unchecked_dist += line.len; unchecked_dist += line.len;
} else { } else {
unchecked_dist = line.len; unchecked_dist = line.len;
auto force = part.is_stable_while_extruding(weakest_conn, line, layer_z, params);
if (force > 0) {
if (island_lines_dist.get_lines().empty()) {
island_lines_dist = LinesDistancer(island.external_lines);
}
Vec2f target_point; Vec2f target_point;
size_t _idx; size_t _idx;
Vec3f pivot_site_search_point = to_3d(Vec2f(line.b + (line.b - line.a).normalized() * 300.0f), Vec3f pivot_site_search_point = to_3d(Vec2f(line.b + (line.b - line.a).normalized() * 300.0f),
@ -981,6 +985,8 @@ Issues check_global_stability(SupportGridFilter supports_presence_grid,
island_lines_dist.signed_distance_from_lines(pivot_site_search_point.head<2>(), _idx, island_lines_dist.signed_distance_from_lines(pivot_site_search_point.head<2>(), _idx,
target_point); target_point);
Vec3f support_point = to_3d(target_point, layer_z); Vec3f support_point = to_3d(target_point, layer_z);
auto force = part.is_stable_while_extruding(weakest_conn, line, support_point, layer_z, params);
if (force > 0) {
if (!supports_presence_grid.position_taken(support_point)) { if (!supports_presence_grid.position_taken(support_point)) {
float area = params.support_points_interface_radius * params.support_points_interface_radius float area = params.support_points_interface_radius * params.support_points_interface_radius
* float(PI); * float(PI);

View File

@ -21,7 +21,7 @@ struct Params {
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 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 = 15.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 = 15.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 = 20.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 = 300.0f * gravity_constant; // for areas with possible high layered curled filaments const float malformations_additive_conflict_extruder_force = 150.0f * gravity_constant; // for areas with possible high layered curled filaments
}; };
struct SupportPoint { struct SupportPoint {