ENH: wipe_tower: use uniform wipe tower logic for cli and gui

jira: no-jira
Change-Id: I179212585871071cd17bd37c2756444a2d7aba1f
This commit is contained in:
lane.wei 2025-03-08 16:29:58 +08:00
parent 8c1ed01948
commit 1f3dde9498
5 changed files with 155 additions and 117 deletions

View File

@ -1481,7 +1481,7 @@ int CLI::run(int argc, char **argv)
PlateDataPtrs plate_data_src;
std::vector<plate_obj_size_info_t> plate_obj_size_infos;
//int arrange_option;
int plate_to_slice = 0, filament_count = 0, duplicate_count = 0, real_duplicate_count = 0, current_extruder_count = 0, new_extruder_count = 0;
int plate_to_slice = 0, filament_count = 0, duplicate_count = 0, real_duplicate_count = 0, current_extruder_count = 1, new_extruder_count = 1;
bool first_file = true, is_bbl_3mf = false, need_arrange = true, has_thumbnails = false, up_config_to_date = false, normative_check = true, duplicate_single_object = false, use_first_fila_as_default = false, minimum_save = false, enable_timelapse = false;
bool allow_rotations = true, skip_modified_gcodes = false, avoid_extrusion_cali_region = false, skip_useless_pick = false, allow_newer_file = false, current_is_multi_extruder = false, new_is_multi_extruder = false;
Semver file_version;
@ -3609,6 +3609,72 @@ int CLI::run(int argc, char **argv)
//plate_stride = partplate_list.plate_stride_x();
}
//process some old params
if (is_bbl_3mf && keep_old_params) {
std::vector<std::string> different_keys;
Slic3r::unescape_strings_cstyle(different_settings[0], different_keys);
std::set<std::string> different_key_set(different_keys.begin(), different_keys.end());
BOOST_LOG_TRIVIAL(info) << boost::format("%1%, process old params for support and wipe tower")%__LINE__;
//wipe tower params process
ConfigOptionBool *prime_tower_rib_wall_option = m_print_config.option<ConfigOptionBool>("prime_tower_rib_wall", true);
prime_tower_rib_wall_option->value = false;
ConfigOptionPercent *prime_tower_infill_gap_option = m_print_config.option<ConfigOptionPercent>("prime_tower_infill_gap", true);
prime_tower_infill_gap_option->value = 100;
ConfigOptionInts *filament_adhesiveness_category_option = m_print_config.option<ConfigOptionInts>("filament_adhesiveness_category", true);
std::vector<int>& filament_adhesiveness_category_values = filament_adhesiveness_category_option->values;
filament_adhesiveness_category_values.resize(filament_count);
for (int index = 0; index < filament_count; index++)
filament_adhesiveness_category_values[index] = 100;
ConfigOptionFloats *filament_prime_volume_option = m_print_config.option<ConfigOptionFloats>("filament_prime_volume", true);
std::vector<double>& filament_prime_volume_values = filament_prime_volume_option->values;
filament_prime_volume_values.resize(filament_count);
for (int index = 0; index < filament_count; index++) {
if (old_filament_prime_volume != 0.f)
filament_prime_volume_values[index] = old_filament_prime_volume;
else
filament_prime_volume_values[index] = filament_prime_volume_values[0];
}
//support params process
ConfigOptionBool *enable_support_option = m_print_config.option<ConfigOptionBool>("enable_support", true);
ConfigOptionEnum<SupportType>* support_type_option = m_print_config.option<ConfigOptionEnum<SupportType>>("support_type", true);
ConfigOptionEnum<SupportMaterialStyle>* support_style_option = m_print_config.option<ConfigOptionEnum<SupportMaterialStyle>>("support_style", true);
ConfigOptionFloat *support_top_z_distance_option = m_print_config.option<ConfigOptionFloat>("support_top_z_distance", true);
if (support_type_option->value == stTreeAuto)
{
if (different_key_set.find("support_type") == different_key_set.end())
support_type_option->value = stNormalAuto;
}
//traverse each object one by one
size_t num_objects = m_models[0].objects.size();
for (int i = 0; i < num_objects; ++i) {
ModelObject* object = m_models[0].objects[i];
DynamicPrintConfig object_config = object->config.get();
ConfigOptionBool *obj_enable_support_option = object_config.option<ConfigOptionBool>("enable_support");
if (enable_support_option->value || (obj_enable_support_option && obj_enable_support_option->value)) {
ConfigOptionEnum<SupportType>* obj_support_type_option = object_config.option<ConfigOptionEnum<SupportType>>("support_type");
ConfigOptionEnum<SupportMaterialStyle>* obj_support_style_option = object_config.option<ConfigOptionEnum<SupportMaterialStyle>>("support_style");
ConfigOptionFloat *obj_support_top_z_distance_option = object_config.option<ConfigOptionFloat>("support_top_z_distance");
SupportType obj_support_type = obj_support_type_option? obj_support_type_option->value: support_type_option->value;
SupportMaterialStyle obj_support_style = obj_support_style_option? obj_support_style_option->value: support_style_option->value;
if ((obj_support_type == stTreeAuto) && (obj_support_style == smsDefault ))
{
float support_top_z_distance = obj_support_top_z_distance_option? obj_support_top_z_distance_option->value: support_top_z_distance_option->value;
if (!object->has_custom_layering() && (support_top_z_distance == 0)) {
obj_support_style_option = object_config.option<ConfigOptionEnum<SupportMaterialStyle>>("support_style", true);
obj_support_style_option->value = smsTreeOrganic;
}
}
}
}
}
auto get_print_sequence = [](Slic3r::GUI::PartPlate* plate, DynamicPrintConfig& print_config, bool &is_seq_print) {
PrintSequence curr_plate_seq = plate->get_print_seq();
if (curr_plate_seq == PrintSequence::ByDefault) {
@ -3624,7 +3690,7 @@ int CLI::run(int argc, char **argv)
}
};
auto check_plate_wipe_tower = [get_print_sequence, is_smooth_timelapse](Slic3r::GUI::PartPlate* plate, int plate_index, DynamicPrintConfig& print_config, plate_obj_size_info_t &plate_obj_size_info) {
auto check_plate_wipe_tower = [get_print_sequence, is_smooth_timelapse, new_extruder_count](Slic3r::GUI::PartPlate* plate, int plate_index, DynamicPrintConfig& print_config, plate_obj_size_info_t &plate_obj_size_info) {
plate_obj_size_info.obj_bbox= plate->get_objects_bounding_box();
BOOST_LOG_TRIVIAL(info) << boost::format("plate %1%, object bbox: min {%2%, %3%, %4%} - max {%5%, %6%, %7%}")
%(plate_index+1) %plate_obj_size_info.obj_bbox.min.x() % plate_obj_size_info.obj_bbox.min.y() % plate_obj_size_info.obj_bbox.min.z() %plate_obj_size_info.obj_bbox.max.x() % plate_obj_size_info.obj_bbox.max.y() % plate_obj_size_info.obj_bbox.max.z();
@ -3683,7 +3749,7 @@ int CLI::run(int argc, char **argv)
ConfigOptionFloats* volume_option = print_config.option<ConfigOptionFloats>("filament_prime_volume", true);
std::vector<double> wipe_volume = volume_option->values;
Vec3d wipe_tower_size = plate->estimate_wipe_tower_size(print_config, plate_obj_size_info.wipe_width, get_max_element(wipe_volume), filaments_cnt);
Vec3d wipe_tower_size = plate->estimate_wipe_tower_size(print_config, plate_obj_size_info.wipe_width, get_max_element(wipe_volume), new_extruder_count, filaments_cnt);
plate_obj_size_info.wipe_depth = wipe_tower_size(1);
Vec3d origin = plate->get_origin();
@ -3984,71 +4050,6 @@ int CLI::run(int argc, char **argv)
if (has_sequence_plates)
sliced_info.upward_compatibility_taint.push_back("PrintSequenceByObject");
//process some old params
if (is_bbl_3mf && keep_old_params) {
std::vector<std::string> different_keys;
Slic3r::unescape_strings_cstyle(different_settings[0], different_keys);
std::set<std::string> different_key_set(different_keys.begin(), different_keys.end());
//wipe tower params process
ConfigOptionBool *prime_tower_rib_wall_option = m_print_config.option<ConfigOptionBool>("prime_tower_rib_wall", true);
prime_tower_rib_wall_option->value = false;
ConfigOptionPercent *prime_tower_infill_gap_option = m_print_config.option<ConfigOptionPercent>("prime_tower_infill_gap", true);
prime_tower_infill_gap_option->value = 100;
ConfigOptionInts *filament_adhesiveness_category_option = m_print_config.option<ConfigOptionInts>("filament_adhesiveness_category", true);
std::vector<int>& filament_adhesiveness_category_values = filament_adhesiveness_category_option->values;
filament_adhesiveness_category_values.resize(filament_count);
for (int index = 0; index < filament_count; index++)
filament_adhesiveness_category_values[index] = 100;
ConfigOptionFloats *filament_prime_volume_option = m_print_config.option<ConfigOptionFloats>("filament_prime_volume", true);
std::vector<double>& filament_prime_volume_values = filament_prime_volume_option->values;
filament_prime_volume_values.resize(filament_count);
for (int index = 0; index < filament_count; index++) {
if (old_filament_prime_volume != 0.f)
filament_prime_volume_values[index] = old_filament_prime_volume;
else
filament_prime_volume_values[index] = filament_prime_volume_values[0];
}
//support params process
ConfigOptionBool *enable_support_option = m_print_config.option<ConfigOptionBool>("enable_support", true);
ConfigOptionEnum<SupportType>* support_type_option = m_print_config.option<ConfigOptionEnum<SupportType>>("support_type", true);
ConfigOptionEnum<SupportMaterialStyle>* support_style_option = m_print_config.option<ConfigOptionEnum<SupportMaterialStyle>>("support_style", true);
ConfigOptionFloat *support_top_z_distance_option = m_print_config.option<ConfigOptionFloat>("support_top_z_distance", true);
if (support_type_option->value == stTreeAuto)
{
if (different_key_set.find("support_type") == different_key_set.end())
support_type_option->value = stNormalAuto;
}
//traverse each object one by one
size_t num_objects = m_models[0].objects.size();
for (int i = 0; i < num_objects; ++i) {
ModelObject* object = m_models[0].objects[i];
DynamicPrintConfig object_config = object->config.get();
ConfigOptionBool *obj_enable_support_option = object_config.option<ConfigOptionBool>("enable_support");
if (enable_support_option->value || (obj_enable_support_option && obj_enable_support_option->value)) {
ConfigOptionEnum<SupportType>* obj_support_type_option = object_config.option<ConfigOptionEnum<SupportType>>("support_type");
ConfigOptionEnum<SupportMaterialStyle>* obj_support_style_option = object_config.option<ConfigOptionEnum<SupportMaterialStyle>>("support_style");
ConfigOptionFloat *obj_support_top_z_distance_option = object_config.option<ConfigOptionFloat>("support_top_z_distance");
SupportType obj_support_type = obj_support_type_option? obj_support_type_option->value: support_type_option->value;
SupportMaterialStyle obj_support_style = obj_support_style_option? obj_support_style_option->value: support_style_option->value;
if ((obj_support_type == stTreeAuto) && (obj_support_style == smsDefault ))
{
float support_top_z_distance = obj_support_top_z_distance_option? obj_support_top_z_distance_option->value: support_top_z_distance_option->value;
if (!object->has_custom_layering() && (support_top_z_distance == 0)) {
obj_support_style_option = object_config.option<ConfigOptionEnum<SupportMaterialStyle>>("support_style", true);
obj_support_style_option->value = smsTreeOrganic;
}
}
}
}
}
// Loop through transform options.
bool user_center_specified = false;
Points beds = get_bed_shape(m_print_config);
@ -4521,24 +4522,33 @@ int CLI::run(int argc, char **argv)
y = WIPE_TOWER_MARGIN;
}
ConfigOptionFloat wt_x_opt(x);
ConfigOptionFloat wt_y_opt(y);
//create the options using default if neccessary
ConfigOptionFloats* wipe_x_option = m_print_config.option<ConfigOptionFloats>("wipe_tower_x", true);
ConfigOptionFloats* wipe_y_option = m_print_config.option<ConfigOptionFloats>("wipe_tower_y", true);
ConfigOptionFloat* width_option = m_print_config.option<ConfigOptionFloat>("prime_tower_width", true);
ConfigOptionFloat* rotation_angle_option = m_print_config.option<ConfigOptionFloat>("wipe_tower_rotation_angle", true);
ConfigOptionFloats *volume_option = m_print_config.option<ConfigOptionFloats>("filament_prime_volume", true);
ConfigOptionBool *prime_tower_rib_wall_option = m_print_config.option<ConfigOptionBool>("prime_tower_rib_wall", true);
std::vector<double> wipe_volume = volume_option->values;
BOOST_LOG_TRIVIAL(info) << boost::format("prime_tower_width %1% wipe_tower_rotation_angle %2% prime_volume %3%") % width_option->value % rotation_angle_option->value % get_max_element(wipe_volume);
BOOST_LOG_TRIVIAL(info) << boost::format("prime_tower_width %1% wipe_tower_rotation_angle %2% prime_volume %3%, rib_wall %4%") % width_option->value % rotation_angle_option->value % get_max_element(wipe_volume) %prime_tower_rib_wall_option->value;
ConfigOptionFloat wt_x_opt(x);
ConfigOptionFloat wt_y_opt(y);
wipe_x_option->set_at(&wt_x_opt, i, 0);
wipe_y_option->set_at(&wt_y_opt, i, 0);
Vec3d wipe_tower_size, wipe_tower_pos;
ArrangePolygon wipe_tower_ap = cur_plate->estimate_wipe_tower_polygon(m_print_config, i, wipe_tower_pos, wipe_tower_size, new_extruder_count, assemble_plate.filaments_count, true);
ArrangePolygon wipe_tower_ap = cur_plate->estimate_wipe_tower_polygon(m_print_config, i, assemble_plate.filaments_count, true);
//update the new wp position
wt_x_opt.value = wipe_tower_pos(0);
wt_y_opt.value = wipe_tower_pos(1);
BOOST_LOG_TRIVIAL(info) << boost::format("%1%, after estimate_wipe_tower_polygon pos {%2%, %3%}, size {%4%, %5%}")%__LINE__ % wipe_tower_pos(0) % wipe_tower_pos(1) % wipe_tower_size(0) %wipe_tower_size(1);
wipe_x_option->set_at(&wt_x_opt, i, 0);
wipe_y_option->set_at(&wt_y_opt, i, 0);
wipe_tower_ap.bed_idx = i;
unselected.emplace_back(wipe_tower_ap);
@ -4794,8 +4804,19 @@ int CLI::run(int argc, char **argv)
wipe_y_option->set_at(&wt_y_opt, plate_index_valid, 0);
}
Vec3d wipe_tower_size, wipe_tower_pos;
ArrangePolygon wipe_tower_ap = partplate_list.get_plate(plate_index_valid)->estimate_wipe_tower_polygon(m_print_config, plate_index_valid, wipe_tower_pos, wipe_tower_size, new_extruder_count, extruder_size, true);
ArrangePolygon wipe_tower_ap = partplate_list.get_plate(plate_index_valid)->estimate_wipe_tower_polygon(m_print_config, plate_index_valid, extruder_size, true);
//update the new wp position
if (bedid < plate_count) {
wt_x_opt.value = wipe_tower_pos(0);
wt_y_opt.value = wipe_tower_pos(1);
wipe_x_option->set_at(&wt_x_opt, plate_index_valid, 0);
wipe_y_option->set_at(&wt_y_opt, plate_index_valid, 0);
BOOST_LOG_TRIVIAL(info) << boost::format("%1%, after estimate_wipe_tower_polygon, pos {%2%, %3%}, size {%4%, %5%}, plate %6%")%__LINE__ % wipe_tower_pos(0) % wipe_tower_pos(1) % wipe_tower_size(0) %wipe_tower_size(1) %bedid;
}
wipe_tower_ap.bed_idx = bedid;
unselected.emplace_back(wipe_tower_ap);
@ -4885,7 +4906,7 @@ int CLI::run(int argc, char **argv)
//float depth = v * (filaments_cnt - 1) / (layer_height * w);
Vec3d wipe_tower_size = cur_plate->estimate_wipe_tower_size(m_print_config, w, get_max_element(v), filaments_cnt);
Vec3d wipe_tower_size = cur_plate->estimate_wipe_tower_size(m_print_config, w, get_max_element(v), new_extruder_count, filaments_cnt);
Vec3d plate_origin = cur_plate->get_origin();
int plate_width, plate_depth, plate_height;
partplate_list.get_plate_size(plate_width, plate_depth, plate_height);

