mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-07 15:07:31 -06:00
Merge BS 1.7.7.89
# Conflicts: # bbl/i18n/ko/BambuStudio_ko.po # localization/i18n/OrcaSlicer.pot # localization/i18n/de/OrcaSlicer_de.po # localization/i18n/en/OrcaSlicer_en.po # localization/i18n/es/OrcaSlicer_es.po # localization/i18n/fr/OrcaSlicer_fr.po # localization/i18n/hu/OrcaSlicer_hu.po # localization/i18n/it/OrcaSlicer_it.po # localization/i18n/ja/OrcaSlicer_ja.po # localization/i18n/nl/OrcaSlicer_nl.po # localization/i18n/sv/OrcaSlicer_sv.po # localization/i18n/zh_cn/OrcaSlicer_zh_CN.po # resources/i18n/de/BambuStudio.mo # resources/i18n/en/BambuStudio.mo # resources/i18n/es/BambuStudio.mo # resources/i18n/fr/BambuStudio.mo # resources/i18n/hu/BambuStudio.mo # resources/i18n/it/BambuStudio.mo # resources/i18n/ja/BambuStudio.mo # resources/i18n/ko/BambuStudio.mo # resources/i18n/nl/BambuStudio.mo # resources/i18n/sv/BambuStudio.mo # resources/i18n/zh_cn/BambuStudio.mo # resources/profiles/Anycubic/machine/Anycubic Kobra Max 0.4 nozzle.json # src/OrcaSlicer.cpp # src/libnest2d/include/libnest2d/selections/firstfit.hpp # src/libslic3r/GCode/GCodeProcessor.cpp # src/libslic3r/Print.cpp # src/libslic3r/Print.hpp # src/libslic3r/PrintConfig.cpp # src/slic3r/GUI/CalibrationWizardPresetPage.cpp # src/slic3r/GUI/GLCanvas3D.cpp # src/slic3r/GUI/PartPlate.cpp # src/slic3r/GUI/PartPlate.hpp # src/slic3r/GUI/ReleaseNote.cpp # src/slic3r/GUI/Tab.cpp # version.inc
This commit is contained in:
commit
a7729ca83f
213 changed files with 2090 additions and 649 deletions
|
@ -32,6 +32,7 @@
|
|||
#include "ShortestPath.hpp"
|
||||
#include "SupportMaterial.hpp"
|
||||
#include "Thread.hpp"
|
||||
#include "Time.hpp"
|
||||
#include "GCode.hpp"
|
||||
#include "GCode/WipeTower.hpp"
|
||||
#include "GCode/WipeTower2.hpp"
|
||||
|
@ -589,7 +590,7 @@ StringObjectException Print::sequential_print_clearance_valid(const Print &print
|
|||
auto tmp = offset(convex_hull_no_offset,
|
||||
// Shrink the extruder_clearance_radius a tiny bit, so that if the object arrangement algorithm placed the objects
|
||||
// exactly by satisfying the extruder_clearance_radius, this test will not trigger collision.
|
||||
float(scale_(0.5 * print.config().extruder_clearance_radius.value - EPSILON)),
|
||||
float(scale_(0.5 * print.config().extruder_clearance_radius.value - 0.1)),
|
||||
jtRound, scale_(0.1));
|
||||
if (!tmp.empty()) { // tmp may be empty due to clipper's bug, see STUDIO-2452
|
||||
convex_hull = tmp.front();
|
||||
|
@ -954,30 +955,15 @@ static StringObjectException layered_print_cleareance_valid(const Print &print,
|
|||
|
||||
bool Print::check_multi_filaments_compatibility(const std::vector<std::string>& filament_types)
|
||||
{
|
||||
static std::map<std::string, bool> filament_is_high_temp{
|
||||
{"PLA", false},
|
||||
{"PLA-CF", false},
|
||||
//{"PETG", true},
|
||||
{"ABS", true},
|
||||
{"TPU", false},
|
||||
{"PA", true},
|
||||
{"PA-CF", true},
|
||||
{"PET-CF", true},
|
||||
{"PC", true},
|
||||
{"ASA", true},
|
||||
{"HIPS", true}
|
||||
};
|
||||
|
||||
bool has_high_temperature_filament = false;
|
||||
bool has_low_temperature_filament = false;
|
||||
|
||||
for (const auto& type : filament_types)
|
||||
if (filament_is_high_temp.find(type) != filament_is_high_temp.end()) {
|
||||
if (filament_is_high_temp[type])
|
||||
has_high_temperature_filament = true;
|
||||
else
|
||||
has_low_temperature_filament = true;
|
||||
}
|
||||
for (const auto& type : filament_types) {
|
||||
if (get_filament_temp_type(type) ==FilamentTempType::HighTemp)
|
||||
has_high_temperature_filament = true;
|
||||
else if (get_filament_temp_type(type) == FilamentTempType::LowTemp)
|
||||
has_low_temperature_filament = true;
|
||||
}
|
||||
|
||||
if (has_high_temperature_filament && has_low_temperature_filament)
|
||||
return false;
|
||||
|
@ -985,6 +971,44 @@ bool Print::check_multi_filaments_compatibility(const std::vector<std::string>&
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Print::is_filaments_compatible(const std::vector<int>& filament_types)
|
||||
{
|
||||
bool has_high_temperature_filament = false;
|
||||
bool has_low_temperature_filament = false;
|
||||
|
||||
for (const auto& type : filament_types) {
|
||||
if (type == FilamentTempType::HighTemp)
|
||||
has_high_temperature_filament = true;
|
||||
else if (type == FilamentTempType::LowTemp)
|
||||
has_low_temperature_filament = true;
|
||||
}
|
||||
|
||||
if (has_high_temperature_filament && has_low_temperature_filament)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
int Print::get_compatible_filament_type(const std::set<int>& filament_types)
|
||||
{
|
||||
bool has_high_temperature_filament = false;
|
||||
bool has_low_temperature_filament = false;
|
||||
|
||||
for (const auto& type : filament_types) {
|
||||
if (type == FilamentTempType::HighTemp)
|
||||
has_high_temperature_filament = true;
|
||||
else if (type == FilamentTempType::LowTemp)
|
||||
has_low_temperature_filament = true;
|
||||
}
|
||||
|
||||
if (has_high_temperature_filament && has_low_temperature_filament)
|
||||
return HighLowCompatible;
|
||||
else if (has_high_temperature_filament)
|
||||
return HighTemp;
|
||||
else if (has_low_temperature_filament)
|
||||
return LowTemp;
|
||||
return HighLowCompatible;
|
||||
}
|
||||
|
||||
//BBS: this function is used to check whether multi filament can be printed
|
||||
StringObjectException Print::check_multi_filament_valid(const Print& print)
|
||||
{
|
||||
|
@ -1613,8 +1637,12 @@ std::map<ObjectID, unsigned int> getObjectExtruderMap(const Print& print) {
|
|||
}
|
||||
|
||||
// Slicing process, running at a background thread.
|
||||
void Print::process(bool use_cache)
|
||||
void Print::process(long long *time_cost_with_cache, bool use_cache)
|
||||
{
|
||||
long long start_time = 0, end_time = 0;
|
||||
if (time_cost_with_cache)
|
||||
*time_cost_with_cache = 0;
|
||||
|
||||
name_tbb_thread_pool_threads_set_locale();
|
||||
|
||||
//compute the PrintObject with the same geometries
|
||||
|
@ -1775,6 +1803,16 @@ void Print::process(bool use_cache)
|
|||
}
|
||||
}
|
||||
);
|
||||
|
||||
for (PrintObject* obj : m_objects) {
|
||||
if (need_slicing_objects.count(obj) != 0) {
|
||||
obj->detect_overhangs_for_lift();
|
||||
}
|
||||
else {
|
||||
if (obj->set_started(posDetectOverhangsForLift))
|
||||
obj->set_done(posDetectOverhangsForLift);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (PrintObject *obj : m_objects) {
|
||||
|
@ -1791,6 +1829,8 @@ void Print::process(bool use_cache)
|
|||
obj->set_done(posIroning);
|
||||
if (obj->set_started(posSupportMaterial))
|
||||
obj->set_done(posSupportMaterial);
|
||||
if (obj->set_started(posDetectOverhangsForLift))
|
||||
obj->set_done(posDetectOverhangsForLift);
|
||||
}
|
||||
else {
|
||||
obj->make_perimeters();
|
||||
|
@ -1804,8 +1844,10 @@ void Print::process(bool use_cache)
|
|||
|
||||
for (PrintObject *obj : m_objects)
|
||||
{
|
||||
if (need_slicing_objects.count(obj) == 0)
|
||||
if (need_slicing_objects.count(obj) == 0) {
|
||||
obj->copy_layers_from_shared_object();
|
||||
obj->copy_layers_overhang_from_shared_object();
|
||||
}
|
||||
}
|
||||
|
||||
if (this->set_started(psWipeTower)) {
|
||||
|
@ -1824,6 +1866,9 @@ void Print::process(bool use_cache)
|
|||
if (this->set_started(psSkirtBrim)) {
|
||||
this->set_status(70, L("Generating skirt & brim"));
|
||||
|
||||
if (time_cost_with_cache)
|
||||
start_time = (long long)Slic3r::Utils::get_current_time_utc();
|
||||
|
||||
m_skirt.clear();
|
||||
m_skirt_convex_hull.clear();
|
||||
m_first_layer_convex_hull.points.clear();
|
||||
|
@ -1908,6 +1953,11 @@ void Print::process(bool use_cache)
|
|||
|
||||
this->finalize_first_layer_convex_hull();
|
||||
this->set_done(psSkirtBrim);
|
||||
|
||||
if (time_cost_with_cache) {
|
||||
end_time = (long long)Slic3r::Utils::get_current_time_utc();
|
||||
*time_cost_with_cache = *time_cost_with_cache + end_time - start_time;
|
||||
}
|
||||
}
|
||||
//BBS
|
||||
for (PrintObject *obj : m_objects) {
|
||||
|
@ -1925,18 +1975,6 @@ void Print::process(bool use_cache)
|
|||
}
|
||||
}
|
||||
|
||||
// BBS
|
||||
for (PrintObject* obj : m_objects) {
|
||||
if (need_slicing_objects.count(obj) != 0) {
|
||||
obj->detect_overhangs_for_lift();
|
||||
}
|
||||
else {
|
||||
obj->copy_layers_overhang_from_shared_object();
|
||||
if (obj->set_started(posDetectOverhangsForLift))
|
||||
obj->set_done(posDetectOverhangsForLift);
|
||||
}
|
||||
}
|
||||
|
||||
// BBS
|
||||
if(!m_no_check)
|
||||
{
|
||||
|
@ -2229,6 +2267,77 @@ Vec2d Print::translate_to_print_space(const Vec2d &point) const {
|
|||
Vec2d Print::translate_to_print_space(const Point &point) const {
|
||||
return Vec2d(unscaled(point.x()) - m_origin(0), unscaled(point.y()) - m_origin(1));
|
||||
}
|
||||
|
||||
FilamentTempType Print::get_filament_temp_type(const std::string& filament_type)
|
||||
{
|
||||
const static std::string HighTempFilamentStr = "high_temp_filament";
|
||||
const static std::string LowTempFilamentStr = "low_temp_filament";
|
||||
const static std::string HighLowCompatibleFilamentStr = "high_low_compatible_filament";
|
||||
static std::unordered_map<std::string, std::unordered_set<std::string>>filament_temp_type_map;
|
||||
|
||||
if (filament_temp_type_map.empty()) {
|
||||
fs::path file_path = fs::path(resources_dir()) / "info" / "filament_info.json";
|
||||
std::ifstream in(file_path.string());
|
||||
json j;
|
||||
try{
|
||||
j = json::parse(in);
|
||||
in.close();
|
||||
auto&&high_temp_filament_arr =j[HighTempFilamentStr].get < std::vector<std::string>>();
|
||||
filament_temp_type_map[HighTempFilamentStr] = std::unordered_set<std::string>(high_temp_filament_arr.begin(), high_temp_filament_arr.end());
|
||||
auto&& low_temp_filament_arr = j[LowTempFilamentStr].get < std::vector<std::string>>();
|
||||
filament_temp_type_map[LowTempFilamentStr] = std::unordered_set<std::string>(low_temp_filament_arr.begin(), low_temp_filament_arr.end());
|
||||
auto&& high_low_compatible_filament_arr = j[HighLowCompatibleFilamentStr].get < std::vector<std::string>>();
|
||||
filament_temp_type_map[HighLowCompatibleFilamentStr] = std::unordered_set<std::string>(high_low_compatible_filament_arr.begin(), high_low_compatible_filament_arr.end());
|
||||
}
|
||||
catch (const json::parse_error& err){
|
||||
in.close();
|
||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ": parse " << file_path.string() << " got a nlohmann::detail::parse_error, reason = " << err.what();
|
||||
filament_temp_type_map[HighTempFilamentStr] = {"ABS","ASA","PC","PA","PA-CF","PA6-CF","PET-CF","PPS","PPS-CF","PPA-GF","PPA-CF"};
|
||||
filament_temp_type_map[LowTempFilamentStr] = {"PLA","TPU","PLA-CF","PLA-AERO","PVA"};
|
||||
filament_temp_type_map[HighLowCompatibleFilamentStr] = { "HIPS","PETG" };
|
||||
}
|
||||
}
|
||||
|
||||
if (filament_temp_type_map[HighLowCompatibleFilamentStr].find(filament_type) != filament_temp_type_map[HighLowCompatibleFilamentStr].end())
|
||||
return HighLowCompatible;
|
||||
if (filament_temp_type_map[HighTempFilamentStr].find(filament_type) != filament_temp_type_map[HighTempFilamentStr].end())
|
||||
return HighTemp;
|
||||
if (filament_temp_type_map[LowTempFilamentStr].find(filament_type) != filament_temp_type_map[LowTempFilamentStr].end())
|
||||
return LowTemp;
|
||||
return Undefine;
|
||||
}
|
||||
|
||||
int Print::get_hrc_by_nozzle_type(const NozzleType&type)
|
||||
{
|
||||
static std::map<std::string, int>nozzle_type_to_hrc;
|
||||
if (nozzle_type_to_hrc.empty()) {
|
||||
fs::path file_path = fs::path(resources_dir()) / "info" / "nozzle_info.json";
|
||||
std::ifstream in(file_path.string());
|
||||
json j;
|
||||
try {
|
||||
j = json::parse(in);
|
||||
in.close();
|
||||
for (const auto& elem : j["nozzle_hrc"].items())
|
||||
nozzle_type_to_hrc[elem.key()] = elem.value();
|
||||
}
|
||||
catch (const json::parse_error& err) {
|
||||
in.close();
|
||||
BOOST_LOG_TRIVIAL(error) << __FUNCTION__ << ": parse " << file_path.string() << " got a nlohmann::detail::parse_error, reason = " << err.what();
|
||||
nozzle_type_to_hrc = {
|
||||
{"hardened_steel",55},
|
||||
{"stainless_steel",20},
|
||||
{"brass",2},
|
||||
{"undefine",0}
|
||||
};
|
||||
}
|
||||
}
|
||||
auto iter = nozzle_type_to_hrc.find(NozzleTypeEumnToStr[type]);
|
||||
if (iter != nozzle_type_to_hrc.end())
|
||||
return iter->second;
|
||||
//0 represents undefine
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Print::finalize_first_layer_convex_hull()
|
||||
{
|
||||
append(m_first_layer_convex_hull.points, m_skirt_convex_hull);
|
||||
|
@ -2656,6 +2765,8 @@ std::string PrintStatistics::finalize_output_path(const std::string &path_in) co
|
|||
#define JSON_LAYER_ID "layer_id"
|
||||
#define JSON_LAYER_SLICED_POLYGONS "sliced_polygons"
|
||||
#define JSON_LAYER_SLLICED_BBOXES "sliced_bboxes"
|
||||
#define JSON_LAYER_OVERHANG_POLYGONS "overhang_polygons"
|
||||
#define JSON_LAYER_OVERHANG_BBOX "overhang_bbox"
|
||||
|
||||
#define JSON_SUPPORT_LAYER_ISLANDS "support_islands"
|
||||
#define JSON_SUPPORT_LAYER_FILLS "support_fills"
|
||||
|
@ -3292,6 +3403,19 @@ void extract_layer(const json& layer_json, Layer& layer) {
|
|||
layer.lslices_bboxes.push_back(std::move(bbox));
|
||||
}
|
||||
|
||||
//overhang_polygons
|
||||
int overhang_polygons_count = layer_json[JSON_LAYER_OVERHANG_POLYGONS].size();
|
||||
for (int polygon_index = 0; polygon_index < overhang_polygons_count; polygon_index++)
|
||||
{
|
||||
ExPolygon polygon;
|
||||
|
||||
polygon = layer_json[JSON_LAYER_OVERHANG_POLYGONS][polygon_index];
|
||||
layer.loverhangs.push_back(std::move(polygon));
|
||||
}
|
||||
|
||||
//overhang_box
|
||||
layer.loverhangs_bbox = layer_json[JSON_LAYER_OVERHANG_BBOX];
|
||||
|
||||
//layer_regions
|
||||
int layer_region_count = layer.region_count();
|
||||
for (int layer_region_index = 0; layer_region_index < layer_region_count; layer_region_index++)
|
||||
|
@ -3367,7 +3491,7 @@ int Print::export_cached_data(const std::string& directory, bool with_space)
|
|||
boost::filesystem::path directory_path(directory);
|
||||
|
||||
auto convert_layer_to_json = [](json& layer_json, const Layer* layer) {
|
||||
json slice_polygons_json = json::array(), slice_bboxs_json = json::array(), layer_regions_json = json::array();
|
||||
json slice_polygons_json = json::array(), slice_bboxs_json = json::array(), overhang_polygons_json = json::array(), layer_regions_json = json::array();
|
||||
layer_json[JSON_LAYER_PRINT_Z] = layer->print_z;
|
||||
layer_json[JSON_LAYER_HEIGHT] = layer->height;
|
||||
layer_json[JSON_LAYER_SLICE_Z] = layer->slice_z;
|
||||
|
@ -3390,6 +3514,16 @@ int Print::export_cached_data(const std::string& directory, bool with_space)
|
|||
}
|
||||
layer_json[JSON_LAYER_SLLICED_BBOXES] = std::move(slice_bboxs_json);
|
||||
|
||||
//overhang_polygons
|
||||
for (const ExPolygon& overhang_polygon : layer->loverhangs) {
|
||||
json overhang_polygon_json = overhang_polygon;
|
||||
overhang_polygons_json.push_back(std::move(overhang_polygon_json));
|
||||
}
|
||||
layer_json[JSON_LAYER_OVERHANG_POLYGONS] = std::move(overhang_polygons_json);
|
||||
|
||||
//overhang_box
|
||||
layer_json[JSON_LAYER_OVERHANG_BBOX] = layer->loverhangs_bbox;
|
||||
|
||||
for (const LayerRegion *layer_region : layer->regions()) {
|
||||
json region_json = *layer_region;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue