diff --git a/src/OrcaSlicer.cpp b/src/OrcaSlicer.cpp index 5f8dcd85ff..9a33f3738e 100644 --- a/src/OrcaSlicer.cpp +++ b/src/OrcaSlicer.cpp @@ -3136,6 +3136,7 @@ int CLI::run(int argc, char **argv) std::vector current_extruder_areas; //update part plate's size double print_height = m_print_config.opt_float("printable_height"); + std::vector current_extruder_print_heights; double height_to_lid = m_print_config.opt_float("extruder_clearance_height_to_lid"); double height_to_rod = m_print_config.opt_float("extruder_clearance_height_to_rod"); double clearance_radius = m_print_config.opt_float("extruder_clearance_radius"); @@ -3145,6 +3146,9 @@ int CLI::run(int argc, char **argv) if (m_print_config.opt("extruder_printable_area")) { current_extruder_areas = m_print_config.opt("extruder_printable_area")->values; } + if (m_print_config.opt("extruder_printable_height")) { + current_extruder_print_heights = m_print_config.opt("extruder_printable_height")->values; + } current_printable_width = current_printable_area[2].x() - current_printable_area[0].x(); current_printable_depth = current_printable_area[2].y() - current_printable_area[0].y(); current_printable_height = print_height; @@ -3195,7 +3199,7 @@ int CLI::run(int argc, char **argv) else { partplate_list.reset_size(old_printable_width, old_printable_depth, old_printable_height, false); } - partplate_list.set_shapes(make_counter_clockwise(current_printable_area), current_exclude_area, current_extruder_areas, bed_texture, height_to_lid, height_to_rod); + partplate_list.set_shapes(make_counter_clockwise(current_printable_area), current_exclude_area, current_extruder_areas, current_extruder_print_heights, bed_texture, height_to_lid, height_to_rod); //plate_stride = partplate_list.plate_stride_x(); } @@ -4915,7 +4919,7 @@ int CLI::run(int argc, char **argv) BOOST_LOG_TRIVIAL(info) << boost::format("print_volume {%1%,%2%,%3%}->{%4%, %5%, %6%}") % print_volume.min(0) % print_volume.min(1) % print_volume.min(2) % print_volume.max(0) % print_volume.max(1) % print_volume.max(2) << std::endl; #else - BuildVolume build_volume(part_plate->get_shape(), print_height, part_plate->get_extruder_areas()); + BuildVolume build_volume(part_plate->get_shape(), print_height, part_plate->get_extruder_areas(), current_extruder_print_heights); //model.update_print_volume_state(build_volume); unsigned int count = model.update_print_volume_state(build_volume); diff --git a/src/libslic3r/BuildVolume.cpp b/src/libslic3r/BuildVolume.cpp index 42dc437e8e..00217301c4 100644 --- a/src/libslic3r/BuildVolume.cpp +++ b/src/libslic3r/BuildVolume.cpp @@ -9,9 +9,11 @@ namespace Slic3r { -BuildVolume::BuildVolume(const std::vector &printable_area, const double printable_height, const std::vector> &extruder_areas) : m_bed_shape(printable_area), m_max_print_height(printable_height), m_extruder_shapes(extruder_areas) +BuildVolume::BuildVolume(const std::vector &printable_area, const double printable_height, const std::vector> &extruder_areas, const std::vector& extruder_printable_heights) + : m_bed_shape(printable_area), m_max_print_height(printable_height), m_extruder_shapes(extruder_areas), m_extruder_printable_height(extruder_printable_heights) { assert(printable_height >= 0); + assert(extruder_printable_heights.size() == extruder_areas.size()); m_polygon = Polygon::new_scale(printable_area); assert(m_polygon.is_counter_clockwise()); @@ -83,6 +85,7 @@ BuildVolume::BuildVolume(const std::vector &printable_area, const double m_shared_volume.data[1] = m_bboxf.min.y(); m_shared_volume.data[2] = m_bboxf.max.x(); m_shared_volume.data[3] = m_bboxf.max.y(); + m_shared_volume.zs[1] = m_bboxf.max.z(); for (unsigned int index = 0; index < m_extruder_shapes.size(); index++) { std::vector& extruder_shape = m_extruder_shapes[index]; @@ -97,7 +100,7 @@ BuildVolume::BuildVolume(const std::vector &printable_area, const double return; } - if (extruder_shape == printable_area) { + if ((extruder_shape == printable_area)&&(extruder_printable_heights[index] == printable_height)) { extruder_volume.same_with_bed = true; extruder_volume.type = m_type; extruder_volume.bbox = m_bbox; @@ -110,7 +113,7 @@ BuildVolume::BuildVolume(const std::vector &printable_area, const double double poly_area = poly.area(); extruder_volume.bbox = get_extents(poly); BoundingBoxf temp_bboxf = get_extents(extruder_shape); - extruder_volume.bboxf = BoundingBoxf3{ to_3d(temp_bboxf.min, 0.), to_3d(temp_bboxf.max, printable_height) }; + extruder_volume.bboxf = BoundingBoxf3{ to_3d(temp_bboxf.min, 0.), to_3d(temp_bboxf.max, extruder_printable_heights[index]) }; if (extruder_shape.size() >= 4 && std::abs((poly_area - double(extruder_volume.bbox.size().x()) * double(extruder_volume.bbox.size().y()))) < sqr(SCALED_EPSILON)) { @@ -161,11 +164,13 @@ BuildVolume::BuildVolume(const std::vector &printable_area, const double m_shared_volume.data[2] = extruder_volume.bboxf.max.x(); if (m_shared_volume.data[3] > extruder_volume.bboxf.max.y()) m_shared_volume.data[3] = extruder_volume.bboxf.max.y(); + if (m_shared_volume.zs[1] > extruder_volume.bboxf.max.z()) + m_shared_volume.zs[1] = extruder_volume.bboxf.max.z(); } m_shared_volume.type = static_cast(m_type); m_shared_volume.zs[0] = 0.f; - m_shared_volume.zs[1] = printable_height; + //m_shared_volume.zs[1] = printable_height; } BOOST_LOG_TRIVIAL(debug) << "BuildVolume printable_area clasified as: " << this->type_name(); diff --git a/src/libslic3r/BuildVolume.hpp b/src/libslic3r/BuildVolume.hpp index af8e7535cc..6e32f46d52 100644 --- a/src/libslic3r/BuildVolume.hpp +++ b/src/libslic3r/BuildVolume.hpp @@ -55,12 +55,13 @@ public: // Initialized to empty, all zeros, Invalid. BuildVolume() {} // Initialize from PrintConfig::printable_area and PrintConfig::printable_height - BuildVolume(const std::vector &printable_area, const double printable_height, const std::vector> &extruder_areas); + BuildVolume(const std::vector &printable_area, const double printable_height, const std::vector> &extruder_areas, const std::vector& extruder_printable_heights); // Source data, unscaled coordinates. const std::vector& printable_area() const { return m_bed_shape; } double printable_height() const { return m_max_print_height; } const std::vector>& extruder_areas() const { return m_extruder_shapes; } + const std::vector& extruder_heights() const { return m_extruder_printable_height; } const BuildSharedVolume& get_shared_volume() const { return m_shared_volume; } // Derived data @@ -139,6 +140,7 @@ private: BuildSharedVolume m_shared_volume; //used for rendering // Source definition of the print volume height (PrintConfig::printable_height) double m_max_print_height { 0.f }; + std::vector m_extruder_printable_height; // Derived values. BuildVolume_Type m_type { BuildVolume_Type::Invalid }; diff --git a/src/libslic3r/GCode/GCodeProcessor.hpp b/src/libslic3r/GCode/GCodeProcessor.hpp index c1a81a5a07..8132fde08d 100644 --- a/src/libslic3r/GCode/GCodeProcessor.hpp +++ b/src/libslic3r/GCode/GCodeProcessor.hpp @@ -226,6 +226,7 @@ class Print; //BBS: add bed exclude area Pointfs bed_exclude_area; std::vector extruder_areas; + std::vector extruder_heights; //BBS: add toolpath_outside bool toolpath_outside; //BBS: add object_label_enabled diff --git a/src/libslic3r/Support/TreeSupport3D.cpp b/src/libslic3r/Support/TreeSupport3D.cpp index 266c274807..9b613bae61 100644 --- a/src/libslic3r/Support/TreeSupport3D.cpp +++ b/src/libslic3r/Support/TreeSupport3D.cpp @@ -3553,7 +3553,7 @@ static void generate_support_areas(Print &print, TreeSupport* tree_support, cons print.set_status(69, _L("Generating support")); generate_support_toolpaths(print_object.support_layers(), print_object.config(), support_params, print_object.slicing_parameters(), raft_layers, bottom_contacts, top_contacts, intermediate_layers, interface_layers, base_interface_layers); - + auto t_end = std::chrono::high_resolution_clock::now(); BOOST_LOG_TRIVIAL(info) << "Total time of organic tree support: " << 0.001 * std::chrono::duration_cast(t_end - t_start).count() << " ms"; #if 0 @@ -4020,7 +4020,7 @@ void generate_tree_support_3D(PrintObject &print_object, TreeSupport* tree_suppo Points bedpts = tree_support->m_machine_border.contour.points; Pointfs bedptsf; std::transform(bedpts.begin(), bedpts.end(), std::back_inserter(bedptsf), [](const Point &p) { return unscale(p); }); - BuildVolume build_volume{ bedptsf, tree_support->m_print_config->printable_height, {}}; + BuildVolume build_volume{ bedptsf, tree_support->m_print_config->printable_height, {}, {} }; TreeSupport3D::generate_support_areas(*print_object.print(), tree_support, build_volume, { idx }, throw_on_cancel); } diff --git a/src/slic3r/GUI/3DBed.cpp b/src/slic3r/GUI/3DBed.cpp index 9814e38db5..5ebff64854 100644 --- a/src/slic3r/GUI/3DBed.cpp +++ b/src/slic3r/GUI/3DBed.cpp @@ -251,8 +251,8 @@ void Bed3D::Axes::render() } //BBS: add part plate logic -bool Bed3D::set_shape(const Pointfs& printable_area, const double printable_height, std::vector extruder_areas, const std::string& custom_model, bool force_as_custom, - const Vec2d& position, bool with_reset) +bool Bed3D::set_shape(const Pointfs& printable_area, const double printable_height, std::vector extruder_areas, std::vector extruder_heights, const std::string& custom_model, bool force_as_custom, + const Vec2d position, bool with_reset) { /*auto check_texture = [](const std::string& texture) { boost::system::error_code ec; // so the exists call does not throw (e.g. after a permission problem) @@ -289,7 +289,7 @@ bool Bed3D::set_shape(const Pointfs& printable_area, const double printable_heig } //BBS: add position related logic - if (m_bed_shape == printable_area && m_build_volume.printable_height() == printable_height && m_type == type && m_model_filename == model_filename && position == m_position && m_extruder_shapes == extruder_areas) + if (m_bed_shape == printable_area && m_build_volume.printable_height() == printable_height && m_type == type && m_model_filename == model_filename && position == m_position && m_extruder_shapes == extruder_areas && m_extruder_heights == extruder_heights) // No change, no need to update the UI. return false; @@ -298,6 +298,7 @@ bool Bed3D::set_shape(const Pointfs& printable_area, const double printable_heig m_position = position; m_bed_shape = printable_area; m_extruder_shapes = extruder_areas; + m_extruder_heights = extruder_heights; if ((position(0) != 0) || (position(1) != 0)) { Pointfs new_bed_shape; for (const Vec2d& p : m_bed_shape) { @@ -313,10 +314,10 @@ bool Bed3D::set_shape(const Pointfs& printable_area, const double printable_heig } new_extruder_shapes.push_back(new_extruder_shape); } - m_build_volume = BuildVolume { new_bed_shape, printable_height, new_extruder_shapes }; + m_build_volume = BuildVolume { new_bed_shape, printable_height, new_extruder_shapes, m_extruder_heights }; } else - m_build_volume = BuildVolume { printable_area, printable_height, m_extruder_shapes }; + m_build_volume = BuildVolume { printable_area, printable_height, m_extruder_shapes, m_extruder_heights }; m_type = type; //m_texture_filename = texture_filename; m_model_filename = model_filename; @@ -352,7 +353,7 @@ bool Bed3D::set_shape(const Pointfs& printable_area, const double printable_heig //BBS: add api to set position for partplate related bed void Bed3D::set_position(Vec2d& position) { - set_shape(m_bed_shape, m_build_volume.printable_height(), m_extruder_shapes, m_model_filename, false, position, false); + set_shape(m_bed_shape, m_build_volume.printable_height(), m_extruder_shapes, m_extruder_heights, m_model_filename, false, position, false); } void Bed3D::set_axes_mode(bool origin) diff --git a/src/slic3r/GUI/3DBed.hpp b/src/slic3r/GUI/3DBed.hpp index ac9b10497e..d65132c02b 100644 --- a/src/slic3r/GUI/3DBed.hpp +++ b/src/slic3r/GUI/3DBed.hpp @@ -116,6 +116,7 @@ private: Vec2d m_position{ Vec2d::Zero() }; std::vector m_bed_shape; std::vector> m_extruder_shapes; + std::vector m_extruder_heights; bool m_is_dark = false; public: @@ -127,8 +128,8 @@ public: //FIXME if the build volume max print height is updated, this function still returns zero // as this class does not use it, thus there is no need to update the UI. // BBS - bool set_shape(const Pointfs& printable_area, const double printable_height, std::vector extruder_areas, const std::string& custom_model, bool force_as_custom = false, - const Vec2d& position = Vec2d::Zero(), bool with_reset = true); + bool set_shape(const Pointfs& printable_area, const double printable_height, std::vector extruder_areas, std::vector extruder_heights, const std::string& custom_model, bool force_as_custom = false, + const Vec2d position = Vec2d::Zero(), bool with_reset = true); void set_position(Vec2d& position); void set_axes_mode(bool origin); diff --git a/src/slic3r/GUI/3DScene.cpp b/src/slic3r/GUI/3DScene.cpp index ccaa92e5cd..605233ed04 100644 --- a/src/slic3r/GUI/3DScene.cpp +++ b/src/slic3r/GUI/3DScene.cpp @@ -1077,7 +1077,7 @@ bool GLVolumeCollection::check_outside_state(const BuildVolume &build_volume, Mo GUI::PartPlate* curr_plate = GUI::wxGetApp().plater()->get_partplate_list().get_selected_plate(); const Pointfs& pp_bed_shape = curr_plate->get_shape(); - BuildVolume plate_build_volume(pp_bed_shape, build_volume.printable_height(), build_volume.extruder_areas()); + BuildVolume plate_build_volume(pp_bed_shape, build_volume.printable_height(), build_volume.extruder_areas(), build_volume.extruder_heights()); const std::vector& exclude_areas = curr_plate->get_exclude_areas(); std::map>> objects_unprintable_filaments; @@ -1287,6 +1287,7 @@ bool GLVolumeCollection::check_outside_state(const BuildVolume &build_volume, Mo if (filament_maps[filament - 1] == extruder_id) { object_filament_info.manual_filaments.emplace(filament, extruder_id); + object_results->filament_maps[filament] = extruder_id; conflict_filaments_set.emplace(filament); } } diff --git a/src/slic3r/GUI/3DScene.hpp b/src/slic3r/GUI/3DScene.hpp index 0546261168..1099437fab 100644 --- a/src/slic3r/GUI/3DScene.hpp +++ b/src/slic3r/GUI/3DScene.hpp @@ -69,6 +69,7 @@ struct ObjectFilamentInfo { struct ObjectFilamentResults { FilamentMapMode mode; std::vector filaments; //filaments has conflicts + std::map filament_maps; //filament maps std::vector partly_outside_objects; //partly outside objects std::vector object_filaments; diff --git a/src/slic3r/GUI/BedShapeDialog.cpp b/src/slic3r/GUI/BedShapeDialog.cpp index 4cc13f3c0a..5c7cc94771 100644 --- a/src/slic3r/GUI/BedShapeDialog.cpp +++ b/src/slic3r/GUI/BedShapeDialog.cpp @@ -25,7 +25,7 @@ namespace GUI { BedShape::BedShape(const Pointfs& points) { - m_build_volume = { points, 0.f, {} }; + m_build_volume = { points, 0.f, {}, {} }; } static std::string get_option_label(BedShape::Parameter param) diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp index b7940609e0..7e2dad84af 100644 --- a/src/slic3r/GUI/GCodeViewer.cpp +++ b/src/slic3r/GUI/GCodeViewer.cpp @@ -1009,6 +1009,7 @@ void GCodeViewer::load(const GCodeProcessorResult& gcode_result, const Print& pr //BBS: add bed exclude area Pointfs bed_exclude_area = Pointfs(); std::vector extruder_areas; + std::vector extruder_heights; std::string texture; std::string model; @@ -1030,8 +1031,10 @@ void GCodeViewer::load(const GCodeProcessorResult& gcode_result, const Print& pr if (!gcode_result.extruder_areas.empty()) extruder_areas = gcode_result.extruder_areas; + if (!gcode_result.extruder_heights.empty()) + extruder_heights = gcode_result.extruder_heights; - wxGetApp().plater()->set_bed_shape(printable_area, bed_exclude_area, gcode_result.printable_height, extruder_areas, texture, model, gcode_result.printable_area.empty()); + wxGetApp().plater()->set_bed_shape(printable_area, bed_exclude_area, gcode_result.printable_height, extruder_areas, extruder_heights, texture, model, gcode_result.printable_area.empty()); } /*else { // adjust printbed size in dependence of toolpaths bbox diff --git a/src/slic3r/GUI/GLCanvas3D.cpp b/src/slic3r/GUI/GLCanvas3D.cpp index d923253072..82aa96f414 100644 --- a/src/slic3r/GUI/GLCanvas3D.cpp +++ b/src/slic3r/GUI/GLCanvas3D.cpp @@ -1386,6 +1386,18 @@ void GLCanvas3D::construct_error_string(ObjectFilamentResults& object_result, st error_string += _u8L("Please solve the problem by moving them within the build volume.\n"); } else { + error_string += _u8L("In the Filament manual-matching mode, Following filament->extruder maps: \n"); + for (auto& filament: object_result.filaments) + { + error_string += std::to_string(filament) + "->" + std::to_string(object_result.filament_maps[filament]) + "\n"; + } + error_string += "cannot be printed as they are placed in the unprintable area of the corresponding extruder. This may be caused by the following objects:\n"; + for(ObjectFilamentInfo& object_filament: object_result.object_filaments) + { + error_string += object_filament.object->name; + error_string += "\n"; + } + error_string += _u8L("Please solve the problem by moving them within the build volume.\n"); } } } diff --git a/src/slic3r/GUI/MainFrame.cpp b/src/slic3r/GUI/MainFrame.cpp index bccccb40ee..790b7b2dd5 100644 --- a/src/slic3r/GUI/MainFrame.cpp +++ b/src/slic3r/GUI/MainFrame.cpp @@ -846,7 +846,7 @@ void MainFrame::update_layout() { m_main_sizer->Add(m_plater, 1, wxEXPAND); //BBS: add bed exclude area - m_plater->set_bed_shape({ { 0.0, 0.0 }, { 200.0, 0.0 }, { 200.0, 200.0 }, { 0.0, 200.0 } }, {}, 0.0, {}, {}, {}, true); + m_plater->set_bed_shape({ { 0.0, 0.0 }, { 200.0, 0.0 }, { 200.0, 200.0 }, { 0.0, 200.0 } }, {}, 0.0, {}, {}, {}, {}, true); m_plater->get_collapse_toolbar().set_enabled(false); m_plater->enable_sidebar(false); m_plater->Show(); diff --git a/src/slic3r/GUI/PartPlate.cpp b/src/slic3r/GUI/PartPlate.cpp index ab7623b722..de6fd7cc87 100644 --- a/src/slic3r/GUI/PartPlate.cpp +++ b/src/slic3r/GUI/PartPlate.cpp @@ -2121,7 +2121,7 @@ bool PartPlate::check_outside(int obj_id, int instance_id, BoundingBoxf3* boundi // Orca: For sinking object, we use a more expensive algorithm so part below build plate won't be considered if (plate_box.intersects(instance_box)) { // TODO: FIXME: this does not take exclusion area into account - const BuildVolume build_volume(get_shape(), m_plater->build_volume().printable_height(), m_extruder_areas); + const BuildVolume build_volume(get_shape(), m_plater->build_volume().printable_height(), m_extruder_areas, m_extruder_heights); const auto state = instance->calc_print_volume_state(build_volume); outside = state == ModelInstancePVS_Partly_Outside; } @@ -2668,9 +2668,10 @@ void PartPlate::generate_exclude_polygon(ExPolygon &exclude_polygon) exclude_polygon.contour.make_counter_clockwise(); } -bool PartPlate::set_shape(const Pointfs& shape, const Pointfs& exclude_areas, const std::vector& extruder_areas, Vec2d position, float height_to_lid, float height_to_rod) +bool PartPlate::set_shape(const Pointfs& shape, const Pointfs& exclude_areas, const std::vector& extruder_areas, const std::vector& extruder_heights, Vec2d position, float height_to_lid, float height_to_rod) { Pointfs new_shape, new_exclude_areas; + m_extruder_heights = extruder_heights; for (const Vec2d& p : shape) { new_shape.push_back(Vec2d(p.x() + position.x(), p.y() + position.y())); } @@ -3675,7 +3676,7 @@ void PartPlateList::reset_size(int width, int depth, int height, bool reload_obj m_plate_height = height; update_all_plates_pos_and_size(false, false, true); if (update_shapes) { - set_shapes(m_shape, m_exclude_areas, m_extruder_areas, m_logo_texture_filename, m_height_to_lid, m_height_to_rod); + set_shapes(m_shape, m_exclude_areas, m_extruder_areas, m_extruder_heights, m_logo_texture_filename, m_height_to_lid, m_height_to_rod); } if (reload_objects) reload_all_objects(); @@ -3760,7 +3761,7 @@ void PartPlateList::reinit() //reset plate 0's position Vec2d pos = compute_shape_position(0, m_plate_cols); - m_plate_list[0]->set_shape(m_shape, m_exclude_areas, m_extruder_areas, pos, m_height_to_lid, m_height_to_rod); + m_plate_list[0]->set_shape(m_shape, m_exclude_areas, m_extruder_areas, m_extruder_heights, pos, m_height_to_lid, m_height_to_rod); //reset unprintable plate's position Vec3d origin2 = compute_origin_for_unprintable(); unprintable_plate.set_pos_and_size(origin2, m_plate_width, m_plate_depth, m_plate_height, false); @@ -3777,7 +3778,7 @@ void PartPlateList::reinit() void PartPlateList::update_plates() { update_all_plates_pos_and_size(true, false); - set_shapes(m_shape, m_exclude_areas, m_extruder_areas, m_logo_texture_filename, m_height_to_lid, m_height_to_rod); + set_shapes(m_shape, m_exclude_areas, m_extruder_areas, m_extruder_heights, m_logo_texture_filename, m_height_to_lid, m_height_to_rod); } int PartPlateList::create_plate(bool adjust_position) @@ -3810,7 +3811,7 @@ int PartPlateList::create_plate(bool adjust_position) plate->set_index(new_index); Vec2d pos = compute_shape_position(new_index, cols); - plate->set_shape(m_shape, m_exclude_areas, m_extruder_areas, pos, m_height_to_lid, m_height_to_rod); + plate->set_shape(m_shape, m_exclude_areas, m_extruder_areas, m_extruder_heights, pos, m_height_to_lid, m_height_to_rod); m_plate_list.emplace_back(plate); update_plate_cols(); if (old_cols != cols) @@ -3818,7 +3819,7 @@ int PartPlateList::create_plate(bool adjust_position) BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(":old_cols %1% -> new_cols %2%") % old_cols % cols; //update the origin of each plate update_all_plates_pos_and_size(adjust_position, false); - set_shapes(m_shape, m_exclude_areas, m_extruder_areas, m_logo_texture_filename, m_height_to_lid, m_height_to_rod); + set_shapes(m_shape, m_exclude_areas, m_extruder_areas, m_extruder_heights, m_logo_texture_filename, m_height_to_lid, m_height_to_rod); if (m_plater) { Vec2d pos = compute_shape_position(m_current_plate, cols); @@ -3989,7 +3990,7 @@ int PartPlateList::delete_plate(int index) //update render shapes Vec2d pos = compute_shape_position(i, m_plate_cols); - plate->set_shape(m_shape, m_exclude_areas, m_extruder_areas, pos, m_height_to_lid, m_height_to_rod); + plate->set_shape(m_shape, m_exclude_areas, m_extruder_areas, m_extruder_heights, pos, m_height_to_lid, m_height_to_rod); } //update current_plate if delete current @@ -4012,7 +4013,7 @@ int PartPlateList::delete_plate(int index) { //update the origin of each plate update_all_plates_pos_and_size(); - set_shapes(m_shape, m_exclude_areas, m_extruder_areas, m_logo_texture_filename, m_height_to_lid, m_height_to_rod); + set_shapes(m_shape, m_exclude_areas, m_extruder_areas, m_extruder_heights, m_logo_texture_filename, m_height_to_lid, m_height_to_rod); } else { @@ -5109,12 +5110,13 @@ void PartPlateList::select_plate_view() m_plater->get_camera().select_view("topfront"); } -bool PartPlateList::set_shapes(const Pointfs& shape, const Pointfs& exclude_areas, const std::vector& extruder_areas, const std::string& texture_filename, float height_to_lid, float height_to_rod) +bool PartPlateList::set_shapes(const Pointfs& shape, const Pointfs& exclude_areas, const std::vector& extruder_areas, const std::vector& extruder_heights, const std::string& texture_filename, float height_to_lid, float height_to_rod) { const std::lock_guard local_lock(m_plates_mutex); m_shape = shape; m_exclude_areas = exclude_areas; m_extruder_areas = extruder_areas; + m_extruder_heights = extruder_heights; m_height_to_lid = height_to_lid; m_height_to_rod = height_to_rod; @@ -5128,7 +5130,7 @@ bool PartPlateList::set_shapes(const Pointfs& shape, const Pointfs& exclude_area Vec2d pos; pos = compute_shape_position(i, m_plate_cols); - plate->set_shape(shape, exclude_areas, extruder_areas, pos, height_to_lid, height_to_rod); + plate->set_shape(shape, exclude_areas, extruder_areas, extruder_heights, pos, height_to_lid, height_to_rod); } is_load_bedtype_textures = false; //reload textures is_load_extruder_only_area_textures = false; // reload textures @@ -5308,7 +5310,7 @@ int PartPlateList::rebuild_plates_after_deserialize(std::vector& previous_ } update_plate_cols(); update_all_plates_pos_and_size(false, false, false, false); - set_shapes(m_shape, m_exclude_areas, m_extruder_areas, m_logo_texture_filename, m_height_to_lid, m_height_to_rod); + set_shapes(m_shape, m_exclude_areas, m_extruder_areas, m_extruder_heights, m_logo_texture_filename, m_height_to_lid, m_height_to_rod); for (unsigned int i = 0; i < (unsigned int)m_plate_list.size(); ++i) { bool need_reset_print = false; @@ -5643,7 +5645,7 @@ int PartPlateList::load_gcode_files() //BoundingBoxf3 print_volume = m_plate_list[i]->get_bounding_box(false); //print_volume.max(2) = this->m_plate_height; //print_volume.min(2) = -1e10; - m_model->update_print_volume_state({m_plate_list[i]->get_shape(), (double)this->m_plate_height, m_plate_list[i]->get_extruder_areas() }); + m_model->update_print_volume_state({m_plate_list[i]->get_shape(), (double)this->m_plate_height, m_plate_list[i]->get_extruder_areas(), m_plate_list[i]->get_extruder_heights() }); if (!m_plate_list[i]->load_gcode_from_file(m_plate_list[i]->m_gcode_path_from_3mf)) ret ++; diff --git a/src/slic3r/GUI/PartPlate.hpp b/src/slic3r/GUI/PartPlate.hpp index 1c7adf497c..637df76e0d 100644 --- a/src/slic3r/GUI/PartPlate.hpp +++ b/src/slic3r/GUI/PartPlate.hpp @@ -121,6 +121,7 @@ private: Pointfs m_shape; Pointfs m_exclude_area; std::vector m_extruder_areas; + std::vector m_extruder_heights; BoundingBoxf3 m_bounding_box; BoundingBoxf3 m_extended_bounding_box; mutable std::vector m_exclude_bounding_box; @@ -365,8 +366,9 @@ public: /*rendering related functions*/ const Pointfs& get_shape() const { return m_shape; } - bool set_shape(const Pointfs& shape, const Pointfs& exclude_areas, const std::vector& extruder_areas, Vec2d position, float height_to_lid, float height_to_rod); + bool set_shape(const Pointfs& shape, const Pointfs& exclude_areas, const std::vector& extruder_areas, const std::vector& extruder_heights, Vec2d position, float height_to_lid, float height_to_rod); const std::vector& get_extruder_areas() const { return m_extruder_areas; } + const std::vector& get_extruder_heights() const { return m_extruder_heights; } bool contains(const Vec3d& point) const; bool contains(const GLVolume& v) const; bool contains(const BoundingBoxf3& bb) const; @@ -571,6 +573,7 @@ class PartPlateList : public ObjectBase Pointfs m_shape; Pointfs m_exclude_areas; std::vector m_extruder_areas; + std::vector m_extruder_heights; BoundingBoxf3 m_bounding_box; bool m_intialized; std::string m_logo_texture_filename; @@ -830,7 +833,7 @@ public: int select_plate_by_obj(int obj_index, int instance_index); void calc_bounding_boxes(); void select_plate_view(); - bool set_shapes(const Pointfs& shape, const Pointfs& exclude_areas, const std::vector& extruder_areas, const std::string& custom_texture, float height_to_lid, float height_to_rod); + bool set_shapes(const Pointfs& shape, const Pointfs& exclude_areas, const std::vector& extruder_areas, const std::vector& extruder_heights, const std::string& custom_texture, float height_to_lid, float height_to_rod); void set_hover_id(int id); void reset_hover_id(); bool intersects(const BoundingBoxf3 &bb); diff --git a/src/slic3r/GUI/Plater.cpp b/src/slic3r/GUI/Plater.cpp index efe2db290b..7d29dad000 100644 --- a/src/slic3r/GUI/Plater.cpp +++ b/src/slic3r/GUI/Plater.cpp @@ -2953,7 +2953,7 @@ struct Plater::priv // fills the m_bed.m_grid_lines and sets m_bed.m_origin. // Sets m_bed.m_polygon to limit the object placement. //BBS: add bed exclude area - void set_bed_shape(const Pointfs& shape, const Pointfs& exclude_areas, const double printable_height, std::vector extruder_areas, const std::string& custom_texture, const std::string& custom_model, bool force_as_custom = false); + void set_bed_shape(const Pointfs& shape, const Pointfs& exclude_areas, const double printable_height, std::vector extruder_areas, std::vector extruder_heights, const std::string& custom_texture, const std::string& custom_model, bool force_as_custom = false); bool can_delete() const; bool can_delete_all() const; @@ -5622,7 +5622,7 @@ void Plater::priv::update_print_volume_state() { //BBS: use the plate's bounding box instead of the bed's PartPlate* pp = partplate_list.get_curr_plate(); - BuildVolume build_volume(pp->get_shape(), this->bed.build_volume().printable_height(), this->bed.build_volume().extruder_areas()); + BuildVolume build_volume(pp->get_shape(), this->bed.build_volume().printable_height(), this->bed.build_volume().extruder_areas(), this->bed.build_volume().extruder_heights()); this->model.update_print_volume_state(build_volume); } @@ -8728,7 +8728,7 @@ bool Plater::priv::show_publish_dlg(bool show) } //BBS: add bed exclude area -void Plater::priv::set_bed_shape(const Pointfs& shape, const Pointfs& exclude_areas, const double printable_height, std::vector extruder_areas, const std::string& custom_texture, const std::string& custom_model, bool force_as_custom) +void Plater::priv::set_bed_shape(const Pointfs& shape, const Pointfs& exclude_areas, const double printable_height, std::vector extruder_areas, std::vector extruder_heights, const std::string& custom_texture, const std::string& custom_model, bool force_as_custom) { //Orca: reduce resolution for large bed printer BoundingBoxf bed_size = get_extents(shape); @@ -8739,7 +8739,7 @@ void Plater::priv::set_bed_shape(const Pointfs& shape, const Pointfs& exclude_ar //BBS: add shape position Vec2d shape_position = partplate_list.get_current_shape_position(); - bool new_shape = bed.set_shape(shape, printable_height, extruder_areas, custom_model, force_as_custom, shape_position); + bool new_shape = bed.set_shape(shape, printable_height, extruder_areas, extruder_heights, custom_model, force_as_custom, shape_position); float prev_height_lid, prev_height_rod; partplate_list.get_height_limits(prev_height_lid, prev_height_rod); @@ -8763,11 +8763,11 @@ void Plater::priv::set_bed_shape(const Pointfs& shape, const Pointfs& exclude_ar //Pointfs& exclude_areas = config->option("bed_exclude_area")->values; partplate_list.reset_size(max.x() - min.x() - Bed3D::Axes::DefaultTipRadius, max.y() - min.y() - Bed3D::Axes::DefaultTipRadius, z); - partplate_list.set_shapes(shape, exclude_areas, extruder_areas, custom_texture, height_to_lid, height_to_rod); + partplate_list.set_shapes(shape, exclude_areas, extruder_areas, extruder_heights, custom_texture, height_to_lid, height_to_rod); Vec2d new_shape_position = partplate_list.get_current_shape_position(); if (shape_position != new_shape_position) - bed.set_shape(shape, printable_height, extruder_areas, custom_model, force_as_custom, new_shape_position); + bed.set_shape(shape, printable_height, extruder_areas, extruder_heights, custom_model, force_as_custom, new_shape_position); } } @@ -13880,14 +13880,15 @@ void Plater::set_bed_shape() const p->config->option("bed_exclude_area")->values, p->config->option("printable_height")->value, p->config->option("extruder_printable_area")->values, + p->config->option("extruder_printable_height")->values, p->config->option("bed_custom_texture")->value.empty() ? texture_filename : p->config->option("bed_custom_texture")->value, p->config->option("bed_custom_model")->value); } //BBS: add bed exclude area -void Plater::set_bed_shape(const Pointfs& shape, const Pointfs& exclude_area, const double printable_height, std::vector extruder_areas, const std::string& custom_texture, const std::string& custom_model, bool force_as_custom) const +void Plater::set_bed_shape(const Pointfs& shape, const Pointfs& exclude_area, const double printable_height, std::vector extruder_areas, std::vector extruder_heights, const std::string& custom_texture, const std::string& custom_model, bool force_as_custom) const { - p->set_bed_shape(make_counter_clockwise(shape), exclude_area, printable_height, extruder_areas, custom_texture, custom_model, force_as_custom); + p->set_bed_shape(make_counter_clockwise(shape), exclude_area, printable_height, extruder_areas, extruder_heights, custom_texture, custom_model, force_as_custom); } void Plater::force_filament_colors_update() diff --git a/src/slic3r/GUI/Plater.hpp b/src/slic3r/GUI/Plater.hpp index 3fc1d7d786..0290254431 100644 --- a/src/slic3r/GUI/Plater.hpp +++ b/src/slic3r/GUI/Plater.hpp @@ -674,7 +674,7 @@ public: void update_flush_volume_matrix(size_t old_nozzle_size, size_t new_nozzle_size); //BBS: add bed exclude area void set_bed_shape() const; - void set_bed_shape(const Pointfs& shape, const Pointfs& exclude_area, const double printable_height, std::vector extruder_areas, const std::string& custom_texture, const std::string& custom_model, bool force_as_custom = false) const; + void set_bed_shape(const Pointfs& shape, const Pointfs& exclude_area, const double printable_height, std::vector extruder_areas, std::vector extruder_heights, const std::string& custom_texture, const std::string& custom_model, bool force_as_custom = false) const; const NotificationManager* get_notification_manager() const; NotificationManager* get_notification_manager(); diff --git a/src/slic3r/Utils/CalibUtils.cpp b/src/slic3r/Utils/CalibUtils.cpp index edb8981db1..e9afabfba9 100644 --- a/src/slic3r/Utils/CalibUtils.cpp +++ b/src/slic3r/Utils/CalibUtils.cpp @@ -1012,6 +1012,7 @@ bool CalibUtils::process_and_store_3mf(Model *model, const DynamicPrintConfig &f { Pointfs bedfs = make_counter_clockwise(full_config.opt("printable_area")->values); std::vector extruder_areas = full_config.option("extruder_printable_area")->values; + std::vector extruder_heights = full_config.option("extruder_printable_height")->values; double print_height = full_config.opt_float("printable_height"); double current_width = bedfs[2].x() - bedfs[0].x(); double current_depth = bedfs[2].y() - bedfs[0].y(); @@ -1058,7 +1059,7 @@ bool CalibUtils::process_and_store_3mf(Model *model, const DynamicPrintConfig &f int print_index; part_plate->get_print(&print, &gcode_result, &print_index); - BuildVolume build_volume(bedfs, print_height, extruder_areas); + BuildVolume build_volume(bedfs, print_height, extruder_areas, extruder_heights); unsigned int count = model->update_print_volume_state(build_volume); if (count == 0) { error_message = _L("Unable to calibrate: maybe because the set calibration value range is too large, or the step is too small");