update slic3r

This commit is contained in:
QIDI TECH
2025-09-17 12:32:36 +08:00
parent 0c78224f1a
commit 5cdfef9f9e
199 changed files with 14601 additions and 7804 deletions

View File

@@ -256,10 +256,13 @@ void ArrangeJob::prepare_all() {
NotificationManager::NotificationLevel::WarningNotificationLevel, into_u8(msg));
}
const DynamicPrintConfig& current_config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
bool enable_wrapping = current_config.option<ConfigOptionBool>("enable_wrapping_detection")->value;
prepare_wipe_tower();
// add the virtual object into unselect list if has
plate_list.preprocess_exclude_areas(m_unselected, MAX_NUM_PLATES);
plate_list.preprocess_exclude_areas(m_unselected, enable_wrapping, MAX_NUM_PLATES);
}
arrangement::ArrangePolygon estimate_wipe_tower_info(int plate_index, std::set<int>& extruder_ids)
@@ -432,8 +435,11 @@ void ArrangeJob::prepare_partplate() {
m_unselected.emplace_back(std::move(ap));
}
const DynamicPrintConfig &current_config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
bool enable_wrapping = current_config.option<ConfigOptionBool>("enable_wrapping_detection")->value;
// add the virtual object into unselect list if has
plate_list.preprocess_exclude_areas(m_unselected, current_plate_index + 1);
plate_list.preprocess_exclude_areas(m_unselected, enable_wrapping, current_plate_index + 1);
}
void ArrangeJob::prepare_outside_plate() {
@@ -523,8 +529,11 @@ void ArrangeJob::prepare_outside_plate() {
prepare_wipe_tower(true);
const DynamicPrintConfig &current_config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
bool enable_wrapping = current_config.option<ConfigOptionBool>("enable_wrapping_detection")->value;
// add the virtual object into unselect list if has
plate_list.preprocess_exclude_areas(m_unselected, current_plate_index + 1);
plate_list.preprocess_exclude_areas(m_unselected, enable_wrapping, current_plate_index + 1);
}
//QDS: add partplate logic
@@ -655,7 +664,8 @@ void ArrangeJob::process()
Points bedpts = get_shrink_bedpts(global_config,params);
partplate_list.preprocess_exclude_areas(params.excluded_regions, 1, scale_(1));
bool enable_wrapping = global_config.option<ConfigOptionBool>("enable_wrapping_detection")->value;
partplate_list.preprocess_exclude_areas(params.excluded_regions, enable_wrapping, 1, scale_(1));
ARRANGE_LOG(debug) << "bedpts:" << bedpts[0].transpose() << ", " << bedpts[1].transpose() << ", " << bedpts[2].transpose() << ", " << bedpts[3].transpose();

View File

@@ -4,6 +4,8 @@
#include "slic3r/GUI/GUI.hpp"
#include "slic3r/GUI/GUI_App.hpp"
#include "slic3r/GUI/DeviceCore/DevManager.h"
namespace Slic3r {
namespace GUI {

View File

@@ -61,12 +61,12 @@ void CreateFontImageJob::process(Ctl &ctl)
double standard_scale = get_text_shape_scale(fp, ff);
bool support_backup_fonts = GUI::wxGetApp().app_config->get_bool("support_backup_fonts");
EmbossShape emboss_shape;
ExPolygons shapes = support_backup_fonts ? Emboss::text2shapes(emboss_shape, font_file_with_cache, text.c_str(), fp, was_canceled, ft_fn, standard_scale):
Emboss::text2shapes(emboss_shape, font_file_with_cache, text.c_str(), fp, was_canceled);
ExPolygons shapes = support_backup_fonts ? Emboss::text2shapes(emboss_shape, font_file_with_cache, text.c_str(), fp, standard_scale, was_canceled, ft_fn) :
Emboss::text2shapes(emboss_shape, font_file_with_cache, text.c_str(), fp, standard_scale, was_canceled);
m_input.generate_origin_text = true;
if (shapes.empty()) {// select some character from font e.g. default text
m_input.generate_origin_text = false;
shapes = Emboss::text2shapes(emboss_shape, font_file_with_cache, default_text.c_str(), fp, was_canceled, ft_fn, standard_scale);
shapes = Emboss::text2shapes(emboss_shape, font_file_with_cache, default_text.c_str(), fp, standard_scale, was_canceled, ft_fn);
}
if (shapes.empty()) {
@@ -190,7 +190,8 @@ void Slic3r::GUI::BackupFonts::generate_backup_fonts() {
font_names.emplace_back(wxString::FromUTF8("Arial")); // Arabic
#endif
#ifdef __linux__
font_names.emplace_back(wxString(L"宋体")); // chinese confirm
font_names.emplace_back(wxString(L"宋体")); // chinese confirm
font_names.emplace_back(wxString("AR PL UMing CN"));// chinese confirm
font_names.emplace_back(wxString::FromUTF8("MS Gothic")); // Japanese
font_names.emplace_back(wxString::FromUTF8("NanumGothic")); // Korean
font_names.emplace_back(wxString::FromUTF8("Arial")); // Arabic

View File

@@ -42,8 +42,8 @@ void CreateFontStyleImagesJob::process(Ctl &ctl)
EmbossShape emboss_shape;
auto & ff = *item.font.font_file;
double standard_scale = get_text_shape_scale(item.prop, ff);
shapes = support_backup_fonts ? text2shapes(emboss_shape, item.font, m_input.text.c_str(), item.prop, was_canceled, ft_fn, standard_scale)
:text2shapes(emboss_shape, item.font, m_input.text.c_str(), item.prop, was_canceled);
shapes = support_backup_fonts ? text2shapes(emboss_shape, item.font, m_input.text.c_str(), item.prop, standard_scale, was_canceled, ft_fn) :
text2shapes(emboss_shape, item.font, m_input.text.c_str(), item.prop, standard_scale, was_canceled);
// create image description
StyleManager::StyleImage &image = m_images[index];
BoundingBox &bounding_box = image.bounding_box;

View File

@@ -3,6 +3,7 @@
#include <type_traits>
#include <boost/log/trivial.hpp>
//
#include <libslic3r/ClipperUtils.hpp>
#include <libslic3r/Line.hpp>
#include <libslic3r/Model.hpp>
#include <libslic3r/Format/OBJ.hpp> // load_obj for default mesh
@@ -1275,7 +1276,7 @@ ProjectTransform calc_project_tran(DataBase &input, double real_scale)
return project_tr;
}
void create_all_char_mesh(DataBase &input, std::vector<TriangleMesh> &result, EmbossShape &shape)
void create_all_char_mesh(DataBase &input, std::vector<TriangleMesh> &result, std::vector<float> &text_cursors, EmbossShape &shape)
{
shape = input.create_shape();//this will call letter2shapes
if (shape.shapes_with_ids.empty())
@@ -1317,6 +1318,7 @@ void create_all_char_mesh(DataBase &input, std::vector<TriangleMesh> &result, Em
result.emplace_back(mesh);
}
}
text_cursors = shape.text_cursors;
}
float get_single_char_width(const std::vector<TriangleMesh> &chars_mesh_result)
@@ -1332,20 +1334,11 @@ float get_single_char_width(const std::vector<TriangleMesh> &chars_mesh_result)
return 0.f;
}
bool calc_text_lengths(std::vector<double> &text_lengths, const std::vector<TriangleMesh> &chars_mesh_result)
bool calc_text_lengths(std::vector<double> &text_lengths, const std::vector<float> &text_cursors)
{
text_lengths.clear();
auto single_char_width = get_single_char_width(chars_mesh_result);
if (single_char_width < 0.01) { return false; }
for (int i = 0; i < chars_mesh_result.size(); ++i) {
auto box = chars_mesh_result[i].bounding_box();
auto box_size = box.size();
auto half_x_length = box_size[0] / 2.0f;
if (half_x_length < 0.01) {
text_lengths.emplace_back(single_char_width + 1);
} else {
text_lengths.emplace_back(half_x_length + 1);
}
for (int i = 0; i < text_cursors.size(); i++) {
text_lengths.emplace_back(text_cursors[i]/2.f);
}
return true;
}
@@ -1403,7 +1396,7 @@ void GenerateTextJob::process(Ctl &ctl)
auto canceled = was_canceled(ctl, *m_input.m_data_update.base);
if (canceled)
return;
create_all_char_mesh(*m_input.m_data_update.base, m_input.m_chars_mesh_result, m_input.m_text_shape);
create_all_char_mesh(*m_input.m_data_update.base, m_input.m_chars_mesh_result, m_input.m_text_cursors,m_input.m_text_shape);
if (m_input.m_chars_mesh_result.empty()) {
return;
}
@@ -1457,10 +1450,10 @@ bool GenerateTextJob::update_text_positions(InputInfo &input_info)
return false;
}
std::vector<double> text_lengths;
if (!calc_text_lengths(text_lengths, input_info.m_chars_mesh_result)) {
if (!calc_text_lengths(text_lengths, input_info.m_text_cursors)) {
return false;
}
int text_num = input_info.m_chars_mesh_result.size(); // FIX by BBS 20250109
int text_num = input_info.m_chars_mesh_result.size(); // FIX by QDS 20250109
input_info.m_position_points.clear();
input_info.m_normal_points.clear();
/*auto mouse_position_world = m_text_position_in_world.cast<double>();
@@ -1844,6 +1837,9 @@ void GenerateTextJob::get_text_mesh(TriangleMesh &result_mesh, std::vector<Trian
if (chars_mesh.size() == 0) {
BOOST_LOG_TRIVIAL(info) << boost::format("check error:get_text_mesh");
}
if (i >= chars_mesh.size() || i< 0) {
return;
}
TriangleMesh mesh = chars_mesh[i]; // m_cur_font_name
auto box = mesh.bounding_box();
mesh.translate(-box.center().x(), 0, 0);
@@ -1949,12 +1945,12 @@ void GenerateTextJob::generate_mesh_according_points(InputInfo &input_info)
CreateObjectTextJob::CreateObjectTextJob(CreateTextInput &&input) : m_input(std::move(input)) {}
void CreateObjectTextJob::process(Ctl &ctl) {
create_all_char_mesh(*m_input.base, m_input.m_chars_mesh_result, m_input.m_text_shape);
create_all_char_mesh(*m_input.base, m_input.m_chars_mesh_result, m_input.m_text_cursors, m_input.m_text_shape);
if (m_input.m_chars_mesh_result.empty()) {
return;
}
std::vector<double> text_lengths;
calc_text_lengths(text_lengths, m_input.m_chars_mesh_result);
calc_text_lengths(text_lengths, m_input.m_text_cursors);
calc_position_points(m_input.m_position_points, text_lengths, m_input.text_info.m_text_gap, Vec3d(1, 0, 0));
}

View File

@@ -264,6 +264,7 @@ public:
struct CreateTextInput
{
std::vector<TriangleMesh> m_chars_mesh_result;
std::vector<float> m_text_cursors;
EmbossShape m_text_shape;
TextInfo text_info;
DataBasePtr base;
@@ -281,9 +282,9 @@ public:
};
const GLVolume *find_glvoloume_render_screen_cs(const Selection &selection, const Vec2d &screen_center, const Camera &camera, const ModelObjectPtrs &objects, Vec2d *closest_center);
void create_all_char_mesh(DataBase &input, std::vector<TriangleMesh> &result, EmbossShape &shape);
void create_all_char_mesh(DataBase &input, std::vector<TriangleMesh> &result,std::vector<float>& text_cursors, EmbossShape &shape);
float get_single_char_width( const std::vector<TriangleMesh> &chars_mesh_result);
bool calc_text_lengths(std::vector<double> &text_lengths,const std::vector<TriangleMesh>& chars_mesh_result);
bool calc_text_lengths(std::vector<double> &text_lengths, const std::vector<float> & text_cursors);
void calc_position_points(std::vector<Vec3d> &position_points, std::vector<double> &text_lengths, float text_gap, const Vec3d &temp_pos_dir);
struct Texture
@@ -353,6 +354,7 @@ public:
Geometry::Transformation m_text_tran_in_world; // Transform3d m_text_cs_to_world_tran;
//Transform3d m_object_cs_to_world_tran;
std::vector<TriangleMesh> m_chars_mesh_result;
std::vector<float> m_text_cursors;
Vec3d m_text_position_in_world;
Vec3f m_text_normal_in_world;
float m_text_gap;

View File

@@ -120,10 +120,11 @@ void FillBedJob::prepare()
if (m_selected.empty()) return;
bool enable_wrapping = global_config.option<ConfigOptionBool>("enable_wrapping_detection")->value;
//add the virtual object into unselect list if has
double scaled_exclusion_gap = scale_(1);
plate_list.preprocess_exclude_areas(params.excluded_regions, 1, scaled_exclusion_gap);
plate_list.preprocess_exclude_areas(m_unselected);
plate_list.preprocess_exclude_areas(params.excluded_regions, enable_wrapping, 1, scaled_exclusion_gap);
plate_list.preprocess_exclude_areas(m_unselected, enable_wrapping);
m_bedpts = get_bed_shape(global_config);

View File

@@ -9,6 +9,8 @@
#include "slic3r/GUI/MainFrame.hpp"
#include "qidi_networking.hpp"
#include "slic3r/GUI/DeviceCore/DevManager.h"
#include "slic3r/GUI/DeviceCore/DevUtil.h"
namespace Slic3r {
namespace GUI {
@@ -256,6 +258,8 @@ void PrintJob::process()
params.auto_flow_cali = this->auto_flow_cali;
params.auto_offset_cali = this->auto_offset_cali;
params.task_ext_change_assist = this->task_ext_change_assist;
//y71
params.enable_multi_box = this->enable_multi_box;
if (m_print_type == "from_sdcard_view") {
params.dst_file = m_dst_path;
@@ -286,22 +290,20 @@ void PrintJob::process()
catch (...) {}
}
auto model_name = model_info->metadata_items.find(QDT_DESIGNER_MODEL_TITLE_TAG);
if (model_name != model_info->metadata_items.end()) {
try {
if (m_print_type != "from_sdcard_view") {
auto model_name = model_info->metadata_items.find(QDT_DESIGNER_MODEL_TITLE_TAG);
if (model_name != model_info->metadata_items.end()) {
try {
std::string mall_model_name = model_name->second;
std::replace(mall_model_name.begin(), mall_model_name.end(), ' ', '_');
const char *unusable_symbols = "<>[]:/\\|?*\" ";
for (const char *symbol = unusable_symbols; *symbol != '\0'; ++symbol) { std::replace(mall_model_name.begin(), mall_model_name.end(), *symbol, '_'); }
std::string mall_model_name = model_name->second;
std::replace(mall_model_name.begin(), mall_model_name.end(), ' ', '_');
const char* unusable_symbols = "<>[]:/\\|?*\" ";
for (const char* symbol = unusable_symbols; *symbol != '\0'; ++symbol) {
std::replace(mall_model_name.begin(), mall_model_name.end(), *symbol, '_');
}
std::regex pattern("_+");
params.project_name = std::regex_replace(mall_model_name, pattern, "_");
params.project_name = truncate_string(params.project_name, 100);
std::regex pattern("_+");
params.project_name = std::regex_replace(mall_model_name, pattern, "_");
params.project_name = truncate_string(params.project_name, 100);
} catch (...) {}
}
catch (...) {}
}
}
@@ -486,7 +488,7 @@ void PrintJob::process()
try {
job_info_j.parse(job_info);
if (job_info_j.contains("job_id")) {
curr_job_id = JsonValParser::get_longlong_val(job_info_j["job_id"]);
curr_job_id = DevJsonValParser::get_longlong_val(job_info_j["job_id"]);
}
BOOST_LOG_TRIVIAL(trace) << "print_job: curr_obj_id=" << curr_job_id;

View File

@@ -89,9 +89,12 @@ public:
int auto_bed_leveling{0};
int auto_flow_cali{0};
int auto_offset_cali{0};
//y71
int enable_multi_box{0};
void set_print_config(std::string bed_type, bool bed_leveling, bool flow_cali, bool vabration_cali, bool record_timelapse, bool layer_inspect, bool ext_change_assist,
int auto_bed_levelingt,
int auto_enable_multi_box,
int auto_flow_calit,
int auto_offset_calit)
{
@@ -104,6 +107,7 @@ public:
task_ext_change_assist = ext_change_assist;
auto_bed_leveling = auto_bed_levelingt;
enable_multi_box = auto_enable_multi_box;
auto_flow_cali = auto_flow_calit;
auto_offset_cali = auto_offset_calit;