ENH:instead of prime_volume by filament_prime_volume

Jira: none

Signed-off-by: qing.zhang <qing.zhang@bambulab.com>
Change-Id: I96e7d0604da8f90678feed81833e3a634752ffff
This commit is contained in:
qing.zhang 2025-01-20 11:31:33 +08:00 committed by lane.wei
parent ab2cc0f73a
commit be02e769bb
15 changed files with 73 additions and 49 deletions

View File

@ -108,6 +108,9 @@
"filament_wipe_distance": [ "filament_wipe_distance": [
"nil" "nil"
], ],
"filament_prime_volume": [
"45"
],
"filament_z_hop": [ "filament_z_hop": [
"nil" "nil"
], ],

View File

@ -43,6 +43,9 @@
"nil", "nil",
"nil" "nil"
], ],
"filament_prime_volume": [
"45"
],
"filament_z_hop": [ "filament_z_hop": [
"nil", "nil",
"nil" "nil"

View File

@ -3663,10 +3663,10 @@ int CLI::run(int argc, char **argv)
float brim_width = brim_width_option->value; float brim_width = brim_width_option->value;
if (brim_width < 0) brim_width = WipeTower::get_auto_brim_by_height((float)plate_obj_size_info.obj_bbox.max.z()); if (brim_width < 0) brim_width = WipeTower::get_auto_brim_by_height((float)plate_obj_size_info.obj_bbox.max.z());
ConfigOptionFloat* volume_option = print_config.option<ConfigOptionFloat>("prime_volume", true); ConfigOptionFloats* volume_option = print_config.option<ConfigOptionFloats>("filament_prime_volume", true);
float wipe_volume = volume_option->value; 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, 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), filaments_cnt);
plate_obj_size_info.wipe_depth = wipe_tower_size(1); plate_obj_size_info.wipe_depth = wipe_tower_size(1);
Vec3d origin = plate->get_origin(); Vec3d origin = plate->get_origin();
@ -4447,9 +4447,10 @@ int CLI::run(int argc, char **argv)
ConfigOptionFloats* wipe_y_option = m_print_config.option<ConfigOptionFloats>("wipe_tower_y", 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* 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); ConfigOptionFloat* rotation_angle_option = m_print_config.option<ConfigOptionFloat>("wipe_tower_rotation_angle", true);
ConfigOptionFloat* volume_option = m_print_config.option<ConfigOptionFloat>("prime_volume", true); ConfigOptionFloats *volume_option = m_print_config.option<ConfigOptionFloats>("filament_prime_volume", 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 % volume_option->value; 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);
wipe_x_option->set_at(&wt_x_opt, i, 0); wipe_x_option->set_at(&wt_x_opt, i, 0);
wipe_y_option->set_at(&wt_y_opt, i, 0); wipe_y_option->set_at(&wt_y_opt, i, 0);
@ -4698,9 +4699,10 @@ int CLI::run(int argc, char **argv)
ConfigOptionFloats* wipe_y_option = m_print_config.option<ConfigOptionFloats>("wipe_tower_y", 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* 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); ConfigOptionFloat* rotation_angle_option = m_print_config.option<ConfigOptionFloat>("wipe_tower_rotation_angle", true);
ConfigOptionFloat* volume_option = m_print_config.option<ConfigOptionFloat>("prime_volume", true); ConfigOptionFloats *volume_option = m_print_config.option<ConfigOptionFloats>("filament_prime_volume", 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 %volume_option->value ; 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);
for (int bedid = 0; bedid < MAX_PLATE_COUNT; bedid++) { for (int bedid = 0; bedid < MAX_PLATE_COUNT; bedid++) {
@ -4778,7 +4780,7 @@ int CLI::run(int argc, char **argv)
} }
float w = dynamic_cast<const ConfigOptionFloat *>(m_print_config.option("prime_tower_width"))->value; float w = dynamic_cast<const ConfigOptionFloat *>(m_print_config.option("prime_tower_width"))->value;
float a = dynamic_cast<const ConfigOptionFloat *>(m_print_config.option("wipe_tower_rotation_angle"))->value; float a = dynamic_cast<const ConfigOptionFloat *>(m_print_config.option("wipe_tower_rotation_angle"))->value;
float v = dynamic_cast<const ConfigOptionFloat *>(m_print_config.option("prime_volume"))->value; std::vector<double> v = dynamic_cast<const ConfigOptionFloats *>(m_print_config.option("filament_prime_volume"))->values;
unsigned int filaments_cnt = plate_data_src[plate_to_slice-1]->slice_filaments_info.size(); unsigned int filaments_cnt = plate_data_src[plate_to_slice-1]->slice_filaments_info.size();
if ((filaments_cnt == 0) || need_skip) if ((filaments_cnt == 0) || need_skip)
{ {
@ -4801,7 +4803,7 @@ int CLI::run(int argc, char **argv)
//float depth = v * (filaments_cnt - 1) / (layer_height * w); //float depth = v * (filaments_cnt - 1) / (layer_height * w);
Vec3d wipe_tower_size = cur_plate->estimate_wipe_tower_size(m_print_config, w, v, filaments_cnt); Vec3d wipe_tower_size = cur_plate->estimate_wipe_tower_size(m_print_config, w, get_max_element(v), filaments_cnt);
Vec3d plate_origin = cur_plate->get_origin(); Vec3d plate_origin = cur_plate->get_origin();
int plate_width, plate_depth, plate_height; int plate_width, plate_depth, plate_height;
partplate_list.get_plate_size(plate_width, plate_depth, plate_height); partplate_list.get_plate_size(plate_width, plate_depth, plate_height);
@ -4814,8 +4816,8 @@ int CLI::run(int argc, char **argv)
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format("arrange wipe_tower: wp_brim_width %1%")%wp_brim_width; BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format("arrange wipe_tower: wp_brim_width %1%")%wp_brim_width;
} }
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format("arrange wipe_tower: x=%1%, y=%2%, width=%3%, depth=%4%, angle=%5%, prime_volume=%6%, filaments_cnt=%7%, layer_height=%8%, plate_width=%9%, plate_depth=%10%") BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format("arrange wipe_tower: x=%1%, y=%2%, width=%3%, depth=%4%, angle=%5%, prime_volume=%6%, filaments_cnt=%7%, layer_height=%8%, plate_width=%9%, plate_depth=%10%") %
%x %y %w %depth %a %v %filaments_cnt %layer_height %plate_width %plate_depth; x % y % w % depth % a % get_max_element(v) % filaments_cnt % layer_height % plate_width % plate_depth;
if ((y + depth + margin + wp_brim_width) > (float)plate_depth) { if ((y + depth + margin + wp_brim_width) > (float)plate_depth) {
y = (float)plate_depth - depth - margin - wp_brim_width; y = (float)plate_depth - depth - margin - wp_brim_width;
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format("arrange wipe_tower: exceeds the border, change y to %1%, plate_depth=%2%")%y %plate_depth; BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format("arrange wipe_tower: exceeds the border, change y to %1%, plate_depth=%2%")%y %plate_depth;

View File

@ -1311,7 +1311,7 @@ float WipeTower::get_auto_brim_by_height(float max_height) {
return 8.f; return 8.f;
} }
WipeTower::WipeTower(const PrintConfig& config, int plate_idx, Vec3d plate_origin, const float prime_volume, size_t initial_tool, const float wipe_tower_height) : WipeTower::WipeTower(const PrintConfig& config, int plate_idx, Vec3d plate_origin, size_t initial_tool, const float wipe_tower_height) :
m_semm(config.single_extruder_multi_material.value), m_semm(config.single_extruder_multi_material.value),
m_wipe_tower_pos(config.wipe_tower_x.get_at(plate_idx), config.wipe_tower_y.get_at(plate_idx)), m_wipe_tower_pos(config.wipe_tower_x.get_at(plate_idx), config.wipe_tower_y.get_at(plate_idx)),
m_wipe_tower_width(float(config.prime_tower_width)), m_wipe_tower_width(float(config.prime_tower_width)),
@ -1328,7 +1328,6 @@ WipeTower::WipeTower(const PrintConfig& config, int plate_idx, Vec3d plate_origi
m_travel_speed(config.travel_speed.get_at(get_extruder_index(config, (unsigned int)initial_tool))), m_travel_speed(config.travel_speed.get_at(get_extruder_index(config, (unsigned int)initial_tool))),
m_current_tool(initial_tool), m_current_tool(initial_tool),
//wipe_volumes(flush_matrix) //wipe_volumes(flush_matrix)
m_wipe_volume(prime_volume),
m_enable_timelapse_print(config.timelapse_type.value == TimelapseType::tlSmooth), m_enable_timelapse_print(config.timelapse_type.value == TimelapseType::tlSmooth),
m_filaments_change_length(config.filament_change_length.values), m_filaments_change_length(config.filament_change_length.values),
m_is_multi_extruder(config.nozzle_diameter.size() > 1), m_is_multi_extruder(config.nozzle_diameter.size() > 1),

View File

@ -166,7 +166,7 @@ public:
// width -- width of wipe tower in mm ( default 60 mm - leave as it is ) // width -- width of wipe tower in mm ( default 60 mm - leave as it is )
// wipe_area -- space available for one toolchange in mm // wipe_area -- space available for one toolchange in mm
// BBS: add partplate logic // BBS: add partplate logic
WipeTower(const PrintConfig& config, int plate_idx, Vec3d plate_origin, const float wipe_volume, size_t initial_tool, const float wipe_tower_height); WipeTower(const PrintConfig& config, int plate_idx, Vec3d plate_origin, size_t initial_tool, const float wipe_tower_height);
// Set the extruder properties. // Set the extruder properties.
@ -448,7 +448,6 @@ private:
size_t m_current_tool = 0; size_t m_current_tool = 0;
// BBS // BBS
//const std::vector<std::vector<float>> wipe_volumes; //const std::vector<std::vector<float>> wipe_volumes;
const float m_wipe_volume;
float m_depth_traversed = 0.f; // Current y position at the wipe tower. float m_depth_traversed = 0.f; // Current y position at the wipe tower.
bool m_current_layer_finished = false; bool m_current_layer_finished = false;

View File

@ -879,7 +879,7 @@ static std::vector<std::string> s_Preset_print_options {
"inner_wall_line_width", "outer_wall_line_width", "sparse_infill_line_width", "internal_solid_infill_line_width", "inner_wall_line_width", "outer_wall_line_width", "sparse_infill_line_width", "internal_solid_infill_line_width",
"top_surface_line_width", "support_line_width", "infill_wall_overlap", "bridge_flow", "top_surface_line_width", "support_line_width", "infill_wall_overlap", "bridge_flow",
"elefant_foot_compensation", "xy_contour_compensation", "xy_hole_compensation", "resolution", "enable_prime_tower", "elefant_foot_compensation", "xy_contour_compensation", "xy_hole_compensation", "resolution", "enable_prime_tower",
"prime_tower_width", "prime_tower_brim_width", "prime_tower_skip_points", "prime_volume", "prime_tower_width", "prime_tower_brim_width", "prime_tower_skip_points",
"prime_tower_rib_wall","prime_tower_extra_rib_length","prime_tower_rib_width","prime_tower_fillet_wall", "prime_tower_rib_wall","prime_tower_extra_rib_length","prime_tower_rib_width","prime_tower_fillet_wall",
"enable_circle_compensation", "circle_compensation_speed", "circle_compensation_manual_offset", "enable_circle_compensation", "circle_compensation_speed", "circle_compensation_manual_offset",
"counter_coef_1", "counter_coef_2", "counter_coef_3", "hole_coef_1", "hole_coef_2", "hole_coef_3", "counter_coef_1", "counter_coef_2", "counter_coef_3", "hole_coef_1", "hole_coef_2", "hole_coef_3",
@ -935,7 +935,7 @@ static std::vector<std::string> s_Preset_filament_options {
"enable_pressure_advance", "pressure_advance", "chamber_temperatures","filament_notes", "enable_pressure_advance", "pressure_advance", "chamber_temperatures","filament_notes",
"filament_long_retractions_when_cut","filament_retraction_distances_when_cut","filament_shrink", "filament_long_retractions_when_cut","filament_retraction_distances_when_cut","filament_shrink",
//BBS filament change length while the extruder color //BBS filament change length while the extruder color
"filament_change_length" "filament_change_length","filament_prime_volume"
}; };
static std::vector<std::string> s_Preset_machine_limits_options { static std::vector<std::string> s_Preset_machine_limits_options {

View File

@ -270,7 +270,7 @@ bool Print::invalidate_state_by_config_options(const ConfigOptionResolver & /* n
//|| opt_key == "wipe_tower_bridging" //|| opt_key == "wipe_tower_bridging"
|| opt_key == "wipe_tower_no_sparse_layers" || opt_key == "wipe_tower_no_sparse_layers"
|| opt_key == "flush_volumes_matrix" || opt_key == "flush_volumes_matrix"
|| opt_key == "prime_volume" || opt_key == "filament_prime_volume"
|| opt_key == "flush_into_infill" || opt_key == "flush_into_infill"
|| opt_key == "flush_into_support" || opt_key == "flush_into_support"
|| opt_key == "initial_layer_infill_speed" || opt_key == "initial_layer_infill_speed"
@ -2537,9 +2537,10 @@ const WipeTowerData& Print::wipe_tower_data(size_t filaments_cnt) const
if (max_height < EPSILON) return m_wipe_tower_data; if (max_height < EPSILON) return m_wipe_tower_data;
if (! is_step_done(psWipeTower) && filaments_cnt !=0) { if (! is_step_done(psWipeTower) && filaments_cnt !=0) {
std::vector<double> filament_wipe_volume = m_config.filament_prime_volume.values;
double wipe_volume = get_max_element(filament_wipe_volume);
if (m_config.prime_tower_rib_wall.value) { if (m_config.prime_tower_rib_wall.value) {
double layer_height = 0.08f; // hard code layer height double layer_height = 0.08f; // hard code layer height
double wipe_volume = m_config.prime_volume;
layer_height = m_objects.front()->config().layer_height.value; layer_height = m_objects.front()->config().layer_height.value;
int filament_depth_count = m_config.nozzle_diameter.values.size() == 2 ? filaments_cnt : filaments_cnt - 1; int filament_depth_count = m_config.nozzle_diameter.values.size() == 2 ? filaments_cnt : filaments_cnt - 1;
if (filaments_cnt == 1 && enable_timelapse_print()) if (filaments_cnt == 1 && enable_timelapse_print())
@ -2555,7 +2556,6 @@ const WipeTowerData& Print::wipe_tower_data(size_t filaments_cnt) const
// BBS // BBS
double width = m_config.prime_tower_width; double width = m_config.prime_tower_width;
double layer_height = 0.2; // hard code layer height double layer_height = 0.2; // hard code layer height
double wipe_volume = m_config.prime_volume;
if (filaments_cnt == 1 && enable_timelapse_print()) { if (filaments_cnt == 1 && enable_timelapse_print()) {
const_cast<Print *>(this)->m_wipe_tower_data.depth = wipe_volume / (layer_height * width); const_cast<Print *>(this)->m_wipe_tower_data.depth = wipe_volume / (layer_height * width);
} else { } else {
@ -2628,7 +2628,7 @@ void Print::_make_wipe_tower()
// Initialize the wipe tower. // Initialize the wipe tower.
// BBS: in BBL machine, wipe tower is only use to prime extruder. So just use a global wipe volume. // BBS: in BBL machine, wipe tower is only use to prime extruder. So just use a global wipe volume.
WipeTower wipe_tower(m_config, m_plate_index, m_origin, m_config.prime_volume, m_wipe_tower_data.tool_ordering.first_extruder(), WipeTower wipe_tower(m_config, m_plate_index, m_origin, m_wipe_tower_data.tool_ordering.first_extruder(),
m_wipe_tower_data.tool_ordering.empty() ? 0.f : m_wipe_tower_data.tool_ordering.back().print_z); m_wipe_tower_data.tool_ordering.empty() ? 0.f : m_wipe_tower_data.tool_ordering.back().print_z);
wipe_tower.set_has_tpu_filament(this->has_tpu_filament()); wipe_tower.set_has_tpu_filament(this->has_tpu_filament());
wipe_tower.set_filament_map(this->get_filament_maps()); wipe_tower.set_filament_map(this->get_filament_maps());
@ -2693,7 +2693,7 @@ void Print::_make_wipe_tower()
volume_to_purge = std::max(0.f, volume_to_purge - grab_purge_volume); volume_to_purge = std::max(0.f, volume_to_purge - grab_purge_volume);
wipe_tower.plan_toolchange((float)layer_tools.print_z, (float)layer_tools.wipe_tower_layer_height, current_filament_id, filament_id, wipe_tower.plan_toolchange((float)layer_tools.print_z, (float)layer_tools.wipe_tower_layer_height, current_filament_id, filament_id,
m_config.prime_volume, volume_to_purge); m_config.filament_prime_volume.values[filament_id], volume_to_purge);
current_filament_id = filament_id; current_filament_id = filament_id;
nozzle_cur_filament_ids[nozzle_id] = filament_id; nozzle_cur_filament_ids[nozzle_id] = filament_id;
} }

View File

@ -1867,6 +1867,15 @@ void PrintConfigDef::init_fff_params()
def->mode = comDevelop; def->mode = comDevelop;
def->set_default_value(new ConfigOptionBools{false}); def->set_default_value(new ConfigOptionBools{false});
// BBS
def = this->add("filament_prime_volume", coFloats);
def->label = L("Filament prime volume");
def->tooltip = L("The volume of material to prime extruder on tower.");
def->sidetext = L("mm³");
def->min = 1.0;
def->mode = comSimple;
def->set_default_value(new ConfigOptionFloats{45.});
// BBS // BBS
def = this->add("temperature_vitrification", coInts); def = this->add("temperature_vitrification", coInts);
def->label = L("Softening temperature"); def->label = L("Softening temperature");
@ -4290,14 +4299,14 @@ void PrintConfigDef::init_fff_params()
def->sidetext = ""; def->sidetext = "";
def->set_default_value(new ConfigOptionFloats{1.0}); def->set_default_value(new ConfigOptionFloats{1.0});
// BBS // // BBS
def = this->add("prime_volume", coFloat); // def = this->add("prime_volume", coFloat);
def->label = L("Prime volume"); // def->label = L("Prime volume");
def->tooltip = L("The volume of material to prime extruder on tower."); // def->tooltip = L("The volume of material to prime extruder on tower.");
def->sidetext = L("mm³"); // def->sidetext = L("mm³");
def->min = 1.0; // def->min = 1.0;
def->mode = comSimple; // def->mode = comSimple;
def->set_default_value(new ConfigOptionFloat(45.)); // def->set_default_value(new ConfigOptionFloat(45.));
def = this->add("wipe_tower_x", coFloats); def = this->add("wipe_tower_x", coFloats);
//def->label = L("Position X"); //def->label = L("Position X");
@ -5263,7 +5272,7 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va
} else if (opt_key == "bottom_solid_infill_flow_ratio") { } else if (opt_key == "bottom_solid_infill_flow_ratio") {
opt_key = "initial_layer_flow_ratio"; opt_key = "initial_layer_flow_ratio";
} else if (opt_key == "wiping_volume") { } else if (opt_key == "wiping_volume") {
opt_key = "prime_volume"; opt_key = "filament_prime_volume";
} else if (opt_key == "wipe_tower_brim_width") { } else if (opt_key == "wipe_tower_brim_width") {
opt_key = "prime_tower_brim_width"; opt_key = "prime_tower_brim_width";
} else if (opt_key == "tool_change_gcode") { } else if (opt_key == "tool_change_gcode") {
@ -5379,7 +5388,8 @@ void PrintConfigDef::handle_legacy(t_config_option_key &opt_key, std::string &va
"can_switch_nozzle_type", "can_add_auxiliary_fan", "extra_flush_volume", "spaghetti_detector", "adaptive_layer_height", "can_switch_nozzle_type", "can_add_auxiliary_fan", "extra_flush_volume", "spaghetti_detector", "adaptive_layer_height",
"z_hop_type","nozzle_hrc","chamber_temperature","only_one_wall_top","bed_temperature_difference","long_retraction_when_cut", "z_hop_type","nozzle_hrc","chamber_temperature","only_one_wall_top","bed_temperature_difference","long_retraction_when_cut",
"retraction_distance_when_cut", "retraction_distance_when_cut",
"seam_slope_type","seam_slope_start_height","seam_slope_gap", "seam_slope_min_length" "seam_slope_type","seam_slope_start_height","seam_slope_gap", "seam_slope_min_length",
"prime_volume"
}; };
if (ignore.find(opt_key) != ignore.end()) { if (ignore.find(opt_key) != ignore.end()) {

View File

@ -1206,7 +1206,6 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
((ConfigOptionFloats, flush_volumes_matrix)) ((ConfigOptionFloats, flush_volumes_matrix))
((ConfigOptionFloats, flush_volumes_vector)) ((ConfigOptionFloats, flush_volumes_vector))
// BBS: wipe tower is only used for priming // BBS: wipe tower is only used for priming
((ConfigOptionFloat, prime_volume))
((ConfigOptionFloats, flush_multiplier)) ((ConfigOptionFloats, flush_multiplier))
//((ConfigOptionFloat, z_offset)) //((ConfigOptionFloat, z_offset))
// BBS: project filaments // BBS: project filaments
@ -1241,7 +1240,8 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
((ConfigOptionFloats, counter_limit_min)) ((ConfigOptionFloats, counter_limit_min))
((ConfigOptionFloats, counter_limit_max)) ((ConfigOptionFloats, counter_limit_max))
((ConfigOptionFloats, hole_limit_min)) ((ConfigOptionFloats, hole_limit_min))
((ConfigOptionFloats, hole_limit_max))) ((ConfigOptionFloats, hole_limit_max))
((ConfigOptionFloats, filament_prime_volume)))
// This object is mapped to Perl as Slic3r::Config::Full. // This object is mapped to Perl as Slic3r::Config::Full.
PRINT_CONFIG_CLASS_DERIVED_DEFINE0( PRINT_CONFIG_CLASS_DERIVED_DEFINE0(
FullPrintConfig, FullPrintConfig,

View File

@ -132,6 +132,16 @@ inline DataType round_up_divide(DataType dividend, DataType divisor) //!< Return
return (dividend + divisor - 1) / divisor; return (dividend + divisor - 1) / divisor;
} }
template<typename T>
T get_max_element(const std::vector<T> &vec)
{
static_assert(std::is_arithmetic<T>::value, "T must be of numeric type.");
if (vec.empty())
return static_cast<T>(0);
return *std::max_element(vec.begin(), vec.end());
}
// Set a path with GUI localization files. // Set a path with GUI localization files.
void set_local_dir(const std::string &path); void set_local_dir(const std::string &path);

View File

@ -678,7 +678,7 @@ void ConfigManipulation::toggle_print_fff_options(DynamicPrintConfig *config, in
toggle_field("standby_temperature_delta", have_ooze_prevention); toggle_field("standby_temperature_delta", have_ooze_prevention);
bool have_prime_tower = config->opt_bool("enable_prime_tower"); bool have_prime_tower = config->opt_bool("enable_prime_tower");
for (auto el : {"prime_tower_width", "prime_volume", "prime_tower_brim_width", "prime_tower_skip_points", "prime_tower_rib_wall"}) for (auto el : {"prime_tower_width", "prime_tower_brim_width", "prime_tower_skip_points", "prime_tower_rib_wall"})
toggle_line(el, have_prime_tower); toggle_line(el, have_prime_tower);
bool have_rib_wall = config->opt_bool("prime_tower_rib_wall")&&have_prime_tower; bool have_rib_wall = config->opt_bool("prime_tower_rib_wall")&&have_prime_tower;

View File

@ -2911,15 +2911,16 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
float w = dynamic_cast<const ConfigOptionFloat*>(m_config->option("prime_tower_width"))->value; float w = dynamic_cast<const ConfigOptionFloat*>(m_config->option("prime_tower_width"))->value;
float a = dynamic_cast<const ConfigOptionFloat*>(proj_cfg.option("wipe_tower_rotation_angle"))->value; float a = dynamic_cast<const ConfigOptionFloat*>(proj_cfg.option("wipe_tower_rotation_angle"))->value;
// BBS // BBS
float v = dynamic_cast<const ConfigOptionFloat*>(m_config->option("prime_volume"))->value; std::vector<double> v = dynamic_cast<const ConfigOptionFloats*>(m_config->option("filament_prime_volume"))->values;
Vec3d plate_origin = ppl.get_plate(plate_id)->get_origin(); Vec3d plate_origin = ppl.get_plate(plate_id)->get_origin();
const Print* print = m_process->fff_print(); const Print* print = m_process->fff_print();
float brim_width = print->wipe_tower_data(filaments_count).brim_width; float brim_width = print->wipe_tower_data(filaments_count).brim_width;
const DynamicPrintConfig &print_cfg = wxGetApp().preset_bundle->prints.get_edited_preset().config; const DynamicPrintConfig &print_cfg = wxGetApp().preset_bundle->prints.get_edited_preset().config;
Vec3d wipe_tower_size = ppl.get_plate(plate_id)->estimate_wipe_tower_size(print_cfg, w, v); 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) 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, v); wipe_tower_size = ppl.get_plate(plate_id)->calculate_wipe_tower_size(print_cfg, w, wipe_vol);
{ // update for wipe tower position { // update for wipe tower position
part_plate->get_extruder_areas(); part_plate->get_extruder_areas();

View File

@ -1412,8 +1412,7 @@ Vec3d PartPlate::calculate_wipe_tower_size(const DynamicPrintConfig &config, con
auto timelapse_type = config.option<ConfigOptionEnum<TimelapseType>>("timelapse_type"); auto timelapse_type = config.option<ConfigOptionEnum<TimelapseType>>("timelapse_type");
bool timelapse_enabled = timelapse_type ? (timelapse_type->value == TimelapseType::tlSmooth) : false; bool timelapse_enabled = timelapse_type ? (timelapse_type->value == TimelapseType::tlSmooth) : false;
int nozzle_nums = wxGetApp().preset_bundle->get_printer_extruder_count();
int nozzle_nums = wxGetApp().preset_bundle->get_printer_extruder_count();
double depth = std::sqrt(wipe_volume * (nozzle_nums == 2 ? plate_extruder_size : (plate_extruder_size - 1)) / layer_height); double depth = std::sqrt(wipe_volume * (nozzle_nums == 2 ? plate_extruder_size : (plate_extruder_size - 1)) / layer_height);
if (timelapse_enabled || plate_extruder_size > 1) { if (timelapse_enabled || plate_extruder_size > 1) {
float min_wipe_tower_depth = WipeTower::get_limit_depth_by_height(max_height); float min_wipe_tower_depth = WipeTower::get_limit_depth_by_height(max_height);
@ -1459,7 +1458,7 @@ Vec3d PartPlate::estimate_wipe_tower_size(const DynamicPrintConfig & config, con
auto timelapse_type = config.option<ConfigOptionEnum<TimelapseType>>("timelapse_type"); auto timelapse_type = config.option<ConfigOptionEnum<TimelapseType>>("timelapse_type");
bool timelapse_enabled = timelapse_type ? (timelapse_type->value == TimelapseType::tlSmooth) : false; bool timelapse_enabled = timelapse_type ? (timelapse_type->value == TimelapseType::tlSmooth) : false;
double depth = wipe_volume * (plate_extruder_size - 1) / (layer_height * w); double depth = wipe_volume * (plate_extruder_size - 1) / (layer_height * w);
if (timelapse_enabled || depth > EPSILON) { if (timelapse_enabled || depth > EPSILON) {
float min_wipe_tower_depth = 0.f; float min_wipe_tower_depth = 0.f;
auto iter = WipeTower::min_depth_per_height.begin(); auto iter = WipeTower::min_depth_per_height.begin();
@ -1504,8 +1503,8 @@ arrangement::ArrangePolygon PartPlate::estimate_wipe_tower_polygon(const Dynamic
float y = dynamic_cast<const ConfigOptionFloats*>(config.option("wipe_tower_y"))->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 w = dynamic_cast<const ConfigOptionFloat*>(config.option("prime_tower_width"))->value;
//float a = dynamic_cast<const ConfigOptionFloat*>(config.option("wipe_tower_rotation_angle"))->value; //float a = dynamic_cast<const ConfigOptionFloat*>(config.option("wipe_tower_rotation_angle"))->value;
float v = dynamic_cast<const ConfigOptionFloat*>(config.option("prime_volume"))->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, v, plate_extruder_size, use_global_objects); Vec3d wipe_tower_size = estimate_wipe_tower_size(config, w, get_max_element(v), plate_extruder_size, use_global_objects);
int plate_width=m_width, plate_depth=m_depth; int plate_width=m_width, plate_depth=m_depth;
float depth = wipe_tower_size(1); float depth = wipe_tower_size(1);
float margin = WIPE_TOWER_MARGIN, wp_brim_width = 0.f; float margin = WIPE_TOWER_MARGIN, wp_brim_width = 0.f;

View File

@ -4045,8 +4045,8 @@ Plater::priv::priv(Plater *q, MainFrame *main_frame)
"extruder_clearance_height_to_lid", "extruder_clearance_height_to_rod", "extruder_clearance_height_to_lid", "extruder_clearance_height_to_rod",
"nozzle_height", "skirt_loops", "skirt_distance", "nozzle_height", "skirt_loops", "skirt_distance",
"brim_width", "brim_object_gap", "brim_type", "nozzle_diameter", "single_extruder_multi_material", "brim_width", "brim_object_gap", "brim_type", "nozzle_diameter", "single_extruder_multi_material",
"enable_prime_tower", "wipe_tower_x", "wipe_tower_y", "prime_tower_width", "prime_tower_brim_width", "prime_tower_skip_points", "prime_volume", "enable_prime_tower", "wipe_tower_x", "wipe_tower_y", "prime_tower_width", "prime_tower_brim_width", "prime_tower_skip_points",
"prime_tower_rib_wall","prime_tower_extra_rib_length", "prime_tower_rib_width","prime_tower_fillet_wall", "prime_tower_rib_wall","prime_tower_extra_rib_length", "prime_tower_rib_width","prime_tower_fillet_wall", "filament_prime_volume",
"extruder_colour", "filament_colour", "filament_type", "material_colour", "printable_height", "extruder_printable_height", "printer_model", "printer_technology", "extruder_colour", "filament_colour", "filament_type", "material_colour", "printable_height", "extruder_printable_height", "printer_model", "printer_technology",
// These values are necessary to construct SlicingParameters by the Canvas3D variable layer height editor. // These values are necessary to construct SlicingParameters by the Canvas3D variable layer height editor.
"layer_height", "initial_layer_print_height", "min_layer_height", "max_layer_height", "layer_height", "initial_layer_print_height", "min_layer_height", "max_layer_height",
@ -14759,9 +14759,7 @@ void Plater::on_config_change(const DynamicPrintConfig &config)
boost::starts_with(opt_key, "prime_tower") || boost::starts_with(opt_key, "prime_tower") ||
boost::starts_with(opt_key, "wipe_tower") || boost::starts_with(opt_key, "wipe_tower") ||
// opt_key == "filament_minimal_purge_on_wipe_tower" // ? #ys_FIXME // opt_key == "filament_minimal_purge_on_wipe_tower" // ? #ys_FIXME
opt_key == "single_extruder_multi_material" || opt_key == "single_extruder_multi_material") {
// BBS
opt_key == "prime_volume") {
update_scheduled = true; update_scheduled = true;
} }
else if(opt_key == "extruder_colour") { else if(opt_key == "extruder_colour") {

View File

@ -2226,7 +2226,6 @@ void TabPrint::build()
optgroup->append_single_option_line("enable_prime_tower","parameter/prime-tower"); optgroup->append_single_option_line("enable_prime_tower","parameter/prime-tower");
optgroup->append_single_option_line("prime_tower_skip_points", "parameter/prime-tower"); optgroup->append_single_option_line("prime_tower_skip_points", "parameter/prime-tower");
optgroup->append_single_option_line("prime_tower_width","parameter/prime-tower"); optgroup->append_single_option_line("prime_tower_width","parameter/prime-tower");
optgroup->append_single_option_line("prime_volume","parameter/prime-tower");
optgroup->append_single_option_line("prime_tower_brim_width","parameter/prime-tower"); optgroup->append_single_option_line("prime_tower_brim_width","parameter/prime-tower");
optgroup->append_single_option_line("prime_tower_rib_wall", "parameter/prime-tower"); optgroup->append_single_option_line("prime_tower_rib_wall", "parameter/prime-tower");
optgroup->append_single_option_line("prime_tower_extra_rib_length","parameter/prime-tower"); optgroup->append_single_option_line("prime_tower_extra_rib_length","parameter/prime-tower");
@ -3188,6 +3187,7 @@ void TabFilament::build()
optgroup->append_single_option_line("impact_strength_z"); optgroup->append_single_option_line("impact_strength_z");
optgroup->append_single_option_line("filament_change_length"); optgroup->append_single_option_line("filament_change_length");
optgroup->append_single_option_line("filament_prime_volume");
//optgroup->append_single_option_line("filament_colour"); //optgroup->append_single_option_line("filament_colour");
optgroup->append_single_option_line("required_nozzle_HRC"); optgroup->append_single_option_line("required_nozzle_HRC");
optgroup->append_single_option_line("default_filament_colour"); optgroup->append_single_option_line("default_filament_colour");