Revert "Fix Compile Warnings (#5963)"

This reverts commit b83e16dbdd.

Found regressions like auto orientation didn't work anymore after this change, revert it
This commit is contained in:
SoftFever 2024-08-12 00:00:20 +08:00
parent 0286c36f42
commit 7082e945b1
184 changed files with 1091 additions and 461 deletions

View file

@ -358,7 +358,7 @@ void CBaseException::ShowExceptionInformation()
OutputString(_T("Exception Flag :0x%x "), m_pEp->ExceptionRecord->ExceptionFlags); OutputString(_T("Exception Flag :0x%x "), m_pEp->ExceptionRecord->ExceptionFlags);
OutputString(_T("NumberParameters :%ld \n"), m_pEp->ExceptionRecord->NumberParameters); OutputString(_T("NumberParameters :%ld \n"), m_pEp->ExceptionRecord->NumberParameters);
for (unsigned int i = 0; i < m_pEp->ExceptionRecord->NumberParameters; i++) for (int i = 0; i < m_pEp->ExceptionRecord->NumberParameters; i++)
{ {
OutputString(_T("Param %d :0x%x \n"), i, m_pEp->ExceptionRecord->ExceptionInformation[i]); OutputString(_T("Param %d :0x%x \n"), i, m_pEp->ExceptionRecord->ExceptionInformation[i]);
} }

View file

