mirror of
https://github.com/QIDITECH/QIDIStudio.git
synced 2026-02-07 04:11:50 +03:00
update libslic3r
This commit is contained in:
@@ -1457,7 +1457,6 @@ static inline ExPolygons detect_overhangs(
|
||||
// This is done to increase size of the supporting columns below, as they are calculated by
|
||||
// propagating these contact surfaces downwards.
|
||||
diff_polygons = diff(intersection(expand(diff_polygons, lower_layer_offset, SUPPORT_SURFACES_OFFSET_PARAMETERS), layerm_polygons), lower_layer_polygons);
|
||||
if (xy_expansion != 0) { diff_polygons = expand(diff_polygons, xy_expansion, SUPPORT_SURFACES_OFFSET_PARAMETERS); }
|
||||
}
|
||||
//FIXME add user defined filtering here based on minimal area or minimum radius or whatever.
|
||||
|
||||
@@ -1509,6 +1508,8 @@ static inline ExPolygons detect_overhangs(
|
||||
if (diff_polygons.empty() || offset(diff_polygons, -0.1 * fw).empty())
|
||||
continue;
|
||||
|
||||
if (xy_expansion != 0) { diff_polygons = expand(diff_polygons, xy_expansion, SUPPORT_SURFACES_OFFSET_PARAMETERS); }
|
||||
|
||||
polygons_append(overhang_polygons, diff_polygons);
|
||||
} // for each layer.region
|
||||
}
|
||||
|
||||
@@ -171,6 +171,12 @@ struct SupportParameters {
|
||||
std::numeric_limits<double>::max();
|
||||
|
||||
support_style = object_config.support_style;
|
||||
if (support_style != smsDefault) {
|
||||
if ((support_style == smsSnug || support_style == smsGrid) && is_tree(object_config.support_type)) support_style = smsDefault;
|
||||
if ((support_style == smsTreeSlim || support_style == smsTreeStrong || support_style == smsTreeHybrid || support_style == smsTreeOrganic) &&
|
||||
!is_tree(object_config.support_type))
|
||||
support_style = smsDefault;
|
||||
}
|
||||
if (support_style == smsDefault) {
|
||||
if (is_tree(object_config.support_type)) {
|
||||
// organic support doesn't work with variable layer heights (including adaptive layer height and height range modifier, see #4313)
|
||||
|
||||
@@ -33,7 +33,7 @@ using namespace std::literals;
|
||||
|
||||
// or warning
|
||||
// had to use a define beacuse the macro processing inside macro BOOST_LOG_TRIVIAL()
|
||||
#define error_level_not_in_cache error
|
||||
#define error_level_not_in_cache debug
|
||||
|
||||
//FIXME Machine border is currently ignored.
|
||||
static Polygons calculateMachineBorderCollision(Polygon machine_border)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
#include <math.h>
|
||||
#include <chrono>
|
||||
#include <math.h>
|
||||
|
||||
@@ -219,6 +218,7 @@ static void draw_contours_and_nodes_to_svg
|
||||
|
||||
// draw layer nodes
|
||||
svg.draw(layer_pts, "green", coord_t(scale_(0.1)));
|
||||
for (SupportNode *node : layer_nodes) { svg.draw({node->overhang}, "green", 0.5); }
|
||||
|
||||
// lower layer points
|
||||
layer_pts.clear();
|
||||
@@ -227,13 +227,13 @@ static void draw_contours_and_nodes_to_svg
|
||||
}
|
||||
svg.draw(layer_pts, "black", coord_t(scale_(0.1)));
|
||||
|
||||
// higher layer points
|
||||
layer_pts.clear();
|
||||
for (SupportNode* node : layer_nodes) {
|
||||
if(node->parent)
|
||||
layer_pts.push_back(node->parent->position);
|
||||
}
|
||||
svg.draw(layer_pts, "blue", coord_t(scale_(0.1)));
|
||||
//// higher layer points
|
||||
//layer_pts.clear();
|
||||
//for (SupportNode* node : layer_nodes) {
|
||||
// if(node->parent)
|
||||
// layer_pts.push_back(node->parent->position);
|
||||
//}
|
||||
//svg.draw(layer_pts, "blue", coord_t(scale_(0.1)));
|
||||
}
|
||||
|
||||
static void draw_layer_mst
|
||||
@@ -1645,6 +1645,8 @@ void TreeSupport::move_bounds_to_contact_nodes(std::vector<TreeSupport3D::Suppor
|
||||
|
||||
void TreeSupport::generate()
|
||||
{
|
||||
if (!is_tree(m_object_config->support_type.value)) return;
|
||||
|
||||
if (m_support_params.support_style == smsTreeOrganic) {
|
||||
generate_tree_support_3D(*m_object, this, this->throw_on_cancel);
|
||||
return;
|
||||
@@ -2076,8 +2078,7 @@ void TreeSupport::draw_circles()
|
||||
area = offset_ex({ node.overhang }, scale_(m_ts_data->m_xy_distance));
|
||||
}
|
||||
area = diff_clipped(area, get_collision(node.is_sharp_tail && node.distance_to_top <= 0));
|
||||
if (node.type == ePolygon)
|
||||
area_poly = area;
|
||||
if (node.type == ePolygon) append(area_poly, area);
|
||||
}
|
||||
else {
|
||||
Polygon circle(branch_circle);
|
||||
@@ -2108,6 +2109,12 @@ void TreeSupport::draw_circles()
|
||||
if(!tmp.empty())
|
||||
circle = tmp[0];
|
||||
}
|
||||
area = avoid_object_remove_extra_small_parts(ExPolygon(circle), get_collision(node.is_sharp_tail && node.distance_to_top <= 0));
|
||||
// area = diff_clipped({ ExPolygon(circle) }, get_collision(node.is_sharp_tail && node.distance_to_top <= 0));
|
||||
|
||||
if (!area.empty()) has_circle_node = true;
|
||||
if (node.need_extra_wall) need_extra_wall = true;
|
||||
|
||||
// merge overhang to get a smoother interface surface
|
||||
// Do not merge when buildplate_only is on, because some underneath nodes may have been deleted.
|
||||
if (top_interface_layers > 0 && node.support_roof_layers_below > 0 && !on_buildplate_only && !node.is_sharp_tail) {
|
||||
@@ -2119,14 +2126,6 @@ void TreeSupport::draw_circles()
|
||||
}
|
||||
append(area, overhang_expanded);
|
||||
}
|
||||
|
||||
area = avoid_object_remove_extra_small_parts(ExPolygon(circle), get_collision(node.is_sharp_tail && node.distance_to_top <= 0));
|
||||
//area = diff_clipped({ ExPolygon(circle) }, get_collision(node.is_sharp_tail && node.distance_to_top <= 0));
|
||||
|
||||
if (!area.empty())
|
||||
has_circle_node = true;
|
||||
if(node.need_extra_wall)
|
||||
need_extra_wall = true;
|
||||
}
|
||||
|
||||
if (obj_layer_nr>0 && node.distance_to_top < 0)
|
||||
@@ -2203,22 +2202,22 @@ void TreeSupport::draw_circles()
|
||||
}
|
||||
auto &area_groups = ts_layer->area_groups;
|
||||
for (auto& expoly : ts_layer->base_areas) {
|
||||
if (area(expoly) < SQ(scale_(1))) continue;
|
||||
//if (area(expoly) < SQ(scale_(1))) continue;
|
||||
area_groups.emplace_back(&expoly, SupportLayer::BaseType, max_layers_above_base);
|
||||
area_groups.back().need_infill = overlaps({ expoly }, area_poly);
|
||||
area_groups.back().need_extra_wall = need_extra_wall && !area_groups.back().need_infill;
|
||||
}
|
||||
for (auto& expoly : ts_layer->roof_areas) {
|
||||
if (area(expoly) < SQ(scale_(1))) continue;
|
||||
//if (area(expoly) < SQ(scale_(1))) continue;
|
||||
area_groups.emplace_back(&expoly, SupportLayer::RoofType, max_layers_above_roof);
|
||||
area_groups.back().interface_id = interface_id;
|
||||
}
|
||||
for (auto &expoly : ts_layer->floor_areas) {
|
||||
if (area(expoly) < SQ(scale_(1))) continue;
|
||||
//if (area(expoly) < SQ(scale_(1))) continue;
|
||||
area_groups.emplace_back(&expoly, SupportLayer::FloorType, 10000);
|
||||
}
|
||||
for (auto &expoly : ts_layer->roof_1st_layer) {
|
||||
if (area(expoly) < SQ(scale_(1))) continue;
|
||||
//if (area(expoly) < SQ(scale_(1))) continue;
|
||||
area_groups.emplace_back(&expoly, SupportLayer::Roof1stLayer, max_layers_above_roof1);
|
||||
}
|
||||
|
||||
@@ -2900,7 +2899,7 @@ void TreeSupport::drop_nodes()
|
||||
}
|
||||
}
|
||||
auto next_collision = get_collision(0, obj_layer_nr_next);
|
||||
const bool to_buildplate = !is_inside_ex(next_collision, next_layer_vertex);
|
||||
const bool to_buildplate = !is_inside_ex(m_ts_data->m_layer_outlines[obj_layer_nr_next], next_layer_vertex);
|
||||
SupportNode * next_node = m_ts_data->create_node(next_layer_vertex, node.distance_to_top + 1, obj_layer_nr_next, node.support_roof_layers_below - 1, to_buildplate, p_node,
|
||||
print_z_next, height_next);
|
||||
// don't increase radius if next node will collide partially with the object (STUDIO-7883)
|
||||
@@ -3259,9 +3258,11 @@ std::vector<LayerHeightData> TreeSupport::plan_layer_heights()
|
||||
for (int layer_nr = 0; layer_nr < contact_nodes.size(); layer_nr++) {
|
||||
if (contact_nodes[layer_nr].empty()) continue;
|
||||
SupportNode *node1 = contact_nodes[layer_nr].front();
|
||||
auto it = z_heights.lower_bound(node1->print_z + EPSILON);
|
||||
if (it == z_heights.end()) it = std::prev(it);
|
||||
int layer_nr2 = std::distance(z_heights.begin(), it);
|
||||
auto it = std::min_element(layer_heights.begin(), layer_heights.end(), [node1](const LayerHeightData &l1, const LayerHeightData &l2) {
|
||||
return std::abs(l1.print_z - node1->print_z) < std::abs(l2.print_z - node1->print_z);
|
||||
});
|
||||
if (it == layer_heights.end()) it = std::prev(it);
|
||||
int layer_nr2 = std::distance(layer_heights.begin(), it);
|
||||
contact_nodes2[layer_nr2].insert(contact_nodes2[layer_nr2].end(), contact_nodes[layer_nr].begin(), contact_nodes[layer_nr].end());
|
||||
}
|
||||
contact_nodes = contact_nodes2;
|
||||
@@ -3285,7 +3286,7 @@ std::vector<LayerHeightData> TreeSupport::plan_layer_heights()
|
||||
if (accum_height > node1->height - EPSILON) break;
|
||||
}
|
||||
}
|
||||
BOOST_LOG_TRIVIAL(debug) << format("plan_layer_heights adjust node's height %d %.2f: (%.3f,%d)->(%.3f,%.3f,%d)", layer_nr, node1->print_z,
|
||||
BOOST_LOG_TRIVIAL(debug) << format("plan_layer_heights adjust node's height print_z[%d]=%.2f: (%.3f,%d)->(%.3f,%.3f,%d)", layer_nr, node1->print_z,
|
||||
node1->height, node1->distance_to_top, new_height, accum_height, -num_layers);
|
||||
for (SupportNode *node : contact_nodes[layer_nr]) {
|
||||
node->height = new_height;
|
||||
@@ -3503,6 +3504,7 @@ void TreeSupport::generate_contact_points()
|
||||
if (!curr_nodes.empty()) nonempty_layers++;
|
||||
for (auto node : curr_nodes) { all_nodes.emplace_back(node->position(0), node->position(1), scale_(node->print_z)); }
|
||||
#ifdef SUPPORT_TREE_DEBUG_TO_SVG
|
||||
if (!curr_nodes.empty())
|
||||
draw_contours_and_nodes_to_svg(debug_out_path("init_contact_points_%.2f.svg", bottom_z), layer->loverhangs,layer->lslices_extrudable, m_ts_data->m_layer_outlines_below[layer_nr],
|
||||
contact_nodes[layer_nr], contact_nodes[layer_nr - 1], { "overhang","lslices","outlines_below"});
|
||||
#endif
|
||||
|
||||
@@ -792,7 +792,7 @@ static std::optional<std::pair<Point, size_t>> polyline_sample_next_point_at_dis
|
||||
if (distance == 0)
|
||||
return do_final_difference ? diff(ret, collision_trimmed()) : union_(ret);
|
||||
if (safe_step_size < 0 || last_step_offset_without_check < 0) {
|
||||
BOOST_LOG_TRIVIAL(error) << "Offset increase got invalid parameter!";
|
||||
BOOST_LOG_TRIVIAL(warning) << "Offset increase got invalid parameter!";
|
||||
tree_supports_show_error("Negative offset distance... How did you manage this ?"sv, true);
|
||||
return do_final_difference ? diff(ret, collision_trimmed()) : union_(ret);
|
||||
}
|
||||
@@ -1686,7 +1686,7 @@ static Point move_inside_if_outside(const Polygons &polygons, Point from, int di
|
||||
));
|
||||
check_layer_data = current_elem.to_buildplate ? to_bp_data : to_model_data;
|
||||
if (area(check_layer_data) < tiny_area_threshold) {
|
||||
BOOST_LOG_TRIVIAL(error) << "Lost area by doing catch up from " << ceil_radius_before << " to radius " <<
|
||||
BOOST_LOG_TRIVIAL(debug) << "Lost area by doing catch up from " << ceil_radius_before << " to radius " <<
|
||||
volumes.ceilRadius(support_element_collision_radius(config, current_elem), settings.use_min_distance);
|
||||
tree_supports_show_error("Area lost catching up radius. May not cause visible malformation."sv, true);
|
||||
}
|
||||
@@ -1983,7 +1983,7 @@ static void increase_areas_one_layer(
|
||||
<< "Trying to keep area by moving faster than intended: Success";
|
||||
break;
|
||||
} else if (!settings.no_error)
|
||||
BOOST_LOG_TRIVIAL(error) << "Trying to keep area by moving faster than intended: FAILURE! WRONG BRANCHES LIKLY!";
|
||||
BOOST_LOG_TRIVIAL(warning) << "Trying to keep area by moving faster than intended: FAILURE! WRONG BRANCHES LIKLY!";
|
||||
}
|
||||
|
||||
if (add) {
|
||||
@@ -2447,7 +2447,7 @@ void create_layer_pathing(const TreeModelVolumes &volumes, const TreeSupportSett
|
||||
return true;
|
||||
if (elem.areas.to_bp_areas.empty() && elem.areas.to_model_areas.empty()) {
|
||||
if (area(elem.areas.influence_areas) < tiny_area_threshold) {
|
||||
BOOST_LOG_TRIVIAL(error) << "Insert Error of Influence area bypass on layer " << layer_idx - 1;
|
||||
BOOST_LOG_TRIVIAL(warning) << "Insert Error of Influence area bypass on layer " << layer_idx - 1;
|
||||
tree_supports_show_error("Insert error of area after bypassing merge.\n"sv, true);
|
||||
}
|
||||
// Move the area to output.
|
||||
@@ -2480,7 +2480,7 @@ void create_layer_pathing(const TreeModelVolumes &volumes, const TreeSupportSett
|
||||
if (! elem.areas.influence_areas.empty()) {
|
||||
Polygons new_area = safe_union(elem.areas.influence_areas);
|
||||
if (area(new_area) < tiny_area_threshold) {
|
||||
BOOST_LOG_TRIVIAL(error) << "Insert Error of Influence area on layer " << layer_idx - 1 << ". Origin of " << elem.parents.size() << " areas. Was to bp " << elem.state.to_buildplate;
|
||||
BOOST_LOG_TRIVIAL(warning) << "Insert Error of Influence area on layer " << layer_idx - 1 << ". Origin of " << elem.parents.size() << " areas. Was to bp " << elem.state.to_buildplate;
|
||||
tree_supports_show_error("Insert error of area after merge.\n"sv, true);
|
||||
}
|
||||
this_layer.emplace_back(elem.state, std::move(elem.parents), std::move(new_area));
|
||||
@@ -2509,7 +2509,7 @@ static void set_points_on_areas(const SupportElement &elem, SupportElements *lay
|
||||
|
||||
// Based on the branch center point of the current layer, the point on the next (further up) layer is calculated.
|
||||
if (! elem.state.result_on_layer_is_set()) {
|
||||
BOOST_LOG_TRIVIAL(error) << "Uninitialized support element";
|
||||
BOOST_LOG_TRIVIAL(warning) << "Uninitialized support element";
|
||||
tree_supports_show_error("Uninitialized support element. A branch may be missing.\n"sv, true);
|
||||
return;
|
||||
}
|
||||
@@ -2677,7 +2677,8 @@ void create_nodes_from_area(
|
||||
if (! elem.state.result_on_layer_is_set()) {
|
||||
if (elem.state.to_buildplate || (elem.state.distance_to_top < config.min_dtt_to_model && ! elem.state.supports_roof)) {
|
||||
if (elem.state.to_buildplate) {
|
||||
BOOST_LOG_TRIVIAL(error) << "Uninitialized Influence area targeting " << elem.state.target_position.x() << "," << elem.state.target_position.y() << ") "
|
||||
BOOST_LOG_TRIVIAL(warning) << "Uninitialized Influence area targeting " << elem.state.target_position.x() << "," << elem.state.target_position.y()
|
||||
<< ") "
|
||||
"at target_height: " << elem.state.target_height << " layer: " << layer_idx;
|
||||
tree_supports_show_error("Uninitialized support element! A branch could be missing or exist partially."sv, true);
|
||||
}
|
||||
@@ -4213,7 +4214,6 @@ static void generate_support_areas(Print &print, TreeSupport* tree_support, cons
|
||||
// organic support default pattern is none.
|
||||
if (config.support_pattern == smpDefault) {
|
||||
config.support_pattern = smpNone;
|
||||
support_params.support_density = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user