mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-06 07:47:16 +08:00
Merge branch 'master' into fs_emboss
This commit is contained in:
commit
6ee384557e
@ -1032,6 +1032,10 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
|||||||
m_pressure_equalizer = make_unique<PressureEqualizer>(print.config());
|
m_pressure_equalizer = make_unique<PressureEqualizer>(print.config());
|
||||||
m_enable_extrusion_role_markers = (bool)m_pressure_equalizer;
|
m_enable_extrusion_role_markers = (bool)m_pressure_equalizer;
|
||||||
|
|
||||||
|
if (print.config().avoid_crossing_curled_overhangs){
|
||||||
|
this->m_avoid_crossing_curled_overhangs.init_bed_shape(get_bed_shape(print.config()));
|
||||||
|
}
|
||||||
|
|
||||||
// Write information on the generator.
|
// Write information on the generator.
|
||||||
file.write_format("; %s\n\n", Slic3r::header_slic3r_generated().c_str());
|
file.write_format("; %s\n\n", Slic3r::header_slic3r_generated().c_str());
|
||||||
|
|
||||||
@ -2107,8 +2111,12 @@ LayerResult GCode::process_layer(
|
|||||||
if (this->config().avoid_crossing_curled_overhangs) {
|
if (this->config().avoid_crossing_curled_overhangs) {
|
||||||
m_avoid_crossing_curled_overhangs.clear();
|
m_avoid_crossing_curled_overhangs.clear();
|
||||||
for (const ObjectLayerToPrint &layer_to_print : layers) {
|
for (const ObjectLayerToPrint &layer_to_print : layers) {
|
||||||
m_avoid_crossing_curled_overhangs.add_obstacles(layer_to_print.object_layer, Point(scaled(this->origin())));
|
if (layer_to_print.object() == nullptr)
|
||||||
m_avoid_crossing_curled_overhangs.add_obstacles(layer_to_print.support_layer, Point(scaled(this->origin())));
|
continue;
|
||||||
|
for (const auto &instance : layer_to_print.object()->instances()) {
|
||||||
|
m_avoid_crossing_curled_overhangs.add_obstacles(layer_to_print.object_layer, instance.shift);
|
||||||
|
m_avoid_crossing_curled_overhangs.add_obstacles(layer_to_print.support_layer, instance.shift);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
#include "JumpPointSearch.hpp"
|
#include "JumpPointSearch.hpp"
|
||||||
#include "BoundingBox.hpp"
|
#include "BoundingBox.hpp"
|
||||||
|
#include "ExPolygon.hpp"
|
||||||
#include "Point.hpp"
|
#include "Point.hpp"
|
||||||
#include "libslic3r/AStar.hpp"
|
#include "libslic3r/AStar.hpp"
|
||||||
#include "libslic3r/KDTreeIndirect.hpp"
|
#include "libslic3r/KDTreeIndirect.hpp"
|
||||||
@ -181,17 +182,18 @@ public:
|
|||||||
void JPSPathFinder::clear()
|
void JPSPathFinder::clear()
|
||||||
{
|
{
|
||||||
inpassable.clear();
|
inpassable.clear();
|
||||||
obstacle_max = Pixel(std::numeric_limits<coord_t>::min(), std::numeric_limits<coord_t>::min());
|
max_search_box.max = Pixel(std::numeric_limits<coord_t>::min(), std::numeric_limits<coord_t>::min());
|
||||||
obstacle_min = Pixel(std::numeric_limits<coord_t>::max(), std::numeric_limits<coord_t>::max());
|
max_search_box.min = Pixel(std::numeric_limits<coord_t>::max(), std::numeric_limits<coord_t>::max());
|
||||||
|
add_obstacles(bed_shape);
|
||||||
}
|
}
|
||||||
|
|
||||||
void JPSPathFinder::add_obstacles(const Lines &obstacles)
|
void JPSPathFinder::add_obstacles(const Lines &obstacles)
|
||||||
{
|
{
|
||||||
auto store_obstacle = [&](coord_t x, coord_t y) {
|
auto store_obstacle = [&](coord_t x, coord_t y) {
|
||||||
obstacle_max.x() = std::max(obstacle_max.x(), x);
|
max_search_box.max.x() = std::max(max_search_box.max.x(), x);
|
||||||
obstacle_max.y() = std::max(obstacle_max.y(), y);
|
max_search_box.max.y() = std::max(max_search_box.max.y(), y);
|
||||||
obstacle_min.x() = std::min(obstacle_min.x(), x);
|
max_search_box.min.x() = std::min(max_search_box.min.x(), x);
|
||||||
obstacle_min.y() = std::min(obstacle_min.y(), y);
|
max_search_box.min.y() = std::min(max_search_box.min.y(), y);
|
||||||
inpassable.insert(Pixel{x, y});
|
inpassable.insert(Pixel{x, y});
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
@ -240,9 +242,9 @@ Polyline JPSPathFinder::find_path(const Point &p0, const Point &p1)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
BoundingBox search_box({start, end, obstacle_max, obstacle_min});
|
BoundingBox search_box = max_search_box;
|
||||||
search_box.max += Pixel(1, 1);
|
search_box.max -= Pixel(1, 1);
|
||||||
search_box.min -= Pixel(1, 1);
|
search_box.min += Pixel(1, 1);
|
||||||
|
|
||||||
BoundingBox bounding_square(Points{start, end});
|
BoundingBox bounding_square(Points{start, end});
|
||||||
bounding_square.max += Pixel(5, 5);
|
bounding_square.max += Pixel(5, 5);
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
#define SRC_LIBSLIC3R_JUMPPOINTSEARCH_HPP_
|
#define SRC_LIBSLIC3R_JUMPPOINTSEARCH_HPP_
|
||||||
|
|
||||||
#include "BoundingBox.hpp"
|
#include "BoundingBox.hpp"
|
||||||
|
#include "Polygon.hpp"
|
||||||
#include "libslic3r/Layer.hpp"
|
#include "libslic3r/Layer.hpp"
|
||||||
#include "libslic3r/Point.hpp"
|
#include "libslic3r/Point.hpp"
|
||||||
#include "libslic3r/Polyline.hpp"
|
#include "libslic3r/Polyline.hpp"
|
||||||
@ -16,18 +17,19 @@ class JPSPathFinder
|
|||||||
using Pixel = Point;
|
using Pixel = Point;
|
||||||
std::unordered_set<Pixel, PointHash> inpassable;
|
std::unordered_set<Pixel, PointHash> inpassable;
|
||||||
coordf_t print_z;
|
coordf_t print_z;
|
||||||
Pixel obstacle_min;
|
BoundingBox max_search_box;
|
||||||
Pixel obstacle_max;
|
Lines bed_shape;
|
||||||
|
|
||||||
const coord_t resolution = scaled(1.5);
|
const coord_t resolution = scaled(1.5);
|
||||||
Pixel pixelize(const Point &p) { return p / resolution; }
|
Pixel pixelize(const Point &p) { return p / resolution; }
|
||||||
Point unpixelize(const Pixel &p) { return p * resolution; }
|
Point unpixelize(const Pixel &p) { return p * resolution; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
JPSPathFinder() { clear(); };
|
JPSPathFinder() = default;
|
||||||
|
void init_bed_shape(const Points &bed_shape) { this->bed_shape = (to_lines(Polygon{bed_shape})); };
|
||||||
void clear();
|
void clear();
|
||||||
void add_obstacles(const Lines &obstacles);
|
void add_obstacles(const Lines &obstacles);
|
||||||
void add_obstacles(const Layer* layer, const Point& global_origin);
|
void add_obstacles(const Layer *layer, const Point &global_origin);
|
||||||
Polyline find_path(const Point &start, const Point &end);
|
Polyline find_path(const Point &start, const Point &end);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1043,6 +1043,7 @@ void estimate_supports_malformations(SupportLayerPtrs &layers, float flow_width,
|
|||||||
AABBTreeLines::LinesDistancer<ExtrusionLine> prev_layer_lines{};
|
AABBTreeLines::LinesDistancer<ExtrusionLine> prev_layer_lines{};
|
||||||
|
|
||||||
for (SupportLayer *l : layers) {
|
for (SupportLayer *l : layers) {
|
||||||
|
l->malformed_lines.clear();
|
||||||
std::vector<ExtrusionLine> current_layer_lines;
|
std::vector<ExtrusionLine> current_layer_lines;
|
||||||
|
|
||||||
for (const ExtrusionEntity *extrusion : l->support_fills.flatten().entities) {
|
for (const ExtrusionEntity *extrusion : l->support_fills.flatten().entities) {
|
||||||
@ -1114,6 +1115,7 @@ void estimate_malformations(LayerPtrs &layers, const Params ¶ms)
|
|||||||
LD prev_layer_lines{};
|
LD prev_layer_lines{};
|
||||||
|
|
||||||
for (Layer *l : layers) {
|
for (Layer *l : layers) {
|
||||||
|
l->malformed_lines.clear();
|
||||||
std::vector<Linef> boundary_lines = l->lower_layer != nullptr ? to_unscaled_linesf(l->lower_layer->lslices) : std::vector<Linef>();
|
std::vector<Linef> boundary_lines = l->lower_layer != nullptr ? to_unscaled_linesf(l->lower_layer->lslices) : std::vector<Linef>();
|
||||||
AABBTreeLines::LinesDistancer<Linef> prev_layer_boundary{std::move(boundary_lines)};
|
AABBTreeLines::LinesDistancer<Linef> prev_layer_boundary{std::move(boundary_lines)};
|
||||||
std::vector<ExtrusionLine> current_layer_lines;
|
std::vector<ExtrusionLine> current_layer_lines;
|
||||||
|
@ -2785,7 +2785,7 @@ bool ConfigWizard::priv::check_and_install_missing_materials(Technology technolo
|
|||||||
{
|
{
|
||||||
// Walk over all installed Printer presets and verify whether there is a filament or SLA material profile installed at the same PresetBundle,
|
// Walk over all installed Printer presets and verify whether there is a filament or SLA material profile installed at the same PresetBundle,
|
||||||
// which is compatible with it.
|
// which is compatible with it.
|
||||||
const auto printer_models_missing_materials = [this, only_for_model_id](PrinterTechnology technology, const std::string §ion)
|
const auto printer_models_missing_materials = [this, only_for_model_id](PrinterTechnology technology, const std::string §ion, bool no_templates)
|
||||||
{
|
{
|
||||||
const std::map<std::string, std::string> &appconfig_presets = appconfig_new.has_section(section) ? appconfig_new.get_section(section) : std::map<std::string, std::string>();
|
const std::map<std::string, std::string> &appconfig_presets = appconfig_new.has_section(section) ? appconfig_new.get_section(section) : std::map<std::string, std::string>();
|
||||||
std::set<const VendorProfile::PrinterModel*> printer_models_without_material;
|
std::set<const VendorProfile::PrinterModel*> printer_models_without_material;
|
||||||
@ -2805,8 +2805,8 @@ bool ConfigWizard::priv::check_and_install_missing_materials(Technology technolo
|
|||||||
has_material = true;
|
has_material = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// find if preset.first is part of the templates profile (up is searching if preset.first is part of printer vendor preset)
|
// find if preset.first is part of the templates profile (up is searching if preset.first is part of printer vendor preset)
|
||||||
|
if (!no_templates) {
|
||||||
for (const auto& bp : bundles) {
|
for (const auto& bp : bundles) {
|
||||||
if (!bp.second.preset_bundle->vendors.empty() && bp.second.preset_bundle->vendors.begin()->second.templates_profile) {
|
if (!bp.second.preset_bundle->vendors.empty() && bp.second.preset_bundle->vendors.begin()->second.templates_profile) {
|
||||||
const PresetCollection& template_materials = bp.second.preset_bundle->materials(technology);
|
const PresetCollection& template_materials = bp.second.preset_bundle->materials(technology);
|
||||||
@ -2817,6 +2817,7 @@ bool ConfigWizard::priv::check_and_install_missing_materials(Technology technolo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (has_material)
|
if (has_material)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -2872,8 +2873,10 @@ bool ConfigWizard::priv::check_and_install_missing_materials(Technology technolo
|
|||||||
return out;
|
return out;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
bool no_templates = wxGetApp().app_config->get("no_templates") == "1";
|
||||||
|
|
||||||
if (any_fff_selected && (technology & T_FFF)) {
|
if (any_fff_selected && (technology & T_FFF)) {
|
||||||
std::set<const VendorProfile::PrinterModel*> printer_models_without_material = printer_models_missing_materials(ptFFF, AppConfig::SECTION_FILAMENTS);
|
std::set<const VendorProfile::PrinterModel*> printer_models_without_material = printer_models_missing_materials(ptFFF, AppConfig::SECTION_FILAMENTS, no_templates);
|
||||||
if (! printer_models_without_material.empty()) {
|
if (! printer_models_without_material.empty()) {
|
||||||
if (only_for_model_id.empty())
|
if (only_for_model_id.empty())
|
||||||
ask_and_select_default_materials(
|
ask_and_select_default_materials(
|
||||||
@ -2891,7 +2894,7 @@ bool ConfigWizard::priv::check_and_install_missing_materials(Technology technolo
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (any_sla_selected && (technology & T_SLA)) {
|
if (any_sla_selected && (technology & T_SLA)) {
|
||||||
std::set<const VendorProfile::PrinterModel*> printer_models_without_material = printer_models_missing_materials(ptSLA, AppConfig::SECTION_MATERIALS);
|
std::set<const VendorProfile::PrinterModel*> printer_models_without_material = printer_models_missing_materials(ptSLA, AppConfig::SECTION_MATERIALS, no_templates);
|
||||||
if (! printer_models_without_material.empty()) {
|
if (! printer_models_without_material.empty()) {
|
||||||
if (only_for_model_id.empty())
|
if (only_for_model_id.empty())
|
||||||
ask_and_select_default_materials(
|
ask_and_select_default_materials(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user