mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-29 20:01:26 +00:00
ENH: add new arrangement features for wrapping detection area
Jira: STUDIO-13735 Change-Id: I198d19f5e6ef70f0adfa6370269290c81d21a557 (cherry picked from commit dc83637652526111611d0833d5f5798aaa3e7be7)
This commit is contained in:
+8
-6
@@ -3431,6 +3431,7 @@ int CLI::run(int argc, char **argv)
|
|||||||
//use Pointfs insteadof Points
|
//use Pointfs insteadof Points
|
||||||
Pointfs current_printable_area = m_print_config.opt<ConfigOptionPoints>("printable_area")->values;
|
Pointfs current_printable_area = m_print_config.opt<ConfigOptionPoints>("printable_area")->values;
|
||||||
Pointfs current_exclude_area = m_print_config.opt<ConfigOptionPoints>("bed_exclude_area")->values;
|
Pointfs current_exclude_area = m_print_config.opt<ConfigOptionPoints>("bed_exclude_area")->values;
|
||||||
|
Pointfs current_wrapping_exclude_area = m_print_config.opt<ConfigOptionPoints>("wrapping_exclude_area", true)->values;
|
||||||
std::vector<Pointfs> current_extruder_areas;
|
std::vector<Pointfs> current_extruder_areas;
|
||||||
//update part plate's size
|
//update part plate's size
|
||||||
double print_height = m_print_config.opt_float("printable_height");
|
double print_height = m_print_config.opt_float("printable_height");
|
||||||
@@ -3497,7 +3498,8 @@ int CLI::run(int argc, char **argv)
|
|||||||
else {
|
else {
|
||||||
partplate_list.reset_size(old_printable_width, old_printable_depth, old_printable_height, false);
|
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, current_extruder_print_heights, bed_texture, height_to_lid, height_to_rod);
|
partplate_list.set_shapes(make_counter_clockwise(current_printable_area), current_exclude_area, current_wrapping_exclude_area, current_extruder_areas, current_extruder_print_heights, bed_texture,
|
||||||
|
height_to_lid, height_to_rod);
|
||||||
//plate_stride = partplate_list.plate_stride_x();
|
//plate_stride = partplate_list.plate_stride_x();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4426,7 +4428,7 @@ int CLI::run(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add the virtual object into unselect list if has
|
// add the virtual object into unselect list if has
|
||||||
partplate_list.preprocess_exclude_areas(unselected, i + 1);
|
partplate_list.preprocess_exclude_areas(unselected, enable_wrapping_detect, i + 1);
|
||||||
if (avoid_extrusion_cali_region)
|
if (avoid_extrusion_cali_region)
|
||||||
partplate_list.preprocess_nonprefered_areas(unselected, i + 1);
|
partplate_list.preprocess_nonprefered_areas(unselected, i + 1);
|
||||||
|
|
||||||
@@ -4454,7 +4456,7 @@ int CLI::run(int argc, char **argv)
|
|||||||
|
|
||||||
beds = get_shrink_bedpts(&m_print_config, arrange_cfg);
|
beds = get_shrink_bedpts(&m_print_config, arrange_cfg);
|
||||||
|
|
||||||
partplate_list.preprocess_exclude_areas(arrange_cfg.excluded_regions, 1, scale_(1));
|
partplate_list.preprocess_exclude_areas(arrange_cfg.excluded_regions, enable_wrapping_detect, 1, scale_(1));
|
||||||
|
|
||||||
{
|
{
|
||||||
BOOST_LOG_TRIVIAL(debug) << "arrange bedpts:" << beds[0].transpose() << ", " << beds[1].transpose() << ", " << beds[2].transpose() << ", " << beds[3].transpose();
|
BOOST_LOG_TRIVIAL(debug) << "arrange bedpts:" << beds[0].transpose() << ", " << beds[1].transpose() << ", " << beds[2].transpose() << ", " << beds[3].transpose();
|
||||||
@@ -4663,7 +4665,7 @@ int CLI::run(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//add the virtual object into unselect list if has
|
//add the virtual object into unselect list if has
|
||||||
partplate_list.preprocess_exclude_areas(unselected);
|
partplate_list.preprocess_exclude_areas(unselected, enable_wrapping_detect);
|
||||||
|
|
||||||
if (used_filament_set.size() > 0)
|
if (used_filament_set.size() > 0)
|
||||||
{
|
{
|
||||||
@@ -4877,7 +4879,7 @@ int CLI::run(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// add the virtual object into unselect list if has
|
// add the virtual object into unselect list if has
|
||||||
partplate_list.preprocess_exclude_areas(unselected, plate_to_slice);
|
partplate_list.preprocess_exclude_areas(unselected, enable_wrapping_detect, plate_to_slice);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -4905,7 +4907,7 @@ int CLI::run(int argc, char **argv)
|
|||||||
|
|
||||||
beds=get_shrink_bedpts(&m_print_config, arrange_cfg);
|
beds=get_shrink_bedpts(&m_print_config, arrange_cfg);
|
||||||
|
|
||||||
partplate_list.preprocess_exclude_areas(arrange_cfg.excluded_regions, 1, scale_(1));
|
partplate_list.preprocess_exclude_areas(arrange_cfg.excluded_regions, enable_wrapping_detect, 1, scale_(1));
|
||||||
|
|
||||||
{
|
{
|
||||||
BOOST_LOG_TRIVIAL(debug) << "arrange bedpts:" << beds[0].transpose() << ", " << beds[1].transpose() << ", " << beds[2].transpose() << ", " << beds[3].transpose();
|
BOOST_LOG_TRIVIAL(debug) << "arrange bedpts:" << beds[0].transpose() << ", " << beds[1].transpose() << ", " << beds[2].transpose() << ", " << beds[3].transpose();
|
||||||
|
|||||||
@@ -1440,6 +1440,7 @@ void GCodeProcessorResult::reset() {
|
|||||||
printable_area = Pointfs();
|
printable_area = Pointfs();
|
||||||
//BBS: add bed exclude area
|
//BBS: add bed exclude area
|
||||||
bed_exclude_area = Pointfs();
|
bed_exclude_area = Pointfs();
|
||||||
|
wrapping_exclude_area = Pointfs();
|
||||||
//BBS: add toolpath_outside
|
//BBS: add toolpath_outside
|
||||||
toolpath_outside = false;
|
toolpath_outside = false;
|
||||||
//BBS: add label_object_enabled
|
//BBS: add label_object_enabled
|
||||||
@@ -1468,6 +1469,7 @@ void GCodeProcessorResult::reset() {
|
|||||||
printable_area = Pointfs();
|
printable_area = Pointfs();
|
||||||
//BBS: add bed exclude area
|
//BBS: add bed exclude area
|
||||||
bed_exclude_area = Pointfs();
|
bed_exclude_area = Pointfs();
|
||||||
|
wrapping_exclude_area = Pointfs();
|
||||||
//BBS: add toolpath_outside
|
//BBS: add toolpath_outside
|
||||||
toolpath_outside = false;
|
toolpath_outside = false;
|
||||||
//BBS: add label_object_enabled
|
//BBS: add label_object_enabled
|
||||||
@@ -1990,6 +1992,10 @@ void GCodeProcessor::apply_config(const DynamicPrintConfig& config)
|
|||||||
if (bed_exclude_area != nullptr)
|
if (bed_exclude_area != nullptr)
|
||||||
m_result.bed_exclude_area = bed_exclude_area->values;
|
m_result.bed_exclude_area = bed_exclude_area->values;
|
||||||
|
|
||||||
|
const ConfigOptionPoints* wrapping_exclude_area = config.option<ConfigOptionPoints>("wrapping_exclude_area");
|
||||||
|
if (wrapping_exclude_area != nullptr)
|
||||||
|
m_result.wrapping_exclude_area = wrapping_exclude_area->values;
|
||||||
|
|
||||||
const ConfigOptionString* print_settings_id = config.option<ConfigOptionString>("print_settings_id");
|
const ConfigOptionString* print_settings_id = config.option<ConfigOptionString>("print_settings_id");
|
||||||
if (print_settings_id != nullptr)
|
if (print_settings_id != nullptr)
|
||||||
m_result.settings_ids.print = print_settings_id->value;
|
m_result.settings_ids.print = print_settings_id->value;
|
||||||
|
|||||||
@@ -227,6 +227,7 @@ class Print;
|
|||||||
Pointfs printable_area;
|
Pointfs printable_area;
|
||||||
//BBS: add bed exclude area
|
//BBS: add bed exclude area
|
||||||
Pointfs bed_exclude_area;
|
Pointfs bed_exclude_area;
|
||||||
|
Pointfs wrapping_exclude_area;
|
||||||
std::vector<Pointfs> extruder_areas;
|
std::vector<Pointfs> extruder_areas;
|
||||||
std::vector<double> extruder_heights;
|
std::vector<double> extruder_heights;
|
||||||
//BBS: add toolpath_outside
|
//BBS: add toolpath_outside
|
||||||
@@ -277,6 +278,7 @@ class Print;
|
|||||||
lines_ends = other.lines_ends;
|
lines_ends = other.lines_ends;
|
||||||
printable_area = other.printable_area;
|
printable_area = other.printable_area;
|
||||||
bed_exclude_area = other.bed_exclude_area;
|
bed_exclude_area = other.bed_exclude_area;
|
||||||
|
wrapping_exclude_area = other.wrapping_exclude_area;
|
||||||
toolpath_outside = other.toolpath_outside;
|
toolpath_outside = other.toolpath_outside;
|
||||||
label_object_enabled = other.label_object_enabled;
|
label_object_enabled = other.label_object_enabled;
|
||||||
long_retraction_when_cut = other.long_retraction_when_cut;
|
long_retraction_when_cut = other.long_retraction_when_cut;
|
||||||
|
|||||||
@@ -1021,6 +1021,7 @@ void GCodeViewer::load(const GCodeProcessorResult& gcode_result, const Print& pr
|
|||||||
Pointfs printable_area;
|
Pointfs printable_area;
|
||||||
//BBS: add bed exclude area
|
//BBS: add bed exclude area
|
||||||
Pointfs bed_exclude_area = Pointfs();
|
Pointfs bed_exclude_area = Pointfs();
|
||||||
|
Pointfs wrapping_exclude_area = Pointfs();
|
||||||
std::vector<Pointfs> extruder_areas;
|
std::vector<Pointfs> extruder_areas;
|
||||||
std::vector<double> extruder_heights;
|
std::vector<double> extruder_heights;
|
||||||
std::string texture;
|
std::string texture;
|
||||||
@@ -1042,12 +1043,15 @@ void GCodeViewer::load(const GCodeProcessorResult& gcode_result, const Print& pr
|
|||||||
if (!gcode_result.bed_exclude_area.empty())
|
if (!gcode_result.bed_exclude_area.empty())
|
||||||
bed_exclude_area = gcode_result.bed_exclude_area;
|
bed_exclude_area = gcode_result.bed_exclude_area;
|
||||||
|
|
||||||
|
if (!gcode_result.wrapping_exclude_area.empty())
|
||||||
|
wrapping_exclude_area = gcode_result.wrapping_exclude_area;
|
||||||
|
|
||||||
if (!gcode_result.extruder_areas.empty())
|
if (!gcode_result.extruder_areas.empty())
|
||||||
extruder_areas = gcode_result.extruder_areas;
|
extruder_areas = gcode_result.extruder_areas;
|
||||||
if (!gcode_result.extruder_heights.empty())
|
if (!gcode_result.extruder_heights.empty())
|
||||||
extruder_heights = gcode_result.extruder_heights;
|
extruder_heights = gcode_result.extruder_heights;
|
||||||
|
|
||||||
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());
|
wxGetApp().plater()->set_bed_shape(printable_area, bed_exclude_area, wrapping_exclude_area, gcode_result.printable_height, extruder_areas, extruder_heights, texture, model, gcode_result.printable_area.empty());
|
||||||
}
|
}
|
||||||
/*else {
|
/*else {
|
||||||
// adjust printbed size in dependence of toolpaths bbox
|
// adjust printbed size in dependence of toolpaths bbox
|
||||||
|
|||||||
@@ -247,8 +247,11 @@ void ArrangeJob::prepare_all() {
|
|||||||
|
|
||||||
prepare_wipe_tower();
|
prepare_wipe_tower();
|
||||||
|
|
||||||
|
const DynamicPrintConfig& current_config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
|
||||||
|
bool enable_wrapping = current_config.option<ConfigOptionBool>("enable_wrapping_detection")->value;
|
||||||
|
|
||||||
// add the virtual object into unselect list if has
|
// add the virtual object into unselect list if has
|
||||||
plate_list.preprocess_exclude_areas(m_unselected, MAX_NUM_PLATES);
|
plate_list.preprocess_exclude_areas(m_unselected, enable_wrapping, MAX_NUM_PLATES);
|
||||||
}
|
}
|
||||||
|
|
||||||
arrangement::ArrangePolygon estimate_wipe_tower_info(int plate_index, std::set<int>& extruder_ids)
|
arrangement::ArrangePolygon estimate_wipe_tower_info(int plate_index, std::set<int>& extruder_ids)
|
||||||
@@ -421,8 +424,11 @@ void ArrangeJob::prepare_partplate() {
|
|||||||
m_unselected.emplace_back(std::move(ap));
|
m_unselected.emplace_back(std::move(ap));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const DynamicPrintConfig ¤t_config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
|
||||||
|
bool enable_wrapping = current_config.option<ConfigOptionBool>("enable_wrapping_detection")->value;
|
||||||
|
|
||||||
// add the virtual object into unselect list if has
|
// add the virtual object into unselect list if has
|
||||||
plate_list.preprocess_exclude_areas(m_unselected, current_plate_index + 1);
|
plate_list.preprocess_exclude_areas(m_unselected, enable_wrapping, current_plate_index + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//BBS: add partplate logic
|
//BBS: add partplate logic
|
||||||
@@ -534,7 +540,8 @@ void ArrangeJob::process(Ctl &ctl)
|
|||||||
|
|
||||||
Points bedpts = get_shrink_bedpts(m_plater->config(),params);
|
Points bedpts = get_shrink_bedpts(m_plater->config(),params);
|
||||||
|
|
||||||
partplate_list.preprocess_exclude_areas(params.excluded_regions, 1, scale_(1));
|
bool enable_wrapping = global_config.option<ConfigOptionBool>("enable_wrapping_detection")->value;
|
||||||
|
partplate_list.preprocess_exclude_areas(params.excluded_regions, enable_wrapping, 1, scale_(1));
|
||||||
|
|
||||||
BOOST_LOG_TRIVIAL(debug) << "arrange bedpts:" << bedpts[0].transpose() << ", " << bedpts[1].transpose() << ", " << bedpts[2].transpose() << ", " << bedpts[3].transpose();
|
BOOST_LOG_TRIVIAL(debug) << "arrange bedpts:" << bedpts[0].transpose() << ", " << bedpts[1].transpose() << ", " << bedpts[2].transpose() << ", " << bedpts[3].transpose();
|
||||||
|
|
||||||
|
|||||||
@@ -119,10 +119,11 @@ void FillBedJob::prepare()
|
|||||||
|
|
||||||
if (m_selected.empty()) return;
|
if (m_selected.empty()) return;
|
||||||
|
|
||||||
|
bool enable_wrapping = global_config.option<ConfigOptionBool>("enable_wrapping_detection")->value;
|
||||||
//add the virtual object into unselect list if has
|
//add the virtual object into unselect list if has
|
||||||
double scaled_exclusion_gap = scale_(1);
|
double scaled_exclusion_gap = scale_(1);
|
||||||
plate_list.preprocess_exclude_areas(params.excluded_regions, 1, scaled_exclusion_gap);
|
plate_list.preprocess_exclude_areas(params.excluded_regions, enable_wrapping, 1, scaled_exclusion_gap);
|
||||||
plate_list.preprocess_exclude_areas(m_unselected);
|
plate_list.preprocess_exclude_areas(m_unselected, enable_wrapping);
|
||||||
|
|
||||||
m_bedpts = get_bed_shape(*m_plater->config());
|
m_bedpts = get_bed_shape(*m_plater->config());
|
||||||
|
|
||||||
|
|||||||
@@ -871,7 +871,7 @@ void MainFrame::update_layout()
|
|||||||
{
|
{
|
||||||
m_main_sizer->Add(m_plater, 1, wxEXPAND);
|
m_main_sizer->Add(m_plater, 1, wxEXPAND);
|
||||||
//BBS: add bed exclude area
|
//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->get_collapse_toolbar().set_enabled(false);
|
||||||
m_plater->enable_sidebar(false);
|
m_plater->enable_sidebar(false);
|
||||||
m_plater->Show();
|
m_plater->Show();
|
||||||
|
|||||||
@@ -3982,7 +3982,7 @@ void PartPlateList::reset_size(int width, int depth, int height, bool reload_obj
|
|||||||
m_plate_height = height;
|
m_plate_height = height;
|
||||||
update_all_plates_pos_and_size(false, false, true);
|
update_all_plates_pos_and_size(false, false, true);
|
||||||
if (update_shapes) {
|
if (update_shapes) {
|
||||||
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);
|
set_shapes(m_shape, m_exclude_areas, m_wrapping_exclude_areas, m_extruder_areas, m_extruder_heights, m_logo_texture_filename, m_height_to_lid, m_height_to_rod);
|
||||||
}
|
}
|
||||||
if (reload_objects)
|
if (reload_objects)
|
||||||
reload_all_objects();
|
reload_all_objects();
|
||||||
@@ -4084,7 +4084,7 @@ void PartPlateList::reinit()
|
|||||||
void PartPlateList::update_plates()
|
void PartPlateList::update_plates()
|
||||||
{
|
{
|
||||||
update_all_plates_pos_and_size(true, false);
|
update_all_plates_pos_and_size(true, false);
|
||||||
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);
|
set_shapes(m_shape, m_exclude_areas, m_wrapping_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)
|
int PartPlateList::create_plate(bool adjust_position)
|
||||||
@@ -4125,7 +4125,7 @@ int PartPlateList::create_plate(bool adjust_position)
|
|||||||
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(":old_cols %1% -> new_cols %2%") % old_cols % cols;
|
BOOST_LOG_TRIVIAL(debug) << __FUNCTION__ << boost::format(":old_cols %1% -> new_cols %2%") % old_cols % cols;
|
||||||
//update the origin of each plate
|
//update the origin of each plate
|
||||||
update_all_plates_pos_and_size(adjust_position, false);
|
update_all_plates_pos_and_size(adjust_position, false);
|
||||||
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);
|
set_shapes(m_shape, m_exclude_areas, m_wrapping_exclude_areas, m_extruder_areas, m_extruder_heights, m_logo_texture_filename, m_height_to_lid, m_height_to_rod);
|
||||||
|
|
||||||
if (m_plater) {
|
if (m_plater) {
|
||||||
Vec2d pos = compute_shape_position(m_current_plate, cols);
|
Vec2d pos = compute_shape_position(m_current_plate, cols);
|
||||||
@@ -4319,7 +4319,7 @@ int PartPlateList::delete_plate(int index)
|
|||||||
{
|
{
|
||||||
//update the origin of each plate
|
//update the origin of each plate
|
||||||
update_all_plates_pos_and_size();
|
update_all_plates_pos_and_size();
|
||||||
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);
|
set_shapes(m_shape, m_exclude_areas, m_wrapping_exclude_areas, m_extruder_areas, m_extruder_heights, m_logo_texture_filename, m_height_to_lid, m_height_to_rod);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -5134,10 +5134,40 @@ bool PartPlateList::preprocess_arrange_polygon_other_locked(int obj_index, int i
|
|||||||
return locked;
|
return locked;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PartPlateList::preprocess_exclude_areas(arrangement::ArrangePolygons& unselected, int num_plates, float inflation)
|
bool PartPlateList::preprocess_exclude_areas(arrangement::ArrangePolygons &unselected, bool enable_wrapping_detect, int num_plates, float inflation)
|
||||||
{
|
{
|
||||||
bool added = false;
|
bool added = false;
|
||||||
|
|
||||||
|
// wrapping detection area
|
||||||
|
if (enable_wrapping_detect)
|
||||||
|
{
|
||||||
|
if (!m_wrapping_exclude_areas.empty())
|
||||||
|
{
|
||||||
|
Polygon ap{};
|
||||||
|
for (const Vec2d &p : m_wrapping_exclude_areas)
|
||||||
|
{
|
||||||
|
ap.append({scale_(p(0)), scale_(p(1))});
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int j = 0; j < num_plates; j++)
|
||||||
|
{
|
||||||
|
arrangement::ArrangePolygon ret;
|
||||||
|
ret.poly.contour = ap;
|
||||||
|
ret.translation = Vec2crd(0, 0);
|
||||||
|
ret.rotation = 0.0f;
|
||||||
|
ret.is_virt_object = true;
|
||||||
|
ret.bed_idx = j;
|
||||||
|
ret.height = 1;
|
||||||
|
ret.name = "WrappingRegion";
|
||||||
|
ret.inflation = inflation;
|
||||||
|
|
||||||
|
unselected.emplace_back(std::move(ret));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
added = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// excluded area
|
||||||
if (m_exclude_areas.size() > 0)
|
if (m_exclude_areas.size() > 0)
|
||||||
{
|
{
|
||||||
//has exclude areas
|
//has exclude areas
|
||||||
@@ -5442,11 +5472,19 @@ void PartPlateList::select_plate_view()
|
|||||||
m_plater->get_camera().select_view("topfront");
|
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::vector<double>& extruder_heights, 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 Pointfs &wrapping_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);
|
const std::lock_guard<std::mutex> local_lock(m_plates_mutex);
|
||||||
m_shape = shape;
|
m_shape = shape;
|
||||||
m_exclude_areas = exclude_areas;
|
m_exclude_areas = exclude_areas;
|
||||||
|
m_wrapping_exclude_areas = wrapping_exclude_areas;
|
||||||
m_extruder_areas = extruder_areas;
|
m_extruder_areas = extruder_areas;
|
||||||
m_extruder_heights = extruder_heights;
|
m_extruder_heights = extruder_heights;
|
||||||
m_height_to_lid = height_to_lid;
|
m_height_to_lid = height_to_lid;
|
||||||
@@ -5642,7 +5680,7 @@ int PartPlateList::rebuild_plates_after_deserialize(std::vector<bool>& previous_
|
|||||||
}
|
}
|
||||||
update_plate_cols();
|
update_plate_cols();
|
||||||
update_all_plates_pos_and_size(false, false, false, false);
|
update_all_plates_pos_and_size(false, false, false, false);
|
||||||
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);
|
set_shapes(m_shape, m_exclude_areas, m_wrapping_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)
|
for (unsigned int i = 0; i < (unsigned int)m_plate_list.size(); ++i)
|
||||||
{
|
{
|
||||||
bool need_reset_print = false;
|
bool need_reset_print = false;
|
||||||
|
|||||||
@@ -579,6 +579,7 @@ class PartPlateList : public ObjectBase
|
|||||||
PartPlate unprintable_plate;
|
PartPlate unprintable_plate;
|
||||||
Pointfs m_shape;
|
Pointfs m_shape;
|
||||||
Pointfs m_exclude_areas;
|
Pointfs m_exclude_areas;
|
||||||
|
Pointfs m_wrapping_exclude_areas;
|
||||||
std::vector<Pointfs> m_extruder_areas;
|
std::vector<Pointfs> m_extruder_areas;
|
||||||
std::vector<double> m_extruder_heights;
|
std::vector<double> m_extruder_heights;
|
||||||
BoundingBoxf3 m_bounding_box;
|
BoundingBoxf3 m_bounding_box;
|
||||||
@@ -755,6 +756,7 @@ public:
|
|||||||
Vec3d get_current_plate_origin() { return compute_origin(m_current_plate, m_plate_cols); }
|
Vec3d get_current_plate_origin() { return compute_origin(m_current_plate, m_plate_cols); }
|
||||||
Vec2d get_current_shape_position() { return compute_shape_position(m_current_plate, m_plate_cols); }
|
Vec2d get_current_shape_position() { return compute_shape_position(m_current_plate, m_plate_cols); }
|
||||||
Pointfs get_exclude_area() { return m_exclude_areas; }
|
Pointfs get_exclude_area() { return m_exclude_areas; }
|
||||||
|
Pointfs get_wrapping_exclude_area() const { return m_wrapping_exclude_areas; }
|
||||||
|
|
||||||
std::set<int> get_extruders(bool conside_custom_gcode = false) const;
|
std::set<int> get_extruders(bool conside_custom_gcode = false) const;
|
||||||
|
|
||||||
@@ -816,7 +818,7 @@ public:
|
|||||||
//preprocess an arrangement::ArrangePolygon, return true if it is in a locked plate
|
//preprocess an arrangement::ArrangePolygon, return true if it is in a locked plate
|
||||||
bool preprocess_arrange_polygon(int obj_index, int instance_index, arrangement::ArrangePolygon& arrange_polygon, bool selected);
|
bool preprocess_arrange_polygon(int obj_index, int instance_index, arrangement::ArrangePolygon& arrange_polygon, bool selected);
|
||||||
bool preprocess_arrange_polygon_other_locked(int obj_index, int instance_index, arrangement::ArrangePolygon& arrange_polygon, bool selected);
|
bool preprocess_arrange_polygon_other_locked(int obj_index, int instance_index, arrangement::ArrangePolygon& arrange_polygon, bool selected);
|
||||||
bool preprocess_exclude_areas(arrangement::ArrangePolygons& unselected, int num_plates = 16, float inflation = 0);
|
bool preprocess_exclude_areas(arrangement::ArrangePolygons& unselected, bool enable_wrapping_detect, int num_plates = 16, float inflation = 0);
|
||||||
bool preprocess_nonprefered_areas(arrangement::ArrangePolygons& regions, int num_plates = 1, float inflation=0);
|
bool preprocess_nonprefered_areas(arrangement::ArrangePolygons& regions, int num_plates = 1, float inflation=0);
|
||||||
|
|
||||||
void postprocess_bed_index_for_selected(arrangement::ArrangePolygon& arrange_polygon);
|
void postprocess_bed_index_for_selected(arrangement::ArrangePolygon& arrange_polygon);
|
||||||
@@ -841,7 +843,14 @@ public:
|
|||||||
int select_plate_by_obj(int obj_index, int instance_index);
|
int select_plate_by_obj(int obj_index, int instance_index);
|
||||||
void calc_bounding_boxes();
|
void calc_bounding_boxes();
|
||||||
void select_plate_view();
|
void select_plate_view();
|
||||||
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);
|
bool set_shapes(const Pointfs &shape,
|
||||||
|
const Pointfs &exclude_areas,
|
||||||
|
const Pointfs &wrapping_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 set_hover_id(int id);
|
||||||
void reset_hover_id();
|
void reset_hover_id();
|
||||||
bool intersects(const BoundingBoxf3 &bb);
|
bool intersects(const BoundingBoxf3 &bb);
|
||||||
|
|||||||
@@ -4175,7 +4175,15 @@ struct Plater::priv
|
|||||||
// fills the m_bed.m_grid_lines and sets m_bed.m_origin.
|
// fills the m_bed.m_grid_lines and sets m_bed.m_origin.
|
||||||
// Sets m_bed.m_polygon to limit the object placement.
|
// Sets m_bed.m_polygon to limit the object placement.
|
||||||
//BBS: add bed exclude area
|
//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, std::vector<double> extruder_heights, 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 Pointfs &wrapping_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() const;
|
||||||
bool can_delete_all() const;
|
bool can_delete_all() const;
|
||||||
@@ -4334,7 +4342,7 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
|
|||||||
, main_frame(main_frame)
|
, main_frame(main_frame)
|
||||||
//BBS: add bed_exclude_area
|
//BBS: add bed_exclude_area
|
||||||
, config(Slic3r::DynamicPrintConfig::new_from_defaults_keys({
|
, config(Slic3r::DynamicPrintConfig::new_from_defaults_keys({
|
||||||
"printable_area", "bed_exclude_area", "extruder_printable_area", "bed_custom_texture", "bed_custom_model", "print_sequence",
|
"printable_area", "bed_exclude_area", "wrapping_exclude_area", "extruder_printable_area", "bed_custom_texture", "bed_custom_model", "print_sequence",
|
||||||
"extruder_clearance_radius",
|
"extruder_clearance_radius",
|
||||||
"extruder_clearance_height_to_lid", "extruder_clearance_height_to_rod",
|
"extruder_clearance_height_to_lid", "extruder_clearance_height_to_rod",
|
||||||
"nozzle_height", "skirt_type", "skirt_loops", "skirt_speed","min_skirt_length", "skirt_distance", "skirt_start_angle",
|
"nozzle_height", "skirt_type", "skirt_loops", "skirt_speed","min_skirt_length", "skirt_distance", "skirt_start_angle",
|
||||||
@@ -10215,7 +10223,15 @@ bool Plater::priv::show_publish_dlg(bool show)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//BBS: add bed exclude area
|
//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, std::vector<double> extruder_heights, 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 Pointfs &wrapping_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)
|
||||||
{
|
{
|
||||||
//Orca: reduce resolution for large bed printer
|
//Orca: reduce resolution for large bed printer
|
||||||
BoundingBoxf bed_size = get_extents(shape);
|
BoundingBoxf bed_size = get_extents(shape);
|
||||||
@@ -10234,7 +10250,9 @@ void Plater::priv::set_bed_shape(const Pointfs& shape, const Pointfs& exclude_ar
|
|||||||
double height_to_rod = config->opt_float("extruder_clearance_height_to_rod");
|
double height_to_rod = config->opt_float("extruder_clearance_height_to_rod");
|
||||||
|
|
||||||
Pointfs prev_exclude_areas = partplate_list.get_exclude_area();
|
Pointfs prev_exclude_areas = partplate_list.get_exclude_area();
|
||||||
new_shape |= (height_to_lid != prev_height_lid) || (height_to_rod != prev_height_rod) || (prev_exclude_areas != exclude_areas);
|
Pointfs prev_wrapping_exclude_areas = partplate_list.get_wrapping_exclude_area();
|
||||||
|
new_shape |= (height_to_lid != prev_height_lid) || (height_to_rod != prev_height_rod) || (prev_exclude_areas != exclude_areas)
|
||||||
|
|| (prev_wrapping_exclude_areas != wrapping_exclude_areas);
|
||||||
if (!new_shape && partplate_list.get_logo_texture_filename() != custom_texture) {
|
if (!new_shape && partplate_list.get_logo_texture_filename() != custom_texture) {
|
||||||
partplate_list.update_logo_texture_filename(custom_texture);
|
partplate_list.update_logo_texture_filename(custom_texture);
|
||||||
}
|
}
|
||||||
@@ -10250,7 +10268,7 @@ void Plater::priv::set_bed_shape(const Pointfs& shape, const Pointfs& exclude_ar
|
|||||||
|
|
||||||
//Pointfs& exclude_areas = config->option<ConfigOptionPoints>("bed_exclude_area")->values;
|
//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.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, extruder_heights, custom_texture, height_to_lid, height_to_rod);
|
partplate_list.set_shapes(shape, exclude_areas, wrapping_exclude_areas, extruder_areas, extruder_heights, custom_texture, height_to_lid, height_to_rod);
|
||||||
|
|
||||||
Vec2d new_shape_position = partplate_list.get_current_shape_position();
|
Vec2d new_shape_position = partplate_list.get_current_shape_position();
|
||||||
if (shape_position != new_shape_position)
|
if (shape_position != new_shape_position)
|
||||||
@@ -15490,6 +15508,7 @@ void Plater::set_bed_shape() const
|
|||||||
set_bed_shape(p->config->option<ConfigOptionPoints>("printable_area")->values,
|
set_bed_shape(p->config->option<ConfigOptionPoints>("printable_area")->values,
|
||||||
//BBS: add bed exclude areas
|
//BBS: add bed exclude areas
|
||||||
p->config->option<ConfigOptionPoints>("bed_exclude_area")->values,
|
p->config->option<ConfigOptionPoints>("bed_exclude_area")->values,
|
||||||
|
p->config->option<ConfigOptionPoints>("wrapping_exclude_area")->values,
|
||||||
p->config->option<ConfigOptionFloat>("printable_height")->value,
|
p->config->option<ConfigOptionFloat>("printable_height")->value,
|
||||||
p->config->option<ConfigOptionPointsGroups>("extruder_printable_area")->values,
|
p->config->option<ConfigOptionPointsGroups>("extruder_printable_area")->values,
|
||||||
p->config->option<ConfigOptionFloatsNullable>("extruder_printable_height")->values,
|
p->config->option<ConfigOptionFloatsNullable>("extruder_printable_height")->values,
|
||||||
@@ -15498,9 +15517,9 @@ void Plater::set_bed_shape() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
//BBS: add bed exclude area
|
//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, std::vector<double> extruder_heights, 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 Pointfs& wrapping_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(make_counter_clockwise(shape), exclude_area, printable_height, extruder_areas, extruder_heights, custom_texture, custom_model, force_as_custom);
|
p->set_bed_shape(make_counter_clockwise(shape), exclude_area, wrapping_exclude_area, printable_height, extruder_areas, extruder_heights, custom_texture, custom_model, force_as_custom);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Plater::force_filament_colors_update()
|
void Plater::force_filament_colors_update()
|
||||||
|
|||||||
@@ -755,7 +755,15 @@ public:
|
|||||||
void update_flush_volume_matrix(size_t old_nozzle_size, size_t new_nozzle_size);
|
void update_flush_volume_matrix(size_t old_nozzle_size, size_t new_nozzle_size);
|
||||||
//BBS: add bed exclude area
|
//BBS: add bed exclude area
|
||||||
void set_bed_shape() const;
|
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, std::vector<double> extruder_heights, 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 Pointfs &wrapping_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;
|
const NotificationManager* get_notification_manager() const;
|
||||||
NotificationManager* get_notification_manager();
|
NotificationManager* get_notification_manager();
|
||||||
|
|||||||
Reference in New Issue
Block a user