ENH: buildvolume: add logic to support extruder_printable_height

jira: no-jira
Change-Id: I962c4aed8c536c0fd8b89ae090cd0463c5d645db
This commit is contained in:
lane.wei 2024-11-23 12:26:54 +08:00
parent ab588003e3
commit 43773d7701
18 changed files with 80 additions and 42 deletions

View File

@ -3462,6 +3462,7 @@ int CLI::run(int argc, char **argv)
std::vector<Pointfs> current_extruder_areas;
//update part plate's size
double print_height = m_print_config.opt_float("printable_height");
std::vector<double> 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 cleareance_radius = m_print_config.opt_float("extruder_clearance_max_radius");
@ -3471,6 +3472,9 @@ int CLI::run(int argc, char **argv)
if (m_print_config.opt<ConfigOptionPointsGroups>("extruder_printable_area")) {
current_extruder_areas = m_print_config.opt<ConfigOptionPointsGroups>("extruder_printable_area")->values;
}
if (m_print_config.opt<ConfigOptionFloatsNullable>("extruder_printable_height")) {
current_extruder_print_heights = m_print_config.opt<ConfigOptionFloatsNullable>("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;
@ -3521,7 +3525,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(current_printable_area, current_exclude_area, current_extruder_areas, bed_texture, height_to_lid, height_to_rod);
partplate_list.set_shapes(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();
}
@ -5431,7 +5435,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);

View File

@ -9,9 +9,11 @@
namespace Slic3r {
BuildVolume::BuildVolume(const std::vector<Vec2d> &printable_area, const double printable_height, const std::vector<std::vector<Vec2d>> &extruder_areas) : m_bed_shape(printable_area), m_max_print_height(printable_height), m_extruder_shapes(extruder_areas)
BuildVolume::BuildVolume(const std::vector<Vec2d> &printable_area, const double printable_height, const std::vector<std::vector<Vec2d>> &extruder_areas, const std::vector<double>& 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);
@ -82,6 +84,7 @@ BuildVolume::BuildVolume(const std::vector<Vec2d> &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<Vec2d>& extruder_shape = m_extruder_shapes[index];
@ -96,7 +99,7 @@ BuildVolume::BuildVolume(const std::vector<Vec2d> &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;
@ -109,7 +112,7 @@ BuildVolume::BuildVolume(const std::vector<Vec2d> &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))
{
@ -160,11 +163,13 @@ BuildVolume::BuildVolume(const std::vector<Vec2d> &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<int>(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();

View File

@ -56,12 +56,13 @@ public:
// Initialized to empty, all zeros, Invalid.
BuildVolume() {}
// Initialize from PrintConfig::printable_area and PrintConfig::printable_height
BuildVolume(const std::vector<Vec2d> &printable_area, const double printable_height, const std::vector<std::vector<Vec2d>> &extruder_areas);
BuildVolume(const std::vector<Vec2d> &printable_area, const double printable_height, const std::vector<std::vector<Vec2d>> &extruder_areas, const std::vector<double>& extruder_printable_heights);
// Source data, unscaled coordinates.
const std::vector<Vec2d>& printable_area() const { return m_bed_shape; }
double printable_height() const { return m_max_print_height; }
const std::vector<std::vector<Vec2d>>& extruder_areas() const { return m_extruder_shapes; }
const std::vector<double>& extruder_heights() const { return m_extruder_printable_height; }
const BuildSharedVolume& get_shared_volume() const { return m_shared_volume; }
// Derived data
@ -137,6 +138,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<double> m_extruder_printable_height;
// Derived values.
Type m_type { Type::Invalid };

View File

@ -225,6 +225,7 @@ namespace Slic3r {
//BBS: add bed exclude area
Pointfs bed_exclude_area;
std::vector<Pointfs> extruder_areas;
std::vector<double> extruder_heights;
//BBS: add toolpath_outside
bool toolpath_outside;
//BBS: add object_label_enabled

View File

@ -4817,7 +4817,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);
}

View File

@ -189,7 +189,7 @@ void Bed3D::Axes::render() const
}
//BBS: add part plate logic
bool Bed3D::set_shape(const Pointfs& printable_area, const double printable_height, std::vector<Pointfs> extruder_areas, const std::string& custom_model, bool force_as_custom,
bool Bed3D::set_shape(const Pointfs& printable_area, const double printable_height, std::vector<Pointfs> extruder_areas, std::vector<double> extruder_heights, const std::string& custom_model, bool force_as_custom,
const Vec2d position, bool with_reset)
{
/*auto check_texture = [](const std::string& texture) {
@ -227,7 +227,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;
@ -236,6 +236,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) {
@ -251,10 +252,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;
@ -303,7 +304,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)

View File

@ -106,6 +106,7 @@ private:
Vec2d m_position{ Vec2d::Zero() };
std::vector<Vec2d> m_bed_shape;
std::vector<std::vector<Vec2d>> m_extruder_shapes;
std::vector<double> m_extruder_heights;
bool m_is_dark = false;
public:
@ -117,7 +118,7 @@ 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<Pointfs> extruder_areas, const std::string& custom_model, bool force_as_custom = false,
bool set_shape(const Pointfs& printable_area, const double printable_height, std::vector<Pointfs> extruder_areas, std::vector<double> 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);

View File

@ -1734,7 +1734,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<BoundingBoxf3>& exclude_areas = curr_plate->get_exclude_areas();
std::map<ModelObject*, std::map<int, std::set<int>>> objects_unprintable_filaments;
@ -1943,6 +1943,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);
}
}

View File

@ -63,6 +63,7 @@ struct ObjectFilamentInfo {
struct ObjectFilamentResults {
FilamentMapMode mode;
std::vector<int> filaments; //filaments has conflicts
std::map<int, int> filament_maps; //filament maps
std::vector<ModelObject*> partly_outside_objects; //partly outside objects
std::vector<ObjectFilamentInfo> object_filaments;

View File

@ -22,7 +22,7 @@ namespace GUI {
BedShape::BedShape(const ConfigOptionPoints& points)
{
m_build_volume = { points.values, 0.f, {} };
m_build_volume = { points.values, 0.f, {}, {} };
}
static std::string get_option_label(BedShape::Parameter param)

View File

@ -1060,6 +1060,7 @@ void GCodeViewer::load(const GCodeProcessorResult& gcode_result, const Print& pr
//BBS: add bed exclude area
Pointfs bed_exclude_area = Pointfs();
std::vector<Pointfs> extruder_areas;
std::vector<double> extruder_heights;
std::string texture;
std::string model;
@ -1081,8 +1082,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

View File

@ -1420,6 +1420,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");
}
}
}

View File

@ -835,7 +835,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->collapse_sidebar(true);
m_plater->Show();

View File

@ -2319,10 +2319,11 @@ void PartPlate::generate_exclude_polygon(ExPolygon &exclude_polygon)
}
}
bool PartPlate::set_shape(const Pointfs& shape, const Pointfs& exclude_areas, const std::vector<Pointfs>& 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<Pointfs>& extruder_areas, const std::vector<double>& extruder_heights, Vec2d position, float height_to_lid, float height_to_rod)
{
Pointfs new_shape, new_exclude_areas;
m_raw_shape = shape;
m_extruder_heights = extruder_heights;
for (const Vec2d& p : shape) {
new_shape.push_back(Vec2d(p.x() + position.x(), p.y() + position.y()));
}
@ -3588,7 +3589,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();
@ -3673,7 +3674,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);
@ -3720,7 +3721,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)
@ -3728,7 +3729,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);
@ -3875,7 +3876,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
@ -3898,7 +3899,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
{
@ -5195,12 +5196,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<Pointfs>& 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<Pointfs>& extruder_areas, const std::vector<double>& extruder_heights, const std::string& texture_filename, float height_to_lid, float height_to_rod)
{
const std::lock_guard<std::mutex> 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;
@ -5214,7 +5216,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
@ -5413,7 +5415,7 @@ int PartPlateList::rebuild_plates_after_deserialize(std::vector<bool>& previous_
for (unsigned int i = 0; i < (unsigned int) m_plate_list.size(); ++i) {
m_plate_list[i]->m_partplate_list = this;
}//set_shapes api: every plate use m_partplate_list
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;
m_plate_list[i]->m_plater = this->m_plater;
@ -5750,7 +5752,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 ++;

View File

@ -121,6 +121,7 @@ private:
Pointfs m_shape;
Pointfs m_exclude_area;
std::vector<Pointfs> m_extruder_areas;
std::vector<double> m_extruder_heights;
BoundingBoxf3 m_bounding_box;
BoundingBoxf3 m_extended_bounding_box;
BoundingBoxf3 m_cur_bed_boundingbox;
@ -349,8 +350,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<Pointfs>& 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<Pointfs>& extruder_areas, const std::vector<double>& extruder_heights, Vec2d position, float height_to_lid, float height_to_rod);
const std::vector<Pointfs>& get_extruder_areas() const { return m_extruder_areas; }
const std::vector<double>& 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;
@ -563,6 +565,7 @@ class PartPlateList : public ObjectBase
Pointfs m_shape;
Pointfs m_exclude_areas;
std::vector<Pointfs> m_extruder_areas;
std::vector<double> m_extruder_heights;
BoundingBoxf3 m_bounding_box;
bool m_intialized;
std::string m_logo_texture_filename;
@ -868,7 +871,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<Pointfs>& 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<Pointfs>& extruder_areas, const std::vector<double>& 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);

View File

@ -3019,7 +3019,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<Pointfs> 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<Pointfs> extruder_areas, std::vector<double> 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;
@ -5597,7 +5597,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);
}
@ -8820,11 +8820,11 @@ 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<Pointfs> 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<Pointfs> extruder_areas, std::vector<double> extruder_heights, const std::string& custom_texture, const std::string& custom_model, bool force_as_custom)
{
//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);
@ -8848,11 +8848,11 @@ void Plater::priv::set_bed_shape(const Pointfs& shape, const Pointfs& exclude_ar
//Pointfs& exclude_areas = config->option<ConfigOptionPoints>("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);
}
}
@ -13791,14 +13791,15 @@ void Plater::set_bed_shape() const
p->config->option<ConfigOptionPoints>("bed_exclude_area")->values,
p->config->option<ConfigOptionFloat>("printable_height")->value,
p->config->option<ConfigOptionPointsGroups>("extruder_printable_area")->values,
p->config->option<ConfigOptionFloatsNullable>("extruder_printable_height")->values,
p->config->option<ConfigOptionString>("bed_custom_texture")->value.empty() ? texture_filename : p->config->option<ConfigOptionString>("bed_custom_texture")->value,
p->config->option<ConfigOptionString>("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<Pointfs> 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<Pointfs> extruder_areas, std::vector<double> extruder_heights, const std::string& custom_texture, const std::string& custom_model, bool force_as_custom) const
{
p->set_bed_shape(shape, exclude_area, printable_height, extruder_areas, custom_texture, custom_model, force_as_custom);
p->set_bed_shape(shape, exclude_area, printable_height, extruder_areas, extruder_heights, custom_texture, custom_model, force_as_custom);
}
void Plater::force_filament_colors_update()

View File

@ -628,7 +628,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<Pointfs> 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<Pointfs> extruder_areas, std::vector<double> 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();

View File

@ -1050,6 +1050,7 @@ bool CalibUtils::process_and_store_3mf(Model *model, const DynamicPrintConfig &f
{
Pointfs bedfs = full_config.opt<ConfigOptionPoints>("printable_area")->values;
std::vector<Pointfs> extruder_areas = full_config.option<ConfigOptionPointsGroups>("extruder_printable_area")->values;
std::vector<double> extruder_heights = full_config.option<ConfigOptionFloatsNullable>("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();
@ -1096,7 +1097,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");