View File

@ -3146,9 +3146,8 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
float brim_width = print->wipe_tower_data(filaments_count).brim_width;
const DynamicPrintConfig &print_cfg = wxGetApp().preset_bundle->prints.get_edited_preset().config;
double wipe_vol = get_max_element(v);
Vec3d wipe_tower_size = ppl.get_plate(plate_id)->estimate_wipe_tower_size(print_cfg, w, wipe_vol);
if (dynamic_cast<const ConfigOptionBool *>(m_config->option("prime_tower_rib_wall"))->value)
wipe_tower_size = ppl.get_plate(plate_id)->calculate_wipe_tower_size(print_cfg, w, wipe_vol);
int nozzle_nums = wxGetApp().preset_bundle->get_printer_extruder_count();
Vec3d wipe_tower_size = ppl.get_plate(plate_id)->estimate_wipe_tower_size(print_cfg, w, wipe_vol, nozzle_nums);
{ // update for wipe tower position
part_plate->get_extruder_areas();

View File

@ -293,7 +293,9 @@ arrangement::ArrangePolygon estimate_wipe_tower_info(int plate_index, std::set<i
// we have to estimate the depth using the extruder number of all plates
int extruder_size = extruder_ids.size();
auto arrange_poly = ppl.get_plate(plate_index_valid)->estimate_wipe_tower_polygon(full_config, plate_index, extruder_size);
Vec3d wipe_tower_size, wipe_tower_pos;
int nozzle_nums = wxGetApp().preset_bundle->get_printer_extruder_count();
auto arrange_poly = ppl.get_plate(plate_index_valid)->estimate_wipe_tower_polygon(full_config, plate_index, wipe_tower_pos, wipe_tower_size, nozzle_nums, extruder_size);
arrange_poly.bed_idx = plate_index;
return arrange_poly;
}

View File

@ -1390,7 +1390,7 @@ bool PartPlate::check_mixture_of_pla_and_petg(const DynamicPrintConfig &config)
return true;
}
Vec3d PartPlate::calculate_wipe_tower_size(const DynamicPrintConfig &config, const double w, const double wipe_volume, int plate_extruder_size, bool use_global_objects) const
/*Vec3d PartPlate::calculate_wipe_tower_size(const DynamicPrintConfig &config, const double w, const double wipe_volume, int plate_extruder_size, bool use_global_objects) const
{
Vec3d wipe_tower_size;
double layer_height = 0.08f; // hard code layer height
@ -1427,72 +1427,88 @@ Vec3d PartPlate::calculate_wipe_tower_size(const DynamicPrintConfig &config, con
}
return wipe_tower_size;
}
}*/
Vec3d PartPlate::estimate_wipe_tower_size(const DynamicPrintConfig & config, const double w, const double wipe_volume, int plate_extruder_size, bool use_global_objects) const
Vec3d PartPlate::estimate_wipe_tower_size(const DynamicPrintConfig & config, const double w, const double wipe_volume, int extruder_count, int plate_extruder_size, bool use_global_objects) const
{
Vec3d wipe_tower_size;
Vec3d wipe_tower_size;
double layer_height = 0.08f; // hard code layer height
double max_height = 0.f;
wipe_tower_size.setZero();
double layer_height = 0.08f; // hard code layer height
double max_height = 0.f;
wipe_tower_size.setZero();
wipe_tower_size(0) = w;
const ConfigOption* layer_height_opt = config.option("layer_height");
if (layer_height_opt)
layer_height = layer_height_opt->getFloat();
const ConfigOption* layer_height_opt = config.option("layer_height");
if (layer_height_opt)
layer_height = layer_height_opt->getFloat();
// empty plate
if (plate_extruder_size == 0)
// empty plate
if (plate_extruder_size == 0)
{
std::vector<int> plate_extruders = get_extruders(true);
plate_extruder_size = plate_extruders.size();
}
if (plate_extruder_size == 0)
return wipe_tower_size;
if (plate_extruder_size == 0)
return wipe_tower_size;
for (int obj_idx = 0; obj_idx < m_model->objects.size(); obj_idx++) {
if (!use_global_objects && !contain_instance_totally(obj_idx, 0))
continue;
for (int obj_idx = 0; obj_idx < m_model->objects.size(); obj_idx++) {
if (!use_global_objects && !contain_instance_totally(obj_idx, 0))
continue;
BoundingBoxf3 bbox = m_model->objects[obj_idx]->bounding_box();
max_height = std::max(bbox.size().z(), max_height);
}
wipe_tower_size(2) = max_height;
BoundingBoxf3 bbox = m_model->objects[obj_idx]->bounding_box();
max_height = std::max(bbox.size().z(), max_height);
}
wipe_tower_size(2) = max_height;
//const DynamicPrintConfig &dconfig = wxGetApp().preset_bundle->prints.get_edited_preset().config;
//const DynamicPrintConfig &dconfig = wxGetApp().preset_bundle->prints.get_edited_preset().config;
auto timelapse_type = config.option<ConfigOptionEnum<TimelapseType>>("timelapse_type");
bool timelapse_enabled = timelapse_type ? (timelapse_type->value == TimelapseType::tlSmooth) : false;
double extra_spacing = config.option("prime_tower_infill_gap")->getFloat() / 100.;
double depth = wipe_volume * (plate_extruder_size - 1) / (layer_height * w) *extra_spacing;
if (timelapse_enabled || depth > EPSILON) {
float min_wipe_tower_depth = WipeTower::get_limit_depth_by_height(max_height);
depth = std::max((double)min_wipe_tower_depth, depth);
}
wipe_tower_size(1) = depth;
return wipe_tower_size;
const ConfigOptionBool* use_rib_wall_opt = config.option<ConfigOptionBool>("prime_tower_rib_wall");
bool use_rib_wall = use_rib_wall_opt ? use_rib_wall_opt->value: true;
double depth;
if (use_rib_wall) {
depth = std::sqrt(wipe_volume * (extruder_count == 2 ? plate_extruder_size : (plate_extruder_size - 1)) / layer_height * extra_spacing);
if (timelapse_enabled || plate_extruder_size > 1) {
float min_wipe_tower_depth = WipeTower::get_limit_depth_by_height(max_height);
depth = std::max((double) min_wipe_tower_depth, depth);
wipe_tower_size(0) = wipe_tower_size(1) = depth;
}
}
else {
depth = wipe_volume * (plate_extruder_size - 1) / (layer_height * w) *extra_spacing;
if (timelapse_enabled || depth > EPSILON) {
float min_wipe_tower_depth = WipeTower::get_limit_depth_by_height(max_height);
depth = std::max((double)min_wipe_tower_depth, depth);
}
wipe_tower_size(0) = w;
wipe_tower_size(1) = depth;
}
return wipe_tower_size;
}
arrangement::ArrangePolygon PartPlate::estimate_wipe_tower_polygon(const DynamicPrintConfig& config, int plate_index, int plate_extruder_size, bool use_global_objects) const
arrangement::ArrangePolygon PartPlate::estimate_wipe_tower_polygon(const DynamicPrintConfig& config, int plate_index, Vec3d& wt_pos, Vec3d& wt_size, int extruder_count, int plate_extruder_size, bool use_global_objects) const
{
float x = dynamic_cast<const ConfigOptionFloats*>(config.option("wipe_tower_x"))->get_at(plate_index);
float y = dynamic_cast<const ConfigOptionFloats*>(config.option("wipe_tower_y"))->get_at(plate_index);
float w = dynamic_cast<const ConfigOptionFloat*>(config.option("prime_tower_width"))->value;
//float a = dynamic_cast<const ConfigOptionFloat*>(config.option("wipe_tower_rotation_angle"))->value;
std::vector<double> v = dynamic_cast<const ConfigOptionFloats*>(config.option("filament_prime_volume"))->values;
Vec3d wipe_tower_size = estimate_wipe_tower_size(config, w, get_max_element(v), plate_extruder_size, use_global_objects);
wt_size = estimate_wipe_tower_size(config, w, get_max_element(v), extruder_count, plate_extruder_size, use_global_objects);
int plate_width=m_width, plate_depth=m_depth;
float depth = wipe_tower_size(1);
float depth = wt_size(1);
float margin = WIPE_TOWER_MARGIN, wp_brim_width = 0.f;
const ConfigOption* wipe_tower_brim_width_opt = config.option("prime_tower_brim_width");
if (wipe_tower_brim_width_opt) {
wp_brim_width = wipe_tower_brim_width_opt->getFloat();
if (wp_brim_width < 0) wp_brim_width = WipeTower::get_auto_brim_by_height((float) wipe_tower_size.z());
if (wp_brim_width < 0) wp_brim_width = WipeTower::get_auto_brim_by_height((float) wt_size.z());
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format("arrange wipe_tower: wp_brim_width %1%") % wp_brim_width;
}
x = std::clamp(x, margin, (float)plate_width - w - margin - wp_brim_width);
y = std::clamp(y, margin, (float)plate_depth - depth - margin - wp_brim_width);
wt_pos(0) = x;
wt_pos(1) = y;
wt_pos(2) = 0.f;
arrangement::ArrangePolygon wipe_tower_ap;
Polygon ap({

View File

@ -304,9 +304,9 @@ public:
BoundingBoxf3 get_objects_bounding_box();
Vec3d get_origin() { return m_origin; }
Vec3d calculate_wipe_tower_size(const DynamicPrintConfig &config, const double w, const double wipe_volume, int plate_extruder_size = 0, bool use_global_objects = false) const;
Vec3d estimate_wipe_tower_size(const DynamicPrintConfig & config, const double w, const double wipe_volume, int plate_extruder_size = 0, bool use_global_objects = false) const;
arrangement::ArrangePolygon estimate_wipe_tower_polygon(const DynamicPrintConfig & config, int plate_index, int plate_extruder_size = 0, bool use_global_objects = false) const;
//Vec3d calculate_wipe_tower_size(const DynamicPrintConfig &config, const double w, const double wipe_volume, int plate_extruder_size = 0, bool use_global_objects = false) const;
Vec3d estimate_wipe_tower_size(const DynamicPrintConfig & config, const double w, const double wipe_volume, int extruder_count = 1, int plate_extruder_size = 0, bool use_global_objects = false) const;
arrangement::ArrangePolygon estimate_wipe_tower_polygon(const DynamicPrintConfig & config, int plate_index, Vec3d& wt_pos, Vec3d& wt_size, int extruder_count = 1, int plate_extruder_size = 0, bool use_global_objects = false) const;
bool check_objects_empty_and_gcode3mf(std::vector<int> &result) const;
// get used filaments from config, 1 based idx
std::vector<int> get_extruders(bool conside_custom_gcode = false) const;