Feature/merge bs1.91 (#5394)

* fixed logic error in PLA jamming gcode for P1S

* Fix use after free bug in LinesBucketQueue::emplace_back_bucket
I found a use after free bug in LinesBucketQueue::emplace_back_bucket. This was found by enabling address sanitizer.
The LinesBucketQueue class has two related members:
std::vector<LinesBucket> line_buckets;
std::priority_queue<LinesBucket *, std::vector<LinesBucket *>, LinesBucketPtrComp> line_bucket_ptr_queue;
line_bucket_ptr_queue holds pointers into line_buckets. However, since items are inserted into line_buckets one at a time, existing pointers that were stored inside line_bucket_ptr_queue become invalid. Specifically:
void LinesBucketQueue::emplace_back_bucket(ExtrusionLayers &&els, const void *objPtr, Point offset)
{
    auto oldSize = line_buckets.capacity();
    line_buckets.emplace_back(std::move(els), objPtr, offset); <--- Causes a reallocation, making previous pointers invalid
    line_bucket_ptr_queue.push(&line_buckets.back()); <-- priority queue compares against old, now invalid pointers
    ...

The proposed fix is to calculate the required number of entries in ConflictChecker::find_inter_of_lines_in_diff_objs, and then calling line_buckets.reserve(count). This ensures that sufficient buffer is allocated up front and the pointers are stable as items are added.

* Updated to fix the handling of the capacity change, and removed the code I previously added to reserve upfront since it is not really needed

* Remove accidentally added whitespace

* Removed unused method

* ENH:add mz_zip_reader_extract_to_file_w api

to solove plugin install failed problem by special wide char
jira: none
Change-Id: Ic7d3efe3fdf852387650abf9df65803da9e46a60
(cherry picked from commit b68ad03717a63675fef2f3ef73d4058bf311adea)

* FIX: PrinterFileSystem report real connect error

Change-Id: I99d6ff7f6dcb1f53ccf59854f5f19d0bd39fa9fc
Jira: none

* rename preference name

* FIX:Relax restrictions on importing obj files

jira: none
Change-Id: I61a0156a8424a5f59922956918d37d38e2c3306a

* FIX: [6469] popup dialog too mach when reload object

Jira: 6469

Change-Id: I4097e3a3b018c7a676fea93bf63f8f778bb3148b

* FIX:fixed incorrect display of printer options page on Linux

jira:[STUDIO-6220]

Change-Id: Id1f084658b0b340b7f17ab97ba82c0fd3ae83fae

* FIX: handle exception of dividing by zero in arranging

jira: none
Change-Id: I0d20464dbe81a80293539100f06d72dee456a27b
(cherry picked from commit 94746ae9bf7f467243849570450567b4fdc78e3a)

* ENH:delete no use code

jira: none
Change-Id: I40e7ffa7ea47bb3cd4039eef9f6c28c604eb3abc

* FIX: PrinterFileSystem::FileRemoved

Change-Id: I891aaa8d58ff379dc1ebd8581064865a33388f74

* FIX: resend ttcode to printer on -90 error

Change-Id: I96dc45102a2759a9f1a0002f42c3a91b2c6b2d75
Jira: STUDIO-5947
(cherry picked from commit 97d687b7c88f8cd51b8eddd39120349d8eac42b1)

* FIX: fix some issue in multi machine

JIRA: STUDIO-6934 STUDIO-6888
1. Fix the issue of incomplete display caused by excessively long file names
2. Fix the issue of icon display being too large
3. Fix the issue of garbled Chinese characters in the task list

Change-Id: I36bc10bf2067f44aaa7e3651b58e526ea323c8ad

* FIX: Incorrect multiplier, when the multiplier is set to below 1

github: #3987 #3805
1. In some languages that use commas as decimal points, setting multiplier below 1 will resolve to 0
2. Unable to save multiplier correctly

Change-Id: I62bc55e270929ebb5e910eb79c6f97106e842b93

* Arrange

* FIX: wrong wipe tower when open 3mf file

1.wipe tower pos in 3mf was overwritten by default pos when opening 3mf
with a different printer profile.This patch fix it

jira: STUDIO-5890

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: I12e5d4b80a0ad86194db0682c1763ba4a9492521

* ENH: update A1 machine gcode

1.Adjust the y position of the A1 extrusion compensation line

jira:NEW

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: Iea690a0184ae10a47f53e1532272c31fc0a04cfa

* FIX: minor spelling mistake in gcode

github:#3477

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: Id3201bf8b8125ce060e2cac102ab2525877e27c1

* FIX: slice crash with height_range

github: 3917
Change-Id: Icdf83013213b47935b7a795ed75cc3d49057665d

* FIX: ERROR_RES_BUSY text

Change-Id: Ifde1a7b0c6ab915eb226c2072c46edd40f60cf9a
Jira: STUDIO-6436

* ENH:Unable to send printing without selecting a device

jira:[STUDIO-6850]

Change-Id: Ic537579727fd1618af364db93fce8fbbe4cd635a

* FIX:add exit_gizmo before slice model

jira: STUDIO-5531
Change-Id: Icddc9d73b3d91bb68e9768d13e48cbae0680e58e

* FIX: PrinterFileSystem report real connect error

Change-Id: Id6750cfa2a98fe8325ba677dabb606a0a701b495

* FIX: add can slice judgement in slice all plates processing

jira: STUDIO-6325

Change-Id: Ic7fb8cef000c03210bb77289a570ee6b60b6083e

* FIX:Fixed error in displaying the name of Bambu filaments

Change-Id: Ib42194c07b6eefe793eec81a588debc9d622d951

* FIX: text hidden in calibration tab

jira: STUDIO-6264

Change-Id: I24fbc590638a3213d948a973422e010486113923

* FIX: logic error in PLA fan control

github PR: #3948

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: I28e4a673e590e83d151e92cc82caab45012aeabe

* FIX:upgrade cluster algorithm to remove duplicate labels

jira: none
Change-Id: I4d68d8cd8e080932c7c308bc8f69e27546ffe309

* FIX: can not parse json float in ES on macOS

jira: STUDIO-5889

Change-Id: I622f4b474c378d77b0e43d67a320f023be2d5811

* ENH:Clear the value of the previous nozzle type

jira:[for nozzle check]

Change-Id: I9a932b833fb07de6cb0a91abe6372b0e91f273f1

* ENH: update A1 gcode

1.Modify the width of extrusion compensation line

jira:NEW

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Change-Id: I90543758c866d74f2154e3135d7569109def84b8

* FIX: the height range is not valid in assemble object

github: 3876
Change-Id: Id38672bbf0c01bc9b9f0a3e2bf1052d945b45131

* FIX: calibration page text hidden in linux

jira: STUDIO-6264

Change-Id: If210abf64057eb2e9c2c5b11d41fa33f18684c72

* ENH:clear nozzle information

jira:[STUDIO-7050]

Change-Id: I15ca4973d09132ddb5cb5a56bedd795ba6976b27

* update plugin version

---------

Signed-off-by: xun.zhang <xun.zhang@bambulab.com>
Co-authored-by: afriede <me@afriede.dev>
Co-authored-by: Momin Al-Ghosien <momin@sanestudios.com>
Co-authored-by: zhou.xu <zhou.xu@bambulab.com>
Co-authored-by: chunmao.guo <chunmao.guo@bambulab.com>
Co-authored-by: maosheng.wei <maosheng.wei@bambulab.com>
Co-authored-by: tao wang <tao.wang@bambulab.com>
Co-authored-by: Arthur <arthur.tang@bambulab.com>
Co-authored-by: Kunlong Ma <kunlong.ma@bambulab.com>
Co-authored-by: xun.zhang <xun.zhang@bambulab.com>
Co-authored-by: zhimin.zeng <zhimin.zeng@bambulab.com>
Co-authored-by: liz.li <liz.li@bambulab.com>
This commit is contained in:
SoftFever 2024-05-19 21:22:14 +08:00 committed by GitHub
parent 6e701454fd
commit ad341ec9e6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
62 changed files with 579 additions and 189 deletions

View file

@ -1,7 +1,7 @@
{
"name": "Bambulab",
"url": "http://www.bambulab.com/Parameters/vendor/BBL.json",
"version": "01.09.00.07",
"version": "01.09.00.10",
"force_update": "0",
"description": "the initial version of BBL configurations",
"machine_model_list": [

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -119,9 +119,9 @@ public:
for(; j < placers.size() && !was_packed && !cancelled(); j++) {
result = placers[j].pack(*it, rem(it, store_));
score = result.score();
score_all_plates = std::accumulate(placers.begin(), placers.begin() + j, score,
[](double sum, const Placer& elem) { return sum + elem.score(); });
if (this->unfitindicator_) this->unfitindicator_(it->get().name + " bed_id="+std::to_string(j) + ",score=" + std::to_string(score));
score_all_plates = score;
for (int i = 0; i < placers.size(); i++) { score_all_plates += placers[i].score();}
if (this->unfitindicator_) this->unfitindicator_(it->get().name + " bed_id="+std::to_string(j) + ",score=" + std::to_string(score)+", score_all_plates="+std::to_string(score_all_plates));
if(score >= 0 && score < LARGE_COST_TO_REJECT) {
if (bed_id_firstfit == -1) {

View file

@ -640,28 +640,25 @@ protected:
score += lambda4 * hasRowHeightConflict + lambda4 * hasLidHeightConflict;
}
else {
int valid_items_cnt = 0;
double height_score = 0;
for (int i = 0; i < m_items.size(); i++) {
Item& p = m_items[i];
if (p.is_virt_object) {
// Better not put items above wipe tower
if (p.is_wipe_tower) {
if (ibb.maxCorner().y() > p.boundingBox().maxCorner().y())
score += 1;
else if(m_pilebb.defined)
score += norm(pl::distance(ibb.center(), m_pilebb.center()));
}
else
continue;
} else {
if (!p.is_virt_object) {
valid_items_cnt++;
// 高度接近的件尽量摆到一起
score += (1- std::abs(item.height - p.height) / params.printable_height)
height_score += (1- std::abs(item.height - p.height) / params.printable_height)
* norm(pl::distance(ibb.center(), p.boundingBox().center()));
//score += LARGE_COST_TO_REJECT * (item.bed_temp - p.bed_temp != 0);
if (!Print::is_filaments_compatible({ item.filament_temp_type,p.filament_temp_type }))
if (!Print::is_filaments_compatible({ item.filament_temp_type,p.filament_temp_type })) {
score += LARGE_COST_TO_REJECT;
break;
}
}
}
if (valid_items_cnt > 0)
score += height_score / valid_items_cnt;
}
std::set<int> extruder_ids;
for (int i = 0; i < m_items.size(); i++) {
@ -682,9 +679,11 @@ protected:
}
// for layered printing, we want extruder change as few as possible
// this has very weak effect, CAN NOT use a large weight
int last_extruder_cnt = extruder_ids.size();
extruder_ids.insert(item.extrude_ids.begin(), item.extrude_ids.end());
int new_extruder_cnt= extruder_ids.size();
if (!params.is_seq_print) {
score += 1 * std::max(0, ((int) extruder_ids.size() - 1));
score += 1 * (new_extruder_cnt-last_extruder_cnt);
}
return std::make_tuple(score, fullbb);
@ -943,8 +942,15 @@ template<class Bin> void remove_large_items(std::vector<Item> &items, Bin &&bin)
template<class S> Radians min_area_boundingbox_rotation(const S &sh)
{
try {
return minAreaBoundingBox<S, TCompute<S>, boost::rational<LargeInt>>(sh)
.angleToX();
}
catch (const std::exception& e) {
// min_area_boundingbox_rotation may throw exception of dividing 0 if the object is already perfectly aligned to X
BOOST_LOG_TRIVIAL(error) << "arranging min_area_boundingbox_rotation fails, msg=" << e.what();
return 0.0;
}
}
template<class S>

View file

@ -36,12 +36,25 @@ bool load_obj(const char *path, TriangleMesh *meshptr, ObjInfo& obj_info, std::s
bool exist_mtl = false;
if (data.mtllibs.size() > 0) { // read mtl
for (auto mtl_name : data.mtllibs) {
if (mtl_name.size() == 0){
continue;
}
exist_mtl = true;
bool mtl_name_is_path = false;
boost::filesystem::path mtl_abs_path(mtl_name);
if (boost::filesystem::exists(mtl_abs_path)) {
mtl_name_is_path = true;
}
boost::filesystem::path mtl_path;
if (!mtl_name_is_path) {
boost::filesystem::path full_path(path);
std::string dir = full_path.parent_path().string();
auto mtl_file = dir + "/" + mtl_name;
boost::filesystem::path mtl_path(mtl_file);
auto _mtl_path = mtl_path.string().c_str();
if (boost::filesystem::exists(mtl_path)) {
boost::filesystem::path temp_mtl_path(mtl_file);
mtl_path = temp_mtl_path;
}
auto _mtl_path = mtl_name_is_path ? mtl_abs_path.string().c_str() : mtl_path.string().c_str();
if (boost::filesystem::exists(mtl_name_is_path ? mtl_abs_path : mtl_path)) {
if (!ObjParser::mtlparse(_mtl_path, mtl_data)) {
BOOST_LOG_TRIVIAL(error) << "load_obj:load_mtl: failed to parse " << _mtl_path;
message = _L("load mtl in obj: failed to parse");
@ -52,7 +65,6 @@ bool load_obj(const char *path, TriangleMesh *meshptr, ObjInfo& obj_info, std::s
BOOST_LOG_TRIVIAL(error) << "load_obj: failed to load mtl_path:" << _mtl_path;
}
}
exist_mtl = true;
}
// Count the faces and verify, that all faces are triangular.
size_t num_faces = 0;

View file

@ -237,7 +237,7 @@ static bool obj_parseline(const char *line, ObjData &data)
}
}
if (vertex.coordIdx < 0)
vertex.coordIdx += (int)data.coordinates.size() / 4;
vertex.coordIdx += (int) data.coordinates.size() / OBJ_VERTEX_LENGTH;
else
-- vertex.coordIdx;
if (vertex.normalIdx < 0)
@ -604,9 +604,6 @@ bool objparse(const char *path, ObjData &data)
BOOST_LOG_TRIVIAL(error) << "ObjParser: Out of memory";
}
::fclose(pFile);
// printf("vertices: %d\r\n", data.vertices.size() / 4);
// printf("coords: %d\r\n", data.coordinates.size());
return true;
}
@ -646,9 +643,6 @@ bool mtlparse(const char *path, MtlData &data)
BOOST_LOG_TRIVIAL(error) << "MtlParser: Out of memory";
}
::fclose(pFile);
// printf("vertices: %d\r\n", data.vertices.size() / 4);
// printf("coords: %d\r\n", data.coordinates.size());
return true;
}

View file

@ -90,9 +90,14 @@ void LinesBucketQueue::emplace_back_bucket(ExtrusionLayers &&els, const void *ob
{
auto oldSize = line_buckets.capacity();
line_buckets.emplace_back(std::move(els), objPtr, offset);
line_bucket_ptr_queue.push(&line_buckets.back());
auto newSize = line_buckets.capacity();
if (oldSize != newSize) { // pointers change
// Since line_bucket_ptr_queue is storing pointers into line_buckets,
// we need to handle the case where the capacity changes since that makes
// the existing pointers invalid
if (oldSize == newSize) {
line_bucket_ptr_queue.push(&line_buckets.back());
}
else { // pointers change, create a new queue from scratch
decltype(line_bucket_ptr_queue) newQueue;
for (LinesBucket &bucket : line_buckets) { newQueue.push(&bucket); }
std::swap(line_bucket_ptr_queue, newQueue);
@ -215,6 +220,7 @@ ConflictResultOpt ConflictChecker::find_inter_of_lines_in_diff_objs(PrintObjectP
{
if (objs.size() <= 1 && !wtdptr) { return {}; }
LinesBucketQueue conflictQueue;
if (wtdptr.has_value()) { // wipe tower at 0 by default
auto wtpaths = wtdptr.value()->getFakeExtrusionPathsFromWipeTower();
ExtrusionLayers wtels;

View file

@ -238,16 +238,6 @@ Model Model::read_from_file(const std::string& input_file, DynamicPrintConfig* c
if (vertex_filament_ids.size() > 0) {
result = obj_import_vertex_color_deal(vertex_filament_ids, first_extruder_id, & model);
}
} else { // test //todo delete
vertex_filament_ids.push_back(2);
vertex_filament_ids.push_back(3);
vertex_filament_ids.push_back(4);
vertex_filament_ids.push_back(1); // 4
vertex_filament_ids.push_back(1);
vertex_filament_ids.push_back(1);
vertex_filament_ids.push_back(1);
vertex_filament_ids.push_back(1); // 8
result = obj_import_vertex_color_deal(vertex_filament_ids, first_extruder_id, &model);
}
} else if (obj_info.face_colors.size() > 0 && obj_info.has_uv_png == false) { // mtl file
std::vector<unsigned char> face_filament_ids;

View file

@ -27,7 +27,8 @@ public:
cv::Mat image8UC3;
convert_color_space(flatten_image8UC3, image8UC3, color_space);
cv::Mat image32FC3(image8UC3.rows, 1, CV_32FC3);
for (int i = 0; i < image8UC3.rows; i++) image32FC3.at<cv::Vec3f>(i, 0) = image8UC3.at<cv::Vec3b>(i, 0);
for (int i = 0; i < image8UC3.rows; i++)
image32FC3.at<cv::Vec3f>(i, 0) = image8UC3.at<cv::Vec3b>(i, 0);
apply(image32FC3, num_cluster, color_space);
repalce_centers_aplha(ori_image, new_image);
@ -43,16 +44,25 @@ public:
convert_color_space(this->m_centers8UC3, this->m_centers8UC3, color_space, true);
}
void apply(const std::vector<std::array<float, 4>> &ori_colors,
std::vector<std::array<float, 4>> & cluster_results,
std::vector<int> & labels,
int num_cluster = -1,
int max_cluster = 15,
int color_space = 2)
{
// 0~255
cv::Mat flatten_image8UC3 = flatten_vector(ori_colors);
this->apply(flatten_image8UC3, cluster_results, labels, num_cluster, max_cluster, color_space);
}
void apply(const cv::Mat & flatten_image8UC3,
std::vector<std::array<float, 4>> &cluster_results,
std::vector<int> & labels,
int num_cluster = -1,
int max_cluster = 15,
int color_space = 2)
{
cv::Mat image8UC3;
convert_color_space(flatten_image8UC3, image8UC3, color_space);
@ -61,35 +71,43 @@ public:
image32FC3.at<cv::Vec3f>(i, 0) = image8UC3.at<cv::Vec3b>(i, 0);
int best_cluster = 1;
double cur_score, best_score = 100;
int max_cluster = ori_colors.size();
double cur_score = 0, best_score = 100;
num_cluster = fmin(num_cluster, max_cluster);
if (num_cluster < 1) {
cur_score = kmeans(image32FC3, 1, this->m_flatten_labels, cv::TermCriteria(cv::TermCriteria::EPS + cv::TermCriteria::COUNT, 300, 0.5), 3, cv::KMEANS_PP_CENTERS);
if (!this->more_than_request(image8UC3, max_cluster)) max_cluster = compute_num_colors(image8UC3);
num_cluster = fmin(num_cluster, max_cluster);
cur_score = cv::kmeans(image32FC3, 1, this->m_flatten_labels, cv::TermCriteria(cv::TermCriteria::EPS + cv::TermCriteria::COUNT, 300, 0.5), 3, cv::KMEANS_PP_CENTERS);
best_score = cur_score;
for (int cur_cluster = 2; cur_cluster < 16; cur_cluster++) {
if (cur_cluster > max_cluster)
for (int cur_cluster = 2; cur_cluster < max_cluster + 1; cur_cluster++) {
cv::Mat centers32FC3;
cur_score = cv::kmeans(image32FC3, cur_cluster, this->m_flatten_labels, cv::TermCriteria(cv::TermCriteria::EPS + cv::TermCriteria::COUNT, 300, 0.5), 3,
cv::KMEANS_PP_CENTERS, centers32FC3);
if (this->repeat_center(cur_cluster, centers32FC3, color_space))
break;
cur_score = kmeans(image32FC3, cur_cluster, this->m_flatten_labels, cv::TermCriteria(cv::TermCriteria::EPS + cv::TermCriteria::COUNT, 300, 0.5), 3,
cv::KMEANS_PP_CENTERS);
best_cluster = cur_score < best_score ? cur_cluster : best_cluster;
best_score = cur_score < best_score ? cur_score : best_score;
}
} else
} else if (this->more_than_request(image8UC3, num_cluster))
best_cluster = num_cluster;
else {
best_cluster = compute_num_colors(image8UC3);
std::cout << "num of image color is " << best_cluster << ", less than custom number " << num_cluster << std::endl;
}
cv::Mat centers32FC3;
kmeans(image32FC3, best_cluster, this->m_flatten_labels, cv::TermCriteria(cv::TermCriteria::EPS + cv::TermCriteria::COUNT, 300, 0.5), 3, cv::KMEANS_PP_CENTERS,
cv::kmeans(image32FC3, best_cluster, this->m_flatten_labels, cv::TermCriteria(cv::TermCriteria::EPS + cv::TermCriteria::COUNT, 300, 0.5), 3, cv::KMEANS_PP_CENTERS,
centers32FC3);
this->m_centers8UC3 = cv::Mat(best_cluster, 1, CV_8UC3);
for (int i = 0; i < best_cluster; i++)
this->m_centers8UC3.at<cv::Vec3b>(i) = centers32FC3.at<cv::Vec3f>(i);
for (int i = 0; i < best_cluster; i++) {
auto center = centers32FC3.row(i);
this->m_centers8UC3.at<cv::Vec3b>(i) = {uchar(center.at<float>(0)), uchar(center.at<float>(1)), uchar(center.at<float>(2))};
}
convert_color_space(this->m_centers8UC3, this->m_centers8UC3, color_space, true);
cluster_results.clear();
labels.clear();
for (int i = 0; i < ori_colors.size(); i++)
for (int i = 0; i < flatten_image8UC3.rows; i++)
labels.emplace_back(this->m_flatten_labels.at<int>(i, 0));
for (int i = 0; i < best_cluster; i++) {
cv::Vec3f center = this->m_centers8UC3.at<cv::Vec3b>(i, 0);
@ -97,6 +115,59 @@ public:
}
}
bool more_than_request(const cv::Mat &image8UC3, int target_num)
{
std::vector<cv::Vec3b> uniqueImage;
cv::Vec3b cur_color;
for (int i = 0; i < image8UC3.rows; i++) {
cur_color = image8UC3.at<cv::Vec3b>(i, 0);
if (!is_in(cur_color, uniqueImage)) {
uniqueImage.emplace_back(cur_color);
if (uniqueImage.size() >= target_num) return true;
}
}
return false;
}
int compute_num_colors(const cv::Mat &image8UC3)
{
std::vector<cv::Vec3b> uniqueImage;
cv::Vec3b cur_color;
for (int i = 0; i < image8UC3.rows; i++) {
cur_color = image8UC3.at<cv::Vec3b>(i, 0);
if (!is_in(cur_color, uniqueImage)) uniqueImage.emplace_back(cur_color);
}
return uniqueImage.size();
}
bool is_in(const cv::Vec3b &cur_color, const std::vector<cv::Vec3b> &uniqueImage)
{
for (auto &color : uniqueImage)
if (cur_color[0] == color[0] && cur_color[1] == color[1] && cur_color[2] == color[2]) return true;
return false;
}
bool repeat_center(int cur_cluster, const cv::Mat &centers32FC3, int color_space)
{
cv::Mat centers8UC3 = cv::Mat(cur_cluster, 1, CV_8UC3);
for (int i = 0; i < cur_cluster; i++) {
auto center = centers32FC3.row(i);
centers8UC3.at<cv::Vec3b>(i) = {uchar(center.at<float>(0)), uchar(center.at<float>(1)), uchar(center.at<float>(2))};
}
convert_color_space(centers8UC3, centers8UC3, color_space, true);
std::vector<cv::Vec3b> unique_centers;
cv::Vec3b cur_center;
for (int i = 0; i < cur_cluster; i++) {
cur_center = centers8UC3.at<cv::Vec3b>(i, 0);
if (!is_in(cur_center, unique_centers))
unique_centers.emplace_back(cur_center);
else
return true;
}
return false;
}
void replace_centers(cv::Mat &ori_image, cv::Mat &new_image)
{
for (int i = 0; i < ori_image.rows; i++) {
@ -126,7 +197,7 @@ public:
}
}
void convert_color_space(cv::Mat &ori_image, cv::Mat &image, int color_space, bool reverse = false)
void convert_color_space(const cv::Mat &ori_image, cv::Mat &image, int color_space, bool reverse = false)
{
switch (color_space) {
case 0: image = ori_image; break;

View file

@ -1684,6 +1684,7 @@ void PresetBundle::load_selections(AppConfig &config, const PresetPreferences& p
// If executed due to a Config Wizard update, preferred_printer contains the first newly installed printer, otherwise nullptr.
const Preset *preferred_printer = printers.find_system_preset_by_model_and_variant(preferred_selection.printer_model_id, preferred_selection.printer_variant);
printers.select_preset_by_name(preferred_printer ? preferred_printer->name : initial_printer_profile_name, true);
CNumericLocalesSetter locales_setter;
// Orca: load from orca_presets
// const auto os_presets = config.get_machine_settings(initial_printer_profile_name);

View file

@ -2920,14 +2920,14 @@ PrintRegionConfig region_config_from_model_volume(const PrintRegionConfig &defau
} else {
// default_or_parent_region_config contains parent PrintRegion config, which already contains ModelVolume's config.
}
apply_to_print_region_config(config, volume.config.get());
if (! volume.material_id().empty())
apply_to_print_region_config(config, volume.material()->config.get());
if (layer_range_config != nullptr) {
// Not applicable to modifiers.
assert(volume.is_model_part());
apply_to_print_region_config(config, *layer_range_config);
}
apply_to_print_region_config(config, volume.config.get());
if (! volume.material_id().empty())
apply_to_print_region_config(config, volume.material()->config.get());
// Clamp invalid extruders to the default extruder (with index 1).
clamp_exturder_to_default(config.sparse_infill_filament, num_extruders);
clamp_exturder_to_default(config.wall_filament, num_extruders);

View file

@ -215,7 +215,9 @@ static inline bool overlap_in_xy(const PrintObjectRegions::BoundingBox &l, const
static std::vector<PrintObjectRegions::LayerRangeRegions>::const_iterator layer_range_first(const std::vector<PrintObjectRegions::LayerRangeRegions> &layer_ranges, double z)
{
auto it = lower_bound_by_predicate(layer_ranges.begin(), layer_ranges.end(),
[z](const PrintObjectRegions::LayerRangeRegions &lr) { return lr.layer_height_range.second < z; });
[z](const PrintObjectRegions::LayerRangeRegions &lr) {
return lr.layer_height_range.second < z && abs(lr.layer_height_range.second - z) > EPSILON;
});
assert(it != layer_ranges.end() && it->layer_height_range.first <= z && z <= it->layer_height_range.second);
if (z == it->layer_height_range.second)
if (auto it_next = it; ++ it_next != layer_ranges.end() && it_next->layer_height_range.first == z)
@ -229,7 +231,7 @@ static std::vector<PrintObjectRegions::LayerRangeRegions>::const_iterator layer_
std::vector<PrintObjectRegions::LayerRangeRegions>::const_iterator it,
double z)
{
for (; it->layer_height_range.second <= z; ++ it)
for (; it->layer_height_range.second <= z + EPSILON; ++ it)
assert(it != layer_ranges.end());
assert(it != layer_ranges.end() && it->layer_height_range.first <= z && z < it->layer_height_range.second);
return it;

View file

@ -2987,6 +2987,14 @@ extern "C" {
#include <sys/stat.h>
#if defined(_MSC_VER) || defined(__MINGW64__)
#ifdef WIN32
static FILE *mz_wfopen(const wchar_t *pFilename, const char *pMode)
{
FILE *pFile = NULL;
_wfopen_s(&pFile, pFilename, pMode);
return pFile;
}
#endif
static FILE *mz_fopen(const char *pFilename, const char *pMode)
{
FILE *pFile = NULL;
@ -3004,6 +3012,9 @@ static FILE *mz_freopen(const char *pPath, const char *pMode, FILE *pStream)
#include <sys/utime.h>
#endif
#define MZ_FOPEN mz_fopen
#ifdef WIN32
#define MZ_WFOPEN mz_wfopen
#endif
#define MZ_FCLOSE fclose
#define MZ_FREAD fread
#define MZ_FWRITE fwrite
@ -5117,9 +5128,9 @@ mz_bool mz_zip_reader_extract_to_file(mz_zip_archive *pZip, mz_uint file_index,
return mz_zip_set_error(pZip, MZ_ZIP_UNSUPPORTED_FEATURE);
pFile = MZ_FOPEN(pDst_filename, "wb");
if (!pFile)
if (!pFile) {
return mz_zip_set_error(pZip, MZ_ZIP_FILE_OPEN_FAILED);
}
status = mz_zip_reader_extract_to_callback(pZip, file_index, mz_zip_file_write_callback, pFile, flags);
if (MZ_FCLOSE(pFile) == EOF)
@ -5137,6 +5148,39 @@ mz_bool mz_zip_reader_extract_to_file(mz_zip_archive *pZip, mz_uint file_index,
return status;
}
#ifdef WIN32
mz_bool mz_zip_reader_extract_to_file_w(mz_zip_archive *pZip, mz_uint file_index, const wchar_t *pDst_filename, mz_uint flags)
{
mz_bool status;
mz_zip_archive_file_stat file_stat;
MZ_FILE * pFile;
if (!mz_zip_reader_file_stat(pZip, file_index, &file_stat))
return MZ_FALSE;
if ((file_stat.m_is_directory) || (!file_stat.m_is_supported))
return mz_zip_set_error(pZip, MZ_ZIP_UNSUPPORTED_FEATURE);
pFile = MZ_WFOPEN(pDst_filename, "w");
if (!pFile) {
return mz_zip_set_error(pZip, MZ_ZIP_FILE_OPEN_FAILED);
}
status = mz_zip_reader_extract_to_callback(pZip, file_index, mz_zip_file_write_callback, pFile, flags);
if (MZ_FCLOSE(pFile) == EOF) {
if (status)
mz_zip_set_error(pZip, MZ_ZIP_FILE_CLOSE_FAILED);
status = MZ_FALSE;
}
#if !defined(MINIZ_NO_TIME) && !defined(MINIZ_NO_STDIO)
if (status)
mz_zip_set_file_times(pDst_filename, file_stat.m_time, file_stat.m_time);
#endif
return status;
}
#endif
mz_bool mz_zip_reader_extract_file_to_file(mz_zip_archive *pZip, const char *pArchive_filename, const char *pDst_filename, mz_uint flags)
{

View file

@ -1211,6 +1211,9 @@ mz_bool mz_zip_reader_extract_iter_free(mz_zip_reader_extract_iter_state* pState
/* Extracts a archive file to a disk file and sets its last accessed and modified times. */
/* This function only extracts files, not archive directory records. */
mz_bool mz_zip_reader_extract_to_file(mz_zip_archive *pZip, mz_uint file_index, const char *pDst_filename, mz_uint flags);
#ifdef WIN32
mz_bool mz_zip_reader_extract_to_file_w(mz_zip_archive *pZip, mz_uint file_index, const wchar_t *pDst_filename, mz_uint flags);
#endif
mz_bool mz_zip_reader_extract_file_to_file(mz_zip_archive *pZip, const char *pArchive_filename, const char *pDst_filename, mz_uint flags);
/* Extracts a archive file starting at the current position in the destination FILE stream. */

View file

@ -800,7 +800,7 @@ void AMSMaterialsSetting::Popup(wxString filament, wxString sn, wxString temp_mi
int selection_idx = -1, idx = 0;
wxArrayString filament_items;
wxString bambu_filament_name;
std::set<std::string> filament_id_set;
PresetBundle * preset_bundle = wxGetApp().preset_bundle;
@ -854,6 +854,8 @@ void AMSMaterialsSetting::Popup(wxString filament, wxString sn, wxString temp_mi
if (filament_it->filament_id == ams_filament_id) {
selection_idx = idx;
bambu_filament_name = filament_it->alias;
// update if nozzle_temperature_range is found
ConfigOption *opt_min = filament_it->config.option("nozzle_temperature_range_low");
@ -893,7 +895,13 @@ void AMSMaterialsSetting::Popup(wxString filament, wxString sn, wxString temp_mi
if (!m_is_third) {
m_comboBox_filament->Hide();
m_readonly_filament->Show();
if (bambu_filament_name.empty()) {
m_readonly_filament->SetLabel("Bambu " + filament);
}
else {
m_readonly_filament->SetLabel(bambu_filament_name);
}
m_input_nozzle_min->GetTextCtrl()->SetValue(temp_min);
m_input_nozzle_max->GetTextCtrl()->SetValue(temp_max);
}

View file

@ -16,10 +16,12 @@ void CalibrationStartPage::create_when(wxWindow* parent, wxString title, wxStrin
m_when_title = new Label(this, title);
m_when_title->SetFont(Label::Head_14);
m_when_title->Wrap(CALIBRATION_START_PAGE_TEXT_MAX_LENGTH);
m_when_title->SetMinSize({CALIBRATION_START_PAGE_TEXT_MAX_LENGTH, -1});
m_when_content = new Label(this, content);;
m_when_content->SetFont(Label::Body_14);
m_when_content->Wrap(CALIBRATION_START_PAGE_TEXT_MAX_LENGTH);
m_when_content->SetMinSize({CALIBRATION_START_PAGE_TEXT_MAX_LENGTH, -1});
}
void CalibrationStartPage::create_about(wxWindow* parent, wxString title, wxString content)
@ -27,10 +29,12 @@ void CalibrationStartPage::create_about(wxWindow* parent, wxString title, wxStri
m_about_title = new Label(this, title);
m_about_title->SetFont(Label::Head_14);
m_about_title->Wrap(CALIBRATION_START_PAGE_TEXT_MAX_LENGTH);
m_about_title->SetMinSize({CALIBRATION_START_PAGE_TEXT_MAX_LENGTH, -1});
m_about_content = new Label(this, content);
m_about_content->SetFont(Label::Body_14);
m_about_content->Wrap(CALIBRATION_START_PAGE_TEXT_MAX_LENGTH);
m_about_content->SetMinSize({CALIBRATION_START_PAGE_TEXT_MAX_LENGTH, -1});
}
void CalibrationStartPage::create_bitmap(wxWindow* parent, const wxBitmap& before_img, const wxBitmap& after_img)
@ -77,6 +81,7 @@ CalibrationPAStartPage::CalibrationPAStartPage(wxWindow* parent, wxWindowID id,
create_page(this);
this->SetSizer(m_top_sizer);
Layout();
m_top_sizer->Fit(this);
}
@ -124,8 +129,8 @@ void CalibrationPAStartPage::create_page(wxWindow* parent)
#ifdef __linux__
wxGetApp().CallAfter([this]() {
m_when_content->SetMinSize(m_when_content->GetSize() + wxSize{ 0, wxWindow::GetCharHeight() / 2 });
m_about_content->SetMinSize(m_about_content->GetSize() + wxSize{ 0, wxWindow::GetCharHeight() / 2 });
m_when_content->SetMinSize(m_when_content->GetSize() + wxSize{ 0, wxWindow::GetCharHeight() });
m_about_content->SetMinSize(m_about_content->GetSize() + wxSize{ 0, wxWindow::GetCharHeight() });
Layout();
Fit();
});
@ -200,6 +205,7 @@ CalibrationFlowRateStartPage::CalibrationFlowRateStartPage(wxWindow* parent, wxW
create_page(this);
this->SetSizer(m_top_sizer);
Layout();
m_top_sizer->Fit(this);
}
@ -231,6 +237,7 @@ void CalibrationFlowRateStartPage::create_page(wxWindow* parent)
auto extra_text = new Label(parent, _L("In addition, Flow Rate Calibration is crucial for foaming materials like LW-PLA used in RC planes. These materials expand greatly when heated, and calibration provides a useful reference flow rate."));
extra_text->SetFont(Label::Body_14);
extra_text->Wrap(CALIBRATION_START_PAGE_TEXT_MAX_LENGTH);
extra_text->SetMinSize({CALIBRATION_START_PAGE_TEXT_MAX_LENGTH, -1});
m_top_sizer->Add(extra_text);
m_top_sizer->AddSpacer(PRESET_GAP);
@ -245,6 +252,7 @@ void CalibrationFlowRateStartPage::create_page(wxWindow* parent)
auto auto_cali_title = new Label(parent, _L("Auto-Calibration"));
auto_cali_title->SetFont(Label::Head_14);
auto_cali_title->Wrap(CALIBRATION_START_PAGE_TEXT_MAX_LENGTH);
auto_cali_title->SetMinSize({CALIBRATION_START_PAGE_TEXT_MAX_LENGTH, -1});
auto auto_cali_content = new Label(this,
_L("Auto Flow Rate Calibration utilizes Bambu Lab's Micro-Lidar technology, directly measuring the calibration patterns. However, please be advised that the efficacy and accuracy of this method may be compromised with specific types of materials. Particularly, filaments that are transparent or semi-transparent, sparkling-particled, or have a high-reflective finish may not be suitable for this calibration and can produce less-than-desirable results.\
@ -252,6 +260,7 @@ void CalibrationFlowRateStartPage::create_page(wxWindow* parent)
\n\nCaution: Flow Rate Calibration is an advanced process, to be attempted only by those who fully understand its purpose and implications. Incorrect usage can lead to sub-par prints or printer damage. Please make sure to carefully read and understand the process before doing it."));
auto_cali_content->SetFont(Label::Body_14);
auto_cali_content->Wrap(CALIBRATION_START_PAGE_TEXT_MAX_LENGTH);
auto_cali_content->SetMinSize({CALIBRATION_START_PAGE_TEXT_MAX_LENGTH, -1});
m_top_sizer->Add(auto_cali_title);
m_top_sizer->Add(auto_cali_content);
@ -262,9 +271,10 @@ void CalibrationFlowRateStartPage::create_page(wxWindow* parent)
m_top_sizer->Add(m_action_panel, 0, wxEXPAND, 0);
#ifdef __linux__
wxGetApp().CallAfter([this, auto_cali_content]() {
m_when_content->SetMinSize(m_when_content->GetSize() + wxSize{ 0, wxWindow::GetCharHeight() / 2 });
auto_cali_content->SetMinSize(auto_cali_content->GetSize() + wxSize{ 0, wxWindow::GetCharHeight() / 2 });
wxGetApp().CallAfter([this, auto_cali_content, extra_text]() {
m_when_content->SetMinSize(m_when_content->GetSize() + wxSize{ 0, wxWindow::GetCharHeight() });
auto_cali_content->SetMinSize(auto_cali_content->GetSize() + wxSize{ 0, wxWindow::GetCharHeight() });
extra_text->SetMinSize(extra_text->GetSize() + wxSize{ 0, wxWindow::GetCharHeight() });
Layout();
Fit();
});
@ -332,6 +342,7 @@ CalibrationMaxVolumetricSpeedStartPage::CalibrationMaxVolumetricSpeedStartPage(w
create_page(this);
this->SetSizer(m_top_sizer);
Layout();
m_top_sizer->Fit(this);
}

View file

@ -3300,7 +3300,7 @@ void CreatePresetSuccessfulDialog::on_dpi_changed(const wxRect &suggested_rect)
}
ExportConfigsDialog::ExportConfigsDialog(wxWindow *parent)
: DPIDialog(parent ? parent : nullptr, wxID_ANY, _L("Export Configs"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX)
: DPIDialog(parent ? parent : nullptr, wxID_ANY, _L("Export Preset Bundle"), wxDefaultPosition, wxDefaultSize, wxCAPTION | wxCLOSE_BOX)
{
m_exprot_type.preset_bundle = _L("Printer config bundle(.orca_printer)");
m_exprot_type.filament_bundle = _L("Filament bundle(.orca_filament)");

View file

@ -2660,8 +2660,6 @@ static ENUM enum_index_of(char const *key, char const **enum_names, int enum_cou
int MachineObject::parse_json(std::string payload, bool key_field_only)
{
CNumericLocalesSetter locales_setter;
parse_msg_count++;
std::chrono::system_clock::time_point clock_start = std::chrono::system_clock::now();
this->set_online_state(true);
@ -2676,6 +2674,7 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
bool restored_json = false;
json j;
json j_pre = json::parse(payload);
CNumericLocalesSetter locales_setter;
if (j_pre.empty()) {
return 0;
}
@ -3511,6 +3510,9 @@ int MachineObject::parse_json(std::string payload, bool key_field_only)
}
}
}
else {
nozzle_type = "";
}
}
catch (...) {
;

View file

@ -2137,6 +2137,13 @@ void GLCanvas3D::deselect_all()
post_event(SimpleEvent(EVT_GLCANVAS_OBJECT_SELECT));
}
void GLCanvas3D::exit_gizmo() {
if (m_gizmos.get_current_type() != GLGizmosManager::Undefined) {
m_gizmos.reset_all_states();
m_gizmos.update_data();
}
}
void GLCanvas3D::set_selected_visible(bool visible)
{
for (unsigned int i : m_selection.get_volume_idxs()) {
@ -7726,24 +7733,26 @@ void GLCanvas3D::_render_imgui_select_plate_toolbar()
m_sel_plate_toolbar.m_items[i]->slice_state = IMToolbarItem::SliceState::SLICED;
else
m_sel_plate_toolbar.m_items[i]->slice_state = IMToolbarItem::SliceState::SLICE_FAILED;
continue;
}
else {
if (!plate_list.get_plate(i)->can_slice())
m_sel_plate_toolbar.m_items[i]->slice_state = IMToolbarItem::SliceState::SLICE_FAILED;
else {
if (plate_list.get_plate(i)->get_slicing_percent() < 0.0f)
m_sel_plate_toolbar.m_items[i]->slice_state = IMToolbarItem::SliceState::UNSLICED;
else
m_sel_plate_toolbar.m_items[i]->slice_state = IMToolbarItem::SliceState::SLICING;
}
}
}
}
if (m_sel_plate_toolbar.show_stats_item) {
all_plates_stats_item->percent = 0.0f;
size_t sliced_plates_cnt = 0;
bool slice_failed = false;
for (auto plate : plate_list.get_nonempty_plate_list()) {
if (plate->is_slice_result_valid() && plate->is_slice_result_ready_for_print())
sliced_plates_cnt++;
if (plate->is_slice_result_valid() && !plate->is_slice_result_ready_for_print())
slice_failed = true;
}
all_plates_stats_item->percent = (float)(sliced_plates_cnt) / (float)(plate_list.get_nonempty_plate_list().size()) * 100.0f;
@ -7754,8 +7763,13 @@ void GLCanvas3D::_render_imgui_select_plate_toolbar()
else if (all_plates_stats_item->percent < 100.0f)
all_plates_stats_item->slice_state = IMToolbarItem::SliceState::SLICING;
if (slice_failed)
for (auto toolbar_item : m_sel_plate_toolbar.m_items) {
if(toolbar_item->slice_state == IMToolbarItem::SliceState::SLICE_FAILED) {
all_plates_stats_item->slice_state = IMToolbarItem::SliceState::SLICE_FAILED;
all_plates_stats_item->selected = false;
break;
}
}
// Changing parameters does not invalid all plates, need extra logic to validate
bool gcode_result_valid = true;

View file

@ -905,6 +905,7 @@ public:
void select_all();
void deselect_all();
void exit_gizmo();
void set_selected_visible(bool visible);
void delete_selected();
void ensure_on_bed(unsigned int object_idx, bool allow_negative_z);

View file

@ -1421,14 +1421,18 @@ int GUI_App::install_plugin(std::string name, std::string package_name, InstallP
mz_bool res = mz_zip_reader_extract_to_file(&archive, stat.m_file_index, dest_zip_file.c_str(), 0);
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", extract %1% from plugin zip %2%\n") % dest_file % stat.m_filename;
if (res == 0) {
#ifdef WIN32
std::wstring new_dest_zip_file = boost::locale::conv::utf_to_utf<wchar_t>(dest_path.generic_string());
res = mz_zip_reader_extract_to_file_w(&archive, stat.m_file_index, new_dest_zip_file.c_str(), 0);
#endif
if (res == 0) {
mz_zip_error zip_error = mz_zip_get_last_error(&archive);
BOOST_LOG_TRIVIAL(error) << "[install_plugin]Archive read error:" << mz_zip_get_error_string(zip_error) << std::endl;
close_zip_reader(&archive);
if (pro_fn) {
pro_fn(InstallStatusUnzipFailed, 0, cancel);
}
if (pro_fn) { pro_fn(InstallStatusUnzipFailed, 0, cancel); }
return InstallStatusUnzipFailed;
}
}
else {
if (pro_fn) {
pro_fn(InstallStatusNormal, 50 + i/num_entries, cancel);

View file

@ -154,6 +154,12 @@ void View3D::deselect_all()
m_canvas->deselect_all();
}
void View3D::exit_gizmo()
{
if (m_canvas != nullptr)
m_canvas->exit_gizmo();
}
void View3D::delete_selected()
{
if (m_canvas != nullptr)

View file

@ -63,6 +63,7 @@ public:
void select_all();
void deselect_all();
void exit_gizmo();
void delete_selected();
void center_selected();
void center_selected_plate(const int plate_idx);

View file

@ -1550,7 +1550,8 @@ wxBoxSizer* MainFrame::create_side_tools()
m_slice_btn->Bind(wxEVT_BUTTON, [this](wxCommandEvent& event)
{
//this->m_plater->select_view_3D("Preview");
m_plater->update(false, true);
m_plater->exit_gizmo();
m_plater->update(true, true);
if (m_slice_select == eSliceAll)
wxPostEvent(m_plater, SimpleEvent(EVT_GLTOOLBAR_SLICE_ALL));
else
@ -2344,7 +2345,7 @@ void MainFrame::init_menubar_as_editor()
[this](wxCommandEvent&) { if (m_plater) m_plater->export_gcode(false); }, "menu_export_gcode", nullptr,
[this]() {return can_export_gcode(); }, this);
append_menu_item(
export_menu, wxID_ANY, _L("Export &Configs") + dots /* + "\tCtrl+E"*/, _L("Export current configuration to files"),
export_menu, wxID_ANY, _L("Export Preset Bundle") + dots /* + "\tCtrl+E"*/, _L("Export current configuration to files"),
[this](wxCommandEvent &) { export_config(); },
"menu_export_config", nullptr,
[]() { return true; }, this);

View file

@ -578,11 +578,11 @@ void MediaPlayCtrl::onStateChanged(wxMediaEvent &event)
m_failed_code = m_media_ctrl->GetLastError();
if (size.GetWidth() >= 320) {
m_last_state = state;
m_failed_code = 0;
SetStatus(_L("Playing..."), false);
m_failed_retry = 0;
m_failed_code = 0;
m_disable_lan = false;
boost::unique_lock lock(m_mutex);
m_tasks.push_back("<play>");

View file

@ -721,5 +721,47 @@ void MultiMachineManagerPage::page_num_enter_evt()
update_page_number();
}
void MultiMachineManagerPage::msw_rescale()
{
m_printer_name->Rescale();
m_printer_name->SetMinSize(wxSize(FromDIP(DEVICE_LEFT_DEV_NAME), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_printer_name->SetMaxSize(wxSize(FromDIP(DEVICE_LEFT_DEV_NAME), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_task_name->Rescale();
m_task_name->SetMinSize(wxSize(FromDIP(DEVICE_LEFT_DEV_NAME), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_task_name->SetMaxSize(wxSize(FromDIP(DEVICE_LEFT_DEV_NAME), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_status->Rescale();
m_status->SetMinSize(wxSize(FromDIP(DEVICE_LEFT_PRO_INFO), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_status->SetMaxSize(wxSize(FromDIP(DEVICE_LEFT_PRO_INFO), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_action->Rescale();
m_action->SetMinSize(wxSize(FromDIP(DEVICE_LEFT_PRO_NAME), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_action->SetMaxSize(wxSize(FromDIP(DEVICE_LEFT_PRO_NAME), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_button_add->Rescale();
m_button_add->SetMinSize(wxSize(FromDIP(90), FromDIP(36)));
m_button_add->SetMaxSize(wxSize(FromDIP(90), FromDIP(36)));
btn_last_page->Rescale();
btn_last_page->SetMinSize(wxSize(FromDIP(20), FromDIP(20)));
btn_last_page->SetMaxSize(wxSize(FromDIP(20), FromDIP(20)));
btn_next_page->Rescale();
btn_next_page->SetMinSize(wxSize(FromDIP(20), FromDIP(20)));
btn_next_page->SetMaxSize(wxSize(FromDIP(20), FromDIP(20)));
m_page_num_enter->Rescale();
m_page_num_enter->SetMinSize(wxSize(FromDIP(25), FromDIP(25)));
m_page_num_enter->SetMaxSize(wxSize(FromDIP(25), FromDIP(25)));
m_button_edit->Rescale();
m_button_edit->SetMinSize(wxSize(FromDIP(90), FromDIP(36)));
m_button_edit->SetMaxSize(wxSize(FromDIP(90), FromDIP(36)));
for (const auto& item : m_device_items) {
item->Refresh();
}
Fit();
Layout();
Refresh();
}
} // namespace GUI
} // namespace Slic3r

View file

@ -60,6 +60,8 @@ public:
void page_num_enter_evt();
void msw_rescale();
private:
std::vector<ObjState> m_state_objs;
std::vector<MultiMachineItem*> m_device_items;

View file

@ -40,6 +40,17 @@ void MultiMachinePage::on_sys_color_changed()
void MultiMachinePage::msw_rescale()
{
m_tabpanel->Rescale();
if (m_local_task_manager)
m_local_task_manager->msw_rescale();
if (m_cloud_task_manager)
m_cloud_task_manager->msw_rescale();
if (m_machine_manager)
m_machine_manager->msw_rescale();
this->Fit();
this->Layout();
this->Refresh();
}
bool MultiMachinePage::Show(bool show)

View file

@ -776,7 +776,7 @@ void LocalTaskManagerPage::refresh_user_device(bool clear)
MultiTaskItem* mtitem = new MultiTaskItem(m_task_list, nullptr, 0);
mtitem->task_obj = task_state_info;
mtitem->m_project_name = wxString::FromUTF8(task_state_info->get_task_name());
mtitem->m_dev_name = task_state_info->get_device_name();
mtitem->m_dev_name = wxString::FromUTF8(task_state_info->get_device_name());
mtitem->m_dev_id = task_state_info->params().dev_id;
mtitem->m_send_time = task_state_info->get_sent_time();
mtitem->state_local_task = task_state_info->state();
@ -855,6 +855,41 @@ void LocalTaskManagerPage::cancel_all(wxCommandEvent& evt)
}
}
void LocalTaskManagerPage::msw_rescale()
{
m_select_checkbox->Rescale();
m_select_checkbox->SetMinSize(wxSize(FromDIP(TASK_LEFT_PRINTABLE), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_select_checkbox->SetMaxSize(wxSize(FromDIP(TASK_LEFT_PRINTABLE), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_task_name->Rescale();
m_task_name->SetMinSize(wxSize(FromDIP(TASK_LEFT_PRO_NAME), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_task_name->SetMaxSize(wxSize(FromDIP(TASK_LEFT_PRO_NAME), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_printer_name->Rescale();
m_printer_name->SetMinSize(wxSize(FromDIP(TASK_LEFT_DEV_NAME), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_printer_name->SetMaxSize(wxSize(FromDIP(TASK_LEFT_DEV_NAME), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_status->Rescale();
m_status->SetMinSize(wxSize(FromDIP(TASK_LEFT_PRO_STATE), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_status->SetMaxSize(wxSize(FromDIP(TASK_LEFT_PRO_STATE), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_info->Rescale();
m_info->SetMinSize(wxSize(FromDIP(TASK_LEFT_PRO_INFO), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_info->SetMaxSize(wxSize(FromDIP(TASK_LEFT_PRO_INFO), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_send_time->Rescale();
m_send_time->SetMinSize(wxSize(FromDIP(TASK_LEFT_SEND_TIME), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_send_time->SetMaxSize(wxSize(FromDIP(TASK_LEFT_SEND_TIME), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_action->Rescale();
m_action->SetMinSize(wxSize(FromDIP(TASK_LEFT_PRO_INFO), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_action->SetMaxSize(wxSize(FromDIP(TASK_LEFT_PRO_INFO), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
btn_stop_all->Rescale();
for (auto it = m_task_items.begin(); it != m_task_items.end(); ++it) {
it->second->Refresh();
}
Fit();
Layout();
Refresh();
}
CloudTaskManagerPage::CloudTaskManagerPage(wxWindow* parent)
: wxPanel(parent, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL)
{
@ -1214,7 +1249,7 @@ void CloudTaskManagerPage::refresh_user_device(bool clear)
//mtitem->task_obj = task_state_info;
mtitem->m_job_id = task_state_info.get_job_id();
mtitem->m_project_name = wxString::FromUTF8(task_state_info.get_task_name());
mtitem->m_dev_name = task_state_info.get_device_name();
mtitem->m_dev_name = wxString::FromUTF8(task_state_info.get_device_name());
mtitem->m_dev_id = task_state_info.params().dev_id;
mtitem->m_send_time = utc_time_to_date(task_state_info.start_time);
@ -1432,5 +1467,52 @@ void CloudTaskManagerPage::page_num_enter_evt()
Layout();*/
}
void CloudTaskManagerPage::msw_rescale()
{
btn_last_page->Rescale();
btn_last_page->SetMinSize(wxSize(FromDIP(20), FromDIP(20)));
btn_last_page->SetMaxSize(wxSize(FromDIP(20), FromDIP(20)));
btn_next_page->Rescale();
btn_next_page->SetMinSize(wxSize(FromDIP(20), FromDIP(20)));
btn_next_page->SetMaxSize(wxSize(FromDIP(20), FromDIP(20)));
m_page_num_enter->Rescale();
m_page_num_enter->SetMinSize(wxSize(FromDIP(25), FromDIP(25)));
m_page_num_enter->SetMaxSize(wxSize(FromDIP(25), FromDIP(25)));
m_select_checkbox->Rescale();
m_select_checkbox->SetMinSize(wxSize(FromDIP(TASK_LEFT_PRINTABLE), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_select_checkbox->SetMaxSize(wxSize(FromDIP(TASK_LEFT_PRINTABLE), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_task_name->Rescale();
m_task_name->SetMinSize(wxSize(FromDIP(TASK_LEFT_PRO_NAME), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_task_name->SetMaxSize(wxSize(FromDIP(TASK_LEFT_PRO_NAME), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_printer_name->Rescale();
m_printer_name->SetMinSize(wxSize(FromDIP(TASK_LEFT_DEV_NAME), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_printer_name->SetMaxSize(wxSize(FromDIP(TASK_LEFT_DEV_NAME), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_status->Rescale();
m_status->SetMinSize(wxSize(FromDIP(TASK_LEFT_PRO_STATE), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_status->SetMaxSize(wxSize(FromDIP(TASK_LEFT_PRO_STATE), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_info->Rescale();
m_info->SetMinSize(wxSize(FromDIP(TASK_LEFT_PRO_INFO), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_info->SetMaxSize(wxSize(FromDIP(TASK_LEFT_PRO_INFO), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_send_time->Rescale();
m_send_time->SetMinSize(wxSize(FromDIP(TASK_LEFT_SEND_TIME), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_send_time->SetMaxSize(wxSize(FromDIP(TASK_LEFT_SEND_TIME), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_action->Rescale();
m_action->SetMinSize(wxSize(FromDIP(TASK_LEFT_PRO_INFO), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
m_action->SetMaxSize(wxSize(FromDIP(TASK_LEFT_PRO_INFO), FromDIP(DEVICE_ITEM_MAX_HEIGHT)));
btn_pause_all->Rescale();
btn_continue_all->Rescale();
btn_stop_all->Rescale();
for (auto it = m_task_items.begin(); it != m_task_items.end(); ++it) {
it->second->Refresh();
}
Fit();
Layout();
Refresh();
}
} // namespace GUI
} // namespace Slic3r

View file

@ -85,6 +85,7 @@ public:
void refresh_user_device(bool clear = false);
bool Show(bool show);
void cancel_all(wxCommandEvent& evt);
void msw_rescale();
private:
SortItem m_sort;
@ -143,6 +144,8 @@ public:
void enable_buttons(bool enable);
void page_num_enter_evt();
void msw_rescale();
private:
SortItem m_sort;
bool device_name_big{ true };

View file

@ -2372,6 +2372,7 @@ struct Plater::priv
void select_all();
void deselect_all();
void exit_gizmo();
void remove(size_t obj_idx);
bool delete_object_from_model(size_t obj_idx, bool refresh_immediately = true); //BBS
void delete_all_objects_from_model();
@ -3926,6 +3927,16 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
//always load config
{
// BBS: save the wipe tower pos in file here, will be used later
ConfigOptionFloats* wipe_tower_x_opt = config.opt<ConfigOptionFloats>("wipe_tower_x");
ConfigOptionFloats* wipe_tower_y_opt = config.opt<ConfigOptionFloats>("wipe_tower_y");
std::optional<ConfigOptionFloats>file_wipe_tower_x;
std::optional<ConfigOptionFloats>file_wipe_tower_y;
if (wipe_tower_x_opt)
file_wipe_tower_x = *wipe_tower_x_opt;
if (wipe_tower_y_opt)
file_wipe_tower_y = *wipe_tower_y_opt;
preset_bundle->load_config_model(filename.string(), std::move(config), file_version);
ConfigOption* bed_type_opt = preset_bundle->project_config.option("curr_bed_type");
@ -4001,6 +4012,17 @@ std::vector<size_t> Plater::priv::load_files(const std::vector<fs::path>& input_
// when for extruder colors are used filament colors
q->on_filaments_change(preset_bundle->filament_presets.size());
is_project_file = true;
//BBS: rewrite wipe tower pos stored in 3mf file , the code above should be seriously reconsidered
{
DynamicConfig& proj_cfg = wxGetApp().preset_bundle->project_config;
ConfigOptionFloats* wipe_tower_x = proj_cfg.opt<ConfigOptionFloats>("wipe_tower_x");
ConfigOptionFloats* wipe_tower_y = proj_cfg.opt<ConfigOptionFloats>("wipe_tower_y");
if (file_wipe_tower_x)
*wipe_tower_x = *file_wipe_tower_x;
if (file_wipe_tower_y)
*wipe_tower_y = *file_wipe_tower_y;
}
}
}
if (!silence) wxGetApp().app_config->update_config_dir(path.parent_path().string());
@ -4771,6 +4793,11 @@ void Plater::priv::deselect_all()
view3D->deselect_all();
}
void Plater::priv::exit_gizmo()
{
view3D->exit_gizmo();
}
void Plater::priv::remove(size_t obj_idx)
{
if (view3D->is_layers_editing_enabled())
@ -5970,7 +5997,8 @@ void Plater::priv::reload_from_disk()
for (auto [src, dest] : replace_paths) {
for (auto [obj_idx, vol_idx] : selected_volumes) {
if (boost::algorithm::iequals(model.objects[obj_idx]->volumes[vol_idx]->source.input_file, src.string()))
replace_volume_with_stl(obj_idx, vol_idx, dest, "");
// When an error occurs, either the dest parsing error occurs, or the number of objects in the dest is greater than 1 and cannot be replaced, and cannot be replaced in this loop.
if (!replace_volume_with_stl(obj_idx, vol_idx, dest, "")) break;
}
}
#else
@ -10659,6 +10687,7 @@ void Plater::remove_curr_plate_all() { p->remove_curr_plate_all(); }
void Plater::select_all() { p->select_all(); }
void Plater::deselect_all() { p->deselect_all(); }
void Plater::exit_gizmo() { p->exit_gizmo(); }
void Plater::remove(size_t obj_idx) { p->remove(obj_idx); }
void Plater::reset(bool apply_presets_change) { p->reset(apply_presets_change); }
@ -12003,7 +12032,7 @@ int Plater::start_next_slice()
this->p->view3D->reload_scene(false);
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(": update_background_process returns %1%")%state;
if (p->partplate_list.get_curr_plate()->is_apply_result_invalid()) {
if (!p->partplate_list.get_curr_plate()->can_slice()) {
p->process_completed_with_error = p->partplate_list.get_curr_plate_index();
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(": found invalidated apply in update_background_process.");
return -1;

View file

@ -378,6 +378,7 @@ public:
void select_all();
void deselect_all();
void exit_gizmo();
void remove(size_t obj_idx);
void reset(bool apply_presets_change = false);
void reset_with_confirm();

View file

@ -217,7 +217,7 @@ wxBoxSizer* PrintOptionsDialog::create_settings_group(wxWindow* parent)
// ai monitoring with levels
line_sizer = new wxBoxSizer(wxHORIZONTAL);
m_cb_ai_monitoring = new CheckBox(parent);
text_ai_monitoring = new wxStaticText(parent, wxID_ANY, _L("Enable AI monitoring of printing"));
text_ai_monitoring = new Label(parent, _L("Enable AI monitoring of printing"));
text_ai_monitoring->SetFont(Label::Body_14);
line_sizer->Add(FromDIP(5), 0, 0, 0);
line_sizer->Add(m_cb_ai_monitoring, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
@ -227,7 +227,7 @@ wxBoxSizer* PrintOptionsDialog::create_settings_group(wxWindow* parent)
line_sizer->Add(FromDIP(5), 0, 0, 0);
line_sizer = new wxBoxSizer(wxHORIZONTAL);
text_ai_monitoring_caption = new wxStaticText(parent, wxID_ANY, _L("Sensitivity of pausing is"));
text_ai_monitoring_caption = new Label(parent, _L("Sensitivity of pausing is"));
text_ai_monitoring_caption->SetFont(Label::Body_14);
text_ai_monitoring_caption->SetForegroundColour(STATIC_TEXT_CAPTION_COL);
text_ai_monitoring_caption->Wrap(-1);
@ -255,7 +255,7 @@ wxBoxSizer* PrintOptionsDialog::create_settings_group(wxWindow* parent)
// detection of build plate position
line_sizer = new wxBoxSizer(wxHORIZONTAL);
m_cb_plate_mark = new CheckBox(parent);
text_plate_mark = new wxStaticText(parent, wxID_ANY, _L("Enable detection of build plate position"));
text_plate_mark = new Label(parent, _L("Enable detection of build plate position"));
text_plate_mark->SetFont(Label::Body_14);
line_sizer->Add(FromDIP(5), 0, 0, 0);
line_sizer->Add(m_cb_plate_mark, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
@ -282,7 +282,7 @@ wxBoxSizer* PrintOptionsDialog::create_settings_group(wxWindow* parent)
// detection of first layer
line_sizer = new wxBoxSizer(wxHORIZONTAL);
m_cb_first_layer = new CheckBox(parent);
text_first_layer = new wxStaticText(parent, wxID_ANY, _L("First Layer Inspection"));
text_first_layer = new Label(parent, _L("First Layer Inspection"));
text_first_layer->SetFont(Label::Body_14);
line_sizer->Add(FromDIP(5), 0, 0, 0);
line_sizer->Add(m_cb_first_layer, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
@ -298,7 +298,7 @@ wxBoxSizer* PrintOptionsDialog::create_settings_group(wxWindow* parent)
// auto-recovery from step loss
line_sizer = new wxBoxSizer(wxHORIZONTAL);
m_cb_auto_recovery = new CheckBox(parent);
text_auto_recovery = new wxStaticText(parent, wxID_ANY, _L("Auto-recovery from step loss"));
text_auto_recovery = new Label(parent, _L("Auto-recovery from step loss"));
text_auto_recovery->SetFont(Label::Body_14);
line_sizer->Add(FromDIP(5), 0, 0, 0);
line_sizer->Add(m_cb_auto_recovery, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
@ -315,7 +315,7 @@ wxBoxSizer* PrintOptionsDialog::create_settings_group(wxWindow* parent)
//Allow prompt sound
line_sizer = new wxBoxSizer(wxHORIZONTAL);
m_cb_sup_sound = new CheckBox(parent);
text_sup_sound = new wxStaticText(parent, wxID_ANY, _L("Allow Prompt Sound"));
text_sup_sound = new Label(parent, _L("Allow Prompt Sound"));
text_sup_sound->SetFont(Label::Body_14);
line_sizer->Add(FromDIP(5), 0, 0, 0);
line_sizer->Add(m_cb_sup_sound, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
@ -332,7 +332,7 @@ wxBoxSizer* PrintOptionsDialog::create_settings_group(wxWindow* parent)
//filament tangle detect
line_sizer = new wxBoxSizer(wxHORIZONTAL);
m_cb_filament_tangle = new CheckBox(parent);
text_filament_tangle = new wxStaticText(parent, wxID_ANY, _L("Filament Tangle Detect"));
text_filament_tangle = new Label(parent, _L("Filament Tangle Detect"));
text_filament_tangle->SetFont(Label::Body_14);
line_sizer->Add(FromDIP(5), 0, 0, 0);
line_sizer->Add(m_cb_filament_tangle, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
@ -349,7 +349,7 @@ wxBoxSizer* PrintOptionsDialog::create_settings_group(wxWindow* parent)
//nozzle blob detect
line_sizer = new wxBoxSizer(wxHORIZONTAL);
m_cb_nozzle_blob = new CheckBox(parent);
text_nozzle_blob = new wxStaticText(parent, wxID_ANY, _L("Nozzle Clumping Detection"));
text_nozzle_blob = new Label(parent, _L("Nozzle Clumping Detection"));
text_nozzle_blob->SetFont(Label::Body_14);
line_sizer->Add(FromDIP(5), 0, 0, 0);
line_sizer->Add(m_cb_nozzle_blob, 0, wxALL | wxALIGN_CENTER_VERTICAL, FromDIP(5));
@ -589,10 +589,17 @@ bool PrinterPartsDialog::Show(bool show)
nozzle_diameter_checkbox->Clear();
if (type.empty()) {
nozzle_type_checkbox->SetValue(wxEmptyString);
nozzle_diameter_checkbox->SetValue(wxEmptyString);
nozzle_type_checkbox->Disable();
nozzle_diameter_checkbox->Disable();
return DPIDialog::Show(show);
}
else {
nozzle_type_checkbox->Enable();
nozzle_diameter_checkbox->Enable();
}
last_nozzle_type = type;

View file

@ -50,17 +50,17 @@ protected:
CheckBox* m_cb_sup_sound;
CheckBox* m_cb_filament_tangle;
CheckBox* m_cb_nozzle_blob;
wxStaticText* text_first_layer;
wxStaticText* text_ai_monitoring;
wxStaticText* text_ai_monitoring_caption;
Label* text_first_layer;
Label* text_ai_monitoring;
Label* text_ai_monitoring_caption;
ComboBox* ai_monitoring_level_list;
wxStaticText* text_plate_mark;
wxStaticText* text_plate_mark_caption;
wxStaticText* text_auto_recovery;
wxStaticText* text_sup_sound;
wxStaticText* text_filament_tangle;
wxStaticText* text_nozzle_blob;
wxStaticText* text_nozzle_blob_caption;
Label* text_plate_mark;
Label* text_plate_mark_caption;
Label* text_auto_recovery;
Label* text_sup_sound;
Label* text_filament_tangle;
Label* text_nozzle_blob;
Label* text_nozzle_blob_caption;
StaticLine* line1;
StaticLine* line2;
StaticLine* line3;

View file

@ -46,7 +46,7 @@ static wxBitmap default_thumbnail;
static std::map<int, std::string> error_messages = {
{PrinterFileSystem::ERROR_PIPE, L("Reconnecting the printer, the operation cannot be completed immediately, please try again later.")},
{PrinterFileSystem::ERROR_RES_BUSY, L("Over 4 systems/handy are using remote access, you can close some and try again.")},
{PrinterFileSystem::ERROR_RES_BUSY, L("The device cannot handle more conversations. Please retry later.")},
{PrinterFileSystem::FILE_NO_EXIST, L("File does not exist.")},
{PrinterFileSystem::FILE_CHECK_ERR, L("File checksum error. Please retry.")},
{PrinterFileSystem::FILE_TYPE_ERR, L("Not supported on the current printer version.")},
@ -73,7 +73,7 @@ PrinterFileSystem::PrinterFileSystem()
wxString path = "D:\\work\\pic\\";
for (int i = 0; i < 10; ++i) {
auto name = wxString::Format(L"gcode-%02d.3mf", i + 1);
m_file_list.push_back({name.ToUTF8().data(), "", time.GetTicks(), 26937, i < 5 ? FF_DOWNLOAD : 0, default_thumbnail, i * 34 - 35});
m_file_list.push_back({name.ToUTF8().data(), "", time.GetTicks(), 26937, i < 5 ? FF_DOWNLOAD : 0, default_thumbnail});
std::ifstream ifs((path + name).ToUTF8().data(), std::ios::binary);
if (ifs)
ParseThumbnail(m_file_list.back(), ifs);
@ -84,7 +84,7 @@ PrinterFileSystem::PrinterFileSystem()
for (int i = 0; i < 100; ++i) {
auto name = wxString::Format(L"img-%03d.jpg", i + 1);
wxImage im(path + name);
m_file_list.push_back({name.ToUTF8().data(), "", time.GetTicks(), 26937, i < 20 ? FF_DOWNLOAD : 0, i > 3 ? im : default_thumbnail, i * 10 - 40 - 1});
m_file_list.push_back({name.ToUTF8().data(), "", time.GetTicks(), 26937, i < 20 ? FF_DOWNLOAD : 0, i > 3 ? im : default_thumbnail});
time.Add(wxDateSpan::Days(-1));
}
m_file_list[0].thumbnail = default_thumbnail;
@ -958,13 +958,13 @@ void PrinterFileSystem::FileRemoved(std::pair<FileType, std::string> type, size_
if (file_index.second == size_t(-1))
return;
if (&file_index.first == &m_file_list) {
auto removeFromGroup = [](std::vector<size_t> &group, size_t index, int total) {
auto removeFromGroup = [](std::vector<size_t> &group, size_t index, size_t total) {
for (auto iter = group.begin(); iter != group.end(); ++iter) {
size_t index2 = -1;
if (*iter < index) continue;
if (*iter == index) {
auto iter2 = iter + 1;
if (iter2 == group.end() ? index == total - 1 : *iter2 == index + 1) {
if (index + 1 == (iter2 == group.end() ? total : *iter2)) {
index2 = std::distance(group.begin(), iter);
}
++iter;
@ -978,11 +978,11 @@ void PrinterFileSystem::FileRemoved(std::pair<FileType, std::string> type, size_
};
size_t index2 = removeFromGroup(m_group_month, index, m_file_list.size());
if (index2 < m_group_month.size()) {
int index3 = removeFromGroup(m_group_year, index, m_group_month.size());
int index3 = removeFromGroup(m_group_year, index2, m_group_month.size());
if (index3 < m_group_year.size()) {
m_group_year.erase(m_group_year.begin() + index3);
if (m_group_mode == G_YEAR)
m_group_flags.erase(m_group_flags.begin() + index2);
m_group_flags.erase(m_group_flags.begin() + index3);
}
m_group_month.erase(m_group_month.begin() + index2);
if (m_group_mode == G_MONTH)
@ -1295,7 +1295,7 @@ void PrinterFileSystem::Reconnect(boost::unique_lock<boost::mutex> &l, int resul
}
wxLogMessage("PrinterFileSystem::Reconnect Failed");
m_status = Status::Failed;
SendChangedEvent(EVT_STATUS_CHANGED, m_status, "", url.size() < 2 ? 1 : 0);
SendChangedEvent(EVT_STATUS_CHANGED, m_status, "", url.size() < 2 ? 1 : m_last_error);
m_cond.timed_wait(l, boost::posix_time::seconds(10));
}
m_status = Status::ListSyncing;

View file

@ -322,7 +322,38 @@ void SendMultiMachinePage::prepare(int plate_idx)
void SendMultiMachinePage::on_dpi_changed(const wxRect& suggested_rect)
{
m_select_checkbox->Rescale();
m_printer_name->Rescale();
m_printer_name->SetMinSize(wxSize(FromDIP(SEND_LEFT_DEV_NAME), FromDIP(SEND_ITEM_MAX_HEIGHT)));
m_printer_name->SetMaxSize(wxSize(FromDIP(SEND_LEFT_DEV_NAME), FromDIP(SEND_ITEM_MAX_HEIGHT)));
m_device_status->Rescale();
m_device_status->SetMinSize(wxSize(FromDIP(SEND_LEFT_DEV_STATUS), FromDIP(SEND_ITEM_MAX_HEIGHT)));
m_device_status->SetMaxSize(wxSize(FromDIP(SEND_LEFT_DEV_STATUS), FromDIP(SEND_ITEM_MAX_HEIGHT)));
m_ams->Rescale();
m_ams->SetMinSize(wxSize(FromDIP(TASK_LEFT_SEND_TIME), FromDIP(SEND_ITEM_MAX_HEIGHT)));
m_ams->SetMaxSize(wxSize(FromDIP(TASK_LEFT_SEND_TIME), FromDIP(SEND_ITEM_MAX_HEIGHT)));
m_refresh_button->Rescale();
m_refresh_button->SetMinSize(wxSize(FromDIP(50), FromDIP(SEND_ITEM_MAX_HEIGHT)));
m_refresh_button->SetMaxSize(wxSize(FromDIP(50), FromDIP(SEND_ITEM_MAX_HEIGHT)));
m_rename_button->msw_rescale();
print_time->msw_rescale();
print_weight->msw_rescale();
timeimg->SetBitmap(print_time->bmp());
weightimg->SetBitmap(print_weight->bmp());
m_button_add->Rescale();
m_button_add->SetMinSize(wxSize(FromDIP(90), FromDIP(36)));
m_button_add->SetMaxSize(wxSize(FromDIP(90), FromDIP(36)));
m_button_send->Rescale();
m_button_send->SetMinSize(wxSize(FromDIP(120), FromDIP(40)));
m_button_send->SetMinSize(wxSize(FromDIP(120), FromDIP(40)));
for (auto it = m_device_items.begin(); it != m_device_items.end(); ++it) {
it->second->Refresh();
}
Fit();
Layout();
Refresh();
}
void SendMultiMachinePage::on_sys_color_changed()
@ -654,6 +685,13 @@ void SendMultiMachinePage::on_send(wxCommandEvent& event)
}
}
if (print_params.size() <= 0) {
MessageDialog msg_wingow(nullptr, _L("There is no device available to send printing."), "", wxICON_WARNING | wxOK);
msg_wingow.ShowModal();
return;
}
if (wxGetApp().getTaskManager()) {
TaskSettings settings;
@ -672,6 +710,15 @@ void SendMultiMachinePage::on_send(wxCommandEvent& event)
settings.sending_interval = std::stoi(app_config->get("sending_interval")) * 60;
settings.max_sending_at_same_time = std::stoi(app_config->get("max_send"));
if (settings.max_sending_at_same_time <= 0) {
MessageDialog msg_wingow(nullptr, _L("The number of printers in use simultaneously cannot be equal to 0."), "", wxICON_WARNING | wxOK);
msg_wingow.ShowModal();
return;
}
wxGetApp().getTaskManager()->start_print(print_params, &settings);
}
catch (...)
@ -943,15 +990,18 @@ wxPanel* SendMultiMachinePage::create_page()
m_title_sizer = new wxBoxSizer(wxHORIZONTAL);
m_rename_switch_panel = new wxSimplebook(m_title_panel);
m_rename_switch_panel->SetMinSize(wxSize(FromDIP(240), FromDIP(25)));
m_rename_switch_panel->SetMaxSize(wxSize(FromDIP(240), FromDIP(25)));
m_rename_normal_panel = new wxPanel(m_rename_switch_panel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL);
m_rename_normal_panel->SetBackgroundColour(*wxWHITE);
rename_sizer_v = new wxBoxSizer(wxVERTICAL);
rename_sizer_h = new wxBoxSizer(wxHORIZONTAL);
m_task_name = new wxStaticText(m_rename_normal_panel, wxID_ANY, wxT("MyLabel"), wxDefaultPosition, wxDefaultSize, wxST_ELLIPSIZE_END);
m_task_name = new wxStaticText(m_rename_normal_panel, wxID_ANY, wxT("MyLabel"), wxDefaultPosition, wxDefaultSize, wxST_ELLIPSIZE_END | wxALIGN_CENTRE);
m_task_name->SetFont(::Label::Body_13);
m_task_name->SetMaxSize(wxSize(FromDIP(390), -1));
m_task_name->SetMinSize(wxSize(FromDIP(200), -1));
m_task_name->SetMaxSize(wxSize(FromDIP(200), -1));
m_rename_button = new ScalableButton(m_rename_normal_panel, wxID_ANY, "ams_editable");
m_rename_button->SetBackgroundColour(*wxWHITE);
rename_sizer_h->Add(m_task_name, 0, wxALIGN_CENTER, 0);

View file

@ -144,8 +144,6 @@ private:
wxPanel* m_title_panel{ nullptr };
wxBoxSizer* m_title_sizer{ nullptr };
wxBoxSizer* m_text_sizer{ nullptr };
ScalableBitmap* m_print_time{ nullptr };
wxStaticBitmap* m_time_img{ nullptr };
wxStaticText* m_stext_time{ nullptr };
wxStaticText* m_stext_weight{ nullptr };
wxStaticBitmap* timeimg{ nullptr };

View file

@ -581,9 +581,7 @@ WipingPanel::WipingPanel(wxWindow* parent, const std::vector<float>& matrix, con
auto on_apply_text_modify = [this](wxEvent& e) {
wxString str = m_flush_multiplier_ebox->GetValue();
str.Replace(",", ".");
double multiplier = 1.f;
if (str.ToDouble(&multiplier)) {
float multiplier = wxAtof(str);
if (multiplier < g_min_flush_multiplier || multiplier > g_max_flush_multiplier) {
str = wxString::Format(("%.2f"), multiplier < g_min_flush_multiplier ? g_min_flush_multiplier : g_max_flush_multiplier);
m_flush_multiplier_ebox->SetValue(str);
@ -597,7 +595,6 @@ WipingPanel::WipingPanel(wxWindow* parent, const std::vector<float>& matrix, con
edit_boxes[i][j]->SetValue(to_string(int(m_matrix[m_number_of_extruders * j + i] * multiplier)));
}
}
}
this->update_warning_texts();
e.Skip();
@ -610,9 +607,7 @@ WipingPanel::WipingPanel(wxWindow* parent, const std::vector<float>& matrix, con
param_sizer->Add(flush_multiplier_title, 0, wxALIGN_CENTER | wxALL, 0);
param_sizer->AddSpacer(FromDIP(5));
m_flush_multiplier_ebox = new wxTextCtrl(m_page_advanced, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(FromDIP(50), -1), wxTE_PROCESS_ENTER);
char flush_multi_str[32] = { 0 };
snprintf(flush_multi_str, sizeof(flush_multi_str), "%.2f", flush_multiplier);
m_flush_multiplier_ebox->SetValue(flush_multi_str);
m_flush_multiplier_ebox->SetValue(wxString::Format(("%.2f"), flush_multiplier));
m_flush_multiplier_ebox->SetValidator(wxTextValidator(wxFILTER_NUMERIC));
param_sizer->Add(m_flush_multiplier_ebox, 0, wxALIGN_CENTER | wxALL, 0);
param_sizer->AddStretchSpacer(1);
@ -622,14 +617,11 @@ WipingPanel::WipingPanel(wxWindow* parent, const std::vector<float>& matrix, con
m_flush_multiplier_ebox->Bind(wxEVT_KILL_FOCUS, on_apply_text_modify);
m_flush_multiplier_ebox->Bind(wxEVT_COMMAND_TEXT_UPDATED, [this](wxCommandEvent&) {
wxString str = m_flush_multiplier_ebox->GetValue();
str.Replace(",", ".");
double multiplier = 1.f;
if (str.ToDouble(&multiplier)) {
float multiplier = wxAtof(str);
if (multiplier < g_min_flush_multiplier || multiplier > g_max_flush_multiplier) {
str = wxString::Format(("%.2f"), multiplier < g_min_flush_multiplier ? g_min_flush_multiplier : g_max_flush_multiplier);
m_flush_multiplier_ebox->SetValue(str);
}
}
m_flush_multiplier_ebox->SetInsertionPointEnd();
});
}

View file

@ -61,12 +61,7 @@ public:
if (m_flush_multiplier_ebox == nullptr)
return 1.f;
wxString str = m_flush_multiplier_ebox->GetValue();
str.Replace(",", ".");
double multiplier = 1.f;
str.ToDouble(&multiplier);
return multiplier;
return wxAtof(m_flush_multiplier_ebox->GetValue());
}
private:

View file

@ -58,6 +58,7 @@ wxMediaCtrl2::wxMediaCtrl2(wxWindow *parent)
void wxMediaCtrl2::Load(wxURI url)
{
#ifdef __WIN32__
InvalidateBestSize();
if (m_imp == nullptr) {
static bool notified = false;
if (!notified) CallAfter([] {

View file

@ -95,7 +95,7 @@ namespace BBL {
#define BAMBU_NETWORK_LIBRARY "bambu_networking"
#define BAMBU_NETWORK_AGENT_NAME "bambu_network_agent"
#define BAMBU_NETWORK_AGENT_VERSION "01.09.01.01"
#define BAMBU_NETWORK_AGENT_VERSION "01.09.01.06"
//iot preset type strings
#define IOT_PRINTER_TYPE_STRING "printer"

View file

@ -17,4 +17,4 @@ set(ORCA_VERSION_MAJOR ${CMAKE_MATCH_1})
set(ORCA_VERSION_MINOR ${CMAKE_MATCH_2})
set(ORCA_VERSION_PATCH ${CMAKE_MATCH_3})
set(SLIC3R_VERSION "01.09.01.58")
set(SLIC3R_VERSION "01.09.01.66")