@ -1190,8 +1190,9 @@ int CLI::run(int argc, char **argv)
//BBS: add plate data related logic //BBS: add plate data related logic
PlateDataPtrs plate_data_src; PlateDataPtrs plate_data_src;
std::vector<plate_obj_size_info_t> plate_obj_size_infos; std::vector<plate_obj_size_info_t> plate_obj_size_infos;
int arrange_option;
int plate_to_slice = 0, filament_count = 0, duplicate_count = 0, real_duplicate_count = 0; int plate_to_slice = 0, filament_count = 0, duplicate_count = 0, real_duplicate_count = 0;
bool first_file = true, is_bbl_3mf = false, need_arrange = true, up_config_to_date = false, normative_check = true, duplicate_single_object = false, use_first_fila_as_default = false, minimum_save = false, enable_timelapse = false; bool first_file = true, is_bbl_3mf = false, need_arrange = true, has_thumbnails = false, up_config_to_date = false, normative_check = true, duplicate_single_object = false, use_first_fila_as_default = false, minimum_save = false, enable_timelapse = false;
bool allow_rotations = true, skip_modified_gcodes = false, avoid_extrusion_cali_region = false, skip_useless_pick = false, allow_newer_file = false; bool allow_rotations = true, skip_modified_gcodes = false, avoid_extrusion_cali_region = false, skip_useless_pick = false, allow_newer_file = false;
Semver file_version; Semver file_version;
std::map<size_t, bool> orients_requirement; std::map<size_t, bool> orients_requirement;
@ -1545,7 +1546,7 @@ int CLI::run(int argc, char **argv)
{ {
ModelObject* object = model.objects[obj_index]; ModelObject* object = model.objects[obj_index];
for (int clone_index = 1; clone_index < clone_count; clone_index++) for (unsigned int clone_index = 1; clone_index < clone_count; clone_index++)
{ {
ModelObject* newObj = model.add_object(*object); ModelObject* newObj = model.add_object(*object);
newObj->name = object->name +"_"+ std::to_string(clone_index+1); newObj->name = object->name +"_"+ std::to_string(clone_index+1);
@ -1618,7 +1619,7 @@ int CLI::run(int argc, char **argv)
} }
} }
catch (std::exception& e) { catch (std::exception& e) {
boost::nowide::cerr << "construct_assemble_list: " << e.what() << std::endl; boost::nowide::cerr << construct_assemble_list << ": " << e.what() << std::endl;
record_exit_reson(outfile_dir, CLI_DATA_FILE_ERROR, 0, cli_errors[CLI_DATA_FILE_ERROR], sliced_info); record_exit_reson(outfile_dir, CLI_DATA_FILE_ERROR, 0, cli_errors[CLI_DATA_FILE_ERROR], sliced_info);
flush_and_exit(CLI_DATA_FILE_ERROR); flush_and_exit(CLI_DATA_FILE_ERROR);
} }
@ -2102,7 +2103,7 @@ int CLI::run(int argc, char **argv)
record_exit_reson(outfile_dir, CLI_INVALID_PARAMS, 0, cli_errors[CLI_INVALID_PARAMS], sliced_info); record_exit_reson(outfile_dir, CLI_INVALID_PARAMS, 0, cli_errors[CLI_INVALID_PARAMS], sliced_info);
flush_and_exit(CLI_INVALID_PARAMS); flush_and_exit(CLI_INVALID_PARAMS);
} }
for (int index = 0; index < filament_count; index ++) for (unsigned int index = 0; index < filament_count; index ++)
{ {
std::string file = uptodate_filaments[index]; std::string file = uptodate_filaments[index];
DynamicPrintConfig config; DynamicPrintConfig config;
@ -2219,7 +2220,7 @@ int CLI::run(int argc, char **argv)
} }
//upwards check //upwards check
bool process_compatible = false, /* machine_upwards = false, */ machine_switch = false; bool process_compatible = false, machine_upwards = false, machine_switch = false;
BOOST_LOG_TRIVIAL(info) << boost::format("current printer %1%, new printer %2%, current process %3%, new process %4%")%current_printer_name %new_printer_name %current_process_name %new_process_name; BOOST_LOG_TRIVIAL(info) << boost::format("current printer %1%, new printer %2%, current process %3%, new process %4%")%current_printer_name %new_printer_name %current_process_name %new_process_name;
BOOST_LOG_TRIVIAL(info) << boost::format("current printer inherits %1%, new printer inherits %2%, current process inherits %3%, new process inherits %4%") BOOST_LOG_TRIVIAL(info) << boost::format("current printer inherits %1%, new printer inherits %2%, current process inherits %3%, new process inherits %4%")
%current_printer_system_name %new_printer_system_name %current_process_system_name %new_process_system_name; %current_printer_system_name %new_printer_system_name %current_process_system_name %new_process_system_name;
@ -2289,7 +2290,7 @@ int CLI::run(int argc, char **argv)
for (int index = 0; index < upward_compatible_printers.size(); index++) { for (int index = 0; index < upward_compatible_printers.size(); index++) {
if (upward_compatible_printers[index] == new_printer_system_name) { if (upward_compatible_printers[index] == new_printer_system_name) {
process_compatible = true; process_compatible = true;
// machine_upwards = true; machine_upwards = true;
BOOST_LOG_TRIVIAL(info) << boost::format("new printer is upward_compatible"); BOOST_LOG_TRIVIAL(info) << boost::format("new printer is upward_compatible");
break; break;
} }
@ -2899,8 +2900,7 @@ int CLI::run(int argc, char **argv)
for (auto& model : m_models) for (auto& model : m_models)
for (ModelObject* o : model.objects) for (ModelObject* o : model.objects)
{ {
/* ModelObject* new_object = */ ModelObject* new_object = m.add_object(*o);
m.add_object(*o);
//BOOST_LOG_TRIVIAL(info) << "object "<<o->name <<", id :" << o->id().id << "\n"; //BOOST_LOG_TRIVIAL(info) << "object "<<o->name <<", id :" << o->id().id << "\n";
//orients_requirement.emplace(new_object->id().id, orients_requirement[o->id().id]); //orients_requirement.emplace(new_object->id().id, orients_requirement[o->id().id]);
//orients_requirement.erase(o->id().id); //orients_requirement.erase(o->id().id);
@ -3343,6 +3343,7 @@ int CLI::run(int argc, char **argv)
BOOST_LOG_TRIVIAL(info) << boost::format("downward_check: all failed, size %1%")%downward_check_size; BOOST_LOG_TRIVIAL(info) << boost::format("downward_check: all failed, size %1%")%downward_check_size;
break; break;
} }
Slic3r::GUI::PartPlate* cur_plate = (Slic3r::GUI::PartPlate *)partplate_list.get_plate(index);
Vec3d size = plate_obj_size_infos[index].obj_bbox.size(); Vec3d size = plate_obj_size_infos[index].obj_bbox.size();
for (int index2 = 0; index2 < downward_check_size; index2 ++) for (int index2 = 0; index2 < downward_check_size; index2 ++)
@ -3392,6 +3393,7 @@ int CLI::run(int argc, char **argv)
} }
// Loop through transform options. // Loop through transform options.
bool user_center_specified = false;
Points beds = get_bed_shape(m_print_config); Points beds = get_bed_shape(m_print_config);
ArrangeParams arrange_cfg; ArrangeParams arrange_cfg;
@ -3415,6 +3417,7 @@ int CLI::run(int argc, char **argv)
ModelObject* new_object = m.add_object(); ModelObject* new_object = m.add_object();
new_object->name = _u8L("Assembly"); new_object->name = _u8L("Assembly");
new_object->add_instance(); new_object->add_instance();
int idx = 0;
for (auto& model : m_models) for (auto& model : m_models)
for (ModelObject* o : model.objects) { for (ModelObject* o : model.objects) {
for (auto volume : o->volumes) { for (auto volume : o->volumes) {
@ -3516,6 +3519,7 @@ int CLI::run(int argc, char **argv)
} }
} }
} else if (opt_key == "center") { } else if (opt_key == "center") {
user_center_specified = true;
for (auto &model : m_models) { for (auto &model : m_models) {
model.add_default_instances(); model.add_default_instances();
// this affects instances: // this affects instances:
@ -3815,6 +3819,7 @@ int CLI::run(int argc, char **argv)
{ {
//do arrange for plate //do arrange for plate
ArrangePolygons selected, unselected; ArrangePolygons selected, unselected;
Model& model = m_models[0];
arrange_cfg = ArrangeParams(); // reset all params arrange_cfg = ArrangeParams(); // reset all params
get_print_sequence(cur_plate, m_print_config, arrange_cfg.is_seq_print); get_print_sequence(cur_plate, m_print_config, arrange_cfg.is_seq_print);
@ -3840,6 +3845,7 @@ int CLI::run(int argc, char **argv)
if (!arrange_cfg.is_seq_print && assemble_plate.filaments_count > 1) if (!arrange_cfg.is_seq_print && assemble_plate.filaments_count > 1)
{ {
//prepare the wipe tower //prepare the wipe tower
int plate_count = partplate_list.get_plate_count();
auto printer_structure_opt = m_print_config.option<ConfigOptionEnum<PrinterStructure>>("printer_structure"); auto printer_structure_opt = m_print_config.option<ConfigOptionEnum<PrinterStructure>>("printer_structure");
const float tower_brim_width = m_print_config.option<ConfigOptionFloat>("prime_tower_width", true)->value; const float tower_brim_width = m_print_config.option<ConfigOptionFloat>("prime_tower_width", true)->value;
@ -4225,6 +4231,7 @@ int CLI::run(int argc, char **argv)
//float depth = v * (filaments_cnt - 1) / (layer_height * w); //float depth = v * (filaments_cnt - 1) / (layer_height * w);
Vec3d wipe_tower_size = cur_plate->estimate_wipe_tower_size(m_print_config, w, v, filaments_cnt); Vec3d wipe_tower_size = cur_plate->estimate_wipe_tower_size(m_print_config, w, v, filaments_cnt);
Vec3d plate_origin = cur_plate->get_origin();
int plate_width, plate_depth, plate_height; int plate_width, plate_depth, plate_height;
partplate_list.get_plate_size(plate_width, plate_depth, plate_height); partplate_list.get_plate_size(plate_width, plate_depth, plate_height);
float depth = wipe_tower_size(1); float depth = wipe_tower_size(1);
@ -4603,7 +4610,7 @@ int CLI::run(int argc, char **argv)
} }
// loop through action options // loop through action options
bool export_to_3mf = false, load_slicedata = false, export_slicedata = false; bool export_to_3mf = false, load_slicedata = false, export_slicedata = false, export_slicedata_error = false;
bool no_check = false; bool no_check = false;
std::string export_3mf_file, load_slice_data_dir, export_slice_data_dir, export_stls_dir; std::string export_3mf_file, load_slice_data_dir, export_slice_data_dir, export_stls_dir;
std::vector<ThumbnailData*> calibration_thumbnails; std::vector<ThumbnailData*> calibration_thumbnails;
@ -5092,6 +5099,7 @@ int CLI::run(int argc, char **argv)
int ret = print->export_cached_data(plate_dir, with_space); int ret = print->export_cached_data(plate_dir, with_space);
if (ret) { if (ret) {
BOOST_LOG_TRIVIAL(error) << "plate "<< index+1<< ": export Slicing data error, ret=" << ret; BOOST_LOG_TRIVIAL(error) << "plate "<< index+1<< ": export Slicing data error, ret=" << ret;
export_slicedata_error = true;
if (fs::exists(plate_dir)) if (fs::exists(plate_dir))
fs::remove_all(plate_dir); fs::remove_all(plate_dir);
record_exit_reson(outfile_dir, ret, index+1, cli_errors[ret], sliced_info); record_exit_reson(outfile_dir, ret, index+1, cli_errors[ret], sliced_info);
@ -5218,7 +5226,8 @@ int CLI::run(int argc, char **argv)
bool need_regenerate_top_thumbnail = oriented_or_arranged || regenerate_thumbnails; bool need_regenerate_top_thumbnail = oriented_or_arranged || regenerate_thumbnails;
bool need_create_thumbnail_group = false, need_create_no_light_group = false, need_create_top_group = false; bool need_create_thumbnail_group = false, need_create_no_light_group = false, need_create_top_group = false;
// get color for platedata // get type and color for platedata
auto* filament_types = dynamic_cast<const ConfigOptionStrings*>(m_print_config.option("filament_type"));
const ConfigOptionStrings* filament_color = dynamic_cast<const ConfigOptionStrings *>(m_print_config.option("filament_colour")); const ConfigOptionStrings* filament_color = dynamic_cast<const ConfigOptionStrings *>(m_print_config.option("filament_colour"));
auto* filament_id = dynamic_cast<const ConfigOptionStrings*>(m_print_config.option("filament_ids")); auto* filament_id = dynamic_cast<const ConfigOptionStrings*>(m_print_config.option("filament_ids"));
const ConfigOptionFloats* nozzle_diameter_option = dynamic_cast<const ConfigOptionFloats *>(m_print_config.option("nozzle_diameter")); const ConfigOptionFloats* nozzle_diameter_option = dynamic_cast<const ConfigOptionFloats *>(m_print_config.option("nozzle_diameter"));

View file

@ -216,7 +216,7 @@ private:
// This is a match. Record result in neighbors list. // This is a match. Record result in neighbors list.
match_neighbors(edge, *link->next); match_neighbors(edge, *link->next);
// Delete the matched edge from the list. // Delete the matched edge from the list.
// HashEdge *temp = link->next; HashEdge *temp = link->next;
link->next = link->next->next; link->next = link->next->next;
// pool.destroy(temp); // pool.destroy(temp);
#ifndef NDEBUG #ifndef NDEBUG

View file

@ -193,7 +193,7 @@ void stl_fix_normal_directions(stl_file *stl)
norm_sw[facet_num] = 1; // Record this one as being fixed. norm_sw[facet_num] = 1; // Record this one as being fixed.
++ checked; ++ checked;
} }
// stl_normal *temp = head->next; // Delete this facet from the list. stl_normal *temp = head->next; // Delete this facet from the list.
head->next = head->next->next; head->next = head->next->next;
// pool.destroy(temp); // pool.destroy(temp);
} else { // If we ran out of facets to fix: All of the facets in this part have been fixed. } else { // If we ran out of facets to fix: All of the facets in this part have been fixed.

View file

@ -768,9 +768,11 @@ bool ImGui::BBLButtonEx(const char* label, const ImVec2& size_arg, ImGuiButtonFl
bool hovered, held; bool hovered, held;
bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags); bool pressed = ButtonBehavior(bb, id, &hovered, &held, flags);
bool b_hover = false;
if (hovered) if (hovered)
{ {
PushStyleColor(ImGuiCol_Text,GetColorU32(ImGuiCol_CheckMark)); PushStyleColor(ImGuiCol_Text,GetColorU32(ImGuiCol_CheckMark));
b_hover = true;
} }
// Render // Render
@ -4165,6 +4167,8 @@ bool ImGui::BBLInputScalar(const char *label, ImGuiDataType data_type, void *p_d
const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y * 2.0f)); const ImRect frame_bb(window->DC.CursorPos, window->DC.CursorPos + ImVec2(w, label_size.y + style.FramePadding.y * 2.0f));
// Tabbing or CTRL-clicking on Drag turns it into an InputText // Tabbing or CTRL-clicking on Drag turns it into an InputText
const bool hovered = ItemHoverable(frame_bb, id); const bool hovered = ItemHoverable(frame_bb, id);
// We are only allowed to access the state if we are already the active widget.
ImGuiInputTextState *state = GetInputTextState(id);
bool push_color_count = 0; bool push_color_count = 0;
if (hovered || g.ActiveId == id) { if (hovered || g.ActiveId == id) {
@ -6294,9 +6298,9 @@ bool ImGui::ColorButton(const char* desc_id, const ImVec4& col, ImGuiColorEditFl
RenderFrameBorder(bb.Min, bb.Max, rounding); RenderFrameBorder(bb.Min, bb.Max, rounding);
else else
#ifdef __APPLE__ #ifdef __APPLE__
window->DrawList->AddRect(bb.Min - ImVec2(3, 3), bb.Max + ImVec2(3, 3), GetColorU32(ImGuiCol_FrameBg), rounding * 2,0,4.0f);; // Color button are often in need of some sort of border window->DrawList->AddRect(bb.Min - ImVec2(3, 3), bb.Max + ImVec2(3, 3), GetColorU32(ImGuiCol_FrameBg), rounding * 2,NULL,4.0f);; // Color button are often in need of some sort of border
#else #else
window->DrawList->AddRect(bb.Min - ImVec2(2, 2), bb.Max + ImVec2(2, 2), GetColorU32(ImGuiCol_FrameBg), rounding * 2,0,3.0f); // Color button are often in need of some sort of border window->DrawList->AddRect(bb.Min - ImVec2(2, 2), bb.Max + ImVec2(2, 2), GetColorU32(ImGuiCol_FrameBg), rounding * 2,NULL,3.0f); // Color button are often in need of some sort of border
#endif #endif
} }
@ -7093,6 +7097,7 @@ bool ImGui::BBLImageSelectable(ImTextureID user_texture_id, const ImVec2& size_a
// Text stays at the submission position, but bounding box may be extended on both sides // Text stays at the submission position, but bounding box may be extended on both sides
const float arrow_size = (flags & ImGuiComboFlags_NoArrowButton) ? 0.0f : GetFrameHeight(); const float arrow_size = (flags & ImGuiComboFlags_NoArrowButton) ? 0.0f : GetFrameHeight();
const ImVec2 text_min = ImVec2(pos.x + arrow_size, pos.y);
const ImVec2 text_max(min_x + size.x, pos.y + size.y); const ImVec2 text_max(min_x + size.x, pos.y + size.y);
// Selectables are meant to be tightly packed together with no click-gap, so we extend their box to cover spacing between selectable. // Selectables are meant to be tightly packed together with no click-gap, so we extend their box to cover spacing between selectable.
@ -7204,6 +7209,7 @@ bool ImGui::BBLImageSelectable(ImTextureID user_texture_id, const ImVec2& size_a
if (flags & ImGuiSelectableFlags_Disabled) PushStyleColor(ImGuiCol_Text, style.Colors[ImGuiCol_TextDisabled]); if (flags & ImGuiSelectableFlags_Disabled) PushStyleColor(ImGuiCol_Text, style.Colors[ImGuiCol_TextDisabled]);
// Render // Render
const ImU32 col = GetColorU32((held && hovered) ? ImGuiCol_ButtonActive : hovered ? ImGuiCol_ButtonHovered : ImGuiCol_Button);
ImVec2 p_min = bb.Min + ImVec2(style.ItemInnerSpacing.x, (bb.Max.y - bb.Min.y - font_size.y) / 2); ImVec2 p_min = bb.Min + ImVec2(style.ItemInnerSpacing.x, (bb.Max.y - bb.Min.y - font_size.y) / 2);
ImVec2 p_max = p_min + font_size; ImVec2 p_max = p_min + font_size;
window->DrawList->AddImage(user_texture_id, p_min, p_max, uv0, uv1, selected || (held && hovered) ? GetColorU32(ImVec4(1.f, 1.f, 1.f, 1.f)) : GetColorU32(tint_col)); window->DrawList->AddImage(user_texture_id, p_min, p_max, uv0, uv1, selected || (held && hovered) ? GetColorU32(ImVec4(1.f, 1.f, 1.f, 1.f)) : GetColorU32(tint_col));

View file

@ -2807,6 +2807,7 @@ namespace IMGUIZMO_NAMESPACE
{ {
static bool isDraging = false; static bool isDraging = false;
static bool isClicking = false; static bool isClicking = false;
static bool isInside = false;
static vec_t interpolationUp; static vec_t interpolationUp;
static vec_t interpolationDir; static vec_t interpolationDir;
static int interpolationFrames = 0; static int interpolationFrames = 0;
@ -3054,6 +3055,7 @@ namespace IMGUIZMO_NAMESPACE
LookAt(&newEye.x, &camTarget.x, &newUp.x, view); LookAt(&newEye.x, &camTarget.x, &newUp.x, view);
viewUpdated = true; viewUpdated = true;
} }
isInside = gContext.mbMouseOver && ImRect(position, position + size).Contains(io.MousePos);
if (io.MouseDown[0] && (fabsf(io.MouseDelta[0]) || fabsf(io.MouseDelta[1])) && isClicking) if (io.MouseDown[0] && (fabsf(io.MouseDelta[0]) || fabsf(io.MouseDelta[1])) && isClicking)
{ {

View file

@ -182,6 +182,7 @@ inline TPoint<RawShape> referenceVertex(const RawShape& sh)
template<class RawBox, class RawShape, class Ratio = double> inline NfpResult<RawShape> nfpInnerRectBed(const RawBox &bed, const RawShape &other) template<class RawBox, class RawShape, class Ratio = double> inline NfpResult<RawShape> nfpInnerRectBed(const RawBox &bed, const RawShape &other)
{ {
using Vertex = TPoint<RawShape>; using Vertex = TPoint<RawShape>;
using Edge = _Segment<Vertex>;
namespace sl = shapelike; namespace sl = shapelike;
auto sbox = sl::boundingBox(other); auto sbox = sl::boundingBox(other);

View file

@ -1119,6 +1119,7 @@ private:
for (const Item& item : items_) { for (const Item& item : items_) {
if (!item.is_virt_object) { extruders.insert(item.extrude_ids.begin(), item.extrude_ids.end()); } if (!item.is_virt_object) { extruders.insert(item.extrude_ids.begin(), item.extrude_ids.end()); }
} }
bool need_wipe_tower = extruders.size() > 1;
std::vector<RawShape> objs,excludes; std::vector<RawShape> objs,excludes;
for (const Item &item : items_) { for (const Item &item : items_) {

View file

@ -18,7 +18,9 @@
#include <boost/nowide/cenv.hpp> #include <boost/nowide/cenv.hpp>
#include <boost/nowide/fstream.hpp> #include <boost/nowide/fstream.hpp>
#include <boost/property_tree/ini_parser.hpp> #include <boost/property_tree/ini_parser.hpp>
#include <boost/property_tree/ptree_fwd.hpp>
#include <boost/algorithm/string/predicate.hpp> #include <boost/algorithm/string/predicate.hpp>
#include <boost/format/format_fwd.hpp>
#include <boost/log/trivial.hpp> #include <boost/log/trivial.hpp>
#include <boost/uuid/uuid.hpp> #include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_generators.hpp> #include <boost/uuid/uuid_generators.hpp>

View file

@ -1,6 +1,7 @@
//Copyright (c) 2022 Ultimaker B.V. //Copyright (c) 2022 Ultimaker B.V.
//CuraEngine is released under the terms of the AGPLv3 or higher. //CuraEngine is released under the terms of the AGPLv3 or higher.
#include <cassert>
#include "BeadingStrategy.hpp" #include "BeadingStrategy.hpp"
#include "Point.hpp" #include "Point.hpp"

View file

@ -9,6 +9,7 @@
#include "RedistributeBeadingStrategy.hpp" #include "RedistributeBeadingStrategy.hpp"
#include "OuterWallInsetBeadingStrategy.hpp" #include "OuterWallInsetBeadingStrategy.hpp"
#include <limits>
#include <boost/log/trivial.hpp> #include <boost/log/trivial.hpp>
namespace Slic3r::Arachne namespace Slic3r::Arachne

View file

@ -3,6 +3,7 @@
#include "RedistributeBeadingStrategy.hpp" #include "RedistributeBeadingStrategy.hpp"
#include <algorithm>
#include <numeric> #include <numeric>
namespace Slic3r::Arachne namespace Slic3r::Arachne

View file

@ -1595,6 +1595,7 @@ SkeletalTrapezoidation::edge_t* SkeletalTrapezoidation::getQuadMaxRedgeTo(edge_t
void SkeletalTrapezoidation::propagateBeadingsUpward(std::vector<edge_t*>& upward_quad_mids, ptr_vector_t<BeadingPropagation>& node_beadings) void SkeletalTrapezoidation::propagateBeadingsUpward(std::vector<edge_t*>& upward_quad_mids, ptr_vector_t<BeadingPropagation>& node_beadings)
{ {
const auto _central_filter_dist = central_filter_dist();
for (auto upward_quad_mids_it = upward_quad_mids.rbegin(); upward_quad_mids_it != upward_quad_mids.rend(); ++upward_quad_mids_it) for (auto upward_quad_mids_it = upward_quad_mids.rbegin(); upward_quad_mids_it != upward_quad_mids.rend(); ++upward_quad_mids_it)
{ {
edge_t* upward_edge = *upward_quad_mids_it; edge_t* upward_edge = *upward_quad_mids_it;
@ -1611,7 +1612,7 @@ void SkeletalTrapezoidation::propagateBeadingsUpward(std::vector<edge_t*>& upwar
{ // Only propagate to places where there is place { // Only propagate to places where there is place
continue; continue;
} }
assert((upward_edge->from->data.distance_to_boundary != upward_edge->to->data.distance_to_boundary || shorter_then(upward_edge->to->p - upward_edge->from->p, central_filter_dist())) && "zero difference R edges should always be central"); assert((upward_edge->from->data.distance_to_boundary != upward_edge->to->data.distance_to_boundary || shorter_then(upward_edge->to->p - upward_edge->from->p, _central_filter_dist)) && "zero difference R edges should always be central");
coord_t length = (upward_edge->to->p - upward_edge->from->p).cast<int64_t>().norm(); coord_t length = (upward_edge->to->p - upward_edge->from->p).cast<int64_t>().norm();
BeadingPropagation upper_beading = lower_beading; BeadingPropagation upper_beading = lower_beading;
upper_beading.dist_to_bottom_source += length; upper_beading.dist_to_bottom_source += length;

View file

@ -8,6 +8,9 @@
#include <boost/log/trivial.hpp> #include <boost/log/trivial.hpp>
#include "utils/linearAlg2D.hpp"
#include "../Line.hpp"
namespace Slic3r::Arachne namespace Slic3r::Arachne
{ {

View file

@ -4,6 +4,7 @@
#include <algorithm> #include <algorithm>
#include "ExtrusionLine.hpp" #include "ExtrusionLine.hpp"
#include "linearAlg2D.hpp"
#include "../../VariableWidth.hpp" #include "../../VariableWidth.hpp"
namespace Slic3r::Arachne namespace Slic3r::Arachne

View file

@ -2,6 +2,7 @@
//CuraEngine is released under the terms of the AGPLv3 or higher. //CuraEngine is released under the terms of the AGPLv3 or higher.
#include "SquareGrid.hpp" #include "SquareGrid.hpp"
#include "../../Point.hpp"
using namespace Slic3r::Arachne; using namespace Slic3r::Arachne;

View file

@ -199,19 +199,23 @@ void update_selected_items_axis_align(ArrangePolygons& selected, const DynamicPr
} }
if (std::abs(a00) > EPSILON) { if (std::abs(a00) > EPSILON) {
double db1_2, db1_6, db1_12, db1_24; double db1_2, db1_6, db1_12, db1_24, db1_20, db1_60;
double m00, m10, m01, m20, m11, m02; double m00, m10, m01, m20, m11, m02, m30, m21, m12, m03;
if (a00 > 0) { if (a00 > 0) {
db1_2 = 0.5; db1_2 = 0.5;
db1_6 = 0.16666666666666666666666666666667; db1_6 = 0.16666666666666666666666666666667;
db1_12 = 0.083333333333333333333333333333333; db1_12 = 0.083333333333333333333333333333333;
db1_24 = 0.041666666666666666666666666666667; db1_24 = 0.041666666666666666666666666666667;
db1_20 = 0.05;
db1_60 = 0.016666666666666666666666666666667;
} }
else { else {
db1_2 = -0.5; db1_2 = -0.5;
db1_6 = -0.16666666666666666666666666666667; db1_6 = -0.16666666666666666666666666666667;
db1_12 = -0.083333333333333333333333333333333; db1_12 = -0.083333333333333333333333333333333;
db1_24 = -0.041666666666666666666666666666667; db1_24 = -0.041666666666666666666666666666667;
db1_20 = -0.05;
db1_60 = -0.016666666666666666666666666666667;
} }
m00 = a00 * db1_2; m00 = a00 * db1_2;
m10 = a10 * db1_6; m10 = a10 * db1_6;
@ -219,6 +223,10 @@ void update_selected_items_axis_align(ArrangePolygons& selected, const DynamicPr
m20 = a20 * db1_12; m20 = a20 * db1_12;
m11 = a11 * db1_24; m11 = a11 * db1_24;
m02 = a02 * db1_12; m02 = a02 * db1_12;
m30 = a30 * db1_20;
m21 = a21 * db1_60;
m12 = a12 * db1_60;
m03 = a03 * db1_20;
double cx = m10 / m00; double cx = m10 / m00;
double cy = m01 / m00; double cy = m01 / m00;

View file

@ -1,5 +1,6 @@
#include "BlacklistedLibraryCheck.hpp" #include "BlacklistedLibraryCheck.hpp"
#include <cstdio>
#include <boost/nowide/convert.hpp> #include <boost/nowide/convert.hpp>
#ifdef WIN32 #ifdef WIN32

View file

@ -576,6 +576,7 @@ double getadhesionCoeff(const PrintObject* printObject)
auto& insts = printObject->instances(); auto& insts = printObject->instances();
auto objectVolumes = insts[0].model_instance->get_object()->volumes; auto objectVolumes = insts[0].model_instance->get_object()->volumes;
auto print = printObject->print();
std::vector<size_t> extrudersFirstLayer; std::vector<size_t> extrudersFirstLayer;
auto firstLayerRegions = printObject->layers().front()->regions(); auto firstLayerRegions = printObject->layers().front()->regions();
if (!firstLayerRegions.empty()) { if (!firstLayerRegions.empty()) {
@ -1583,6 +1584,7 @@ static void make_inner_brim(const Print& print, const ConstPrintObjectPtrs& top_
//BBS: generate out brim by offseting ExPolygons 'islands_area_ex' //BBS: generate out brim by offseting ExPolygons 'islands_area_ex'
Polygons tryExPolygonOffset(const ExPolygons islandAreaEx, const Print& print) Polygons tryExPolygonOffset(const ExPolygons islandAreaEx, const Print& print)
{ {
const auto scaled_resolution = scaled<double>(print.config().resolution.value);
Polygons loops; Polygons loops;
ExPolygons islands_ex; ExPolygons islands_ex;
Flow flow = print.brim_flow(); Flow flow = print.brim_flow();
@ -1657,6 +1659,7 @@ void make_brim(const Print& print, PrintTryCancel try_cancel, Polygons& islands_
std::map<ObjectID, ExPolygons> brimAreaMap; std::map<ObjectID, ExPolygons> brimAreaMap;
std::map<ObjectID, ExPolygons> supportBrimAreaMap; std::map<ObjectID, ExPolygons> supportBrimAreaMap;
Flow flow = print.brim_flow(); Flow flow = print.brim_flow();
const auto scaled_resolution = scaled<double>(print.config().resolution.value);
ExPolygons islands_area_ex = outer_inner_brim_area(print, ExPolygons islands_area_ex = outer_inner_brim_area(print,
float(flow.scaled_spacing()), brimAreaMap, supportBrimAreaMap, objPrintVec, printExtruders); float(flow.scaled_spacing()), brimAreaMap, supportBrimAreaMap, objPrintVec, printExtruders);

View file

@ -28,7 +28,7 @@ bool model_to_csgmesh(const ModelObject &mo,
{ {
bool do_positives = parts_to_include & mpartsPositive; bool do_positives = parts_to_include & mpartsPositive;
bool do_negatives = parts_to_include & mpartsNegative; bool do_negatives = parts_to_include & mpartsNegative;
// bool do_drillholes = parts_to_include & mpartsDrillHoles; bool do_drillholes = parts_to_include & mpartsDrillHoles;
bool do_splits = parts_to_include & mpartsDoSplits; bool do_splits = parts_to_include & mpartsDoSplits;
bool has_splitable_volume = false; bool has_splitable_volume = false;

View file

@ -775,9 +775,10 @@ ConfigSubstitutions ConfigBase::load(const std::string &file, ForwardCompatibili
//BBS: add json support //BBS: add json support
ConfigSubstitutions ConfigBase::load_from_json(const std::string &file, ForwardCompatibilitySubstitutionRule compatibility_rule, std::map<std::string, std::string>& key_values, std::string& reason) ConfigSubstitutions ConfigBase::load_from_json(const std::string &file, ForwardCompatibilitySubstitutionRule compatibility_rule, std::map<std::string, std::string>& key_values, std::string& reason)
{ {
int ret = 0;
ConfigSubstitutionContext substitutions_ctxt(compatibility_rule); ConfigSubstitutionContext substitutions_ctxt(compatibility_rule);
load_from_json(file, substitutions_ctxt, true, key_values, reason); ret = load_from_json(file, substitutions_ctxt, true, key_values, reason);
return std::move(substitutions_ctxt.substitutions); return std::move(substitutions_ctxt.substitutions);
} }

View file

@ -2,6 +2,7 @@
#include "ShortestPath.hpp" #include "ShortestPath.hpp"
#include <algorithm> #include <algorithm>
#include <cmath> #include <cmath>
#include <map>
namespace Slic3r { namespace Slic3r {

View file

@ -1,3 +1,6 @@
#include "../ClipperUtils.hpp"
#include "../ExPolygon.hpp"
#include "../Surface.hpp"
#include "../VariableWidth.hpp" #include "../VariableWidth.hpp"
#include "Arachne/WallToolPaths.hpp" #include "Arachne/WallToolPaths.hpp"

View file

@ -1,5 +1,6 @@
#include "../ClipperUtils.hpp" #include "../ClipperUtils.hpp"
#include "../ShortestPath.hpp" #include "../ShortestPath.hpp"
#include "../Surface.hpp"
#include <cmath> #include <cmath>
#include "FillCrossHatch.hpp" #include "FillCrossHatch.hpp"
@ -64,6 +65,7 @@ static Polylines generate_transform_pattern(double inprogress, int direction, co
odd_poly.points.reserve(num_of_cycle * one_cycle.size()); odd_poly.points.reserve(num_of_cycle * one_cycle.size());
// replicate to odd line // replicate to odd line
Point translate = Point(0, 0);
for (size_t i = 0; i < num_of_cycle; i++) { for (size_t i = 0; i < num_of_cycle; i++) {
Polyline odd_points; Polyline odd_points;
odd_points = Polyline(one_cycle); odd_points = Polyline(one_cycle);
@ -150,6 +152,7 @@ static Polylines generate_infill_layers(coordf_t z_height, double repeat_ratio,
coordf_t period = trans_layer_size + repeat_layer_size; coordf_t period = trans_layer_size + repeat_layer_size;
coordf_t remains = z_height - std::floor(z_height / period) * period; coordf_t remains = z_height - std::floor(z_height / period) * period;
coordf_t trans_z = remains - repeat_layer_size; // put repeat layer first. coordf_t trans_z = remains - repeat_layer_size; // put repeat layer first.
coordf_t repeat_z = remains;
int phase = fmod(z_height, period * 2) - (period - 1); // add epsilon int phase = fmod(z_height, period * 2) - (period - 1); // add epsilon
int direction = phase <= 0 ? -1 : 1; int direction = phase <= 0 ? -1 : 1;

View file

@ -4,6 +4,7 @@
#include "Generator.hpp" #include "Generator.hpp"
#include "TreeNode.hpp" #include "TreeNode.hpp"
#include "../../ClipperUtils.hpp"
#include "../../Layer.hpp" #include "../../Layer.hpp"
#include "../../Print.hpp" #include "../../Print.hpp"
@ -34,7 +35,7 @@ static std::string get_svg_filename(std::string layer_nr_or_z, std::string tag
rand_init = true; rand_init = true;
} }
// int rand_num = rand() % 1000000; int rand_num = rand() % 1000000;
//makedir("./SVG"); //makedir("./SVG");
std::string prefix = "./SVG/"; std::string prefix = "./SVG/";
std::string suffix = ".svg"; std::string suffix = ".svg";

View file

@ -1,4 +1,5 @@
#include <cmath> #include <cmath>
#include <assert.h>
#include "slic3r/Utils/ColorSpaceConvert.hpp" #include "slic3r/Utils/ColorSpaceConvert.hpp"
#include "FlushVolCalc.hpp" #include "FlushVolCalc.hpp"

View file

@ -298,6 +298,7 @@ bool PrusaFileParser::check_3mf_from_prusa(const std::string filename)
const std::string model_file = "3D/3dmodel.model"; const std::string model_file = "3D/3dmodel.model";
int model_file_index = mz_zip_reader_locate_file(&archive, model_file.c_str(), nullptr, 0); int model_file_index = mz_zip_reader_locate_file(&archive, model_file.c_str(), nullptr, 0);
if (model_file_index != -1) { if (model_file_index != -1) {
int depth = 0;
m_parser = XML_ParserCreate(nullptr); m_parser = XML_ParserCreate(nullptr);
XML_SetUserData(m_parser, (void *) this); XML_SetUserData(m_parser, (void *) this);
XML_SetElementHandler(m_parser, start_element_handler, nullptr); XML_SetElementHandler(m_parser, start_element_handler, nullptr);

View file

@ -100,6 +100,7 @@ bool load_obj(const char *path, TriangleMesh *meshptr, ObjInfo& obj_info, std::s
obj_info.is_single_mtl = data.usemtls.size() == 1 && mtl_data.new_mtl_unmap.size() == 1; obj_info.is_single_mtl = data.usemtls.size() == 1 && mtl_data.new_mtl_unmap.size() == 1;
obj_info.face_colors.reserve(num_faces + num_quads); obj_info.face_colors.reserve(num_faces + num_quads);
} }
bool has_color = data.has_vertex_color;
for (size_t i = 0; i < num_vertices; ++ i) { for (size_t i = 0; i < num_vertices; ++ i) {
size_t j = i * OBJ_VERTEX_LENGTH; size_t j = i * OBJ_VERTEX_LENGTH;
its.vertices.emplace_back(data.coordinates[j], data.coordinates[j + 1], data.coordinates[j + 2]); its.vertices.emplace_back(data.coordinates[j], data.coordinates[j + 1], data.coordinates[j + 2]);

View file

@ -878,6 +878,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
bool extract_object_model() bool extract_object_model()
{ {
mz_zip_archive archive; mz_zip_archive archive;
mz_zip_archive_file_stat stat;
mz_zip_zero_struct(&archive); mz_zip_zero_struct(&archive);
if (!open_zip_reader(&archive, zip_path)) { if (!open_zip_reader(&archive, zip_path)) {
@ -1616,9 +1617,9 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
} }
else { else {
_extract_xml_from_archive(archive, sub_rels, _handle_start_relationships_element, _handle_end_relationships_element); _extract_xml_from_archive(archive, sub_rels, _handle_start_relationships_element, _handle_end_relationships_element);
int index = 0;
#if 0 #if 0
int index = 0;
for (auto path : m_sub_model_paths) { for (auto path : m_sub_model_paths) {
if (proFn) { if (proFn) {
proFn(IMPORT_STAGE_READ_FILES, ++index, 3 + m_sub_model_paths.size(), cb_cancel); proFn(IMPORT_STAGE_READ_FILES, ++index, 3 + m_sub_model_paths.size(), cb_cancel);
@ -2218,6 +2219,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
bool _BBS_3MF_Importer::_extract_from_archive(mz_zip_archive& archive, std::string const & path, std::function<bool (mz_zip_archive& archive, const mz_zip_archive_file_stat& stat)> extract, bool restore) bool _BBS_3MF_Importer::_extract_from_archive(mz_zip_archive& archive, std::string const & path, std::function<bool (mz_zip_archive& archive, const mz_zip_archive_file_stat& stat)> extract, bool restore)
{ {
mz_uint num_entries = mz_zip_reader_get_num_files(&archive);
mz_zip_archive_file_stat stat; mz_zip_archive_file_stat stat;
std::string path2 = path; std::string path2 = path;
if (path2.front() == '/') path2 = path2.substr(1); if (path2.front() == '/') path2 = path2.substr(1);
@ -3317,9 +3319,9 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
// Adjust backup object/volume id // Adjust backup object/volume id
std::istringstream iss(m_curr_object->uuid); std::istringstream iss(m_curr_object->uuid);
int backup_id; int backup_id;
// bool need_replace = false; bool need_replace = false;
if (iss >> std::hex >> backup_id) { if (iss >> std::hex >> backup_id) {
// need_replace = (m_curr_object->id != backup_id); need_replace = (m_curr_object->id != backup_id);
m_curr_object->id = backup_id; m_curr_object->id = backup_id;
} }
if (!m_curr_object->components.empty()) if (!m_curr_object->components.empty())
@ -4992,9 +4994,9 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
if (is_bbl_3mf && boost::ends_with(current_object->uuid, OBJECT_UUID_SUFFIX) && top_importer->m_load_restore) { if (is_bbl_3mf && boost::ends_with(current_object->uuid, OBJECT_UUID_SUFFIX) && top_importer->m_load_restore) {
std::istringstream iss(current_object->uuid); std::istringstream iss(current_object->uuid);
int backup_id; int backup_id;
// bool need_replace = false; bool need_replace = false;
if (iss >> std::hex >> backup_id) { if (iss >> std::hex >> backup_id) {
// need_replace = (current_object->id != backup_id); need_replace = (current_object->id != backup_id);
current_object->id = backup_id; current_object->id = backup_id;
} }
//if (need_replace) //if (need_replace)
@ -5989,6 +5991,8 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
auto src_gcode_file = plate_data->gcode_file; auto src_gcode_file = plate_data->gcode_file;
boost::filesystem::ifstream ifs(src_gcode_file, std::ios::binary); boost::filesystem::ifstream ifs(src_gcode_file, std::ios::binary);
std::string buf(64 * 1024, 0); std::string buf(64 * 1024, 0);
const std::size_t & size = boost::filesystem::file_size(src_gcode_file);
std::size_t left_size = size;
while (ifs) { while (ifs) {
ifs.read(buf.data(), buf.size()); ifs.read(buf.data(), buf.size());
int read_bytes = ifs.gcount(); int read_bytes = ifs.gcount();
@ -6226,6 +6230,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
bool _BBS_3MF_Exporter::_add_bbox_file_to_archive(mz_zip_archive& archive, const PlateBBoxData& id_bboxes, int index) bool _BBS_3MF_Exporter::_add_bbox_file_to_archive(mz_zip_archive& archive, const PlateBBoxData& id_bboxes, int index)
{ {
bool res = false;
nlohmann::json j; nlohmann::json j;
id_bboxes.to_json(j); id_bboxes.to_json(j);
std::string out = j.dump(); std::string out = j.dump();
@ -6615,6 +6620,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
auto iter = objects_data.find(objects[i]); auto iter = objects_data.find(objects[i]);
ObjectToObjectDataMap objects_data2; ObjectToObjectDataMap objects_data2;
objects_data2.insert(*iter); objects_data2.insert(*iter);
auto & object = *iter->second.object;
mz_zip_archive archive; mz_zip_archive archive;
mz_zip_zero_struct(&archive); mz_zip_zero_struct(&archive);
mz_zip_writer_init_heap(&archive, 0, 1024 * 1024); mz_zip_writer_init_heap(&archive, 0, 1024 * 1024);
@ -7531,7 +7537,7 @@ void PlateData::parse_filament_info(GCodeProcessorResult *result)
if (!m_skip_model && instance_size > 0) if (!m_skip_model && instance_size > 0)
{ {
for (int j = 0; j < instance_size; ++j) for (unsigned int j = 0; j < instance_size; ++j)
{ {
stream << " <" << INSTANCE_TAG << ">\n"; stream << " <" << INSTANCE_TAG << ">\n";
int obj_id = plate_data->objects_and_instances[j].first; int obj_id = plate_data->objects_and_instances[j].first;

View file

@ -113,6 +113,9 @@ double get_profile_area(std::vector<std::pair<gp_Pnt, gp_Pnt>> profile_line_poin
double area = 0; double area = 0;
for (auto line_points : profile_line_points) { for (auto line_points : profile_line_points) {
bool flag = true;
if (line_points.second.Y() < line_points.first.Y()) flag = false;
area += (line_points.second.X() + line_points.first.X() - 2 * min_x) * (line_points.second.Y() - line_points.first.Y()) / 2; area += (line_points.second.X() + line_points.first.X() - 2 * min_x) * (line_points.second.Y() - line_points.first.Y()) / 2;
} }
@ -134,6 +137,8 @@ bool get_svg_profile(const char *path, std::vector<Element_Info> &element_infos,
int name_index = 1; int name_index = 1;
for (NSVGshape *shape = svg_data->shapes; shape; shape = shape->next) { for (NSVGshape *shape = svg_data->shapes; shape; shape = shape->next) {
char * id = shape->id;
int interpolation_precision = 10; // Number of interpolation points int interpolation_precision = 10; // Number of interpolation points
float step = 1.0f / float(interpolation_precision - 1); float step = 1.0f / float(interpolation_precision - 1);
@ -379,6 +384,7 @@ bool load_svg(const char *path, Model *model, std::string &message)
ModelObject *new_object = model->add_object(); ModelObject *new_object = model->add_object();
// new_object->name ? // new_object->name ?
new_object->input_file = path; new_object->input_file = path;
auto stage_unit3 = stl.size() / LOAD_STEP_STAGE_UNIT_NUM + 1;
for (size_t i = 0; i < stl.size(); i++) { for (size_t i = 0; i < stl.size(); i++) {
// BBS: maybe mesh is empty from step file. Don't add // BBS: maybe mesh is empty from step file. Don't add
if (stl[i].stats.number_of_facets > 0) { if (stl[i].stats.number_of_facets > 0) {

View file

@ -116,6 +116,7 @@ static std::vector<Vec2d> get_path_of_change_filament(const Print& print)
if (excluse_area.size() != 4) if (excluse_area.size() != 4)
return out_points; return out_points;
double cutter_area_x = excluse_area[2].x() + 2;
double cutter_area_y = excluse_area[2].y() + 2; double cutter_area_y = excluse_area[2].y() + 2;
double start_x_position = start_point.x(); double start_x_position = start_point.x();
@ -2491,6 +2492,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
m_avoid_crossing_perimeters.use_external_mp_once(); m_avoid_crossing_perimeters.use_external_mp_once();
// BBS. change tool before moving to origin point. // BBS. change tool before moving to origin point.
if (m_writer.need_toolchange(initial_extruder_id)) { if (m_writer.need_toolchange(initial_extruder_id)) {
const PrintObjectConfig& object_config = object.config();
coordf_t initial_layer_print_height = print.config().initial_layer_print_height.value; coordf_t initial_layer_print_height = print.config().initial_layer_print_height.value;
file.write(this->set_extruder(initial_extruder_id, initial_layer_print_height, true)); file.write(this->set_extruder(initial_extruder_id, initial_layer_print_height, true));
prime_extruder = true; prime_extruder = true;
@ -3275,17 +3277,14 @@ namespace ProcessLayer
const PrintConfig &config) const PrintConfig &config)
{ {
std::string gcode; std::string gcode;
// BBS
bool single_filament_print = config.filament_diameter.size() == 1;
if (custom_gcode != nullptr) { if (custom_gcode != nullptr) {
// Extruder switches are processed by LayerTools, they should be filtered out. // Extruder switches are processed by LayerTools, they should be filtered out.
assert(custom_gcode->type != CustomGCode::ToolChange); assert(custom_gcode->type != CustomGCode::ToolChange);
CustomGCode::Type gcode_type = custom_gcode->type; CustomGCode::Type gcode_type = custom_gcode->type;
//BBS: inserting color gcode is removed
#if 0
// BBS
bool single_filament_print = config.filament_diameter.size() == 1;
bool color_change = gcode_type == CustomGCode::ColorChange; bool color_change = gcode_type == CustomGCode::ColorChange;
bool tool_change = gcode_type == CustomGCode::ToolChange; bool tool_change = gcode_type == CustomGCode::ToolChange;
// Tool Change is applied as Color Change for a single extruder printer only. // Tool Change is applied as Color Change for a single extruder printer only.
@ -3297,7 +3296,8 @@ namespace ProcessLayer
m600_extruder_before_layer = custom_gcode->extruder - 1; m600_extruder_before_layer = custom_gcode->extruder - 1;
else if (gcode_type == CustomGCode::PausePrint) else if (gcode_type == CustomGCode::PausePrint)
pause_print_msg = custom_gcode->extra; pause_print_msg = custom_gcode->extra;
//BBS: inserting color gcode is removed
#if 0
// we should add or not colorprint_change in respect to nozzle_diameter count instead of really used extruders count // we should add or not colorprint_change in respect to nozzle_diameter count instead of really used extruders count
if (color_change || tool_change) if (color_change || tool_change)
{ {
@ -3360,8 +3360,8 @@ namespace Skirt {
{ {
// Prime all extruders printing over the 1st layer over the skirt lines. // Prime all extruders printing over the 1st layer over the skirt lines.
size_t n_loops = print.skirt().entities.size(); size_t n_loops = print.skirt().entities.size();
// size_t n_tools = layer_tools.extruders.size(); size_t n_tools = layer_tools.extruders.size();
// size_t lines_per_extruder = (n_loops + n_tools - 1) / n_tools; size_t lines_per_extruder = (n_loops + n_tools - 1) / n_tools;
// BBS. Extrude skirt with first extruder if min_skirt_length is zero // BBS. Extrude skirt with first extruder if min_skirt_length is zero
//ORCA: Always extrude skirt with first extruder, independantly of if the minimum skirt length is zero or not. The code below //ORCA: Always extrude skirt with first extruder, independantly of if the minimum skirt length is zero or not. The code below
@ -3717,8 +3717,7 @@ LayerResult GCode::process_layer(
Skirt::make_skirt_loops_per_extruder_other_layers(print, layer_tools, m_skirt_done); Skirt::make_skirt_loops_per_extruder_other_layers(print, layer_tools, m_skirt_done);
// BBS: get next extruder according to flush and soluble // BBS: get next extruder according to flush and soluble
// Orca: Left unused due to removed code below auto get_next_extruder = [&](int current_extruder,const std::vector<unsigned int>&extruders) {
/* auto get_next_extruder = [&](int current_extruder,const std::vector<unsigned int>&extruders) {
std::vector<float> flush_matrix(cast<float>(m_config.flush_volumes_matrix.values)); std::vector<float> flush_matrix(cast<float>(m_config.flush_volumes_matrix.values));
const unsigned int number_of_extruders = (unsigned int)(sqrt(flush_matrix.size()) + EPSILON); const unsigned int number_of_extruders = (unsigned int)(sqrt(flush_matrix.size()) + EPSILON);
// Extract purging volumes for each extruder pair: // Extract purging volumes for each extruder pair:
@ -3736,7 +3735,7 @@ LayerResult GCode::process_layer(
} }
} }
return next_extruder; return next_extruder;
}; */ };
if (m_config.enable_overhang_speed && !m_config.overhang_speed_classic) { if (m_config.enable_overhang_speed && !m_config.overhang_speed_classic) {
for (const auto &layer_to_print : layers) { for (const auto &layer_to_print : layers) {
@ -4871,8 +4870,8 @@ std::string GCode::extrude_support(const ExtrusionEntityCollection &support_fill
std::string gcode; std::string gcode;
if (! support_fills.entities.empty()) { if (! support_fills.entities.empty()) {
// const double support_speed = m_config.support_speed.value; const double support_speed = m_config.support_speed.value;
// const double support_interface_speed = m_config.get_abs_value("support_interface_speed"); const double support_interface_speed = m_config.get_abs_value("support_interface_speed");
for (const ExtrusionEntity *ee : support_fills.entities) { for (const ExtrusionEntity *ee : support_fills.entities) {
ExtrusionRole role = ee->role(); ExtrusionRole role = ee->role();
assert(role == erSupportMaterial || role == erSupportMaterialInterface || role == erSupportTransition); assert(role == erSupportMaterial || role == erSupportMaterialInterface || role == erSupportTransition);
@ -6041,6 +6040,7 @@ bool GCode::needs_retraction(const Polyline &travel, ExtrusionRole role, LiftTyp
for (int i = 0; i < m_config.z_hop.size(); i++) for (int i = 0; i < m_config.z_hop.size(); i++)
max_z_hop = std::max(max_z_hop, (float)m_config.z_hop.get_at(i)); max_z_hop = std::max(max_z_hop, (float)m_config.z_hop.get_at(i));
float travel_len_thresh = scale_(max_z_hop / tan(this->writer().extruder()->travel_slope())); float travel_len_thresh = scale_(max_z_hop / tan(this->writer().extruder()->travel_slope()));
float accum_len = 0.f;
Polyline clipped_travel; Polyline clipped_travel;
clipped_travel.append(Polyline(travel.points[0], travel.points[1])); clipped_travel.append(Polyline(travel.points[0], travel.points[1]));
@ -6142,6 +6142,7 @@ std::string GCode::retract(bool toolchange, bool is_last_retraction, LiftType li
} }
if (needs_lift && can_lift) { if (needs_lift && can_lift) {
size_t extruder_id = m_writer.extruder()->id();
gcode += m_writer.lift(!m_spiral_vase ? lift_type : LiftType::NormalLift); gcode += m_writer.lift(!m_spiral_vase ? lift_type : LiftType::NormalLift);
} }

View file

@ -28,6 +28,7 @@ inline Grids line_rasterization(const Line &line, int64_t xdist = scale_(1), int
Point rayStart = line.a; Point rayStart = line.a;
Point rayEnd = line.b; Point rayEnd = line.b;
IndexPair currentVoxel = point_map_grid_index(rayStart, xdist, ydist); IndexPair currentVoxel = point_map_grid_index(rayStart, xdist, ydist);
IndexPair firstVoxel = currentVoxel;
IndexPair lastVoxel = point_map_grid_index(rayEnd, xdist, ydist); IndexPair lastVoxel = point_map_grid_index(rayEnd, xdist, ydist);
Point ray = rayEnd - rayStart; Point ray = rayEnd - rayStart;

View file

@ -3451,6 +3451,7 @@ void GCodeProcessor::process_G2_G3(const GCodeReader::GCodeLine& line)
arc_length = ((int)line.p()) * 2 * PI * (start_point - m_arc_center).norm(); arc_length = ((int)line.p()) * 2 * PI * (start_point - m_arc_center).norm();
//BBS: Attention! arc_onterpolation does not support P mode while P is not 1. //BBS: Attention! arc_onterpolation does not support P mode while P is not 1.
arc_interpolation(start_point, end_point, m_arc_center, (m_move_path_type == EMovePathType::Arc_move_ccw)); arc_interpolation(start_point, end_point, m_arc_center, (m_move_path_type == EMovePathType::Arc_move_ccw));
float radian = ArcSegment::calc_arc_radian(start_point, end_point, m_arc_center, (m_move_path_type == EMovePathType::Arc_move_ccw));
Vec3f start_dir = Circle::calc_tangential_vector(start_point, m_arc_center, (m_move_path_type == EMovePathType::Arc_move_ccw)); Vec3f start_dir = Circle::calc_tangential_vector(start_point, m_arc_center, (m_move_path_type == EMovePathType::Arc_move_ccw));
Vec3f end_dir = Circle::calc_tangential_vector(end_point, m_arc_center, (m_move_path_type == EMovePathType::Arc_move_ccw)); Vec3f end_dir = Circle::calc_tangential_vector(end_point, m_arc_center, (m_move_path_type == EMovePathType::Arc_move_ccw));

View file

@ -1,5 +1,6 @@
#include "../ClipperUtils.hpp" #include "../ClipperUtils.hpp"
#include "../Layer.hpp" #include "../Layer.hpp"
#include "../Polyline.hpp"
#include "RetractWhenCrossingPerimeters.hpp" #include "RetractWhenCrossingPerimeters.hpp"

View file

@ -325,6 +325,7 @@ ToolOrdering::ToolOrdering(const Print &print, unsigned int first_extruder, bool
std::vector<unsigned int> ToolOrdering::generate_first_layer_tool_order(const Print& print) std::vector<unsigned int> ToolOrdering::generate_first_layer_tool_order(const Print& print)
{ {
std::vector<unsigned int> tool_order; std::vector<unsigned int> tool_order;
int initial_extruder_id = -1;
std::map<int, double> min_areas_per_extruder; std::map<int, double> min_areas_per_extruder;
for (auto object : print.objects()) { for (auto object : print.objects()) {
@ -353,6 +354,7 @@ std::vector<unsigned int> ToolOrdering::generate_first_layer_tool_order(const Pr
} }
} }
double max_minimal_area = 0.;
for (auto ape : min_areas_per_extruder) { for (auto ape : min_areas_per_extruder) {
auto iter = tool_order.begin(); auto iter = tool_order.begin();
for (; iter != tool_order.end(); iter++) { for (; iter != tool_order.end(); iter++) {
@ -385,6 +387,7 @@ std::vector<unsigned int> ToolOrdering::generate_first_layer_tool_order(const Pr
std::vector<unsigned int> ToolOrdering::generate_first_layer_tool_order(const PrintObject& object) std::vector<unsigned int> ToolOrdering::generate_first_layer_tool_order(const PrintObject& object)
{ {
std::vector<unsigned int> tool_order; std::vector<unsigned int> tool_order;
int initial_extruder_id = -1;
std::map<int, double> min_areas_per_extruder; std::map<int, double> min_areas_per_extruder;
auto first_layer = object.get_layer(0); auto first_layer = object.get_layer(0);
for (auto layerm : first_layer->regions()) { for (auto layerm : first_layer->regions()) {
@ -409,6 +412,7 @@ std::vector<unsigned int> ToolOrdering::generate_first_layer_tool_order(const Pr
} }
} }
double max_minimal_area = 0.;
for (auto ape : min_areas_per_extruder) { for (auto ape : min_areas_per_extruder) {
auto iter = tool_order.begin(); auto iter = tool_order.begin();
for (; iter != tool_order.end(); iter++) { for (; iter != tool_order.end(); iter++) {

View file

@ -1072,6 +1072,8 @@ void WipeTower::toolchange_Wipe(
const float target_speed = is_first_layer() ? std::min(m_first_layer_speed * 60.f, 4800.f) : 4800.f; const float target_speed = is_first_layer() ? std::min(m_first_layer_speed * 60.f, 4800.f) : 4800.f;
float wipe_speed = 0.33f * target_speed; float wipe_speed = 0.33f * target_speed;
float start_y = writer.y();
#if 0 #if 0
// if there is less than 2.5*m_perimeter_width to the edge, advance straightaway (there is likely a blob anyway) // if there is less than 2.5*m_perimeter_width to the edge, advance straightaway (there is likely a blob anyway)
if ((m_left_to_right ? xr-writer.x() : writer.x()-xl) < 2.5f*m_perimeter_width) { if ((m_left_to_right ? xr-writer.x() : writer.x()-xl) < 2.5f*m_perimeter_width) {
@ -1130,6 +1132,8 @@ void WipeTower::toolchange_Wipe(
m_left_to_right = !m_left_to_right; m_left_to_right = !m_left_to_right;
} }
float end_y = writer.y();
// We may be going back to the model - wipe the nozzle. If this is followed // We may be going back to the model - wipe the nozzle. If this is followed
// by finish_layer, this wipe path will be overwritten. // by finish_layer, this wipe path will be overwritten.
//writer.add_wipe_point(writer.x(), writer.y()) //writer.add_wipe_point(writer.x(), writer.y())
@ -1418,6 +1422,7 @@ void WipeTower::plan_tower()
// If wipe tower height is between the current and next member, set the min_depth as linear interpolation between them // If wipe tower height is between the current and next member, set the min_depth as linear interpolation between them
auto next_height_to_depth = *iter; auto next_height_to_depth = *iter;
if (next_height_to_depth.first > m_wipe_tower_height) { if (next_height_to_depth.first > m_wipe_tower_height) {
float height_base = curr_height_to_depth.first;
float height_diff = next_height_to_depth.first - curr_height_to_depth.first; float height_diff = next_height_to_depth.first - curr_height_to_depth.first;
float min_depth_base = curr_height_to_depth.second; float min_depth_base = curr_height_to_depth.second;
float depth_diff = next_height_to_depth.second - curr_height_to_depth.second; float depth_diff = next_height_to_depth.second - curr_height_to_depth.second;

View file

@ -4,14 +4,21 @@
#include "ClipperUtils.hpp" #include "ClipperUtils.hpp"
#include "ExPolygon.hpp" #include "ExPolygon.hpp"
#include "Line.hpp" #include "Line.hpp"
#include "clipper.hpp"
#include <algorithm>
#include <cassert> #include <cassert>
#include <cmath> #include <cmath>
#include <list>
#include <map>
#include <numeric>
#include <set>
#include <utility> #include <utility>
#include <stack> #include <stack>
#include <vector> #include <vector>
#include <boost/algorithm/string/classification.hpp> #include <boost/algorithm/string/classification.hpp>
#include <boost/algorithm/string/split.hpp> #include <boost/algorithm/string/split.hpp>
#include <boost/log/trivial.hpp>
#if defined(_MSC_VER) && defined(__clang__) #if defined(_MSC_VER) && defined(__clang__)
#define BOOST_NO_CXX17_HDR_STRING_VIEW #define BOOST_NO_CXX17_HDR_STRING_VIEW

View file

@ -1,5 +1,7 @@
#include "Circle.hpp" #include "Circle.hpp"
#include "../Polygon.hpp"
#include <numeric> #include <numeric>
#include <random> #include <random>
#include <boost/log/trivial.hpp> #include <boost/log/trivial.hpp>

View file

@ -2,6 +2,7 @@
#include "libslic3r/Arachne/utils/PolygonsSegmentIndex.hpp" #include "libslic3r/Arachne/utils/PolygonsSegmentIndex.hpp"
#include "libslic3r/Geometry/VoronoiUtils.hpp" #include "libslic3r/Geometry/VoronoiUtils.hpp"
#include "libslic3r/Geometry/VoronoiUtilsCgal.hpp"
#include "libslic3r/MultiMaterialSegmentation.hpp" #include "libslic3r/MultiMaterialSegmentation.hpp"
#include <boost/log/trivial.hpp> #include <boost/log/trivial.hpp>

View file

@ -1,18 +1,26 @@
#include "JumpPointSearch.hpp" #include "JumpPointSearch.hpp"
#include "BoundingBox.hpp" #include "BoundingBox.hpp"
#include "ExPolygon.hpp"
#include "Point.hpp" #include "Point.hpp"
#include "libslic3r/AStar.hpp" #include "libslic3r/AStar.hpp"
#include "libslic3r/KDTreeIndirect.hpp" #include "libslic3r/KDTreeIndirect.hpp"
#include "libslic3r/Polygon.hpp"
#include "libslic3r/Polyline.hpp" #include "libslic3r/Polyline.hpp"
#include "libslic3r/libslic3r.h" #include "libslic3r/libslic3r.h"
#include <algorithm>
#include <cmath>
#include <cstddef>
#include <cstdint> #include <cstdint>
#include <cstdlib> #include <cstdlib>
#include <iterator> #include <iterator>
#include <limits> #include <limits>
#include <optional> #include <optional>
#include <string>
#include <unordered_map> #include <unordered_map>
#include <vector> #include <vector>
#include <oneapi/tbb/scalable_allocator.h>
//#define DEBUG_FILES //#define DEBUG_FILES
#ifdef DEBUG_FILES #ifdef DEBUG_FILES
#include "libslic3r/SVG.hpp" #include "libslic3r/SVG.hpp"

View file

@ -1,7 +1,9 @@
#include "Geometry.hpp" #include "Geometry.hpp"
#include "Line.hpp" #include "Line.hpp"
#include "Polyline.hpp"
#include <algorithm> #include <algorithm>
#include <cmath> #include <cmath>
#include <sstream>
namespace Slic3r { namespace Slic3r {

View file

@ -330,7 +330,7 @@ void segment(CGALMesh& src, std::vector<CGALMesh>& dst, double smoothing_alpha =
// fill holes // fill holes
typedef boost::graph_traits<_EpicMesh>::halfedge_descriptor halfedge_descriptor; typedef boost::graph_traits<_EpicMesh>::halfedge_descriptor halfedge_descriptor;
// typedef boost::graph_traits<_EpicMesh>::vertex_descriptor vertex_descriptor; typedef boost::graph_traits<_EpicMesh>::vertex_descriptor vertex_descriptor;
std::vector<halfedge_descriptor> border_cycles; std::vector<halfedge_descriptor> border_cycles;
CGAL::Polygon_mesh_processing::extract_boundary_cycles(out, std::back_inserter(border_cycles)); CGAL::Polygon_mesh_processing::extract_boundary_cycles(out, std::back_inserter(border_cycles));
for (halfedge_descriptor h : border_cycles) for (halfedge_descriptor h : border_cycles)
@ -693,7 +693,7 @@ bool do_boolean_single(McutMesh &srcMesh, const McutMesh &cutMesh, const std::st
McutMesh outMesh; McutMesh outMesh;
int N_vertices = 0; int N_vertices = 0;
// traversal of all connected components // traversal of all connected components
for (unsigned int n = 0; n < numConnComps; ++n) { for (int n = 0; n < numConnComps; ++n) {
// query the data of each connected component from MCUT // query the data of each connected component from MCUT
McConnectedComponent connComp = connectedComponents[n]; McConnectedComponent connComp = connectedComponents[n];

View file

@ -442,7 +442,7 @@ ModelObject* Model::add_object(const ModelObject &other)
this->objects.push_back(new_object); this->objects.push_back(new_object);
// BBS: backup // BBS: backup
if (need_backup) { if (need_backup) {
if (other.get_model()) { if (auto model = other.get_model()) {
auto iter = object_backup_id_map.find(other.id().id); auto iter = object_backup_id_map.find(other.id().id);
if (iter != object_backup_id_map.end()) { if (iter != object_backup_id_map.end()) {
object_backup_id_map.emplace(new_object->id().id, iter->second); object_backup_id_map.emplace(new_object->id().id, iter->second);
@ -2615,7 +2615,7 @@ size_t ModelVolume::split(unsigned int max_extruders)
size_t ivolume = std::find(this->object->volumes.begin(), this->object->volumes.end(), this) - this->object->volumes.begin(); size_t ivolume = std::find(this->object->volumes.begin(), this->object->volumes.end(), this) - this->object->volumes.begin();
const std::string name = this->name; const std::string name = this->name;
// unsigned int extruder_counter = 0; unsigned int extruder_counter = 0;
const Vec3d offset = this->get_offset(); const Vec3d offset = this->get_offset();
for (TriangleMesh &mesh : meshes) { for (TriangleMesh &mesh : meshes) {
@ -2930,6 +2930,9 @@ bool Model::obj_import_vertex_color_deal(const std::vector<unsigned char> &verte
std::cout << "error"; std::cout << "error";
} }
}; };
auto calc_tri_area = [](const Vec3f &v0, const Vec3f &v1, const Vec3f &v2) {
return std::abs((v0 - v1).cross(v0 - v2).norm()) / 2;
};
auto volume = obj->volumes[0]; auto volume = obj->volumes[0];
volume->config.set("extruder", first_extruder_id); volume->config.set("extruder", first_extruder_id);
auto face_count = volume->mesh().its.indices.size(); auto face_count = volume->mesh().its.indices.size();
@ -3029,6 +3032,7 @@ bool Model::obj_import_face_color_deal(const std::vector<unsigned char> &face_fi
volume->mmu_segmentation_facets.reserve(face_count); volume->mmu_segmentation_facets.reserve(face_count);
if (volume->mesh().its.indices.size() != face_filament_ids.size()) { return false; } if (volume->mesh().its.indices.size() != face_filament_ids.size()) { return false; }
for (size_t i = 0; i < volume->mesh().its.indices.size(); i++) { for (size_t i = 0; i < volume->mesh().its.indices.size(); i++) {
auto face = volume->mesh().its.indices[i];
auto filament_id = face_filament_ids[i]; auto filament_id = face_filament_ids[i];
if (filament_id <= 1) { continue; } if (filament_id <= 1) { continue; }
std::string result; std::string result;

View file

@ -167,6 +167,7 @@ ArrangePolygon get_instance_arrange_poly(ModelInstance* instance, const Slic3r::
auto support_type_ptr = obj->get_config_value<ConfigOptionEnum<SupportType>>(config, "support_type"); auto support_type_ptr = obj->get_config_value<ConfigOptionEnum<SupportType>>(config, "support_type");
auto support_type = support_type_ptr->value; auto support_type = support_type_ptr->value;
auto enable_support = supp_type_ptr->getBool(); auto enable_support = supp_type_ptr->getBool();
int support_int = support_type_ptr->getInt();
if (enable_support && (support_type == stNormalAuto || support_type == stNormal)) if (enable_support && (support_type == stNormalAuto || support_type == stNormal))
ap.brim_width = 6.0; ap.brim_width = 6.0;

View file

@ -338,6 +338,7 @@ static std::vector<std::vector<const MMU_Graph::Arc *>> get_all_next_arcs(
if (arc.type == MMU_Graph::ARC_TYPE::BORDER && arc.color != color) continue; if (arc.type == MMU_Graph::ARC_TYPE::BORDER && arc.color != color) continue;
Vec2d arc_line = graph.nodes[arc.to_idx].point - graph.nodes[arc.from_idx].point;
next_continue_arc.emplace_back(&arc); next_continue_arc.emplace_back(&arc);
all_next_arcs.emplace_back(next_continue_arc); all_next_arcs.emplace_back(next_continue_arc);
} }
@ -1285,6 +1286,7 @@ static void cut_segmented_layers(const std::vector<ExPolygons> &input_exp
const std::function<void()> &throw_on_cancel_callback) const std::function<void()> &throw_on_cancel_callback)
{ {
BOOST_LOG_TRIVIAL(debug) << "MM segmentation - cutting segmented layers in parallel - begin"; BOOST_LOG_TRIVIAL(debug) << "MM segmentation - cutting segmented layers in parallel - begin";
const float interlocking_cut_width = interlocking_depth > 0.f ? std::max(cut_width - interlocking_depth, 0.f) : 0.f;
tbb::parallel_for(tbb::blocked_range<size_t>(0, segmented_regions.size()), tbb::parallel_for(tbb::blocked_range<size_t>(0, segmented_regions.size()),
[&segmented_regions, &input_expolygons, &cut_width, &interlocking_depth, &throw_on_cancel_callback](const tbb::blocked_range<size_t> &range) { [&segmented_regions, &input_expolygons, &cut_width, &interlocking_depth, &throw_on_cancel_callback](const tbb::blocked_range<size_t> &range) {
for (size_t layer_idx = range.begin(); layer_idx < range.end(); ++layer_idx) { for (size_t layer_idx = range.begin(); layer_idx < range.end(); ++layer_idx) {

View file

@ -138,6 +138,8 @@ public:
auto cost_items = get_features(orientation, params.min_volume); auto cost_items = get_features(orientation, params.min_volume);
float unprintability = target_function(cost_items, params.min_volume);
results[orientation] = cost_items; results[orientation] = cost_items;
BOOST_LOG_TRIVIAL(info) << std::fixed << std::setprecision(4) << "orientation:" << orientation.transpose() << ", cost:" << std::fixed << std::setprecision(4) << cost_items.field_values(); BOOST_LOG_TRIVIAL(info) << std::fixed << std::setprecision(4) << "orientation:" << orientation.transpose() << ", cost:" << std::fixed << std::setprecision(4) << cost_items.field_values();
@ -228,10 +230,10 @@ public:
{ {
std::unordered_map<stl_normal, float, VecHash> alignments; std::unordered_map<stl_normal, float, VecHash> alignments;
// init to 0 // init to 0
for (Eigen::Index i = 0; i < areas_.size(); i++) for (size_t i = 0; i < areas_.size(); i++)
alignments.insert(std::pair(normals_.row(i), 0)); alignments.insert(std::pair(normals_.row(i), 0));
// cumulate areas // cumulate areas
for (Eigen::Index i = 0; i < areas_.size(); i++) for (size_t i = 0; i < areas_.size(); i++)
{ {
alignments[normals_.row(i)] += areas_(i); alignments[normals_.row(i)] += areas_(i);
} }
@ -255,11 +257,11 @@ public:
Vec3f n1 = { 0, 0, 0 }; Vec3f n1 = { 0, 0, 0 };
std::vector<float> current_areas = {0, 0}; std::vector<float> current_areas = {0, 0};
// init to 0 // init to 0
for (Eigen::Index i = 0; i < areas_.size(); i++) { for (size_t i = 0; i < areas_.size(); i++) {
alignments_.insert(std::pair(quantize_normals_.row(i), std::pair(current_areas, n1))); alignments_.insert(std::pair(quantize_normals_.row(i), std::pair(current_areas, n1)));
} }
// cumulate areas // cumulate areas
for (Eigen::Index i = 0; i < areas_.size(); i++) for (size_t i = 0; i < areas_.size(); i++)
{ {
alignments_[quantize_normals_.row(i)].first[1] += areas_(i); alignments_[quantize_normals_.row(i)].first[1] += areas_(i);
if (areas_(i) > alignments_[quantize_normals_.row(i)].first[0]){ if (areas_(i) > alignments_[quantize_normals_.row(i)].first[0]){
@ -337,7 +339,7 @@ public:
z_max_hull.resize(mesh_convex_hull.facets_count(), 1); z_max_hull.resize(mesh_convex_hull.facets_count(), 1);
its = mesh_convex_hull.its; its = mesh_convex_hull.its;
for (Eigen::Index i = 0; i < z_max_hull.rows(); i++) for (size_t i = 0; i < z_max_hull.rows(); i++)
{ {
float z0 = its.get_vertex(i,0).dot(orientation); float z0 = its.get_vertex(i,0).dot(orientation);
float z1 = its.get_vertex(i,1).dot(orientation); float z1 = its.get_vertex(i,1).dot(orientation);
@ -391,7 +393,7 @@ public:
// filter overhang // filter overhang
Eigen::VectorXf normal_projection(normals.rows(), 1);// = this->normals.dot(orientation); Eigen::VectorXf normal_projection(normals.rows(), 1);// = this->normals.dot(orientation);
for (Eigen::Index i = 0; i < normals.rows(); i++) for (size_t i = 0; i < normals.rows(); i++)
{ {
normal_projection(i) = normals.row(i).dot(orientation); normal_projection(i) = normals.row(i).dot(orientation);
} }
@ -457,6 +459,7 @@ public:
cost = params.TAR_A * (overhang + params.TAR_B) + params.RELATIVE_F * (/*costs.volume/100*/overhang*params.TAR_C + params.TAR_D + params.TAR_LAF * costs.area_laf * params.use_low_angle_face) / (params.TAR_D + params.CONTOUR_F * costs.contour + params.BOTTOM_F * bottom + params.BOTTOM_HULL_F * bottom_hull + params.TAR_E * overhang + params.TAR_PROJ_AREA * costs.area_projected); cost = params.TAR_A * (overhang + params.TAR_B) + params.RELATIVE_F * (/*costs.volume/100*/overhang*params.TAR_C + params.TAR_D + params.TAR_LAF * costs.area_laf * params.use_low_angle_face) / (params.TAR_D + params.CONTOUR_F * costs.contour + params.BOTTOM_F * bottom + params.BOTTOM_HULL_F * bottom_hull + params.TAR_E * overhang + params.TAR_PROJ_AREA * costs.area_projected);
} }
else { else {
float overhang = costs.overhang;
cost = params.RELATIVE_F * (costs.overhang * params.TAR_C + params.TAR_D + params.TAR_LAF * costs.area_laf * params.use_low_angle_face) / (params.TAR_D + params.CONTOUR_F * costs.contour + params.BOTTOM_F * bottom + params.BOTTOM_HULL_F * bottom_hull + params.TAR_PROJ_AREA * costs.area_projected); cost = params.RELATIVE_F * (costs.overhang * params.TAR_C + params.TAR_D + params.TAR_LAF * costs.area_laf * params.use_low_angle_face) / (params.TAR_D + params.CONTOUR_F * costs.contour + params.BOTTOM_F * bottom + params.BOTTOM_HULL_F * bottom_hull + params.TAR_PROJ_AREA * costs.area_projected);
} }
cost += (costs.bottom < params.BOTTOM_MIN) * 100;// +(costs.height_to_bottom_hull_ratio > params.height_to_bottom_hull_ratio_MIN) * 110; cost += (costs.bottom < params.BOTTOM_MIN) * 100;// +(costs.height_to_bottom_hull_ratio > params.height_to_bottom_hull_ratio_MIN) * 110;

View file

@ -242,10 +242,12 @@ static std::deque<PolylineWithDegree> split_polyline_by_degree(const Polyline &p
Polyline right; Polyline right;
Polyline temp_copy = polyline_with_insert_points; Polyline temp_copy = polyline_with_insert_points;
size_t poly_size = polyline_with_insert_points.size();
// BBS: merge degree in limited range // BBS: merge degree in limited range
//find first degee base //find first degee base
double degree_base = int(points_overhang[points_overhang.size() - 1] / min_degree_gap) * min_degree_gap + min_degree_gap; double degree_base = int(points_overhang[points_overhang.size() - 1] / min_degree_gap) * min_degree_gap + min_degree_gap;
degree_base = degree_base > max_overhang_degree ? max_overhang_degree : degree_base; degree_base = degree_base > max_overhang_degree ? max_overhang_degree : degree_base;
double short_poly_len = 0;
for (int point_idx = points_overhang.size() - 2; point_idx > 0; --point_idx) { for (int point_idx = points_overhang.size() - 2; point_idx > 0; --point_idx) {
double degree = points_overhang[point_idx]; double degree = points_overhang[point_idx];
@ -938,6 +940,7 @@ static ExtrusionEntityCollection traverse_extrusions(const PerimeterGenerator& p
if (perimeter_generator.config->overhang_speed_classic && perimeter_generator.config->enable_overhang_speed && perimeter_generator.config->fuzzy_skin == FuzzySkinType::None) { if (perimeter_generator.config->overhang_speed_classic && perimeter_generator.config->enable_overhang_speed && perimeter_generator.config->fuzzy_skin == FuzzySkinType::None) {
Flow flow = is_external ? perimeter_generator.ext_perimeter_flow : perimeter_generator.perimeter_flow;
std::map<double, std::vector<Polygons>> clipper_serise; std::map<double, std::vector<Polygons>> clipper_serise;
std::map<double,ExtrusionPaths> recognization_paths; std::map<double,ExtrusionPaths> recognization_paths;
@ -2250,6 +2253,7 @@ void PerimeterGenerator::process_no_bridge(Surfaces& all_surfaces, coord_t perim
if (!unsupported.empty()) { if (!unsupported.empty()) {
//only consider the part that can be bridged (really, by the bridge algorithm) //only consider the part that can be bridged (really, by the bridge algorithm)
//first, separate into islands (ie, each ExPlolygon) //first, separate into islands (ie, each ExPlolygon)
int numploy = 0;
//only consider the bottom layer that intersect unsupported, to be sure it's only on our island. //only consider the bottom layer that intersect unsupported, to be sure it's only on our island.
ExPolygonCollection lower_island(support); ExPolygonCollection lower_island(support);
//a detector per island //a detector per island
@ -2367,6 +2371,7 @@ void PerimeterGenerator::process_no_bridge(Surfaces& all_surfaces, coord_t perim
//ExPolygons no_bridge = diff_ex(offset_ex(unbridgeable, ext_perimeter_width * 3 / 2), last); //ExPolygons no_bridge = diff_ex(offset_ex(unbridgeable, ext_perimeter_width * 3 / 2), last);
//bridges_temp = diff_ex(bridges_temp, no_bridge); //bridges_temp = diff_ex(bridges_temp, no_bridge);
coordf_t offset_to_do = bridged_infill_margin; coordf_t offset_to_do = bridged_infill_margin;
bool first = true;
unbridgeable = diff_ex(unbridgeable, offset_ex(bridges_temp, ext_perimeter_width)); unbridgeable = diff_ex(unbridgeable, offset_ex(bridges_temp, ext_perimeter_width));
while (offset_to_do > ext_perimeter_width * 1.5) { while (offset_to_do > ext_perimeter_width * 1.5) {
unbridgeable = offset2_ex(unbridgeable, -ext_perimeter_width / 4, ext_perimeter_width * 2.25, ClipperLib::jtSquare); unbridgeable = offset2_ex(unbridgeable, -ext_perimeter_width / 4, ext_perimeter_width * 2.25, ClipperLib::jtSquare);
@ -2374,6 +2379,7 @@ void PerimeterGenerator::process_no_bridge(Surfaces& all_surfaces, coord_t perim
bridges_temp = offset_ex(bridges_temp, ext_perimeter_width, ClipperLib::jtMiter, 6.); bridges_temp = offset_ex(bridges_temp, ext_perimeter_width, ClipperLib::jtMiter, 6.);
unbridgeable = diff_ex(unbridgeable, offset_ex(bridges_temp, ext_perimeter_width)); unbridgeable = diff_ex(unbridgeable, offset_ex(bridges_temp, ext_perimeter_width));
offset_to_do -= ext_perimeter_width; offset_to_do -= ext_perimeter_width;
first = false;
} }
unbridgeable = offset_ex(unbridgeable, ext_perimeter_width + offset_to_do, ClipperLib::jtSquare); unbridgeable = offset_ex(unbridgeable, ext_perimeter_width + offset_to_do, ClipperLib::jtSquare);
bridges_temp = diff_ex(bridges_temp, unbridgeable); bridges_temp = diff_ex(bridges_temp, unbridgeable);

View file

@ -355,6 +355,8 @@ Polygon Polygon::transform(const Transform3d& trafo) const
if (vertices_count == 0) if (vertices_count == 0)
return dstpoly; return dstpoly;
unsigned int data_size = 3 * vertices_count * sizeof(float);
Eigen::MatrixXd src(3, vertices_count); Eigen::MatrixXd src(3, vertices_count);
for (size_t i = 0; i < vertices_count; i++) for (size_t i = 0; i < vertices_count; i++)
{ {

View file

@ -51,6 +51,7 @@ void Polyline::reverse()
// removes the given distance from the end of the polyline // removes the given distance from the end of the polyline
void Polyline::clip_end(double distance) void Polyline::clip_end(double distance)
{ {
bool last_point_inserted = false;
size_t remove_after_index = MultiPoint::size(); size_t remove_after_index = MultiPoint::size();
while (distance > 0) { while (distance > 0) {
Vec2d last_point = this->last_point().cast<double>(); Vec2d last_point = this->last_point().cast<double>();
@ -64,6 +65,7 @@ void Polyline::clip_end(double distance)
double lsqr = v.squaredNorm(); double lsqr = v.squaredNorm();
if (lsqr > distance * distance) { if (lsqr > distance * distance) {
this->points.emplace_back((last_point + v * (distance / sqrt(lsqr))).cast<coord_t>()); this->points.emplace_back((last_point + v * (distance / sqrt(lsqr))).cast<coord_t>());
last_point_inserted = true;
break; break;
} }
distance -= sqrt(lsqr); distance -= sqrt(lsqr);

View file

@ -1570,6 +1570,7 @@ bool PresetCollection::load_user_preset(std::string name, std::map<std::string,
// Store the loaded presets into a new vector, otherwise the binary search for already existing presets would be broken. // Store the loaded presets into a new vector, otherwise the binary search for already existing presets would be broken.
// (see the "Preset already present, not loading" message). // (see the "Preset already present, not loading" message).
//std::deque<Preset> presets_loaded; //std::deque<Preset> presets_loaded;
int count = 0;
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(" enter, name %1% , total value counts %2%")%name %preset_values.size(); BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(" enter, name %1% , total value counts %2%")%name %preset_values.size();

View file

@ -1853,7 +1853,7 @@ void PresetBundle::export_selections(AppConfig &config)
// BBS // BBS
void PresetBundle::set_num_filaments(unsigned int n, std::string new_color) void PresetBundle::set_num_filaments(unsigned int n, std::string new_color)
{ {
size_t old_filament_count = this->filament_presets.size(); int old_filament_count = this->filament_presets.size();
if (n > old_filament_count && old_filament_count != 0) if (n > old_filament_count && old_filament_count != 0)
filament_presets.resize(n, filament_presets.back()); filament_presets.resize(n, filament_presets.back());
else { else {
@ -1867,7 +1867,7 @@ void PresetBundle::set_num_filaments(unsigned int n, std::string new_color)
//BBS set new filament color to new_color //BBS set new filament color to new_color
if (old_filament_count < n) { if (old_filament_count < n) {
if (!new_color.empty()) { if (!new_color.empty()) {
for (size_t i = old_filament_count; i < n; i++) { for (int i = old_filament_count; i < n; i++) {
filament_color->values[i] = new_color; filament_color->values[i] = new_color;
} }
} }
@ -2054,7 +2054,7 @@ bool PresetBundle::check_filament_temp_equation_by_printer_type_and_nozzle_for_m
//BBS: check whether this is the only edited filament //BBS: check whether this is the only edited filament
bool PresetBundle::is_the_only_edited_filament(unsigned int filament_index) bool PresetBundle::is_the_only_edited_filament(unsigned int filament_index)
{ {
size_t n = this->filament_presets.size(); int n = this->filament_presets.size();
if (filament_index >= n) if (filament_index >= n)
return false; return false;
@ -2117,6 +2117,7 @@ DynamicPrintConfig PresetBundle::full_fff_config() const
// BBS // BBS
size_t num_filaments = this->filament_presets.size(); size_t num_filaments = this->filament_presets.size();
auto* extruder_diameter = dynamic_cast<const ConfigOptionFloats*>(out.option("nozzle_diameter"));
// Collect the "compatible_printers_condition" and "inherits" values over all presets (print, filaments, printers) into a single vector. // Collect the "compatible_printers_condition" and "inherits" values over all presets (print, filaments, printers) into a single vector.
std::vector<std::string> compatible_printers_condition; std::vector<std::string> compatible_printers_condition;
std::vector<std::string> compatible_prints_condition; std::vector<std::string> compatible_prints_condition;
@ -2479,7 +2480,7 @@ void PresetBundle::load_config_file_config(const std::string &name_or_path, bool
std::vector<std::string> filament_ids = std::move(config.option<ConfigOptionStrings>("filament_ids", true)->values); std::vector<std::string> filament_ids = std::move(config.option<ConfigOptionStrings>("filament_ids", true)->values);
std::vector<std::string> print_compatible_printers = std::move(config.option<ConfigOptionStrings>("print_compatible_printers", true)->values); std::vector<std::string> print_compatible_printers = std::move(config.option<ConfigOptionStrings>("print_compatible_printers", true)->values);
//BBS: add different settings check logic //BBS: add different settings check logic
// bool has_different_settings_to_system = config.option("different_settings_to_system")?true:false; bool has_different_settings_to_system = config.option("different_settings_to_system")?true:false;
std::vector<std::string> different_values = std::move(config.option<ConfigOptionStrings>("different_settings_to_system", true)->values); std::vector<std::string> different_values = std::move(config.option<ConfigOptionStrings>("different_settings_to_system", true)->values);
std::string &compatible_printers_condition = Preset::compatible_printers_condition(config); std::string &compatible_printers_condition = Preset::compatible_printers_condition(config);
std::string &compatible_prints_condition = Preset::compatible_prints_condition(config); std::string &compatible_prints_condition = Preset::compatible_prints_condition(config);

View file

@ -831,6 +831,7 @@ StringObjectException Print::sequential_print_clearance_valid(const Print &print
for (int i = k+1; i < print_instance_count; i++) for (int i = k+1; i < print_instance_count; i++)
{ {
auto& p = print_instance_with_bounding_box[i].print_instance;
auto bbox2 = print_instance_with_bounding_box[i].bounding_box; auto bbox2 = print_instance_with_bounding_box[i].bounding_box;
auto py1 = bbox2.min.y(); auto py1 = bbox2.min.y();
auto py2 = bbox2.max.y(); auto py2 = bbox2.max.y();
@ -1403,6 +1404,7 @@ StringObjectException Print::validate(StringObjectException *warning, Polygons*
if (is_BBL_printer()) { if (is_BBL_printer()) {
const t_config_enum_values* bed_type_keys_map = bed_type_def->enum_keys_map; const t_config_enum_values* bed_type_keys_map = bed_type_def->enum_keys_map;
for (unsigned int extruder_id : extruders) {
const ConfigOptionInts* bed_temp_opt = m_config.option<ConfigOptionInts>(get_bed_temp_key(m_config.curr_bed_type)); const ConfigOptionInts* bed_temp_opt = m_config.option<ConfigOptionInts>(get_bed_temp_key(m_config.curr_bed_type));
for (unsigned int extruder_id : extruders) { for (unsigned int extruder_id : extruders) {
int curr_bed_temp = bed_temp_opt->get_at(extruder_id); int curr_bed_temp = bed_temp_opt->get_at(extruder_id);
@ -1427,6 +1429,7 @@ StringObjectException Print::validate(StringObjectException *warning, Polygons*
} }
} }
} }
}
// check if print speed/accel/jerk is higher than the maximum speed of the printer // check if print speed/accel/jerk is higher than the maximum speed of the printer
if (warning) { if (warning) {
@ -1441,7 +1444,7 @@ StringObjectException Print::validate(StringObjectException *warning, Polygons*
} }
return warning_key; return warning_key;
}; };
/* auto check_motion_ability_region_setting = [&](const std::vector<std::string>& keys_to_check, double limit) -> std::string { auto check_motion_ability_region_setting = [&](const std::vector<std::string>& keys_to_check, double limit) -> std::string {
std::string warning_key; std::string warning_key;
for (const auto& key : keys_to_check) { for (const auto& key : keys_to_check) {
if (m_default_region_config.get_abs_value(key) > limit) { if (m_default_region_config.get_abs_value(key) > limit) {
@ -1450,7 +1453,7 @@ StringObjectException Print::validate(StringObjectException *warning, Polygons*
} }
} }
return warning_key; return warning_key;
}; */ };
std::string warning_key; std::string warning_key;
// check jerk // check jerk
@ -2666,7 +2669,7 @@ void Print::_make_wipe_tower()
for (auto &layer_tools : m_wipe_tower_data.tool_ordering.layer_tools()) { // for all layers for (auto &layer_tools : m_wipe_tower_data.tool_ordering.layer_tools()) { // for all layers
if (!layer_tools.has_wipe_tower) if (!layer_tools.has_wipe_tower)
continue; continue;
// bool first_layer = &layer_tools == &m_wipe_tower_data.tool_ordering.front(); bool first_layer = &layer_tools == &m_wipe_tower_data.tool_ordering.front();
wipe_tower.plan_toolchange((float) layer_tools.print_z, (float) layer_tools.wipe_tower_layer_height, current_extruder_id, wipe_tower.plan_toolchange((float) layer_tools.print_z, (float) layer_tools.wipe_tower_layer_height, current_extruder_id,
current_extruder_id); current_extruder_id);

View file

@ -680,6 +680,7 @@ void PrintObject::estimate_curled_extrusions()
[](const PrintRegion *region) { return region->config().enable_overhang_speed.getBool(); })) { [](const PrintRegion *region) { return region->config().enable_overhang_speed.getBool(); })) {
// Estimate curling of support material and add it to the malformaition lines of each layer // Estimate curling of support material and add it to the malformaition lines of each layer
float support_flow_width = support_material_flow(this, this->config().layer_height).width();
SupportSpotsGenerator::Params params{this->print()->m_config.filament_type.values, SupportSpotsGenerator::Params params{this->print()->m_config.filament_type.values,
float(this->print()->default_object_config().inner_wall_acceleration.getFloat()), float(this->print()->default_object_config().inner_wall_acceleration.getFloat()),
this->config().raft_layers.getInt(), this->config().brim_type.value, this->config().raft_layers.getInt(), this->config().brim_type.value,
@ -2951,16 +2952,16 @@ struct POProfiler
void PrintObject::generate_support_preview() void PrintObject::generate_support_preview()
{ {
// POProfiler profiler; POProfiler profiler;
// boost::posix_time::ptime ts1 = boost::posix_time::microsec_clock::local_time(); boost::posix_time::ptime ts1 = boost::posix_time::microsec_clock::local_time();
this->slice(); this->slice();
// boost::posix_time::ptime ts2 = boost::posix_time::microsec_clock::local_time(); boost::posix_time::ptime ts2 = boost::posix_time::microsec_clock::local_time();
// profiler.duration1 = (ts2 - ts1).total_milliseconds(); profiler.duration1 = (ts2 - ts1).total_milliseconds();
this->generate_support_material(); this->generate_support_material();
// boost::posix_time::ptime ts3 = boost::posix_time::microsec_clock::local_time(); boost::posix_time::ptime ts3 = boost::posix_time::microsec_clock::local_time();
// profiler.duration2 = (ts3 - ts2).total_milliseconds(); profiler.duration2 = (ts3 - ts2).total_milliseconds();
} }
void PrintObject::update_slicing_parameters() void PrintObject::update_slicing_parameters()
@ -3670,6 +3671,7 @@ template void PrintObject::remove_bridges_from_contacts<Polygons>(
SupportNecessaryType PrintObject::is_support_necessary() SupportNecessaryType PrintObject::is_support_necessary()
{ {
static const double super_overhang_area_threshold = SQ(scale_(5.0));
const double cantilevel_dist_thresh = scale_(6); const double cantilevel_dist_thresh = scale_(6);
#if 0 #if 0
double threshold_rad = (m_config.support_threshold_angle.value < EPSILON ? 30 : m_config.support_threshold_angle.value + 1) * M_PI / 180.; double threshold_rad = (m_config.support_threshold_angle.value < EPSILON ? 30 : m_config.support_threshold_angle.value + 1) * M_PI / 180.;

View file

@ -151,8 +151,8 @@ static std::vector<VolumeSlices> slice_volumes_inner(
params_base.mode_below = params_base.mode; params_base.mode_below = params_base.mode;
// BBS // BBS
// const size_t num_extruders = print_config.filament_diameter.size(); const size_t num_extruders = print_config.filament_diameter.size();
// const bool is_mm_painted = num_extruders > 1 && std::any_of(model_volumes.cbegin(), model_volumes.cend(), [](const ModelVolume *mv) { return mv->is_mm_painted(); }); const bool is_mm_painted = num_extruders > 1 && std::any_of(model_volumes.cbegin(), model_volumes.cend(), [](const ModelVolume *mv) { return mv->is_mm_painted(); });
// BBS: don't do size compensation when slice volume. // BBS: don't do size compensation when slice volume.
// Will handle contour and hole size compensation seperately later. // Will handle contour and hole size compensation seperately later.
//const auto extra_offset = is_mm_painted ? 0.f : std::max(0.f, float(print_object_config.xy_contour_compensation.value)); //const auto extra_offset = is_mm_painted ? 0.f : std::max(0.f, float(print_object_config.xy_contour_compensation.value));
@ -336,8 +336,7 @@ static std::vector<std::vector<ExPolygons>> slices_to_regions(
}; };
// BBS // BBS
// Orca: unused auto trim_overlap = [](ExPolygons& expolys_a, ExPolygons& expolys_b) {
/* auto trim_overlap = [](ExPolygons& expolys_a, ExPolygons& expolys_b) {
ExPolygons trimming_a; ExPolygons trimming_a;
ExPolygons trimming_b; ExPolygons trimming_b;
@ -362,7 +361,7 @@ static std::vector<std::vector<ExPolygons>> slices_to_regions(
expolys_a = diff_ex(expolys_a, trimming_a); expolys_a = diff_ex(expolys_a, trimming_a);
expolys_b = diff_ex(expolys_b, trimming_b); expolys_b = diff_ex(expolys_b, trimming_b);
}; */ };
std::vector<RegionSlice> temp_slices; std::vector<RegionSlice> temp_slices;
for (size_t zs_complex_idx = range.begin(); zs_complex_idx < range.end(); ++ zs_complex_idx) { for (size_t zs_complex_idx = range.begin(); zs_complex_idx < range.end(); ++ zs_complex_idx) {

View file

@ -99,6 +99,8 @@ std::vector<std::string> init_occt_fonts()
static bool TextToBRep(const char* text, const char* font, const float theTextHeight, Font_FontAspect& theFontAspect, TopoDS_Shape& theShape, double& text_width) static bool TextToBRep(const char* text, const char* font, const float theTextHeight, Font_FontAspect& theFontAspect, TopoDS_Shape& theShape, double& text_width)
{ {
Standard_Integer anArgIt = 1;
Standard_CString aName = "text_shape";
Standard_CString aText = text; Standard_CString aText = text;
Font_BRepFont aFont; Font_BRepFont aFont;

View file

@ -2,6 +2,7 @@
#include "libslic3r/NormalUtils.hpp" #include "libslic3r/NormalUtils.hpp"
#include <unordered_map> #include <unordered_map>
#include <unordered_set>
#include <random> #include <random>
#include <algorithm> #include <algorithm>

View file

@ -1,5 +1,8 @@
#include <numeric>
#include "SlicesToTriangleMesh.hpp" #include "SlicesToTriangleMesh.hpp"
//#include "libslic3r/MTUtils.hpp"
#include "libslic3r/Execution/ExecutionTBB.hpp" #include "libslic3r/Execution/ExecutionTBB.hpp"
#include "libslic3r/ClipperUtils.hpp" #include "libslic3r/ClipperUtils.hpp"
#include "libslic3r/Tesselate.hpp" #include "libslic3r/Tesselate.hpp"

View file

@ -1,6 +1,12 @@
#include "OrganicSupport.hpp" #include "OrganicSupport.hpp"
#include "SupportCommon.hpp" #include "SupportCommon.hpp"
#include "../AABBTreeLines.hpp"
#include "../ClipperUtils.hpp"
#include "../Polygon.hpp"
#include "../Polyline.hpp"
#include "../MutablePolygon.hpp" #include "../MutablePolygon.hpp"
#include "../TriangleMeshSlicer.hpp"
#include <cassert> #include <cassert>

View file

@ -1,4 +1,6 @@
#include "../Print.hpp" #include "../Print.hpp"
#include "../PrintConfig.hpp"
#include "../Slicing.hpp"
#include "SupportParameters.hpp" #include "SupportParameters.hpp"
namespace Slic3r::FFFSupport { namespace Slic3r::FFFSupport {

View file

@ -338,7 +338,7 @@ static std::string get_svg_filename(std::string layer_nr_or_z, std::string tag
rand_init = true; rand_init = true;
} }
// int rand_num = rand() % 1000000; int rand_num = rand() % 1000000;
//makedir("./SVG"); //makedir("./SVG");
std::string prefix = "./SVG/"; std::string prefix = "./SVG/";
std::string suffix = ".svg"; std::string suffix = ".svg";
@ -1554,6 +1554,7 @@ static inline ExPolygons detect_overhangs(
double thresh_angle = object_config.support_threshold_angle.value > 0 ? object_config.support_threshold_angle.value + 1 : 0; double thresh_angle = object_config.support_threshold_angle.value > 0 ? object_config.support_threshold_angle.value + 1 : 0;
thresh_angle = std::min(thresh_angle, 89.); // BBS should be smaller than 90 thresh_angle = std::min(thresh_angle, 89.); // BBS should be smaller than 90
const double threshold_rad = Geometry::deg2rad(thresh_angle); const double threshold_rad = Geometry::deg2rad(thresh_angle);
const coordf_t max_bridge_length = scale_(object_config.max_bridge_length.value);
const bool bridge_no_support = object_config.bridge_no_support.value; const bool bridge_no_support = object_config.bridge_no_support.value;
const coordf_t xy_expansion = scale_(object_config.support_expansion.value); const coordf_t xy_expansion = scale_(object_config.support_expansion.value);
@ -1576,6 +1577,7 @@ static inline ExPolygons detect_overhangs(
{ {
// Generate overhang / contact_polygons for non-raft layers. // Generate overhang / contact_polygons for non-raft layers.
const Layer &lower_layer = *layer.lower_layer; const Layer &lower_layer = *layer.lower_layer;
const bool has_enforcer = !annotations.enforcers_layers.empty() && !annotations.enforcers_layers[layer_id].empty();
// Can't directly use lower_layer.lslices, or we'll miss some very sharp tails. // Can't directly use lower_layer.lslices, or we'll miss some very sharp tails.
// Filter out areas whose diameter that is smaller than extrusion_width. Do not use offset2() for this purpose! // Filter out areas whose diameter that is smaller than extrusion_width. Do not use offset2() for this purpose!
// FIXME if there are multiple regions with different extrusion width, the following code may not be right. // FIXME if there are multiple regions with different extrusion width, the following code may not be right.
@ -1687,6 +1689,7 @@ static inline ExPolygons detect_overhangs(
// check cantilever // check cantilever
if (layer.lower_layer) { if (layer.lower_layer) {
for (ExPolygon& poly : overhang_areas) { for (ExPolygon& poly : overhang_areas) {
float fw = float(layer.regions().front()->flow(frExternalPerimeter).scaled_width());
auto cluster_boundary_ex = intersection_ex(poly, offset_ex(layer.lower_layer->lslices, scale_(0.5))); auto cluster_boundary_ex = intersection_ex(poly, offset_ex(layer.lower_layer->lslices, scale_(0.5)));
Polygons cluster_boundary = to_polygons(cluster_boundary_ex); Polygons cluster_boundary = to_polygons(cluster_boundary_ex);
if (cluster_boundary.empty()) continue; if (cluster_boundary.empty()) continue;
@ -1731,6 +1734,7 @@ static inline std::tuple<Polygons, Polygons, double> detect_contacts(
Polygons enforcer_polygons; Polygons enforcer_polygons;
// BBS. // BBS.
const bool auto_normal_support = object_config.support_type.value == stNormalAuto;
const bool buildplate_only = !annotations.buildplate_covered.empty(); const bool buildplate_only = !annotations.buildplate_covered.empty();
float no_interface_offset = 0.f; float no_interface_offset = 0.f;
@ -1744,6 +1748,8 @@ static inline std::tuple<Polygons, Polygons, double> detect_contacts(
// Generate overhang / contact_polygons for non-raft layers. // Generate overhang / contact_polygons for non-raft layers.
const Layer& lower_layer = *layer.lower_layer; const Layer& lower_layer = *layer.lower_layer;
const bool has_enforcer = !annotations.enforcers_layers.empty() && !annotations.enforcers_layers[layer_id].empty(); const bool has_enforcer = !annotations.enforcers_layers.empty() && !annotations.enforcers_layers[layer_id].empty();
const ExPolygons& lower_layer_expolys = lower_layer.lslices;
const ExPolygons& lower_layer_sharptails = lower_layer.sharp_tails;
// Cache support trimming polygons derived from lower layer polygons, possible merged with "on build plate only" trimming polygons. // Cache support trimming polygons derived from lower layer polygons, possible merged with "on build plate only" trimming polygons.
auto slices_margin_update = auto slices_margin_update =
@ -2181,6 +2187,7 @@ struct OverhangCluster {
static OverhangCluster* add_overhang(std::vector<OverhangCluster>& clusters, ExPolygon* overhang, int layer_nr, coordf_t offset_scaled) { static OverhangCluster* add_overhang(std::vector<OverhangCluster>& clusters, ExPolygon* overhang, int layer_nr, coordf_t offset_scaled) {
OverhangCluster* cluster = nullptr; OverhangCluster* cluster = nullptr;
bool found = false;
for (int i = 0; i < clusters.size(); i++) { for (int i = 0; i < clusters.size(); i++) {
auto cluster_i = &clusters[i]; auto cluster_i = &clusters[i];
if (cluster_i->intersects(*overhang, layer_nr)) { if (cluster_i->intersects(*overhang, layer_nr)) {
@ -3539,13 +3546,13 @@ std::pair<PrintObjectSupportMaterial::MyLayersPtr, PrintObjectSupportMaterial::M
// distinguish between interface and base interface layers // distinguish between interface and base interface layers
// Contact layer is considered an interface layer, therefore run the following block only if support_interface_top_layers > 1. // Contact layer is considered an interface layer, therefore run the following block only if support_interface_top_layers > 1.
// Contact layer needs a base_interface layer, therefore run the following block if support_interface_top_layers > 0, has soluble support and extruders are different. // Contact layer needs a base_interface layer, therefore run the following block if support_interface_top_layers > 0, has soluble support and extruders are different.
// bool soluble_interface_non_soluble_base = bool soluble_interface_non_soluble_base =
// // Zero z-gap between the overhangs and the support interface. // Zero z-gap between the overhangs and the support interface.
// m_slicing_params.soluble_interface && m_slicing_params.soluble_interface &&
// // Interface extruder soluble. // Interface extruder soluble.
// m_object_config->support_interface_filament.value > 0 && m_print_config->filament_soluble.get_at(m_object_config->support_interface_filament.value - 1) && m_object_config->support_interface_filament.value > 0 && m_print_config->filament_soluble.get_at(m_object_config->support_interface_filament.value - 1) &&
// // Base extruder: Either "print with active extruder" not soluble. // Base extruder: Either "print with active extruder" not soluble.
// (m_object_config->support_filament.value == 0 || ! m_print_config->filament_soluble.get_at(m_object_config->support_filament.value - 1)); (m_object_config->support_filament.value == 0 || ! m_print_config->filament_soluble.get_at(m_object_config->support_filament.value - 1));
bool snug_supports = m_object_config->support_style.value == smsSnug; bool snug_supports = m_object_config->support_style.value == smsSnug;
// BBS: if support interface and support base do not use the same filament, add a base layer to improve their adhesion // BBS: if support interface and support base do not use the same filament, add a base layer to improve their adhesion
bool differnt_support_interface_filament = m_object_config->support_interface_filament.value != m_object_config->support_filament.value; bool differnt_support_interface_filament = m_object_config->support_interface_filament.value != m_object_config->support_filament.value;
@ -4621,6 +4628,7 @@ void PrintObjectSupportMaterial::generate_toolpaths(
if (object_layer != nullptr) { if (object_layer != nullptr) {
float biggest_bridge_area = 0.f; float biggest_bridge_area = 0.f;
const Polygons& top_contact_polys = top_contact_layer.polygons_to_extrude();
for (auto layerm : object_layer->regions()) { for (auto layerm : object_layer->regions()) {
for (auto bridge_surface : layerm->fill_surfaces.filter_by_type(stBottomBridge)) { for (auto bridge_surface : layerm->fill_surfaces.filter_by_type(stBottomBridge)) {
float bs_area = bridge_surface->area(); float bs_area = bridge_surface->area();

View file

@ -5,6 +5,7 @@
#include "Print.hpp" #include "Print.hpp"
#include "Layer.hpp" #include "Layer.hpp"
#include "Fill/FillBase.hpp" #include "Fill/FillBase.hpp"
#include "Fill/FillConcentric.hpp"
#include "CurveAnalyzer.hpp" #include "CurveAnalyzer.hpp"
#include "SVG.hpp" #include "SVG.hpp"
#include "ShortestPath.hpp" #include "ShortestPath.hpp"
@ -12,6 +13,7 @@
#include <libnest2d/backends/libslic3r/geometries.hpp> #include <libnest2d/backends/libslic3r/geometries.hpp>
#include <boost/log/trivial.hpp> #include <boost/log/trivial.hpp>
#include <tbb/blocked_range.h>
#include <tbb/parallel_for.h> #include <tbb/parallel_for.h>
#define _L(s) Slic3r::I18N::translate(s) #define _L(s) Slic3r::I18N::translate(s)
@ -467,6 +469,7 @@ static bool move_inside_expolys(const ExPolygons& polygons, Point& from, double
Point ret = from; Point ret = from;
std::vector<Point> valid_pts; std::vector<Point> valid_pts;
double bestDist2 = std::numeric_limits<double>::max(); double bestDist2 = std::numeric_limits<double>::max();
unsigned int bestPoly = NO_INDEX;
bool is_already_on_correct_side_of_boundary = false; // whether [from] is already on the right side of the boundary bool is_already_on_correct_side_of_boundary = false; // whether [from] is already on the right side of the boundary
Point inward_dir; Point inward_dir;
for (unsigned int poly_idx = 0; poly_idx < polygons.size(); poly_idx++) for (unsigned int poly_idx = 0; poly_idx < polygons.size(); poly_idx++)
@ -507,6 +510,7 @@ static bool move_inside_expolys(const ExPolygons& polygons, Point& from, double
if (dist2 < bestDist2) if (dist2 < bestDist2)
{ {
bestDist2 = dist2; bestDist2 = dist2;
bestPoly = poly_idx;
if (distance == 0) { ret = x; } if (distance == 0) { ret = x; }
else else
{ {
@ -543,6 +547,7 @@ static bool move_inside_expolys(const ExPolygons& polygons, Point& from, double
if (dist2 < bestDist2) if (dist2 < bestDist2)
{ {
bestDist2 = dist2; bestDist2 = dist2;
bestPoly = poly_idx;
if (distance == 0) { ret = x; } if (distance == 0) { ret = x; }
else else
{ {
@ -627,6 +632,7 @@ static bool is_inside_ex(const ExPolygons &polygons, const Point &pt)
static bool move_out_expolys(const ExPolygons& polygons, Point& from, double distance, double max_move_distance) static bool move_out_expolys(const ExPolygons& polygons, Point& from, double distance, double max_move_distance)
{ {
Point from0 = from;
ExPolygons polys_dilated = union_ex(offset_ex(polygons, scale_(distance))); ExPolygons polys_dilated = union_ex(offset_ex(polygons, scale_(distance)));
Point pt = projection_onto(polys_dilated, from);// find_closest_ex(from, polys_dilated); Point pt = projection_onto(polys_dilated, from);// find_closest_ex(from, polys_dilated);
Point outward_dir = pt - from; Point outward_dir = pt - from;
@ -728,12 +734,16 @@ void TreeSupport::detect_overhangs(bool detect_first_sharp_tail_only)
const coordf_t extrusion_width = config.get_abs_value("line_width", nozzle_diameter); const coordf_t extrusion_width = config.get_abs_value("line_width", nozzle_diameter);
const coordf_t extrusion_width_scaled = scale_(extrusion_width); const coordf_t extrusion_width_scaled = scale_(extrusion_width);
const coordf_t max_bridge_length = scale_(config.max_bridge_length.value); const coordf_t max_bridge_length = scale_(config.max_bridge_length.value);
const bool bridge_no_support = max_bridge_length > 0;
const bool support_critical_regions_only = config.support_critical_regions_only.value; const bool support_critical_regions_only = config.support_critical_regions_only.value;
const bool config_remove_small_overhangs = config.support_remove_small_overhang.value; const bool config_remove_small_overhangs = config.support_remove_small_overhang.value;
const int enforce_support_layers = config.enforce_support_layers.value; const int enforce_support_layers = config.enforce_support_layers.value;
const double area_thresh_well_supported = SQ(scale_(6)); const double area_thresh_well_supported = SQ(scale_(6));
const double length_thresh_well_supported = scale_(6); const double length_thresh_well_supported = scale_(6);
static const double sharp_tail_max_support_height = 16.f; static const double sharp_tail_max_support_height = 16.f;
// a region is considered well supported if the number of layers below it exceeds this threshold
const int thresh_layers_below = 10 / config.layer_height;
double obj_height = m_object->size().z();
// +1 makes the threshold inclusive // +1 makes the threshold inclusive
double thresh_angle = config.support_threshold_angle.value > EPSILON ? config.support_threshold_angle.value + 1 : 30; double thresh_angle = config.support_threshold_angle.value > EPSILON ? config.support_threshold_angle.value + 1 : 30;
thresh_angle = std::min(thresh_angle, 89.); // should be smaller than 90 thresh_angle = std::min(thresh_angle, 89.); // should be smaller than 90
@ -1396,6 +1406,7 @@ void TreeSupport::generate_toolpaths()
const PrintObjectConfig &object_config = m_object->config(); const PrintObjectConfig &object_config = m_object->config();
coordf_t support_extrusion_width = m_support_params.support_extrusion_width; coordf_t support_extrusion_width = m_support_params.support_extrusion_width;
coordf_t nozzle_diameter = print_config.nozzle_diameter.get_at(object_config.support_filament - 1); coordf_t nozzle_diameter = print_config.nozzle_diameter.get_at(object_config.support_filament - 1);
coordf_t layer_height = object_config.layer_height.value;
const size_t wall_count = object_config.tree_support_wall_count.value; const size_t wall_count = object_config.tree_support_wall_count.value;
// Check if set to zero, use default if so. // Check if set to zero, use default if so.
@ -1409,6 +1420,8 @@ void TreeSupport::generate_toolpaths()
coordf_t interface_density = std::min(1., m_support_material_interface_flow.spacing() / interface_spacing); coordf_t interface_density = std::min(1., m_support_material_interface_flow.spacing() / interface_spacing);
coordf_t bottom_interface_density = std::min(1., m_support_material_interface_flow.spacing() / bottom_interface_spacing); coordf_t bottom_interface_density = std::min(1., m_support_material_interface_flow.spacing() / bottom_interface_spacing);
const coordf_t branch_radius = object_config.tree_support_branch_diameter.value / 2;
const coordf_t branch_radius_scaled = scale_(branch_radius);
if (m_object->support_layers().empty()) if (m_object->support_layers().empty())
return; return;
@ -2113,6 +2126,7 @@ void TreeSupport::draw_circles(const std::vector<std::vector<Node*>>& contact_no
const bool with_lightning_infill = m_support_params.base_fill_pattern == ipLightning; const bool with_lightning_infill = m_support_params.base_fill_pattern == ipLightning;
coordf_t support_extrusion_width = m_support_params.support_extrusion_width; coordf_t support_extrusion_width = m_support_params.support_extrusion_width;
const size_t wall_count = config.tree_support_wall_count.value;
const PrintObjectConfig& object_config = m_object->config(); const PrintObjectConfig& object_config = m_object->config();
BOOST_LOG_TRIVIAL(info) << "draw_circles for object: " << m_object->model_object()->name; BOOST_LOG_TRIVIAL(info) << "draw_circles for object: " << m_object->model_object()->name;
@ -2363,7 +2377,7 @@ void TreeSupport::draw_circles(const std::vector<std::vector<Node*>>& contact_no
ExPolygons& base_areas = ts_layer->base_areas; ExPolygons& base_areas = ts_layer->base_areas;
int layer_nr_lower = layer_nr - 1; int layer_nr_lower = layer_nr - 1;
for (;layer_nr_lower >= 0; layer_nr_lower--) { for (layer_nr_lower; layer_nr_lower >= 0; layer_nr_lower--) {
if (!m_object->get_support_layer(layer_nr_lower + m_raft_layers)->area_groups.empty()) break; if (!m_object->get_support_layer(layer_nr_lower + m_raft_layers)->area_groups.empty()) break;
} }
if (layer_nr_lower <= 0) continue; if (layer_nr_lower <= 0) continue;
@ -2453,7 +2467,7 @@ void TreeSupport::draw_circles(const std::vector<std::vector<Node*>>& contact_no
if (ts_layer->area_groups.empty()) continue; if (ts_layer->area_groups.empty()) continue;
int layer_nr_lower = layer_nr - 1; int layer_nr_lower = layer_nr - 1;
for (;layer_nr_lower >= 0; layer_nr_lower--) { for (layer_nr_lower; layer_nr_lower >= 0; layer_nr_lower--) {
if (!m_object->get_support_layer(layer_nr_lower + m_raft_layers)->area_groups.empty()) break; if (!m_object->get_support_layer(layer_nr_lower + m_raft_layers)->area_groups.empty()) break;
} }
if (layer_nr_lower < 0) continue; if (layer_nr_lower < 0) continue;
@ -2568,10 +2582,15 @@ void TreeSupport::drop_nodes(std::vector<std::vector<Node*>>& contact_nodes)
const coordf_t radius_sample_resolution = m_ts_data->m_radius_sample_resolution; const coordf_t radius_sample_resolution = m_ts_data->m_radius_sample_resolution;
const bool support_on_buildplate_only = config.support_on_build_plate_only.value; const bool support_on_buildplate_only = config.support_on_build_plate_only.value;
const size_t bottom_interface_layers = config.support_interface_bottom_layers.value; const size_t bottom_interface_layers = config.support_interface_bottom_layers.value;
const size_t top_interface_layers = config.support_interface_top_layers.value;
float DO_NOT_MOVER_UNDER_MM = is_slim ? 0 : 5; // do not move contact points under 5mm float DO_NOT_MOVER_UNDER_MM = is_slim ? 0 : 5; // do not move contact points under 5mm
const auto nozzle_diameter = m_object->print()->config().nozzle_diameter.get_at(m_object->config().support_interface_filament-1); const auto nozzle_diameter = m_object->print()->config().nozzle_diameter.get_at(m_object->config().support_interface_filament-1);
const auto support_line_width = config.support_line_width.get_abs_value(nozzle_diameter); const auto support_line_width = config.support_line_width.get_abs_value(nozzle_diameter);
auto get_branch_angle = [this,&config](coordf_t radius) {
if (config.tree_support_branch_angle.value < 30.0) return config.tree_support_branch_angle.value;
return (radius - MIN_BRANCH_RADIUS) / (MAX_BRANCH_RADIUS - MIN_BRANCH_RADIUS) * (config.tree_support_branch_angle.value - 30.0) + 30.0;
};
auto get_max_move_dist = [this, &config, branch_radius, tip_layers, diameter_angle_scale_factor, wall_count, support_extrusion_width, support_line_width](const Node *node, int power = 1) { auto get_max_move_dist = [this, &config, branch_radius, tip_layers, diameter_angle_scale_factor, wall_count, support_extrusion_width, support_line_width](const Node *node, int power = 1) {
double move_dist = node->max_move_dist; double move_dist = node->max_move_dist;
if (node->max_move_dist == 0) { if (node->max_move_dist == 0) {
@ -3183,6 +3202,7 @@ void TreeSupport::adjust_layer_heights(std::vector<std::vector<Node*>>& contact_
const coordf_t layer_height = config.layer_height.value; const coordf_t layer_height = config.layer_height.value;
const coordf_t max_layer_height = m_slicing_params.max_layer_height; const coordf_t max_layer_height = m_slicing_params.max_layer_height;
const size_t bot_intf_layers = config.support_interface_bottom_layers.value; const size_t bot_intf_layers = config.support_interface_bottom_layers.value;
const size_t top_intf_layers = config.support_interface_top_layers.value;
// if already using max layer height, no need to adjust // if already using max layer height, no need to adjust
if (layer_height == max_layer_height) return; if (layer_height == max_layer_height) return;
@ -3304,6 +3324,7 @@ std::vector<LayerHeightData> TreeSupport::plan_layer_heights(std::vector<std::ve
// Insert intermediate layers. // Insert intermediate layers.
size_t n_layers_extra = size_t(ceil(dist / (m_slicing_params.max_suport_layer_height + EPSILON))); size_t n_layers_extra = size_t(ceil(dist / (m_slicing_params.max_suport_layer_height + EPSILON)));
int actual_internel_layers = extr2_layer_nr - extr1_layer_nr - 1;
int extr_layers_left = extr2_layer_nr - extr1_layer_nr - n_layers_extra - 1; int extr_layers_left = extr2_layer_nr - extr1_layer_nr - n_layers_extra - 1;
if (n_layers_extra < 1) if (n_layers_extra < 1)
continue; continue;

View file

@ -173,7 +173,7 @@ static FacetSliceType slice_facet(
// (external on the right of the line) // (external on the right of the line)
for (int j = 0; j < 3; ++ j) { // loop through facet edges for (int j = 0; j < 3; ++ j) { // loop through facet edges
int edge_id; int edge_id;
const stl_vertex *a, *b/* , *c */; const stl_vertex *a, *b, *c;
int a_id, b_id; int a_id, b_id;
{ {
int k = (idx_vertex_lowest + j) % 3; int k = (idx_vertex_lowest + j) % 3;
@ -183,7 +183,7 @@ static FacetSliceType slice_facet(
a = vertices + k; a = vertices + k;
b_id = indices[l]; b_id = indices[l];
b = vertices + l; b = vertices + l;
// c = vertices + (k + 2) % 3; c = vertices + (k + 2) % 3;
} }
// Is edge or face aligned with the cutting plane? // Is edge or face aligned with the cutting plane?

View file

@ -2,6 +2,7 @@
#include <map> #include <map>
#include <random> #include <random>
#include <tbb/parallel_for.h> #include <tbb/parallel_for.h>
#include <tbb/blocked_range.h>
namespace Slic3r { namespace Slic3r {

View file

@ -1,5 +1,5 @@
//#include "TriangulateWall.hpp" #include "TriangulateWall.hpp"
//#include "MTUtils.hpp" #include "MTUtils.hpp"
namespace Slic3r { namespace Slic3r {

View file

@ -1,10 +1,6 @@
#include "Triangulation.hpp" #include "Triangulation.hpp"
#include "IntersectionPoints.hpp" #include "IntersectionPoints.hpp"
#ifndef _WIN32
// On linux and macOS, this include is required
#include <boost/next_prior.hpp> #include <boost/next_prior.hpp>
#endif // _WIN32
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h> #include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Constrained_Delaunay_triangulation_2.h> #include <CGAL/Constrained_Delaunay_triangulation_2.h>
#include <CGAL/Triangulation_vertex_base_with_info_2.h> #include <CGAL/Triangulation_vertex_base_with_info_2.h>

View file

@ -471,9 +471,8 @@ std::string CalibPressureAdvanceLine::print_pa_lines(double start_x, double star
const double e_per_mm = CalibPressureAdvance::e_per_mm(m_line_width, m_height_layer, m_nozzle_diameter, filament_diameter, const double e_per_mm = CalibPressureAdvance::e_per_mm(m_line_width, m_height_layer, m_nozzle_diameter, filament_diameter,
print_flow_ratio); print_flow_ratio);
// Orca: Unused due to skip drawing indicator lines const double thin_e_per_mm = CalibPressureAdvance::e_per_mm(m_thin_line_width, m_height_layer, m_nozzle_diameter, filament_diameter,
// const double thin_e_per_mm = CalibPressureAdvance::e_per_mm(m_thin_line_width, m_height_layer, m_nozzle_diameter, filament_diameter, print_flow_ratio);
// print_flow_ratio);
const double number_e_per_mm = CalibPressureAdvance::e_per_mm(m_number_line_width, m_height_layer, m_nozzle_diameter, filament_diameter, const double number_e_per_mm = CalibPressureAdvance::e_per_mm(m_number_line_width, m_height_layer, m_nozzle_diameter, filament_diameter,
print_flow_ratio); print_flow_ratio);

View file

@ -3,12 +3,19 @@
#include <atomic> #include <atomic>
#include <locale> #include <locale>
#include <ctime>
#include <cstdarg> #include <cstdarg>
#include <stdio.h> #include <stdio.h>
#include "format.hpp" #include "format.hpp"
#include "Platform.hpp"
#include "Time.hpp"
#include "libslic3r.h" #include "libslic3r.h"
#ifdef __APPLE__
#include "MacUtils.hpp"
#endif
#ifdef WIN32 #ifdef WIN32
#include <windows.h> #include <windows.h>
#include <psapi.h> #include <psapi.h>
@ -25,7 +32,6 @@
#ifdef __APPLE__ #ifdef __APPLE__
#include <mach/mach.h> #include <mach/mach.h>
#include <libproc.h> #include <libproc.h>
#include "MacUtils.hpp"
#endif #endif
#ifdef __linux__ #ifdef __linux__
#include <sys/stat.h> #include <sys/stat.h>
@ -33,7 +39,6 @@
#include <sys/sendfile.h> #include <sys/sendfile.h>
#include <dirent.h> #include <dirent.h>
#include <stdio.h> #include <stdio.h>
#include "Platform.hpp"
#endif #endif
#endif #endif
@ -1484,6 +1489,8 @@ bool bbl_calc_md5(std::string &filename, std::string &md5_out)
MD5_Init(&ctx); MD5_Init(&ctx);
boost::nowide::ifstream ifs(filename, std::ios::binary); boost::nowide::ifstream ifs(filename, std::ios::binary);
std::string buf(64 * 1024, 0); std::string buf(64 * 1024, 0);
const std::size_t & size = boost::filesystem::file_size(filename);
std::size_t left_size = size;
while (ifs) { while (ifs) {
ifs.read(buf.data(), buf.size()); ifs.read(buf.data(), buf.size());
int read_bytes = ifs.gcount(); int read_bytes = ifs.gcount();

View file

@ -241,7 +241,7 @@ float GLVolume::last_explosion_ratio = 1.0;
void GLVolume::set_render_color() void GLVolume::set_render_color()
{ {
// bool outside = is_outside || is_below_printbed(); bool outside = is_outside || is_below_printbed();
if (force_native_color || force_neutral_color) { if (force_native_color || force_neutral_color) {
#ifdef ENABBLE_OUTSIDE_COLOR #ifdef ENABBLE_OUTSIDE_COLOR
@ -859,6 +859,7 @@ void GLVolumeCollection::render(GLVolumeCollection::ERenderType type, bool disab
return; return;
GLShaderProgram* sink_shader = GUI::wxGetApp().get_shader("flat"); GLShaderProgram* sink_shader = GUI::wxGetApp().get_shader("flat");
GLShaderProgram* edges_shader = GUI::wxGetApp().get_shader("flat");
if (type == ERenderType::Transparent) { if (type == ERenderType::Transparent) {
glsafe(::glEnable(GL_BLEND)); glsafe(::glEnable(GL_BLEND));
@ -1022,6 +1023,7 @@ bool GLVolumeCollection::check_outside_state(const BuildVolume &build_volume, Mo
GUI::PartPlate* curr_plate = GUI::wxGetApp().plater()->get_partplate_list().get_selected_plate(); GUI::PartPlate* curr_plate = GUI::wxGetApp().plater()->get_partplate_list().get_selected_plate();
const Pointfs& pp_bed_shape = curr_plate->get_shape(); const Pointfs& pp_bed_shape = curr_plate->get_shape();
BuildVolume plate_build_volume(pp_bed_shape, build_volume.printable_height()); BuildVolume plate_build_volume(pp_bed_shape, build_volume.printable_height());
const std::vector<BoundingBoxf3>& exclude_areas = curr_plate->get_exclude_areas();
for (GLVolume* volume : this->volumes) for (GLVolume* volume : this->volumes)
{ {

View file

@ -331,6 +331,7 @@ void AMSMaterialsSetting::create_panel_kn(wxWindow* parent)
kn_val_sizer->Add(m_input_k_val, 0, wxALL | wxEXPAND | wxALIGN_CENTER_VERTICAL, FromDIP(0)); kn_val_sizer->Add(m_input_k_val, 0, wxALL | wxEXPAND | wxALIGN_CENTER_VERTICAL, FromDIP(0));
// n params input // n params input
wxBoxSizer* n_sizer = new wxBoxSizer(wxHORIZONTAL);
m_n_param = new wxStaticText(parent, wxID_ANY, _L("Factor N"), wxDefaultPosition, wxDefaultSize, 0); m_n_param = new wxStaticText(parent, wxID_ANY, _L("Factor N"), wxDefaultPosition, wxDefaultSize, 0);
m_n_param->SetFont(::Label::Body_13); m_n_param->SetFont(::Label::Body_13);
m_n_param->SetForegroundColour(wxColour(50, 58, 61)); m_n_param->SetForegroundColour(wxColour(50, 58, 61));
@ -356,7 +357,7 @@ void AMSMaterialsSetting::paintEvent(wxPaintEvent &evt)
{ {
auto size = GetSize(); auto size = GetSize();
wxPaintDC dc(this); wxPaintDC dc(this);
dc.SetPen(wxPen(StateColor::darkModeColorFor(wxColour("#000000")), 1, wxPENSTYLE_SOLID)); dc.SetPen(wxPen(StateColor::darkModeColorFor(wxColour("#000000")), 1, wxSOLID));
dc.SetBrush(wxBrush(*wxTRANSPARENT_BRUSH)); dc.SetBrush(wxBrush(*wxTRANSPARENT_BRUSH));
dc.DrawRectangle(0, 0, size.x, size.y); dc.DrawRectangle(0, 0, size.x, size.y);
} }

View file

@ -366,6 +366,7 @@ void MaterialItem::doRender(wxDC &dc)
wxString out_txt = m_msg; wxString out_txt = m_msg;
wxString count_txt = ""; wxString count_txt = "";
int new_line_pos = 0;
for (int i = 0; i < m_msg.length(); i++) { for (int i = 0; i < m_msg.length(); i++) {
auto text_size = m_warning_text->GetTextExtent(count_txt); auto text_size = m_warning_text->GetTextExtent(count_txt);
@ -401,6 +402,7 @@ void AmsMapingPopup::on_left_down(wxMouseEvent &evt)
auto pos = ClientToScreen(evt.GetPosition()); auto pos = ClientToScreen(evt.GetPosition());
for (MappingItem *item : m_mapping_item_list) { for (MappingItem *item : m_mapping_item_list) {
auto p_rect = item->ClientToScreen(wxPoint(0, 0)); auto p_rect = item->ClientToScreen(wxPoint(0, 0));
auto left = item->GetSize();
if (pos.x > p_rect.x && pos.y > p_rect.y && pos.x < (p_rect.x + item->GetSize().x) && pos.y < (p_rect.y + item->GetSize().y)) { if (pos.x > p_rect.x && pos.y > p_rect.y && pos.x < (p_rect.x + item->GetSize().x) && pos.y < (p_rect.y + item->GetSize().y)) {
if (item->m_tray_data.type == TrayType::NORMAL && !is_match_material(item->m_tray_data.filament_type)) return; if (item->m_tray_data.type == TrayType::NORMAL && !is_match_material(item->m_tray_data.filament_type)) return;
@ -1522,6 +1524,9 @@ void AmsRMGroup::on_mouse_move(wxMouseEvent& evt)
std::string tray_name = iter->first; std::string tray_name = iter->first;
wxColour tray_color = iter->second; wxColour tray_color = iter->second;
int x = size.x / 2;
int y = size.y / 2;
int radius = size.x / 2;
endAngle += ev_angle; endAngle += ev_angle;
if (click_angle >= startAngle && click_angle < endAngle) { if (click_angle >= startAngle && click_angle < endAngle) {

View file

@ -989,7 +989,7 @@ void AuxiliaryPanel::create_folder(wxString name)
fs::path bfs_path((m_root_dir + "/" + folder_name).ToStdWstring()); fs::path bfs_path((m_root_dir + "/" + folder_name).ToStdWstring());
if (fs::exists(bfs_path)) { if (fs::exists(bfs_path)) {
try { try {
fs::remove_all(bfs_path); bool is_done = fs::remove_all(bfs_path);
} catch (...) { } catch (...) {
BOOST_LOG_TRIVIAL(error) << "Failed removing the auxiliary directory " << m_root_dir.c_str(); BOOST_LOG_TRIVIAL(error) << "Failed removing the auxiliary directory " << m_root_dir.c_str();
} }

View file

@ -337,7 +337,7 @@ wxDataViewItemArray AuxiliaryModel::ImportFile(AuxiliaryModelNode* sel, wxArrayS
dir_path += "\\" + src_bfs_path.filename().generic_wstring(); dir_path += "\\" + src_bfs_path.filename().generic_wstring();
boost::system::error_code ec; boost::system::error_code ec;
if (!fs::copy_file(src_bfs_path, fs::path(dir_path.ToStdWstring()), fs::copy_options::overwrite_existing, ec)) if (!fs::copy_file(src_bfs_path, fs::path(dir_path.ToStdWstring()), fs::copy_option::overwrite_if_exists, ec))
continue; continue;
// Update model data // Update model data

View file

@ -3,6 +3,8 @@
#include <wx/timer.h> #include <wx/timer.h>
#include <wx/gauge.h> #include <wx/gauge.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/statusbr.h>
#include <wx/frame.h>
#include "GUI_App.hpp" #include "GUI_App.hpp"

View file

@ -230,7 +230,7 @@ void BBLTopbar::Init(wxFrame* parent)
this->AddSpacer(FromDIP(10)); this->AddSpacer(FromDIP(10));
wxBitmap save_bitmap = create_scaled_bitmap("topbar_save", nullptr, TOPBAR_ICON_SIZE); wxBitmap save_bitmap = create_scaled_bitmap("topbar_save", nullptr, TOPBAR_ICON_SIZE);
this->AddTool(wxID_SAVE, "", save_bitmap); wxAuiToolBarItem* save_btn = this->AddTool(wxID_SAVE, "", save_bitmap);
this->AddSpacer(FromDIP(10)); this->AddSpacer(FromDIP(10));
@ -278,7 +278,7 @@ void BBLTopbar::Init(wxFrame* parent)
this->AddSpacer(FromDIP(4)); this->AddSpacer(FromDIP(4));
wxBitmap iconize_bitmap = create_scaled_bitmap("topbar_min", nullptr, TOPBAR_ICON_SIZE); wxBitmap iconize_bitmap = create_scaled_bitmap("topbar_min", nullptr, TOPBAR_ICON_SIZE);
this->AddTool(wxID_ICONIZE_FRAME, "", iconize_bitmap); wxAuiToolBarItem* iconize_btn = this->AddTool(wxID_ICONIZE_FRAME, "", iconize_bitmap);
this->AddSpacer(FromDIP(4)); this->AddSpacer(FromDIP(4));
@ -294,7 +294,7 @@ void BBLTopbar::Init(wxFrame* parent)
this->AddSpacer(FromDIP(4)); this->AddSpacer(FromDIP(4));
wxBitmap close_bitmap = create_scaled_bitmap("topbar_close", nullptr, TOPBAR_ICON_SIZE); wxBitmap close_bitmap = create_scaled_bitmap("topbar_close", nullptr, TOPBAR_ICON_SIZE);
this->AddTool(wxID_CLOSE_FRAME, "", close_bitmap); wxAuiToolBarItem* close_btn = this->AddTool(wxID_CLOSE_FRAME, "", close_bitmap);
Realize(); Realize();
// m_toolbar_h = this->GetSize().GetHeight(); // m_toolbar_h = this->GetSize().GetHeight();
@ -466,6 +466,7 @@ void BBLTopbar::UpdateToolbarWidth(int width)
} }
void BBLTopbar::Rescale() { void BBLTopbar::Rescale() {
int em = em_unit(this);
wxAuiToolBarItem* item; wxAuiToolBarItem* item;
/*item = this->FindTool(ID_LOGO); /*item = this->FindTool(ID_LOGO);
@ -495,7 +496,7 @@ void BBLTopbar::Rescale() {
item->SetBitmap(create_scaled_bitmap("calib_sf", nullptr, TOPBAR_ICON_SIZE)); item->SetBitmap(create_scaled_bitmap("calib_sf", nullptr, TOPBAR_ICON_SIZE));
item->SetDisabledBitmap(create_scaled_bitmap("calib_sf_inactive", nullptr, TOPBAR_ICON_SIZE)); item->SetDisabledBitmap(create_scaled_bitmap("calib_sf_inactive", nullptr, TOPBAR_ICON_SIZE));
// item = this->FindTool(ID_TITLE); item = this->FindTool(ID_TITLE);
/*item = this->FindTool(ID_PUBLISH); /*item = this->FindTool(ID_PUBLISH);
item->SetBitmap(create_scaled_bitmap("topbar_publish", this, TOPBAR_ICON_SIZE)); item->SetBitmap(create_scaled_bitmap("topbar_publish", this, TOPBAR_ICON_SIZE));
@ -547,14 +548,14 @@ void BBLTopbar::OnCloseFrame(wxAuiToolBarEvent& event)
void BBLTopbar::OnMouseLeftDClock(wxMouseEvent& mouse) void BBLTopbar::OnMouseLeftDClock(wxMouseEvent& mouse)
{ {
wxPoint mouse_pos = ::wxGetMousePosition();
// check whether mouse is not on any tool item // check whether mouse is not on any tool item
if (this->FindToolByCurrentPosition() != NULL && if (this->FindToolByCurrentPosition() != NULL &&
this->FindToolByCurrentPosition() != m_title_item) { this->FindToolByCurrentPosition() != m_title_item) {
mouse.Skip(); mouse.Skip();
return; return;
} }
#ifdef __WXMSW__ #ifdef __W1XMSW__
wxPoint mouse_pos = ::wxGetMousePosition();
::PostMessage((HWND) m_frame->GetHandle(), WM_NCLBUTTONDBLCLK, HTCAPTION, MAKELPARAM(mouse_pos.x, mouse_pos.y)); ::PostMessage((HWND) m_frame->GetHandle(), WM_NCLBUTTONDBLCLK, HTCAPTION, MAKELPARAM(mouse_pos.x, mouse_pos.y));
return; return;
#endif // __WXMSW__ #endif // __WXMSW__
@ -636,6 +637,7 @@ void BBLTopbar::OnMouseLeftDown(wxMouseEvent& event)
void BBLTopbar::OnMouseLeftUp(wxMouseEvent& event) void BBLTopbar::OnMouseLeftUp(wxMouseEvent& event)
{ {
wxPoint mouse_pos = ::wxGetMousePosition();
if (HasCapture()) if (HasCapture())
{ {
ReleaseMouse(); ReleaseMouse();

View file

@ -5,9 +5,13 @@
#include "format.hpp" #include "format.hpp"
#include <wx/app.h> #include <wx/app.h>
#include <wx/panel.h>
#include <wx/stdpaths.h>
// For zipped archive creation // For zipped archive creation
#include <wx/stdstream.h>
#include <wx/wfstream.h> #include <wx/wfstream.h>
#include <wx/zipstrm.h>
#include <miniz.h> #include <miniz.h>
@ -16,18 +20,23 @@
#include "libslic3r/SLAPrint.hpp" #include "libslic3r/SLAPrint.hpp"
#include "libslic3r/Utils.hpp" #include "libslic3r/Utils.hpp"
#include "libslic3r/GCode/PostProcessor.hpp" #include "libslic3r/GCode/PostProcessor.hpp"
#include "libslic3r/Format/SL1.hpp"
#include "libslic3r/Thread.hpp" #include "libslic3r/Thread.hpp"
#include "libslic3r/libslic3r.h" #include "libslic3r/libslic3r.h"
#include <cassert> #include <cassert>
#include <stdexcept> #include <stdexcept>
#include <cctype>
#include <boost/format/format_fwd.hpp> #include <boost/format/format_fwd.hpp>
#include <boost/filesystem/operations.hpp> #include <boost/filesystem/operations.hpp>
#include <boost/log/trivial.hpp> #include <boost/log/trivial.hpp>
#include <boost/nowide/cstdio.hpp>
#include "I18N.hpp" #include "I18N.hpp"
//#include "RemovableDriveManager.hpp" //#include "RemovableDriveManager.hpp"
#include "slic3r/GUI/Plater.hpp"
namespace Slic3r { namespace Slic3r {
bool SlicingProcessCompletedEvent::critical_error() const bool SlicingProcessCompletedEvent::critical_error() const

View file

@ -67,6 +67,7 @@ PingCodeBindDialog::PingCodeBindDialog(Plater* plater /*= nullptr*/)
SetIcon(wxIcon(encode_path(icon_path.c_str()), wxBITMAP_TYPE_ICO)); SetIcon(wxIcon(encode_path(icon_path.c_str()), wxBITMAP_TYPE_ICO));
SetBackgroundColour(*wxWHITE); SetBackgroundColour(*wxWHITE);
wxBoxSizer* m_sizer_main = new wxBoxSizer(wxVERTICAL);
auto m_line_top = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1, 1), wxTAB_TRAVERSAL); auto m_line_top = new wxPanel(this, wxID_ANY, wxDefaultPosition, wxSize(-1, 1), wxTAB_TRAVERSAL);
m_line_top->SetBackgroundColour(wxColour(166, 169, 170)); m_line_top->SetBackgroundColour(wxColour(166, 169, 170));

View file

@ -226,7 +226,7 @@ SelectMObjectPopup::SelectMObjectPopup(wxWindow* parent)
m_refresh_timer = new wxTimer(); m_refresh_timer = new wxTimer();
m_refresh_timer->SetOwner(this); m_refresh_timer->SetOwner(this);
Bind(EVT_UPDATE_USER_MLIST, &SelectMObjectPopup::update_machine_list, this); Bind(EVT_UPDATE_USER_MLIST, &SelectMObjectPopup::update_machine_list, this);
Bind(wxEVT_TIMER, [this](wxTimerEvent&) { on_timer(); }); Bind(wxEVT_TIMER, &SelectMObjectPopup::on_timer, this);
Bind(EVT_DISSMISS_MACHINE_LIST, &SelectMObjectPopup::on_dissmiss_win, this); Bind(EVT_DISSMISS_MACHINE_LIST, &SelectMObjectPopup::on_dissmiss_win, this);
} }
@ -265,7 +265,7 @@ void SelectMObjectPopup::Popup(wxWindow* WXUNUSED(focus))
} }
} }
on_timer(); wxPostEvent(this, wxTimerEvent());
PopupWindow::Popup(); PopupWindow::Popup();
} }
@ -304,7 +304,7 @@ bool SelectMObjectPopup::Show(bool show) {
return PopupWindow::Show(show); return PopupWindow::Show(show);
} }
void SelectMObjectPopup::on_timer() void SelectMObjectPopup::on_timer(wxTimerEvent& event)
{ {
BOOST_LOG_TRIVIAL(trace) << "SelectMObjectPopup on_timer"; BOOST_LOG_TRIVIAL(trace) << "SelectMObjectPopup on_timer";
wxGetApp().reset_to_active(); wxGetApp().reset_to_active();
@ -459,7 +459,7 @@ CalibrationPanel::CalibrationPanel(wxWindow* parent, wxWindowID id, const wxPoin
Layout(); Layout();
init_timer(); init_timer();
Bind(wxEVT_TIMER, [this](wxTimerEvent&) { on_timer(); }); Bind(wxEVT_TIMER, &CalibrationPanel::on_timer, this);
} }
void CalibrationPanel::init_tabpanel() { void CalibrationPanel::init_tabpanel() {
@ -502,10 +502,10 @@ void CalibrationPanel::init_timer()
m_refresh_timer = new wxTimer(); m_refresh_timer = new wxTimer();
m_refresh_timer->SetOwner(this); m_refresh_timer->SetOwner(this);
m_refresh_timer->Start(REFRESH_INTERVAL); m_refresh_timer->Start(REFRESH_INTERVAL);
on_timer(); wxPostEvent(this, wxTimerEvent());
} }
void CalibrationPanel::on_timer() { void CalibrationPanel::on_timer(wxTimerEvent& event) {
update_all(); update_all();
} }
@ -644,7 +644,7 @@ bool CalibrationPanel::Show(bool show) {
m_refresh_timer->Stop(); m_refresh_timer->Stop();
m_refresh_timer->SetOwner(this); m_refresh_timer->SetOwner(this);
m_refresh_timer->Start(REFRESH_INTERVAL); m_refresh_timer->Start(REFRESH_INTERVAL);
on_timer(); wxPostEvent(this, wxTimerEvent());
DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager(); DeviceManager* dev = Slic3r::GUI::wxGetApp().getDeviceManager();
if (dev) { if (dev) {
@ -670,6 +670,9 @@ bool CalibrationPanel::Show(bool show) {
void CalibrationPanel::on_printer_clicked(wxMouseEvent& event) void CalibrationPanel::on_printer_clicked(wxMouseEvent& event)
{ {
auto mouse_pos = ClientToScreen(event.GetPosition());
wxPoint rect = m_side_tools->ClientToScreen(wxPoint(0, 0));
if (!m_side_tools->is_in_interval()) { if (!m_side_tools->is_in_interval()) {
wxPoint pos = m_side_tools->ClientToScreen(wxPoint(0, 0)); wxPoint pos = m_side_tools->ClientToScreen(wxPoint(0, 0));
pos.y += m_side_tools->GetRect().height; pos.y += m_side_tools->GetRect().height;

View file

@ -94,7 +94,7 @@ private:
private: private:
void OnLeftUp(wxMouseEvent& event); void OnLeftUp(wxMouseEvent& event);
void on_timer(); void on_timer(wxTimerEvent& event);
void update_user_devices(); void update_user_devices();
void on_dissmiss_win(wxCommandEvent& event); void on_dissmiss_win(wxCommandEvent& event);
}; };
@ -117,7 +117,7 @@ public:
protected: protected:
void init_tabpanel(); void init_tabpanel();
void init_timer(); void init_timer();
void on_timer(); void on_timer(wxTimerEvent& event);
int last_status; int last_status;

View file

@ -1126,6 +1126,7 @@ void FlowRateWizard::on_cali_save()
} }
std::string old_preset_name; std::string old_preset_name;
CalibrationPresetPage* preset_page = (static_cast<CalibrationPresetPage*>(preset_step->page));
std::map<int, Preset*> selected_filaments = get_cached_selected_filament(curr_obj); std::map<int, Preset*> selected_filaments = get_cached_selected_filament(curr_obj);
if (!selected_filaments.empty()) { if (!selected_filaments.empty()) {
old_preset_name = selected_filaments.begin()->second->name; old_preset_name = selected_filaments.begin()->second->name;
@ -1172,6 +1173,7 @@ void FlowRateWizard::on_cali_save()
return; return;
std::string old_preset_name; std::string old_preset_name;
CalibrationPresetPage* preset_page = (static_cast<CalibrationPresetPage*>(preset_step->page));
std::map<int, Preset*> selected_filaments = get_cached_selected_filament(curr_obj); std::map<int, Preset*> selected_filaments = get_cached_selected_filament(curr_obj);
if (!selected_filaments.empty()) { if (!selected_filaments.empty()) {
old_preset_name = selected_filaments.begin()->second->name; old_preset_name = selected_filaments.begin()->second->name;
@ -1441,6 +1443,7 @@ void MaxVolumetricSpeedWizard::on_cali_save()
std::string old_preset_name; std::string old_preset_name;
std::string new_preset_name; std::string new_preset_name;
CalibrationPresetPage *preset_page = (static_cast<CalibrationPresetPage *>(preset_step->page));
std::map<int, Preset *> selected_filaments = get_cached_selected_filament(curr_obj); std::map<int, Preset *> selected_filaments = get_cached_selected_filament(curr_obj);
if (!selected_filaments.empty()) { if (!selected_filaments.empty()) {
old_preset_name = selected_filaments.begin()->second->name; old_preset_name = selected_filaments.begin()->second->name;

View file

@ -790,6 +790,7 @@ wxString CalibrationPresetPage::format_text(wxString& m_msg)
wxString out_txt = m_msg; wxString out_txt = m_msg;
wxString count_txt = ""; wxString count_txt = "";
int new_line_pos = 0;
for (int i = 0; i < m_msg.length(); i++) { for (int i = 0; i < m_msg.length(); i++) {
auto text_size = m_statictext_printer_msg->GetTextExtent(count_txt); auto text_size = m_statictext_printer_msg->GetTextExtent(count_txt);

View file

@ -282,6 +282,7 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con
} }
double sparse_infill_density = config->option<ConfigOptionPercent>("sparse_infill_density")->value; double sparse_infill_density = config->option<ConfigOptionPercent>("sparse_infill_density")->value;
auto timelapse_type = config->opt_enum<TimelapseType>("timelapse_type");
if (!is_plate_config && if (!is_plate_config &&
config->opt_bool("spiral_mode") && config->opt_bool("spiral_mode") &&
@ -297,6 +298,7 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con
{ {
DynamicPrintConfig new_conf = *config; DynamicPrintConfig new_conf = *config;
auto answer = show_spiral_mode_settings_dialog(is_object_config); auto answer = show_spiral_mode_settings_dialog(is_object_config);
bool support = true;
if (answer == wxID_YES) { if (answer == wxID_YES) {
new_conf.set_key_value("wall_loops", new ConfigOptionInt(1)); new_conf.set_key_value("wall_loops", new ConfigOptionInt(1));
new_conf.set_key_value("top_shell_layers", new ConfigOptionInt(0)); new_conf.set_key_value("top_shell_layers", new ConfigOptionInt(0));
@ -308,6 +310,8 @@ void ConfigManipulation::update_print_fff_config(DynamicPrintConfig* config, con
new_conf.set_key_value("wall_direction", new ConfigOptionEnum<WallDirection>(WallDirection::Auto)); new_conf.set_key_value("wall_direction", new ConfigOptionEnum<WallDirection>(WallDirection::Auto));
new_conf.set_key_value("timelapse_type", new ConfigOptionEnum<TimelapseType>(tlTraditional)); new_conf.set_key_value("timelapse_type", new ConfigOptionEnum<TimelapseType>(tlTraditional));
sparse_infill_density = 0; sparse_infill_density = 0;
timelapse_type = TimelapseType::tlTraditional;
support = false;
} }
else { else {
new_conf.set_key_value("spiral_mode", new ConfigOptionBool(false)); new_conf.set_key_value("spiral_mode", new ConfigOptionBool(false));

View file

@ -2438,7 +2438,7 @@ bool ConfigWizard::priv::apply_config(AppConfig *app_config, PresetBundle *prese
header = _L_PLURAL("A new vendor was installed and one of its printers will be activated", "New vendors were installed and one of theirs printers will be activated", install_bundles.size()); header = _L_PLURAL("A new vendor was installed and one of its printers will be activated", "New vendors were installed and one of theirs printers will be activated", install_bundles.size());
// Decide whether to create snapshot based on run_reason and the reset profile checkbox // Decide whether to create snapshot based on run_reason and the reset profile checkbox
/*bool snapshot = true; bool snapshot = true;
Snapshot::Reason snapshot_reason = Snapshot::SNAPSHOT_UPGRADE; Snapshot::Reason snapshot_reason = Snapshot::SNAPSHOT_UPGRADE;
switch (run_reason) { switch (run_reason) {
case ConfigWizard::RR_DATA_EMPTY: case ConfigWizard::RR_DATA_EMPTY:
@ -2456,7 +2456,7 @@ bool ConfigWizard::priv::apply_config(AppConfig *app_config, PresetBundle *prese
snapshot = false; snapshot = false;
snapshot_reason = Snapshot::SNAPSHOT_USER; snapshot_reason = Snapshot::SNAPSHOT_USER;
break; break;
}*/ }
//BBS: remove snapshot logic //BBS: remove snapshot logic
/*if (snapshot && ! take_config_snapshot_cancel_on_error(*app_config, snapshot_reason, "", _u8L("Do you want to continue changing the configuration?"))) /*if (snapshot && ! take_config_snapshot_cancel_on_error(*app_config, snapshot_reason, "", _u8L("Do you want to continue changing the configuration?")))
@ -2701,6 +2701,7 @@ ConfigWizard::ConfigWizard(wxWindow *parent)
//BBS: add BBL as default //BBS: add BBL as default
const auto bbl_it = p->bundles.find("BBL"); const auto bbl_it = p->bundles.find("BBL");
wxCHECK_RET(bbl_it != p->bundles.cend(), "Vendor BambooLab not found"); wxCHECK_RET(bbl_it != p->bundles.cend(), "Vendor BambooLab not found");
const VendorProfile * vendor_bbl = bbl_it->second.vendor_profile;
p->only_sla_mode = false; p->only_sla_mode = false;
p->any_sla_selected = p->check_sla_selected(); p->any_sla_selected = p->check_sla_selected();

View file

@ -315,7 +315,7 @@ static wxBoxSizer *create_preset_tree(wxWindow *parent, std::pair<std::string, s
int row = 1; int row = 1;
for (std::shared_ptr<Preset> preset : printer_and_preset.second) { for (std::shared_ptr<Preset> preset : printer_and_preset.second) {
wxString preset_name = wxString::FromUTF8(preset->name); wxString preset_name = wxString::FromUTF8(preset->name);
treeCtrl->AppendItem(rootId, preset_name); wxTreeItemId childId1 = treeCtrl->AppendItem(rootId, preset_name);
row++; row++;
} }
@ -671,6 +671,8 @@ bool CreateFilamentPresetDialog::is_check_box_selected()
wxBoxSizer *CreateFilamentPresetDialog::create_item(FilamentOptionType option_type) wxBoxSizer *CreateFilamentPresetDialog::create_item(FilamentOptionType option_type)
{ {
wxSizer *item = nullptr;
switch (option_type) { switch (option_type) {
case VENDOR: return create_vendor_item(); case VENDOR: return create_vendor_item();
case TYPE: return create_type_item(); case TYPE: return create_type_item();
@ -3090,6 +3092,10 @@ bool CreatePrinterPresetDialog::check_printable_area() {
if (x == 0 || y == 0) { if (x == 0 || y == 0) {
return false; return false;
} }
double x0 = 0.0;
double y0 = 0.0;
double x1 = x;
double y1 = y;
if (dx >= x || dy >= y) { if (dx >= x || dy >= y) {
return false; return false;
} }
@ -4627,6 +4633,7 @@ wxBoxSizer *EditFilamentPresetDialog::create_button_sizer()
WarningDialog dlg(this, _L("All the filament presets belong to this filament would be deleted. \nIf you are using this filament on your printer, please reset the filament information for that slot."), _L("Delete filament"), wxYES | wxCANCEL | wxCANCEL_DEFAULT | wxCENTRE); WarningDialog dlg(this, _L("All the filament presets belong to this filament would be deleted. \nIf you are using this filament on your printer, please reset the filament information for that slot."), _L("Delete filament"), wxYES | wxCANCEL | wxCANCEL_DEFAULT | wxCENTRE);
int res = dlg.ShowModal(); int res = dlg.ShowModal();
if (wxID_YES == res) { if (wxID_YES == res) {
PresetBundle *preset_bundle = wxGetApp().preset_bundle;
std::set<std::shared_ptr<Preset>> inherit_preset_names; std::set<std::shared_ptr<Preset>> inherit_preset_names;
std::set<std::shared_ptr<Preset>> root_preset_names; std::set<std::shared_ptr<Preset>> root_preset_names;
for (std::pair<std::string, std::vector<std::shared_ptr<Preset>>> printer_and_preset : m_printer_compatible_presets) { for (std::pair<std::string, std::vector<std::shared_ptr<Preset>>> printer_and_preset : m_printer_compatible_presets) {

View file

@ -89,6 +89,7 @@ void DailyTipsDataRenderer::open_wiki() const
void DailyTipsDataRenderer::render(const ImVec2& pos, const ImVec2& size) const void DailyTipsDataRenderer::render(const ImVec2& pos, const ImVec2& size) const
{ {
ImGuiWrapper& imgui = *wxGetApp().imgui();
ImGuiWindow* parent_window = ImGui::GetCurrentWindow(); ImGuiWindow* parent_window = ImGui::GetCurrentWindow();
int window_flags = parent_window->Flags; int window_flags = parent_window->Flags;
window_flags &= ~ImGuiWindowFlags_NoScrollbar; window_flags &= ~ImGuiWindowFlags_NoScrollbar;
@ -189,6 +190,7 @@ void DailyTipsDataRenderer::render_text(const ImVec2& start_pos, const ImVec2& s
std::string tips_line = _u8L("For more information, please check out Wiki"); std::string tips_line = _u8L("For more information, please check out Wiki");
std::string wiki_part_text = _u8L("Wiki"); std::string wiki_part_text = _u8L("Wiki");
std::string first_part_text = tips_line.substr(0, tips_line.find(wiki_part_text)); std::string first_part_text = tips_line.substr(0, tips_line.find(wiki_part_text));
ImVec2 wiki_part_size = ImGui::CalcTextSize(wiki_part_text.c_str());
ImVec2 first_part_size = ImGui::CalcTextSize(first_part_text.c_str()); ImVec2 first_part_size = ImGui::CalcTextSize(first_part_text.c_str());
//text //text
@ -198,6 +200,7 @@ void DailyTipsDataRenderer::render_text(const ImVec2& start_pos, const ImVec2& s
ImColor HyperColor = ImColor(31, 142, 234, (int)(255 * m_fade_opacity)).Value; ImColor HyperColor = ImColor(31, 142, 234, (int)(255 * m_fade_opacity)).Value;
ImVec2 wiki_part_rect_min = ImVec2(link_start_pos.x + first_part_size.x, link_start_pos.y); ImVec2 wiki_part_rect_min = ImVec2(link_start_pos.x + first_part_size.x, link_start_pos.y);
ImVec2 wiki_part_rect_max = wiki_part_rect_min + wiki_part_size;
ImGui::PushStyleColor(ImGuiCol_Text, HyperColor.Value); ImGui::PushStyleColor(ImGuiCol_Text, HyperColor.Value);
ImGui::SetCursorScreenPos(wiki_part_rect_min); ImGui::SetCursorScreenPos(wiki_part_rect_min);
imgui.text(wiki_part_text.c_str()); imgui.text(wiki_part_text.c_str());
@ -261,6 +264,9 @@ ImVec2 DailyTipsPanel::get_size()
void DailyTipsPanel::render() void DailyTipsPanel::render()
{ {
ImGuiWrapper& imgui = *wxGetApp().imgui();
float scale = imgui.get_font_size() / 15.0f;
if (!m_first_enter) { if (!m_first_enter) {
retrieve_data_from_hint_database(HintDataNavigation::Curr); retrieve_data_from_hint_database(HintDataNavigation::Curr);
m_first_enter = true; m_first_enter = true;

View file

@ -1007,17 +1007,17 @@ int MachineObject::ams_filament_mapping(std::vector<FilamentInfo> filaments, std
reset_mapping_result(result); reset_mapping_result(result);
try { try {
// try to use ordering ams mapping // try to use ordering ams mapping
// bool order_mapping_result = true; bool order_mapping_result = true;
for (int i = 0; i < filaments.size(); i++) { for (int i = 0; i < filaments.size(); i++) {
if (i >= tray_info_list.size()) { if (i >= tray_info_list.size()) {
// order_mapping_result = false; order_mapping_result = false;
break; break;
} }
if (tray_info_list[i].tray_id == -1) { if (tray_info_list[i].tray_id == -1) {
result[i].tray_id = tray_info_list[i].tray_id; result[i].tray_id = tray_info_list[i].tray_id;
} else { } else {
if (!tray_info_list[i].type.empty() && tray_info_list[i].type != filaments[i].type) { if (!tray_info_list[i].type.empty() && tray_info_list[i].type != filaments[i].type) {
// order_mapping_result = false; order_mapping_result = false;
break; break;
} else { } else {
result[i].tray_id = tray_info_list[i].tray_id; result[i].tray_id = tray_info_list[i].tray_id;
@ -1319,6 +1319,7 @@ wxString MachineObject::get_curr_stage()
int MachineObject::get_curr_stage_idx() int MachineObject::get_curr_stage_idx()
{ {
int result = -1;
for (int i = 0; i < stage_list_info.size(); i++) { for (int i = 0; i < stage_list_info.size(); i++) {
if (stage_list_info[i] == stage_curr) { if (stage_list_info[i] == stage_curr) {
return i; return i;
@ -2348,6 +2349,8 @@ int MachineObject::command_xcam_control(std::string module_name, bool on_off, st
int MachineObject::command_xcam_control_ai_monitoring(bool on_off, std::string lvl) int MachineObject::command_xcam_control_ai_monitoring(bool on_off, std::string lvl)
{ {
bool print_halt = (lvl == "never_halt") ? false:true;
xcam_ai_monitoring = on_off; xcam_ai_monitoring = on_off;
xcam_ai_monitoring_hold_count = HOLD_COUNT_MAX; xcam_ai_monitoring_hold_count = HOLD_COUNT_MAX;
xcam_ai_monitoring_sensitivity = lvl; xcam_ai_monitoring_sensitivity = lvl;
@ -5659,7 +5662,9 @@ void DeviceManager::parse_user_print_info(std::string body)
} }
} }
} }
catch (std::exception&) {} catch (std::exception& e) {
;
}
} }
void DeviceManager::update_user_machine_list_info() void DeviceManager::update_user_machine_list_info()

View file

@ -128,6 +128,7 @@ wxString DownloadProgressDialog::format_text(wxStaticText* st, wxString str, int
wxString out_txt = str; wxString out_txt = str;
wxString count_txt = ""; wxString count_txt = "";
int new_line_pos = 0;
for (int i = 0; i < str.length(); i++) { for (int i = 0; i < str.length(); i++) {
auto text_size = st->GetTextExtent(count_txt); auto text_size = st->GetTextExtent(count_txt);

View file

@ -626,6 +626,7 @@ void ExtrusionCalibration::update_combobox_filaments()
{ {
m_comboBox_filament->SetValue(wxEmptyString); m_comboBox_filament->SetValue(wxEmptyString);
user_filaments.clear(); user_filaments.clear();
int selection_idx = -1;
int filament_index = -1; int filament_index = -1;
int curr_selection = -1; int curr_selection = -1;
wxArrayString filament_items; wxArrayString filament_items;

View file

@ -2,6 +2,7 @@
#include "I18N.hpp" #include "I18N.hpp"
#include "GUI_App.hpp" #include "GUI_App.hpp"
#include "GUI.hpp"
#include "MainFrame.hpp" #include "MainFrame.hpp"
#include "ExtraRenderers.hpp" #include "ExtraRenderers.hpp"
#include "format.hpp" #include "format.hpp"

View file

@ -1447,6 +1447,9 @@ void GCodeViewer::_render_calibration_thumbnail_internal(ThumbnailData& thumbnai
//shader->set_uniform("emission_factor", 0.0f); //shader->set_uniform("emission_factor", 0.0f);
} }
else { else {
switch (buffer.render_primitive_type) {
default: break;
}
int uniform_color = shader->get_uniform_location("uniform_color"); int uniform_color = shader->get_uniform_location("uniform_color");
auto it_path = buffer.render_paths.begin(); auto it_path = buffer.render_paths.begin();
for (unsigned int ibuffer_id = 0; ibuffer_id < static_cast<unsigned int>(buffer.indices.size()); ++ibuffer_id) { for (unsigned int ibuffer_id = 0; ibuffer_id < static_cast<unsigned int>(buffer.indices.size()); ++ibuffer_id) {
@ -1744,10 +1747,10 @@ void GCodeViewer::update_layers_slider_mode()
// true -> single-extruder printer profile OR // true -> single-extruder printer profile OR
// multi-extruder printer profile , but whole model is printed by only one extruder // multi-extruder printer profile , but whole model is printed by only one extruder
// false -> multi-extruder printer profile , and model is printed by several extruders // false -> multi-extruder printer profile , and model is printed by several extruders
// bool one_extruder_printed_model = true; bool one_extruder_printed_model = true;
// extruder used for whole model for multi-extruder printer profile // extruder used for whole model for multi-extruder printer profile
// int only_extruder = -1; int only_extruder = -1;
// BBS // BBS
if (wxGetApp().filaments_cnt() > 1) { if (wxGetApp().filaments_cnt() > 1) {
@ -1770,10 +1773,10 @@ void GCodeViewer::update_layers_slider_mode()
return true; return true;
}; };
// if (is_one_extruder_printed_model()) if (is_one_extruder_printed_model())
// only_extruder = extruder; only_extruder = extruder;
// else else
// one_extruder_printed_model = false; one_extruder_printed_model = false;
} }
} }
@ -3244,6 +3247,12 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool
return in_layers_range(path.sub_paths.front().first.s_id) && in_layers_range(path.sub_paths.back().last.s_id); return in_layers_range(path.sub_paths.front().first.s_id) && in_layers_range(path.sub_paths.back().last.s_id);
}; };
//BBS
auto is_extruder_in_layer_range = [this](const Path& path, size_t extruder_id) {
return path.extruder_id == extruder_id;
};
auto is_travel_in_layers_range = [this](size_t path_id, size_t min_id, size_t max_id) { auto is_travel_in_layers_range = [this](size_t path_id, size_t min_id, size_t max_id) {
const TBuffer& buffer = m_buffers[buffer_id(EMoveType::Travel)]; const TBuffer& buffer = m_buffers[buffer_id(EMoveType::Travel)];
if (path_id >= buffer.paths.size()) if (path_id >= buffer.paths.size())
@ -4088,6 +4097,7 @@ void GCodeViewer::render_all_plates_stats(const std::vector<const GCodeProcessor
std::vector<double> support_used_filaments_g_all_plates; std::vector<double> support_used_filaments_g_all_plates;
float total_time_all_plates = 0.0f; float total_time_all_plates = 0.0f;
float total_cost_all_plates = 0.0f; float total_cost_all_plates = 0.0f;
bool show_detailed_statistics_page = false;
struct ColumnData { struct ColumnData {
enum { enum {
Model = 1, Model = 1,
@ -4389,6 +4399,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
const float icon_size = ImGui::GetTextLineHeight() * 0.7; const float icon_size = ImGui::GetTextLineHeight() * 0.7;
//BBS GUI refactor //BBS GUI refactor
//const float percent_bar_size = 2.0f * ImGui::GetTextLineHeight(); //const float percent_bar_size = 2.0f * ImGui::GetTextLineHeight();
const float percent_bar_size = 0;
bool imperial_units = wxGetApp().app_config->get("use_inches") == "1"; bool imperial_units = wxGetApp().app_config->get("use_inches") == "1";
ImDrawList* draw_list = ImGui::GetWindowDrawList(); ImDrawList* draw_list = ImGui::GetWindowDrawList();
@ -4500,6 +4511,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
append_range_item(0, range.min, decimals); append_range_item(0, range.min, decimals);
} }
else { else {
const float step_size = range.step_size();
for (int i = static_cast<int>(Range_Colors.size()) - 1; i >= 0; --i) { for (int i = static_cast<int>(Range_Colors.size()) - 1; i >= 0; --i) {
append_range_item(i, range.get_value_at_step(i), decimals); append_range_item(i, range.get_value_at_step(i), decimals);
} }
@ -4548,7 +4560,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
return ret; return ret;
}; };
/*auto color_print_ranges = [this](unsigned char extruder_id, const std::vector<CustomGCode::Item>& custom_gcode_per_print_z) { auto color_print_ranges = [this](unsigned char extruder_id, const std::vector<CustomGCode::Item>& custom_gcode_per_print_z) {
std::vector<std::pair<ColorRGBA, std::pair<double, double>>> ret; std::vector<std::pair<ColorRGBA, std::pair<double, double>>> ret;
ret.reserve(custom_gcode_per_print_z.size()); ret.reserve(custom_gcode_per_print_z.size());
@ -4577,7 +4589,27 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
} }
return ret; return ret;
};*/ };
auto upto_label = [](double z) {
char buf[64];
::sprintf(buf, "%.2f", z);
return _u8L("up to") + " " + std::string(buf) + " " + _u8L("mm");
};
auto above_label = [](double z) {
char buf[64];
::sprintf(buf, "%.2f", z);
return _u8L("above") + " " + std::string(buf) + " " + _u8L("mm");
};
auto fromto_label = [](double z1, double z2) {
char buf1[64];
::sprintf(buf1, "%.2f", z1);
char buf2[64];
::sprintf(buf2, "%.2f", z2);
return _u8L("from") + " " + std::string(buf1) + " " + _u8L("to") + " " + std::string(buf2) + " " + _u8L("mm");
};
auto role_time_and_percent = [time_mode](ExtrusionRole role) { auto role_time_and_percent = [time_mode](ExtrusionRole role) {
auto it = std::find_if(time_mode.roles_times.begin(), time_mode.roles_times.end(), [role](const std::pair<ExtrusionRole, float>& item) { return role == item.first; }); auto it = std::find_if(time_mode.roles_times.begin(), time_mode.roles_times.end(), [role](const std::pair<ExtrusionRole, float>& item) { return role == item.first; });
@ -5074,7 +5106,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
ImGuiWindow* window = ImGui::GetCurrentWindow(); ImGuiWindow* window = ImGui::GetCurrentWindow();
const ImRect separator(ImVec2(window->Pos.x + window_padding * 3, window->DC.CursorPos.y), ImVec2(window->Pos.x + window->Size.x - window_padding * 3, window->DC.CursorPos.y + 1.0f)); const ImRect separator(ImVec2(window->Pos.x + window_padding * 3, window->DC.CursorPos.y), ImVec2(window->Pos.x + window->Size.x - window_padding * 3, window->DC.CursorPos.y + 1.0f));
ImGui::ItemSize(ImVec2(0.0f, 0.0f)); ImGui::ItemSize(ImVec2(0.0f, 0.0f));
ImGui::ItemAdd(separator, 0); const bool item_visible = ImGui::ItemAdd(separator, 0);
window->DrawList->AddLine(separator.Min, ImVec2(separator.Max.x, separator.Min.y), ImGui::GetColorU32(ImGuiCol_Separator)); window->DrawList->AddLine(separator.Min, ImVec2(separator.Max.x, separator.Min.y), ImGui::GetColorU32(ImGuiCol_Separator));
std::vector<std::pair<std::string, float>> columns_offsets; std::vector<std::pair<std::string, float>> columns_offsets;
@ -5196,7 +5228,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
return items; return items;
}; };
/*auto append_color_change = [&imgui](const ColorRGBA& color1, const ColorRGBA& color2, const std::array<float, 4>& offsets, const Times& times) { auto append_color_change = [&imgui](const ColorRGBA& color1, const ColorRGBA& color2, const std::array<float, 4>& offsets, const Times& times) {
imgui.text(_u8L("Color change")); imgui.text(_u8L("Color change"));
ImGui::SameLine(); ImGui::SameLine();
@ -5213,9 +5245,9 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
ImGui::SameLine(offsets[0]); ImGui::SameLine(offsets[0]);
imgui.text(short_time(get_time_dhms(times.second - times.first))); imgui.text(short_time(get_time_dhms(times.second - times.first)));
};*/ };
/*auto append_print = [&imgui, imperial_units](const ColorRGBA& color, const std::array<float, 4>& offsets, const Times& times, std::pair<double, double> used_filament) { auto append_print = [&imgui, imperial_units](const ColorRGBA& color, const std::array<float, 4>& offsets, const Times& times, std::pair<double, double> used_filament) {
imgui.text(_u8L("Print")); imgui.text(_u8L("Print"));
ImGui::SameLine(); ImGui::SameLine();
@ -5241,7 +5273,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
::sprintf(buffer, "%.2f g", used_filament.second); ::sprintf(buffer, "%.2f g", used_filament.second);
imgui.text(buffer); imgui.text(buffer);
} }
};*/ };
PartialTimes partial_times = generate_partial_times(time_mode.custom_gcode_times, m_print_statistics.volumes_per_color_change); PartialTimes partial_times = generate_partial_times(time_mode.custom_gcode_times, m_print_statistics.volumes_per_color_change);
if (!partial_times.empty()) { if (!partial_times.empty()) {
@ -5348,7 +5380,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
// } // }
//} //}
/* auto any_option_available = [this]() { auto any_option_available = [this]() {
auto available = [this](EMoveType type) { auto available = [this](EMoveType type) {
const TBuffer& buffer = m_buffers[buffer_id(type)]; const TBuffer& buffer = m_buffers[buffer_id(type)];
return buffer.visible && buffer.has_data(); return buffer.visible && buffer.has_data();
@ -5361,7 +5393,7 @@ void GCodeViewer::render_legend(float &legend_height, int canvas_width, int canv
available(EMoveType::Tool_change) || available(EMoveType::Tool_change) ||
available(EMoveType::Unretract) || available(EMoveType::Unretract) ||
available(EMoveType::Seam); available(EMoveType::Seam);
};*/ };
//auto add_option = [this, append_item](EMoveType move_type, EOptionsColors color, const std::string& text) { //auto add_option = [this, append_item](EMoveType move_type, EOptionsColors color, const std::string& text) {
// const TBuffer& buffer = m_buffers[buffer_id(move_type)]; // const TBuffer& buffer = m_buffers[buffer_id(move_type)];

View file

@ -2773,7 +2773,7 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
ModelInstanceEPrintVolumeState state; ModelInstanceEPrintVolumeState state;
const bool contained_min_one = m_volumes.check_outside_state(m_bed.build_volume(), &state); const bool contained_min_one = m_volumes.check_outside_state(m_bed.build_volume(), &state);
const bool partlyOut = (state == ModelInstanceEPrintVolumeState::ModelInstancePVS_Partly_Outside); const bool partlyOut = (state == ModelInstanceEPrintVolumeState::ModelInstancePVS_Partly_Outside);
// const bool fullyOut = (state == ModelInstanceEPrintVolumeState::ModelInstancePVS_Fully_Outside); const bool fullyOut = (state == ModelInstanceEPrintVolumeState::ModelInstancePVS_Fully_Outside);
_set_warning_notification(EWarning::ObjectClashed, partlyOut); _set_warning_notification(EWarning::ObjectClashed, partlyOut);
//BBS: turn off the warning when fully outside //BBS: turn off the warning when fully outside
@ -4080,12 +4080,12 @@ void GLCanvas3D::on_mouse(wxMouseEvent& evt)
// Set focus in order to remove it from sidebar fields // Set focus in order to remove it from sidebar fields
if (m_canvas != nullptr) { if (m_canvas != nullptr) {
// Only set focus, if the top level window of this canvas is active. // Only set focus, if the top level window of this canvas is active.
// auto p = dynamic_cast<wxWindow*>(evt.GetEventObject()); auto p = dynamic_cast<wxWindow*>(evt.GetEventObject());
// while (p->GetParent()) while (p->GetParent())
// p = p->GetParent(); p = p->GetParent();
// auto *top_level_wnd = dynamic_cast<wxTopLevelWindow*>(p); auto *top_level_wnd = dynamic_cast<wxTopLevelWindow*>(p);
// if (top_level_wnd && top_level_wnd->IsActive() && !wxGetApp().get_side_menu_popup_status()) if (top_level_wnd && top_level_wnd->IsActive() && !wxGetApp().get_side_menu_popup_status())
// m_canvas->SetFocus(); ;// m_canvas->SetFocus();
m_mouse.position = pos.cast<double>(); m_mouse.position = pos.cast<double>();
m_tooltip_enabled = false; m_tooltip_enabled = false;
// 1) forces a frame render to ensure that m_hover_volume_idxs is updated even when the user right clicks while // 1) forces a frame render to ensure that m_hover_volume_idxs is updated even when the user right clicks while
@ -5093,6 +5093,7 @@ std::vector<Vec2f> GLCanvas3D::get_empty_cells(const Vec2f start_point, const Ve
} }
for (size_t i = 0; i < m_model->objects.size(); ++i) { for (size_t i = 0; i < m_model->objects.size(); ++i) {
ModelObject* model_object = m_model->objects[i]; ModelObject* model_object = m_model->objects[i];
auto id = model_object->id().id;
ModelInstance* model_instance0 = model_object->instances.front(); ModelInstance* model_instance0 = model_object->instances.front();
Polygon hull_2d = model_object->convex_hull_2d(Geometry::assemble_transform({ 0.0, 0.0, model_instance0->get_offset().z() }, model_instance0->get_rotation(), Polygon hull_2d = model_object->convex_hull_2d(Geometry::assemble_transform({ 0.0, 0.0, model_instance0->get_offset().z() }, model_instance0->get_rotation(),
model_instance0->get_scaling_factor(), model_instance0->get_mirror())); model_instance0->get_scaling_factor(), model_instance0->get_mirror()));
@ -5363,6 +5364,7 @@ void GLCanvas3D::update_sequential_clearance()
for (int i = k+1; i < bounding_box_count; i++) for (int i = k+1; i < bounding_box_count; i++)
{ {
Polygon& next_convex = convex_and_bounding_boxes[i].hull_polygon;
BoundingBox& next_bbox = convex_and_bounding_boxes[i].bounding_box; BoundingBox& next_bbox = convex_and_bounding_boxes[i].bounding_box;
auto py1 = next_bbox.min.y(); auto py1 = next_bbox.min.y();
auto py2 = next_bbox.max.y(); auto py2 = next_bbox.max.y();
@ -5423,6 +5425,7 @@ bool GLCanvas3D::_render_orient_menu(float left, float right, float bottom, floa
ImGuiWrapper* imgui = wxGetApp().imgui(); ImGuiWrapper* imgui = wxGetApp().imgui();
auto canvas_w = float(get_canvas_size().get_width()); auto canvas_w = float(get_canvas_size().get_width());
auto canvas_h = float(get_canvas_size().get_height());
//BBS: GUI refactor: move main toolbar to the right //BBS: GUI refactor: move main toolbar to the right
//original use center as {0.0}, and top is (canvas_h/2), bottom is (-canvas_h/2), also plus inv_camera //original use center as {0.0}, and top is (canvas_h/2), bottom is (-canvas_h/2), also plus inv_camera
//now change to left_up as {0,0}, and top is 0, bottom is canvas_h //now change to left_up as {0,0}, and top is 0, bottom is canvas_h
@ -5431,7 +5434,6 @@ bool GLCanvas3D::_render_orient_menu(float left, float right, float bottom, floa
ImGuiWrapper::push_toolbar_style(get_scale()); ImGuiWrapper::push_toolbar_style(get_scale());
imgui->set_next_window_pos(x, m_main_toolbar.get_height(), ImGuiCond_Always, 0.5f, 0.0f); imgui->set_next_window_pos(x, m_main_toolbar.get_height(), ImGuiCond_Always, 0.5f, 0.0f);
#else #else
auto canvas_h = float(get_canvas_size().get_height());
const float x = canvas_w - m_main_toolbar.get_width(); const float x = canvas_w - m_main_toolbar.get_width();
const float y = 0.5f * canvas_h - top * float(wxGetApp().plater()->get_camera().get_zoom()); const float y = 0.5f * canvas_h - top * float(wxGetApp().plater()->get_camera().get_zoom());
imgui->set_next_window_pos(x, y, ImGuiCond_Always, 1.0f, 0.0f); imgui->set_next_window_pos(x, y, ImGuiCond_Always, 1.0f, 0.0f);
@ -5446,13 +5448,13 @@ bool GLCanvas3D::_render_orient_menu(float left, float right, float bottom, floa
PrinterTechnology ptech = current_printer_technology(); PrinterTechnology ptech = current_printer_technology();
bool settings_changed = false; bool settings_changed = false;
// float angle_min = 45.f; float angle_min = 45.f;
std::string angle_key = "overhang_angle", rot_key = "enable_rotation"; std::string angle_key = "overhang_angle", rot_key = "enable_rotation";
std::string key_min_area = "min_area"; std::string key_min_area = "min_area";
std::string postfix = "_fff"; std::string postfix = "_fff";
if (ptech == ptSLA) { if (ptech == ptSLA) {
// angle_min = 45.f; angle_min = 45.f;
postfix = "_sla"; postfix = "_sla";
} }
@ -5508,6 +5510,7 @@ bool GLCanvas3D::_render_arrange_menu(float left, float right, float bottom, flo
ImGuiWrapper *imgui = wxGetApp().imgui(); ImGuiWrapper *imgui = wxGetApp().imgui();
auto canvas_w = float(get_canvas_size().get_width()); auto canvas_w = float(get_canvas_size().get_width());
auto canvas_h = float(get_canvas_size().get_height());
//BBS: GUI refactor: move main toolbar to the right //BBS: GUI refactor: move main toolbar to the right
//original use center as {0.0}, and top is (canvas_h/2), bottom is (-canvas_h/2), also plus inv_camera //original use center as {0.0}, and top is (canvas_h/2), bottom is (-canvas_h/2), also plus inv_camera
//now change to left_up as {0,0}, and top is 0, bottom is canvas_h //now change to left_up as {0,0}, and top is 0, bottom is canvas_h
@ -5515,8 +5518,8 @@ bool GLCanvas3D::_render_arrange_menu(float left, float right, float bottom, flo
float left_pos = m_main_toolbar.get_item("arrange")->render_left_pos; float left_pos = m_main_toolbar.get_item("arrange")->render_left_pos;
const float x = (1 + left_pos) * canvas_w / 2; const float x = (1 + left_pos) * canvas_w / 2;
imgui->set_next_window_pos(x, m_main_toolbar.get_height(), ImGuiCond_Always, 0.0f, 0.0f); imgui->set_next_window_pos(x, m_main_toolbar.get_height(), ImGuiCond_Always, 0.0f, 0.0f);
#else #else
auto canvas_h = float(get_canvas_size().get_height());
const float x = canvas_w - m_main_toolbar.get_width(); const float x = canvas_w - m_main_toolbar.get_width();
const float y = 0.5f * canvas_h - top * float(wxGetApp().plater()->get_camera().get_zoom()); const float y = 0.5f * canvas_h - top * float(wxGetApp().plater()->get_camera().get_zoom());
imgui->set_next_window_pos(x, y, ImGuiCond_Always, 1.0f, 0.0f); imgui->set_next_window_pos(x, y, ImGuiCond_Always, 1.0f, 0.0f);
@ -8096,13 +8099,16 @@ void GLCanvas3D::_render_return_toolbar() const
ImVec2 button_icon_size = ImVec2(font_size * 1.3, font_size * 1.3); ImVec2 button_icon_size = ImVec2(font_size * 1.3, font_size * 1.3);
ImGuiWrapper& imgui = *wxGetApp().imgui(); ImGuiWrapper& imgui = *wxGetApp().imgui();
Size cnv_size = get_canvas_size();
auto canvas_w = float(cnv_size.get_width());
auto canvas_h = float(cnv_size.get_height());
float window_width = real_size.x + button_icon_size.x + imgui.scaled(2.0f);
float window_height = button_icon_size.y + imgui.scaled(2.0f);
float window_pos_x = 30.0f + (is_collapse_toolbar_on_left() ? (get_collapse_toolbar_width() + 5.f) : 0); float window_pos_x = 30.0f + (is_collapse_toolbar_on_left() ? (get_collapse_toolbar_width() + 5.f) : 0);
float window_pos_y = 14.0f; float window_pos_y = 14.0f;
imgui.set_next_window_pos(window_pos_x, window_pos_y, ImGuiCond_Always, 0, 0); imgui.set_next_window_pos(window_pos_x, window_pos_y, ImGuiCond_Always, 0, 0);
#ifdef __WINDOWS__ #ifdef __WINDOWS__
float window_width = real_size.x + button_icon_size.x + imgui.scaled(2.0f);
float window_height = button_icon_size.y + imgui.scaled(2.0f);
imgui.set_next_window_size(window_width, window_height, ImGuiCond_Always); imgui.set_next_window_size(window_width, window_height, ImGuiCond_Always);
#endif #endif
@ -8116,6 +8122,9 @@ void GLCanvas3D::_render_return_toolbar() const
imgui.begin(_L("Assembly Return"), ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoBackground imgui.begin(_L("Assembly Return"), ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoScrollbar | ImGuiWindowFlags_NoBackground
| ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse); | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse);
float button_width = 20;
float button_height = 20;
ImVec2 size = ImVec2(button_width, button_height); // Size of the image we want to make visible
ImVec2 uv0 = ImVec2(0.0f, 0.0f); ImVec2 uv0 = ImVec2(0.0f, 0.0f);
ImVec2 uv1 = ImVec2(1.0f, 1.0f); ImVec2 uv1 = ImVec2(1.0f, 1.0f);
@ -8391,11 +8400,11 @@ void GLCanvas3D::_render_assemble_control() const
ImGui::SameLine(window_padding.x + 2 * text_size_x + slider_width + item_spacing * 7 + value_size); ImGui::SameLine(window_padding.x + 2 * text_size_x + slider_width + item_spacing * 7 + value_size);
ImGui::PushItemWidth(slider_width); ImGui::PushItemWidth(slider_width);
imgui->bbl_slider_float_style("##ratio_slider", &m_explosion_ratio, 1.0f, 3.0f, "%1.2f"); bool explosion_slider_changed = imgui->bbl_slider_float_style("##ratio_slider", &m_explosion_ratio, 1.0f, 3.0f, "%1.2f");
ImGui::SameLine(window_padding.x + 2 * text_size_x + 2 * slider_width + item_spacing * 8 + value_size); ImGui::SameLine(window_padding.x + 2 * text_size_x + 2 * slider_width + item_spacing * 8 + value_size);
ImGui::PushItemWidth(value_size); ImGui::PushItemWidth(value_size);
ImGui::BBLDragFloat("##ratio_input", &m_explosion_ratio, 0.1f, 1.0f, 3.0f, "%1.2f"); bool explosion_input_changed = ImGui::BBLDragFloat("##ratio_input", &m_explosion_ratio, 0.1f, 1.0f, 3.0f, "%1.2f");
} }
imgui->end(); imgui->end();
@ -8425,6 +8434,7 @@ void GLCanvas3D::_render_assemble_info() const
auto canvas_h = float(get_canvas_size().get_height()); auto canvas_h = float(get_canvas_size().get_height());
float space_size = imgui->get_style_scaling() * 8.0f; float space_size = imgui->get_style_scaling() * 8.0f;
float caption_max = imgui->calc_text_size(_L("Total Volume:")).x + 3 * space_size; float caption_max = imgui->calc_text_size(_L("Total Volume:")).x + 3 * space_size;
char buf[3][64];
ImGuiIO& io = ImGui::GetIO(); ImGuiIO& io = ImGui::GetIO();
ImFont* font = io.Fonts->Fonts[0]; ImFont* font = io.Fonts->Fonts[0];

View file

@ -470,6 +470,7 @@ void GLTexture::reset()
bool GLTexture::generate_from_text_string(const std::string& text_str, wxFont &font, wxColor background, wxColor foreground) bool GLTexture::generate_from_text_string(const std::string& text_str, wxFont &font, wxColor background, wxColor foreground)
{ {
int w,h,hl;
return generate_from_text(text_str, font, background, foreground); return generate_from_text(text_str, font, background, foreground);
} }

View file

@ -1466,6 +1466,7 @@ void GLToolbar::render_vertical(const GLCanvas3D& parent)
int tex_width, tex_height; int tex_width, tex_height;
if (item->is_action_with_text_image()) { if (item->is_action_with_text_image()) {
float scaled_text_size = m_layout.text_size * m_layout.scale * inv_cnv_w; float scaled_text_size = m_layout.text_size * m_layout.scale * inv_cnv_w;
float scaled_text_width = item->get_extra_size_ratio() * icons_size_x;
float scaled_text_border = 2.5 * m_layout.scale * inv_cnv_h; float scaled_text_border = 2.5 * m_layout.scale * inv_cnv_h;
float scaled_text_height = icons_size_y / 2.0f; float scaled_text_height = icons_size_y / 2.0f;
item->render_text(left, left + scaled_text_size, top - scaled_text_border - scaled_text_height, top - scaled_text_border); item->render_text(left, left + scaled_text_size, top - scaled_text_border - scaled_text_height, top - scaled_text_border);

View file

@ -301,6 +301,7 @@ public:
memDC.SetTextForeground(StateColor::darkModeColorFor(wxColour(144, 144, 144))); memDC.SetTextForeground(StateColor::darkModeColorFor(wxColour(144, 144, 144)));
int width = bitmap.GetWidth(); int width = bitmap.GetWidth();
int text_height = memDC.GetTextExtent(text).GetHeight(); int text_height = memDC.GetTextExtent(text).GetHeight();
int text_width = memDC.GetTextExtent(text).GetWidth();
wxRect text_rect(wxPoint(0, m_action_line_y_position), wxPoint(width, m_action_line_y_position + text_height)); wxRect text_rect(wxPoint(0, m_action_line_y_position), wxPoint(width, m_action_line_y_position + text_height));
memDC.DrawLabel(text, text_rect, wxALIGN_CENTER); memDC.DrawLabel(text, text_rect, wxALIGN_CENTER);
@ -962,7 +963,7 @@ void GUI_App::post_init()
// Neither wxShowEvent nor wxWindowCreateEvent work reliably. // Neither wxShowEvent nor wxWindowCreateEvent work reliably.
if (this->preset_updater) { // G-Code Viewer does not initialize preset_updater. if (this->preset_updater) { // G-Code Viewer does not initialize preset_updater.
CallAfter([this] { CallAfter([this] {
this->config_wizard_startup(); bool cw_showed = this->config_wizard_startup();
std::string http_url = get_http_url(app_config->get_country_code()); std::string http_url = get_http_url(app_config->get_country_code());
std::string language = GUI::into_u8(current_language_code()); std::string language = GUI::into_u8(current_language_code());
@ -1025,7 +1026,8 @@ void GUI_App::post_init()
try { try {
std::time_t lw_t = boost::filesystem::last_write_time(temp_path) ; std::time_t lw_t = boost::filesystem::last_write_time(temp_path) ;
files_vec.push_back({ lw_t, temp_path.filename().string() }); files_vec.push_back({ lw_t, temp_path.filename().string() });
} catch (std::exception&) {} } catch (const std::exception &ex) {
}
} }
std::sort(files_vec.begin(), files_vec.end(), []( std::sort(files_vec.begin(), files_vec.end(), [](
std::pair<time_t, std::string> &a, std::pair<time_t, std::string> &b) { std::pair<time_t, std::string> &a, std::pair<time_t, std::string> &b) {
@ -1315,6 +1317,7 @@ int GUI_App::download_plugin(std::string name, std::string package_name, Install
.on_complete([&pro_fn, tmp_path, target_file_path](std::string body, unsigned status) { .on_complete([&pro_fn, tmp_path, target_file_path](std::string body, unsigned status) {
BOOST_LOG_TRIVIAL(info) << "[download_plugin 2] completed"; BOOST_LOG_TRIVIAL(info) << "[download_plugin 2] completed";
bool cancel = false; bool cancel = false;
int percent = 0;
fs::fstream file(tmp_path, std::ios::out | std::ios::binary | std::ios::trunc); fs::fstream file(tmp_path, std::ios::out | std::ios::binary | std::ios::trunc);
file.write(body.c_str(), body.size()); file.write(body.c_str(), body.size());
file.close(); file.close();
@ -1924,13 +1927,8 @@ void GUI_App::init_app_config()
boost::filesystem::create_directory(data_dir_path); boost::filesystem::create_directory(data_dir_path);
} }
// Change current directory of application // Change current dirtory of application
auto path = encode_path((Slic3r::data_dir() + "/log").c_str()); chdir(encode_path((Slic3r::data_dir() + "/log").c_str()).c_str());
#ifdef _WIN32
_chdir(path.c_str());
#else
chdir(path.c_str());
#endif
} else { } else {
m_datadir_redefined = true; m_datadir_redefined = true;
} }
@ -3367,7 +3365,7 @@ if (res) {
mainframe->refresh_plugin_tips(); mainframe->refresh_plugin_tips();
// BBS: remove SLA related message // BBS: remove SLA related message
} }
} catch (std::exception&) { } catch (std::exception &e) {
// wxMessageBox(e.what(), "", MB_OK); // wxMessageBox(e.what(), "", MB_OK);
} }
} }
@ -3381,7 +3379,9 @@ void GUI_App::ShowDownNetPluginDlg() {
return; return;
DownloadProgressDialog dlg(_L("Downloading Bambu Network Plug-in")); DownloadProgressDialog dlg(_L("Downloading Bambu Network Plug-in"));
dlg.ShowModal(); dlg.ShowModal();
} catch (std::exception&) {} } catch (std::exception &e) {
;
}
} }
void GUI_App::ShowUserLogin(bool show) void GUI_App::ShowUserLogin(bool show)
@ -3396,7 +3396,9 @@ void GUI_App::ShowUserLogin(bool show)
login_dlg = new ZUserLogin(); login_dlg = new ZUserLogin();
} }
login_dlg->ShowModal(); login_dlg->ShowModal();
} catch (std::exception&) {} } catch (std::exception &e) {
;
}
} else { } else {
if (login_dlg) if (login_dlg)
login_dlg->EndModal(wxID_OK); login_dlg->EndModal(wxID_OK);
@ -3416,7 +3418,7 @@ void GUI_App::ShowOnlyFilament() {
// BBS: remove SLA related message // BBS: remove SLA related message
} }
} catch (std::exception&) { } catch (std::exception &e) {
// wxMessageBox(e.what(), "", MB_OK); // wxMessageBox(e.what(), "", MB_OK);
} }
} }
@ -3828,10 +3830,10 @@ std::string GUI_App::handle_web_request(std::string cmd)
auto keyCode = key_event_node.get<int>("key"); auto keyCode = key_event_node.get<int>("key");
auto ctrlKey = key_event_node.get<bool>("ctrl"); auto ctrlKey = key_event_node.get<bool>("ctrl");
auto shiftKey = key_event_node.get<bool>("shift"); auto shiftKey = key_event_node.get<bool>("shift");
auto cmdKey = key_event_node.get<bool>("cmd");
wxKeyEvent e(wxEVT_CHAR_HOOK); wxKeyEvent e(wxEVT_CHAR_HOOK);
#ifdef __APPLE__ #ifdef __APPLE__
auto cmdKey = key_event_node.get<bool>("cmd");
e.SetControlDown(cmdKey); e.SetControlDown(cmdKey);
e.SetRawControlDown(ctrlKey); e.SetRawControlDown(ctrlKey);
#else #else
@ -4787,6 +4789,8 @@ void GUI_App::start_sync_user_preset(bool with_progress_dlg)
}); });
} }
unsigned int http_code = 200;
/* get list witch need to be deleted*/ /* get list witch need to be deleted*/
std::vector<string> delete_cache_presets = get_delete_cache_presets_lock(); std::vector<string> delete_cache_presets = get_delete_cache_presets_lock();
for (auto it = delete_cache_presets.begin(); it != delete_cache_presets.end();) { for (auto it = delete_cache_presets.begin(); it != delete_cache_presets.end();) {
@ -5470,7 +5474,7 @@ void GUI_App::show_ip_address_enter_dialog_handler(wxCommandEvent& evt)
void GUI_App::open_preferences(size_t open_on_tab, const std::string& highlight_option) void GUI_App::open_preferences(size_t open_on_tab, const std::string& highlight_option)
{ {
// bool app_layout_changed = false; bool app_layout_changed = false;
{ {
// the dialog needs to be destroyed before the call to recreate_GUI() // the dialog needs to be destroyed before the call to recreate_GUI()
// or sometimes the application crashes into wxDialogBase() destructor // or sometimes the application crashes into wxDialogBase() destructor
@ -6503,6 +6507,8 @@ static bool del_win_registry(HKEY hkeyHive, const wchar_t *pszVar, const wchar_t
return false; return false;
if (!bDidntExist) { if (!bDidntExist) {
DWORD dwDisposition;
HKEY hkey;
iRC = ::RegDeleteKeyExW(hkeyHive, pszVar, KEY_ALL_ACCESS, 0); iRC = ::RegDeleteKeyExW(hkeyHive, pszVar, KEY_ALL_ACCESS, 0);
if (iRC == ERROR_SUCCESS) { if (iRC == ERROR_SUCCESS) {
return true; return true;

View file

@ -3,6 +3,8 @@
#include "I18N.hpp" #include "I18N.hpp"
#include "wxExtensions.hpp" #include "wxExtensions.hpp"
#include <boost/filesystem.hpp>
#include "GUI_App.hpp" #include "GUI_App.hpp"
#include "Plater.hpp" #include "Plater.hpp"
#include "libslic3r/Model.hpp" #include "libslic3r/Model.hpp"

View file

@ -711,9 +711,9 @@ wxMenuItem* MenuFactory::append_menu_item_settings(wxMenu* menu_)
// Create new items for settings popupmenu // Create new items for settings popupmenu
// if (printer_technology() == ptFFF || if (printer_technology() == ptFFF ||
// (menu->GetMenuItems().size() > 0 && !menu->GetMenuItems().back()->IsSeparator())) (menu->GetMenuItems().size() > 0 && !menu->GetMenuItems().back()->IsSeparator()))
// menu->SetFirstSeparator(); ;// menu->SetFirstSeparator();
// detect itemm for adding of the setting // detect itemm for adding of the setting
ObjectList* object_list = obj_list(); ObjectList* object_list = obj_list();
@ -1341,7 +1341,7 @@ void MenuFactory::create_extra_object_menu()
m_object_menu.AppendSeparator(); m_object_menu.AppendSeparator();
// Set filament insert menu item here // Set filament insert menu item here
// Set Printable // Set Printable
append_menu_item_printable(&m_object_menu); wxMenuItem* menu_item_printable = append_menu_item_printable(&m_object_menu);
append_menu_item_per_object_process(&m_object_menu); append_menu_item_per_object_process(&m_object_menu);
// Enter per object parameters // Enter per object parameters
append_menu_item_per_object_settings(&m_object_menu); append_menu_item_per_object_settings(&m_object_menu);
@ -1496,6 +1496,8 @@ void MenuFactory::create_plate_menu()
// arrange objects on current plate // arrange objects on current plate
append_menu_item(menu, wxID_ANY, _L("Arrange"), _L("arrange current plate"), append_menu_item(menu, wxID_ANY, _L("Arrange"), _L("arrange current plate"),
[](wxCommandEvent&) { [](wxCommandEvent&) {
PartPlate* plate = plater()->get_partplate_list().get_selected_plate();
assert(plate);
plater()->set_prepare_state(Job::PREPARE_STATE_MENU); plater()->set_prepare_state(Job::PREPARE_STATE_MENU);
plater()->arrange(); plater()->arrange();
}, "", nullptr, }, "", nullptr,
@ -1508,6 +1510,8 @@ void MenuFactory::create_plate_menu()
append_menu_item( append_menu_item(
menu, wxID_ANY, _L("Reload All"), _L("reload all from disk"), menu, wxID_ANY, _L("Reload All"), _L("reload all from disk"),
[](wxCommandEvent&) { [](wxCommandEvent&) {
PartPlate* plate = plater()->get_partplate_list().get_selected_plate();
assert(plate);
plater()->set_prepare_state(Job::PREPARE_STATE_MENU); plater()->set_prepare_state(Job::PREPARE_STATE_MENU);
plater()->reload_all_from_disk(); plater()->reload_all_from_disk();
}, },
@ -1516,6 +1520,8 @@ void MenuFactory::create_plate_menu()
// orient objects on current plate // orient objects on current plate
append_menu_item(menu, wxID_ANY, _L("Auto Rotate"), _L("auto rotate current plate"), append_menu_item(menu, wxID_ANY, _L("Auto Rotate"), _L("auto rotate current plate"),
[](wxCommandEvent&) { [](wxCommandEvent&) {
PartPlate* plate = plater()->get_partplate_list().get_selected_plate();
assert(plate);
//BBS TODO call auto rotate for current plate //BBS TODO call auto rotate for current plate
plater()->set_prepare_state(Job::PREPARE_STATE_MENU); plater()->set_prepare_state(Job::PREPARE_STATE_MENU);
plater()->orient(); plater()->orient();
@ -1800,7 +1806,7 @@ void MenuFactory::append_menu_item_clone(wxMenu* menu)
void MenuFactory::append_menu_item_simplify(wxMenu* menu) void MenuFactory::append_menu_item_simplify(wxMenu* menu)
{ {
append_menu_item(menu, wxID_ANY, _L("Simplify Model"), "", wxMenuItem* menu_item = append_menu_item(menu, wxID_ANY, _L("Simplify Model"), "",
[](wxCommandEvent&) { obj_list()->simplify(); }, "", menu, [](wxCommandEvent&) { obj_list()->simplify(); }, "", menu,
[]() {return plater()->can_simplify(); }, m_parent); []() {return plater()->can_simplify(); }, m_parent);
} }
@ -1913,16 +1919,16 @@ void MenuFactory::append_menu_item_change_filament(wxMenu* menu)
wxMenu* extruder_selection_menu = new wxMenu(); wxMenu* extruder_selection_menu = new wxMenu();
const wxString& name = sels.Count() == 1 ? names[0] : names[1]; const wxString& name = sels.Count() == 1 ? names[0] : names[1];
// int initial_extruder = -1; // negative value for multiple object/part selection int initial_extruder = -1; // negative value for multiple object/part selection
// if (sels.Count() == 1) { if (sels.Count() == 1) {
// const ModelConfig& config = obj_list()->get_item_config(sels[0]); const ModelConfig& config = obj_list()->get_item_config(sels[0]);
// // BBS // BBS
// const auto sel_vol = obj_list()->get_selected_model_volume(); const auto sel_vol = obj_list()->get_selected_model_volume();
// if (sel_vol && sel_vol->type() == ModelVolumeType::PARAMETER_MODIFIER) if (sel_vol && sel_vol->type() == ModelVolumeType::PARAMETER_MODIFIER)
// initial_extruder = config.has("extruder") ? config.extruder() : 0; initial_extruder = config.has("extruder") ? config.extruder() : 0;
// else else
// initial_extruder = config.has("extruder") ? config.extruder() : 1; initial_extruder = config.has("extruder") ? config.extruder() : 1;
// } }
// BBS // BBS
bool has_modifier = false; bool has_modifier = false;
@ -1963,6 +1969,7 @@ void MenuFactory::append_menu_item_change_filament(wxMenu* menu)
void MenuFactory::append_menu_item_set_printable(wxMenu* menu) void MenuFactory::append_menu_item_set_printable(wxMenu* menu)
{ {
const Selection& selection = plater()->canvas3D()->get_selection();
bool all_printable = true; bool all_printable = true;
ObjectList* list = obj_list(); ObjectList* list = obj_list();
wxDataViewItemArray sels; wxDataViewItemArray sels;
@ -1970,6 +1977,7 @@ void MenuFactory::append_menu_item_set_printable(wxMenu* menu)
for (wxDataViewItem item : sels) { for (wxDataViewItem item : sels) {
ItemType type = list->GetModel()->GetItemType(item); ItemType type = list->GetModel()->GetItemType(item);
bool check;
if (type != itInstance && type != itObject) if (type != itInstance && type != itObject)
continue; continue;
else { else {
@ -2012,8 +2020,8 @@ void MenuFactory::append_menu_item_locked(wxMenu* menu)
}, "", nullptr, []() { return true; }, m_parent); }, "", nullptr, []() { return true; }, m_parent);
m_parent->Bind(wxEVT_UPDATE_UI, [](wxUpdateUIEvent& evt) { m_parent->Bind(wxEVT_UPDATE_UI, [](wxUpdateUIEvent& evt) {
// PartPlate* plate = plater()->get_partplate_list().get_selected_plate(); PartPlate* plate = plater()->get_partplate_list().get_selected_plate();
// assert(plate); assert(plate);
//bool check = plate->is_locked(); //bool check = plate->is_locked();
//evt.Check(check); //evt.Check(check);
plater()->set_current_canvas_as_dirty(); plater()->set_current_canvas_as_dirty();
@ -2049,6 +2057,8 @@ void MenuFactory::append_menu_item_plate_name(wxMenu *menu)
m_parent->Bind( m_parent->Bind(
wxEVT_UPDATE_UI, wxEVT_UPDATE_UI,
[](wxUpdateUIEvent &evt) { [](wxUpdateUIEvent &evt) {
PartPlate *plate = plater()->get_partplate_list().get_selected_plate();
assert(plate);
plater()->set_current_canvas_as_dirty(); plater()->set_current_canvas_as_dirty();
}, },
item->GetId()); item->GetId());

View file

@ -713,6 +713,7 @@ void ObjectList::update_plate_values_for_items()
Unselect(item); Unselect(item);
bool is_old_parent_expanded = IsExpanded(old_parent); bool is_old_parent_expanded = IsExpanded(old_parent);
bool is_expanded = IsExpanded(item);
m_objects_model->OnPlateChange(plate_idx, item); m_objects_model->OnPlateChange(plate_idx, item);
if (is_old_parent_expanded) if (is_old_parent_expanded)
Expand(old_parent); Expand(old_parent);
@ -738,6 +739,7 @@ void ObjectList::object_config_options_changed(const ObjectVolumeID& ov_id)
if (ov_id.object == nullptr) if (ov_id.object == nullptr)
return; return;
ModelObjectPtrs& objects = wxGetApp().model().objects;
ModelObject* mo = ov_id.object; ModelObject* mo = ov_id.object;
ModelVolume* mv = ov_id.volume; ModelVolume* mv = ov_id.volume;
@ -844,6 +846,8 @@ void ObjectList::update_filament_colors()
void ObjectList::update_name_column_width() const void ObjectList::update_name_column_width() const
{ {
wxSize client_size = this->GetClientSize(); wxSize client_size = this->GetClientSize();
bool p_vbar = this->GetParent()->HasScrollbar(wxVERTICAL);
bool p_hbar = this->GetParent()->HasScrollbar(wxHORIZONTAL);
auto em = em_unit(const_cast<ObjectList*>(this)); auto em = em_unit(const_cast<ObjectList*>(this));
// BBS: walkaround for wxDataViewCtrl::HasScrollbar() does not return correct status // BBS: walkaround for wxDataViewCtrl::HasScrollbar() does not return correct status
@ -932,6 +936,7 @@ void ObjectList::update_name_in_model(const wxDataViewItem& item) const
if (m_objects_model->GetItemType(item) & itPlate) { if (m_objects_model->GetItemType(item) & itPlate) {
std::string name = m_objects_model->GetName(item).ToUTF8().data(); std::string name = m_objects_model->GetName(item).ToUTF8().data();
int plate_idx = -1; int plate_idx = -1;
const ItemType type0 = m_objects_model->GetItemType(item, plate_idx);
if (plate_idx >= 0) { if (plate_idx >= 0) {
auto plate = wxGetApp().plater()->get_partplate_list().get_plate(plate_idx); auto plate = wxGetApp().plater()->get_partplate_list().get_plate(plate_idx);
if (plate->get_plate_name() != name) { if (plate->get_plate_name() != name) {
@ -1346,6 +1351,7 @@ void ObjectList::show_context_menu(const bool evt_context_menu)
plater->SetPlateIndexByRightMenuInLeftUI(-1); plater->SetPlateIndexByRightMenuInLeftUI(-1);
if (type & itPlate) { if (type & itPlate) {
int plate_idx = -1; int plate_idx = -1;
const ItemType type0 = m_objects_model->GetItemType(item, plate_idx);
if (plate_idx >= 0) { if (plate_idx >= 0) {
plater->SetPlateIndexByRightMenuInLeftUI(plate_idx); plater->SetPlateIndexByRightMenuInLeftUI(plate_idx);
} }
@ -2000,7 +2006,7 @@ void ObjectList::load_modifier(const wxArrayString& input_files, ModelObject& mo
try { try {
model = Model::read_from_file(input_file, nullptr, nullptr, LoadStrategy::LoadModel); model = Model::read_from_file(input_file, nullptr, nullptr, LoadStrategy::LoadModel);
} }
catch (std::exception&) { catch (std::exception& e) {
// auto msg = _L("Error!") + " " + input_file + " : " + e.what() + "."; // auto msg = _L("Error!") + " " + input_file + " : " + e.what() + ".";
auto msg = _L("Error!") + " " + _L("Failed to get the model data in the current file."); auto msg = _L("Error!") + " " + _L("Failed to get the model data in the current file.");
show_error(parent, msg); show_error(parent, msg);
@ -2899,7 +2905,7 @@ void ObjectList::boolean()
new_object->config.assign_config(object->config); new_object->config.assign_config(object->config);
if (new_object->instances.empty()) if (new_object->instances.empty())
new_object->add_instance(); new_object->add_instance();
new_object->add_volume(mesh); ModelVolume* new_volume = new_object->add_volume(mesh);
// BBS: ensure on bed but no need to ensure locate in the center around origin // BBS: ensure on bed but no need to ensure locate in the center around origin
new_object->ensure_on_bed(); new_object->ensure_on_bed();
@ -2946,9 +2952,9 @@ DynamicPrintConfig ObjectList::get_default_layer_config(const int obj_idx)
wxGetApp().preset_bundle->prints.get_edited_preset().config.opt_float("layer_height"); wxGetApp().preset_bundle->prints.get_edited_preset().config.opt_float("layer_height");
config.set_key_value("layer_height",new ConfigOptionFloat(layer_height)); config.set_key_value("layer_height",new ConfigOptionFloat(layer_height));
// BBS // BBS
// int extruder = object(obj_idx)->config.has("extruder") ? int extruder = object(obj_idx)->config.has("extruder") ?
// object(obj_idx)->config.opt_int("extruder") : object(obj_idx)->config.opt_int("extruder") :
// wxGetApp().preset_bundle->prints.get_edited_preset().config.opt_float("extruder"); wxGetApp().preset_bundle->prints.get_edited_preset().config.opt_float("extruder");
config.set_key_value("extruder", new ConfigOptionInt(0)); config.set_key_value("extruder", new ConfigOptionInt(0));
return config; return config;
@ -3170,8 +3176,8 @@ void ObjectList::part_selection_changed()
bool update_and_show_settings = false; bool update_and_show_settings = false;
bool update_and_show_layers = false; bool update_and_show_layers = false;
// bool enable_manipulation{true}; Orca: Removed because not used bool enable_manipulation{true};
// bool disable_ss_manipulation{false}; Orca: Removed because not used bool disable_ss_manipulation{false};
bool disable_ununiform_scale{false}; bool disable_ununiform_scale{false};
const auto item = GetSelection(); const auto item = GetSelection();
@ -3179,7 +3185,7 @@ void ObjectList::part_selection_changed()
og_name = _L("Cut Connectors information"); og_name = _L("Cut Connectors information");
update_and_show_manipulations = true; update_and_show_manipulations = true;
// enable_manipulation = false; enable_manipulation = false;
disable_ununiform_scale = true; disable_ununiform_scale = true;
} }
else if (item && (m_objects_model->GetItemType(item) & itPlate)) { else if (item && (m_objects_model->GetItemType(item) & itPlate)) {
@ -3196,7 +3202,7 @@ void ObjectList::part_selection_changed()
obj_idx = selection.get_object_idx(); obj_idx = selection.get_object_idx();
ModelObject *object = (*m_objects)[obj_idx]; ModelObject *object = (*m_objects)[obj_idx];
m_config = &object->config; m_config = &object->config;
// disable_ss_manipulation = object->is_cut(); disable_ss_manipulation = object->is_cut();
} }
else { else {
og_name = _L("Group manipulation"); og_name = _L("Group manipulation");
@ -3205,17 +3211,17 @@ void ObjectList::part_selection_changed()
update_and_show_manipulations = !selection.is_single_full_instance(); update_and_show_manipulations = !selection.is_single_full_instance();
if (int obj_idx = selection.get_object_idx(); obj_idx >= 0) { if (int obj_idx = selection.get_object_idx(); obj_idx >= 0) {
// if (selection.is_any_volume() || selection.is_any_modifier()) if (selection.is_any_volume() || selection.is_any_modifier())
// enable_manipulation = !(*m_objects)[obj_idx]->is_cut(); enable_manipulation = !(*m_objects)[obj_idx]->is_cut();
// else // if (item && m_objects_model->GetItemType(item) == itInstanceRoot) else // if (item && m_objects_model->GetItemType(item) == itInstanceRoot)
// disable_ss_manipulation = (*m_objects)[obj_idx]->is_cut(); disable_ss_manipulation = (*m_objects)[obj_idx]->is_cut();
} }
else { else {
wxDataViewItemArray sels; wxDataViewItemArray sels;
GetSelections(sels); GetSelections(sels);
if (selection.is_single_full_object() || selection.is_multiple_full_instance()) { if (selection.is_single_full_object() || selection.is_multiple_full_instance()) {
// int obj_idx = m_objects_model->GetObjectIdByItem(sels.front()); int obj_idx = m_objects_model->GetObjectIdByItem(sels.front());
// disable_ss_manipulation = (*m_objects)[obj_idx]->is_cut(); disable_ss_manipulation = (*m_objects)[obj_idx]->is_cut();
} else if (selection.is_mixed() || selection.is_multiple_full_object()) { } else if (selection.is_mixed() || selection.is_multiple_full_object()) {
std::map<CutObjectBase, std::set<int>> cut_objects; std::map<CutObjectBase, std::set<int>> cut_objects;
@ -3234,7 +3240,7 @@ void ObjectList::part_selection_changed()
// check if selected cut objects are "full selected" // check if selected cut objects are "full selected"
for (auto cut_object : cut_objects) for (auto cut_object : cut_objects)
if (cut_object.first.check_sum() != cut_object.second.size()) { if (cut_object.first.check_sum() != cut_object.second.size()) {
// disable_ss_manipulation = true; disable_ss_manipulation = true;
break; break;
} }
disable_ununiform_scale = !cut_objects.empty(); disable_ununiform_scale = !cut_objects.empty();
@ -3282,7 +3288,7 @@ void ObjectList::part_selection_changed()
// BBS: select object to edit config // BBS: select object to edit config
m_config = &(*m_objects)[obj_idx]->config; m_config = &(*m_objects)[obj_idx]->config;
update_and_show_settings = true; update_and_show_settings = true;
// disable_ss_manipulation = (*m_objects)[obj_idx]->is_cut(); disable_ss_manipulation = (*m_objects)[obj_idx]->is_cut();
} }
} }
else { else {
@ -3310,8 +3316,8 @@ void ObjectList::part_selection_changed()
m_config = &(*m_objects)[obj_idx]->volumes[volume_id]->config; m_config = &(*m_objects)[obj_idx]->volumes[volume_id]->config;
update_and_show_settings = true; update_and_show_settings = true;
// const ModelVolume *volume = (*m_objects)[obj_idx]->volumes[volume_id]; const ModelVolume *volume = (*m_objects)[obj_idx]->volumes[volume_id];
// enable_manipulation = !((*m_objects)[obj_idx]->is_cut() && (volume->is_cut_connector() || volume->is_model_part())); enable_manipulation = !((*m_objects)[obj_idx]->is_cut() && (volume->is_cut_connector() || volume->is_model_part()));
} }
else if (type & itInstance) { else if (type & itInstance) {
og_name = _L("Instance manipulation"); og_name = _L("Instance manipulation");
@ -3319,7 +3325,7 @@ void ObjectList::part_selection_changed()
// fill m_config by object's values // fill m_config by object's values
m_config = &(*m_objects)[obj_idx]->config; m_config = &(*m_objects)[obj_idx]->config;
// disable_ss_manipulation = (*m_objects)[obj_idx]->is_cut(); disable_ss_manipulation = (*m_objects)[obj_idx]->is_cut();
} }
else if (type & (itLayerRoot | itLayer)) { else if (type & (itLayerRoot | itLayer)) {
og_name = type & itLayerRoot ? _L("Height ranges") : _L("Settings for height range"); og_name = type & itLayerRoot ? _L("Height ranges") : _L("Settings for height range");
@ -3362,7 +3368,7 @@ void ObjectList::part_selection_changed()
if (printer_technology() == ptSLA) if (printer_technology() == ptSLA)
update_and_show_layers = false; update_and_show_layers = false;
else if (update_and_show_layers) { else if (update_and_show_layers) {
//wxGetApp().obj_layers()->get_og()->set_name(" " + og_name + " "); ;//wxGetApp().obj_layers()->get_og()->set_name(" " + og_name + " ");
} }
update_min_height(); update_min_height();
@ -3394,6 +3400,7 @@ wxDataViewItem ObjectList::add_settings_item(wxDataViewItem parent_item, const D
return ret; return ret;
const bool is_object_settings = m_objects_model->GetItemType(parent_item) == itObject; const bool is_object_settings = m_objects_model->GetItemType(parent_item) == itObject;
const bool is_volume_settings = m_objects_model->GetItemType(parent_item) == itVolume;
const bool is_layer_settings = m_objects_model->GetItemType(parent_item) == itLayer; const bool is_layer_settings = m_objects_model->GetItemType(parent_item) == itLayer;
if (!is_object_settings) { if (!is_object_settings) {
ModelVolumeType volume_type = m_objects_model->GetVolumeType(parent_item); ModelVolumeType volume_type = m_objects_model->GetVolumeType(parent_item);
@ -4682,6 +4689,8 @@ void ObjectList::select_item(const ObjectVolumeID& ov_id)
void ObjectList::select_items(const std::vector<ObjectVolumeID>& ov_ids) void ObjectList::select_items(const std::vector<ObjectVolumeID>& ov_ids)
{ {
ModelObjectPtrs& objects = wxGetApp().model().objects;
wxDataViewItemArray sel_items; wxDataViewItemArray sel_items;
for (auto ov_id : ov_ids) { for (auto ov_id : ov_ids) {
if (ov_id.object == nullptr) if (ov_id.object == nullptr)
@ -5686,7 +5695,7 @@ void ObjectList::set_extruder_for_selected_items(const int extruder)
void ObjectList::on_plate_added(PartPlate* part_plate) void ObjectList::on_plate_added(PartPlate* part_plate)
{ {
m_objects_model->AddPlate(part_plate); wxDataViewItem plate_item = m_objects_model->AddPlate(part_plate);
} }
void ObjectList::on_plate_deleted(int plate_idx) void ObjectList::on_plate_deleted(int plate_idx)

View file

@ -205,7 +205,7 @@ bool ObjectSettings::update_settings_list()
bool is_object_settings = false; bool is_object_settings = false;
bool is_volume_settings = false; bool is_volume_settings = false;
bool is_layer_range_settings = false; bool is_layer_range_settings = false;
// bool is_layer_root = false; bool is_layer_root = false;
ModelObject * parent_object = nullptr; ModelObject * parent_object = nullptr;
for (auto item : items) { for (auto item : items) {
auto type = objects_model->GetItemType(item); auto type = objects_model->GetItemType(item);
@ -255,9 +255,9 @@ bool ObjectSettings::update_settings_list()
t_layer_height_range height_range = objects_model->GetLayerRangeByItem(item); t_layer_height_range height_range = objects_model->GetLayerRangeByItem(item);
object_configs.emplace( (ObjectBase*)(&object->layer_config_ranges.at(height_range)), &object->layer_config_ranges.at(height_range) ); object_configs.emplace( (ObjectBase*)(&object->layer_config_ranges.at(height_range)), &object->layer_config_ranges.at(height_range) );
} }
// else if (type == itLayerRoot) { else if (type == itLayerRoot) {
// is_layer_root = true; is_layer_root = true;
// } }
} }
auto tab_plate = dynamic_cast<TabPrintPlate*>(wxGetApp().get_plate_tab()); auto tab_plate = dynamic_cast<TabPrintPlate*>(wxGetApp().get_plate_tab());

View file

@ -280,6 +280,7 @@ wxGridActivationResult GridCellFilamentsEditor::TryActivate(int row, int col, wx
{ {
ObjectGridTable *table = dynamic_cast<ObjectGridTable *>(grid->GetTable()); ObjectGridTable *table = dynamic_cast<ObjectGridTable *>(grid->GetTable());
ObjectGridTable::ObjectGridCol* grid_col = table->get_grid_col(col); ObjectGridTable::ObjectGridCol* grid_col = table->get_grid_col(col);
ObjectGridTable::ObjectGridRow* grid_row = table->get_grid_row(row - 1);
if ( actSource.GetOrigin() == wxGridActivationSource::Key ) { if ( actSource.GetOrigin() == wxGridActivationSource::Key ) {
const wxKeyEvent& key_event = actSource.GetKeyEvent(); const wxKeyEvent& key_event = actSource.GetKeyEvent();
@ -315,6 +316,7 @@ void GridCellFilamentsEditor::DoActivate(int row, int col, wxGrid* grid)
if (m_cached_value != -1) { if (m_cached_value != -1) {
ObjectGridTable *table = dynamic_cast<ObjectGridTable *>(grid->GetTable()); ObjectGridTable *table = dynamic_cast<ObjectGridTable *>(grid->GetTable());
ObjectGridTable::ObjectGridCol* grid_col = table->get_grid_col(col); ObjectGridTable::ObjectGridCol* grid_col = table->get_grid_col(col);
ObjectGridTable::ObjectGridRow* grid_row = table->get_grid_row(row - 1);
if (m_cached_value <= grid_col->choice_count) { if (m_cached_value <= grid_col->choice_count) {
wxString choice = grid_col->choices[m_cached_value-1]; wxString choice = grid_col->choices[m_cached_value-1];
table->SetValue(row, col, choice); table->SetValue(row, col, choice);
@ -330,6 +332,7 @@ void GridCellFilamentsRenderer::Draw(wxGrid &grid, wxGridCellAttr &attr, wxDC &d
wxRect text_rect = rect; wxRect text_rect = rect;
if (table) { if (table) {
ObjectGridTable::ObjectGridCol *grid_col = table->get_grid_col(col);
ObjectGridTable::ObjectGridRow *grid_row = table->get_grid_row(row - 1); ObjectGridTable::ObjectGridRow *grid_row = table->get_grid_row(row - 1);
ConfigOptionInt & cur_option = dynamic_cast<ConfigOptionInt &>((*grid_row)[(ObjectGridTable::GridColType) col]); ConfigOptionInt & cur_option = dynamic_cast<ConfigOptionInt &>((*grid_row)[(ObjectGridTable::GridColType) col]);
@ -469,6 +472,7 @@ wxGridActivationResult GridCellChoiceEditor::TryActivate(int row, int col, wxGri
{ {
ObjectGridTable * table = dynamic_cast<ObjectGridTable *>(grid->GetTable()); ObjectGridTable * table = dynamic_cast<ObjectGridTable *>(grid->GetTable());
ObjectGridTable::ObjectGridCol *grid_col = table->get_grid_col(col); ObjectGridTable::ObjectGridCol *grid_col = table->get_grid_col(col);
ObjectGridTable::ObjectGridRow *grid_row = table->get_grid_row(row - 1);
if (actSource.GetOrigin() == wxGridActivationSource::Key) { if (actSource.GetOrigin() == wxGridActivationSource::Key) {
const wxKeyEvent &key_event = actSource.GetKeyEvent(); const wxKeyEvent &key_event = actSource.GetKeyEvent();
@ -501,6 +505,7 @@ void GridCellChoiceEditor::DoActivate(int row, int col, wxGrid *grid)
if (m_cached_value != -1) { if (m_cached_value != -1) {
ObjectGridTable * table = dynamic_cast<ObjectGridTable *>(grid->GetTable()); ObjectGridTable * table = dynamic_cast<ObjectGridTable *>(grid->GetTable());
ObjectGridTable::ObjectGridCol *grid_col = table->get_grid_col(col); ObjectGridTable::ObjectGridCol *grid_col = table->get_grid_col(col);
ObjectGridTable::ObjectGridRow *grid_row = table->get_grid_row(row - 1);
if (m_cached_value <= grid_col->choice_count) { if (m_cached_value <= grid_col->choice_count) {
wxString choice = grid_col->choices[m_cached_value - 1]; wxString choice = grid_col->choices[m_cached_value - 1];
table->SetValue(row, col, choice); table->SetValue(row, col, choice);
@ -516,6 +521,7 @@ void GridCellComboBoxRenderer::Draw(wxGrid &grid, wxGridCellAttr &attr, wxDC &dc
wxRect text_rect = rect; wxRect text_rect = rect;
if (table) { if (table) {
ObjectGridTable::ObjectGridCol *grid_col = table->get_grid_col(col);
ObjectGridTable::ObjectGridRow *grid_row = table->get_grid_row(row - 1); ObjectGridTable::ObjectGridRow *grid_row = table->get_grid_row(row - 1);
ConfigOptionInt & cur_option = dynamic_cast<ConfigOptionInt &>((*grid_row)[(ObjectGridTable::GridColType) col]); ConfigOptionInt & cur_option = dynamic_cast<ConfigOptionInt &>((*grid_row)[(ObjectGridTable::GridColType) col]);
@ -555,6 +561,7 @@ wxString GridCellSupportEditor::ms_stringValues[2] = { wxT(""), wxT("") };
void GridCellSupportEditor::DoActivate(int row, int col, wxGrid* grid) void GridCellSupportEditor::DoActivate(int row, int col, wxGrid* grid)
{ {
ObjectGrid* local_table = dynamic_cast<ObjectGrid*>(grid);
wxGridBlocks cell_array = grid->GetSelectedBlocks(); wxGridBlocks cell_array = grid->GetSelectedBlocks();
auto left_col = cell_array.begin()->GetLeftCol(); auto left_col = cell_array.begin()->GetLeftCol();
@ -684,6 +691,7 @@ void GridCellSupportRenderer::Draw(wxGrid& grid,
//wxGridCellBoolRenderer::Draw(grid, attr, dc, rect, row, col, isSelected); //wxGridCellBoolRenderer::Draw(grid, attr, dc, rect, row, col, isSelected);
ObjectGridTable * table = dynamic_cast<ObjectGridTable *>(grid.GetTable()); ObjectGridTable * table = dynamic_cast<ObjectGridTable *>(grid.GetTable());
ObjectGridTable::ObjectGridCol *grid_col = table->get_grid_col(col);
ObjectGridTable::ObjectGridRow *grid_row = table->get_grid_row(row - 1); ObjectGridTable::ObjectGridRow *grid_row = table->get_grid_row(row - 1);
ConfigOptionBool & cur_option = dynamic_cast<ConfigOptionBool &>((*grid_row)[(ObjectGridTable::GridColType) col]); ConfigOptionBool & cur_option = dynamic_cast<ConfigOptionBool &>((*grid_row)[(ObjectGridTable::GridColType) col]);
@ -883,6 +891,7 @@ void ObjectGrid::OnKeyDown( wxKeyEvent& event )
// see include/wx/defs.h enum wxKeyCode // see include/wx/defs.h enum wxKeyCode
int keyCode = event.GetKeyCode(); int keyCode = event.GetKeyCode();
int ctrlMask = wxMOD_CONTROL; int ctrlMask = wxMOD_CONTROL;
int shiftMask = wxMOD_SHIFT;
// Coordinates of the selected block to copy to clipboard. // Coordinates of the selected block to copy to clipboard.
wxGridBlockCoords selection; wxGridBlockCoords selection;
wxTextDataObject text_data; wxTextDataObject text_data;
@ -1535,6 +1544,7 @@ void ObjectGridTable::SetValue( int row, int col, const wxString& value )
return; return;
ObjectGridRow* grid_row = m_grid_data[row - 1]; ObjectGridRow* grid_row = m_grid_data[row - 1];
ObjectGridCol* grid_col = m_col_data[col]; ObjectGridCol* grid_col = m_col_data[col];
ObjectList* obj_list = wxGetApp().obj_list();
if (grid_col->type == coEnum) { if (grid_col->type == coEnum) {
int enum_value = 0; int enum_value = 0;
for (int i = 0; i < grid_col->choice_count; i++) for (int i = 0; i < grid_col->choice_count; i++)
@ -1802,6 +1812,9 @@ wxString ObjectGridTable::convert_filament_string(int index, wxString& filament_
void ObjectGridTable::init_cols(ObjectGrid *object_grid) void ObjectGridTable::init_cols(ObjectGrid *object_grid)
{ {
const float font_size = 1.5f * wxGetApp().em_unit();
// printable for object // printable for object
ObjectGridCol *col = new ObjectGridCol(coBool, "printable", ObjectGridTable::category_all, true, false, true, false, wxALIGN_CENTRE); ObjectGridCol *col = new ObjectGridCol(coBool, "printable", ObjectGridTable::category_all, true, false, true, false, wxALIGN_CENTRE);
col->size = object_grid->GetTextExtent(L("Printable")).x; col->size = object_grid->GetTextExtent(L("Printable")).x;
@ -1897,6 +1910,7 @@ void ObjectGridTable::init_cols(ObjectGrid *object_grid)
col = new ObjectGridCol(coFloat, "inner_wall_speed_reset", L("Speed"), false, true, false, false, wxALIGN_LEFT); col = new ObjectGridCol(coFloat, "inner_wall_speed_reset", L("Speed"), false, true, false, false, wxALIGN_LEFT);
m_col_data.push_back(col); m_col_data.push_back(col);
return;
} }
void ObjectGridTable::construct_object_configs(ObjectGrid *object_grid) void ObjectGridTable::construct_object_configs(ObjectGrid *object_grid)
@ -1915,8 +1929,8 @@ void ObjectGridTable::construct_object_configs(ObjectGrid *object_grid)
int object_count = m_panel->m_model->objects.size(); int object_count = m_panel->m_model->objects.size();
PartPlateList& partplate_list = m_panel->m_plater->get_partplate_list(); PartPlateList& partplate_list = m_panel->m_plater->get_partplate_list();
DynamicPrintConfig& global_config = wxGetApp().preset_bundle->prints.get_edited_preset().config; DynamicPrintConfig& global_config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
// const DynamicPrintConfig* plater_config = m_panel->m_plater->config(); const DynamicPrintConfig* plater_config = m_panel->m_plater->config();
// const DynamicPrintConfig& filament_config = *plater_config; const DynamicPrintConfig& filament_config = *plater_config;
for (int i = 0; i < object_count; i++) for (int i = 0; i < object_count; i++)
{ {
@ -2812,7 +2826,7 @@ int ObjectTablePanel::init_filaments_and_colors()
BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", invalid color count:%1%, extruder count: %2%") %color_count %m_filaments_count; BOOST_LOG_TRIVIAL(warning) << __FUNCTION__ << boost::format(", invalid color count:%1%, extruder count: %2%") %color_count %m_filaments_count;
} }
int i = 0; unsigned int i = 0;
ColorRGB rgb; ColorRGB rgb;
while (i < m_filaments_count) { while (i < m_filaments_count) {
const std::string& txt_color = global_config->opt_string("filament_colour", i); const std::string& txt_color = global_config->opt_string("filament_colour", i);
@ -3018,6 +3032,7 @@ void ObjectTablePanel::load_data()
{ {
ObjectGridTable::ObjectGridCol *grid_col = m_object_grid_table->get_grid_col(i); ObjectGridTable::ObjectGridCol *grid_col = m_object_grid_table->get_grid_col(i);
if (grid_col->size > 0) { if (grid_col->size > 0) {
int fit_size1 = m_object_grid->GetColSize(i);
m_object_grid->SetColSize(i, grid_col->size); m_object_grid->SetColSize(i, grid_col->size);
} }
} }
@ -3158,7 +3173,7 @@ void ObjectTablePanel::OnRowSize( wxGridSizeEvent& ev)
g_dialog_max_height =(panel_size.GetHeight() > g_max_size_from_parent.GetHeight())?g_max_size_from_parent.GetHeight():panel_size.GetHeight(); g_dialog_max_height =(panel_size.GetHeight() > g_max_size_from_parent.GetHeight())?g_max_size_from_parent.GetHeight():panel_size.GetHeight();
this->SetMaxSize(wxSize(g_dialog_max_width, g_dialog_max_height)); this->SetMaxSize(wxSize(g_dialog_max_width, g_dialog_max_height));
// wxSize current_size = GetParent()->GetSize(); wxSize current_size = GetParent()->GetSize();
//if (current_size.GetHeight() < g_dialog_max_height) //if (current_size.GetHeight() < g_dialog_max_height)
GetParent()->SetMaxSize(wxSize(g_dialog_max_width, g_dialog_max_height)); GetParent()->SetMaxSize(wxSize(g_dialog_max_width, g_dialog_max_height));
GetParent()->SetSize(wxSize(g_dialog_max_width, g_dialog_max_height)); GetParent()->SetSize(wxSize(g_dialog_max_width, g_dialog_max_height));
@ -3172,7 +3187,7 @@ void ObjectTablePanel::OnColSize( wxGridSizeEvent& ev)
g_dialog_max_height =(panel_size.GetHeight() > g_max_size_from_parent.GetHeight())?g_max_size_from_parent.GetHeight():panel_size.GetHeight(); g_dialog_max_height =(panel_size.GetHeight() > g_max_size_from_parent.GetHeight())?g_max_size_from_parent.GetHeight():panel_size.GetHeight();
this->SetMaxSize(wxSize(g_dialog_max_width, g_dialog_max_height)); this->SetMaxSize(wxSize(g_dialog_max_width, g_dialog_max_height));
// wxSize current_size = GetParent()->GetSize(); wxSize current_size = GetParent()->GetSize();
//if (current_size.GetWidth() < g_dialog_max_width) //if (current_size.GetWidth() < g_dialog_max_width)
GetParent()->SetMaxSize(wxSize(g_dialog_max_width, g_dialog_max_height)); GetParent()->SetMaxSize(wxSize(g_dialog_max_width, g_dialog_max_height));
GetParent()->SetSize(wxSize(g_dialog_max_width, g_dialog_max_height)); GetParent()->SetSize(wxSize(g_dialog_max_width, g_dialog_max_height));
@ -3456,6 +3471,8 @@ void GridCellTextEditor::SetSize(const wxRect &rect) { wxGridCellTextEditor::Set
void GridCellTextEditor::BeginEdit(int row, int col, wxGrid *grid) void GridCellTextEditor::BeginEdit(int row, int col, wxGrid *grid)
{ {
ObjectGridTable * table = dynamic_cast<ObjectGridTable *>(grid->GetTable()); ObjectGridTable * table = dynamic_cast<ObjectGridTable *>(grid->GetTable());
ObjectGridTable::ObjectGridCol *grid_col = table->get_grid_col(col);
ObjectGridTable::ObjectGridRow *grid_row = table->get_grid_row(row - 1);
auto val = table->GetValue(row, col); auto val = table->GetValue(row, col);
@ -3489,6 +3506,10 @@ void GridCellTextEditor::BeginEdit(int row, int col, wxGrid *grid)
bool GridCellTextEditor::EndEdit(int row, int col, const wxGrid *grid, const wxString &WXUNUSED(oldval), wxString *newval) bool GridCellTextEditor::EndEdit(int row, int col, const wxGrid *grid, const wxString &WXUNUSED(oldval), wxString *newval)
{ {
ObjectGridTable * table = dynamic_cast<ObjectGridTable *>(grid->GetTable());
ObjectGridTable::ObjectGridCol *grid_col = table->get_grid_col(col);
ObjectGridTable::ObjectGridRow *grid_row = table->get_grid_row(row - 1);
wxCHECK_MSG(m_control, false, "wxGridCellTextEditor must be created first!"); wxCHECK_MSG(m_control, false, "wxGridCellTextEditor must be created first!");
const wxString value = Text()->GetTextCtrl()->GetValue(); const wxString value = Text()->GetTextCtrl()->GetValue();

View file

@ -108,6 +108,7 @@ bool ObjectTableSettings::update_settings_list(bool is_object, bool is_multiple_
//SettingsFactory::Bundle cat_options = SettingsFactory::get_bundle(&config->get(), is_object); //SettingsFactory::Bundle cat_options = SettingsFactory::get_bundle(&config->get(), is_object);
std::map<std::string, std::vector<SimpleSettingData>> cat_options; std::map<std::string, std::vector<SimpleSettingData>> cat_options;
std::vector<SimpleSettingData> category_settings = SettingsFactory::get_visible_options(category, !is_object); std::vector<SimpleSettingData> category_settings = SettingsFactory::get_visible_options(category, !is_object);
bool display_multiple = false;
auto is_option_modified = [this](std::string key) { auto is_option_modified = [this](std::string key) {
ConfigOption* config_option1 = m_origin_config.option(key); ConfigOption* config_option1 = m_origin_config.option(key);
ConfigOption* config_option2 = m_current_config.option(key); ConfigOption* config_option2 = m_current_config.option(key);
@ -146,6 +147,7 @@ bool ObjectTableSettings::update_settings_list(bool is_object, bool is_multiple_
else else
it1 = cat_options.erase(it1); it1 = cat_options.erase(it1);
} }
display_multiple = true;
} }
else { else {
cat_options.emplace(category, category_settings); cat_options.emplace(category, category_settings);

View file

@ -6,6 +6,7 @@
#include "GUI_App.hpp" #include "GUI_App.hpp"
#include "GUI.hpp" #include "GUI.hpp"
#include "I18N.hpp" #include "I18N.hpp"
#include "3DScene.hpp"
#include "BackgroundSlicingProcess.hpp" #include "BackgroundSlicingProcess.hpp"
#include "OpenGLManager.hpp" #include "OpenGLManager.hpp"
#include "GLCanvas3D.hpp" #include "GLCanvas3D.hpp"
@ -14,11 +15,19 @@
#include "MainFrame.hpp" #include "MainFrame.hpp"
#include "format.hpp" #include "format.hpp"
#include <wx/listbook.h>
#include <wx/notebook.h>
#include <wx/glcanvas.h> #include <wx/glcanvas.h>
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/stattext.h>
#include <wx/choice.h>
#include <wx/combo.h>
#include <wx/combobox.h>
#include <wx/checkbox.h>
// this include must follow the wxWidgets ones or it won't compile on Windows -> see http://trac.wxwidgets.org/ticket/2421 // this include must follow the wxWidgets ones or it won't compile on Windows -> see http://trac.wxwidgets.org/ticket/2421
#include "libslic3r/Print.hpp" #include "libslic3r/Print.hpp"
#include "libslic3r/SLAPrint.hpp"
#include "NotificationManager.hpp" #include "NotificationManager.hpp"
#ifdef _WIN32 #ifdef _WIN32
@ -533,6 +542,7 @@ void Preview::update_layers_slider_from_canvas(wxKeyEvent &event)
const auto key = event.GetKeyCode(); const auto key = event.GetKeyCode();
IMSlider *m_layers_slider = m_canvas->get_gcode_viewer().get_layers_slider(); IMSlider *m_layers_slider = m_canvas->get_gcode_viewer().get_layers_slider();
IMSlider *m_moves_slider = m_canvas->get_gcode_viewer().get_moves_slider();
if (key == 'L') { if (key == 'L') {
if(!m_layers_slider->switch_one_layer_mode()) if(!m_layers_slider->switch_one_layer_mode())
event.Skip(); event.Skip();

Some files were not shown because too many files have changed in this diff Show more