ENH: enhance some functions of the wipe_tower
1.Add automatic calculation of the wipe_tower's brim width by height; 2.modify the min_depth_per_height and the default ridwidth jira: none Change-Id: Idd96bc90e8e631aa8481b559e1e9fec24c6b822f
This commit is contained in:
parent
26af626d8b
commit
4dd4e9e12c
|
@ -19,6 +19,7 @@
|
|||
"40"
|
||||
],
|
||||
"prime_tower_width": "60",
|
||||
"prime_tower_brim_width": "-1",
|
||||
"travel_speed": [
|
||||
"1000",
|
||||
"1000",
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
"200"
|
||||
],
|
||||
"prime_tower_width": "60",
|
||||
"prime_tower_brim_width": "-1",
|
||||
"sparse_infill_speed": [
|
||||
"350",
|
||||
"600",
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
"30"
|
||||
],
|
||||
"prime_tower_width": "60",
|
||||
"prime_tower_brim_width": "-1",
|
||||
"sparse_infill_speed": [
|
||||
"350",
|
||||
"600",
|
||||
|
|
|
@ -67,6 +67,7 @@
|
|||
"10"
|
||||
],
|
||||
"prime_tower_width": "60",
|
||||
"prime_tower_brim_width": "-1",
|
||||
"sparse_infill_speed": [
|
||||
"350",
|
||||
"600",
|
||||
|
|
|
@ -3661,6 +3661,7 @@ int CLI::run(int argc, char **argv)
|
|||
|
||||
ConfigOptionFloat* brim_width_option = print_config.option<ConfigOptionFloat>("prime_tower_brim_width", true);
|
||||
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());
|
||||
|
||||
ConfigOptionFloat* volume_option = print_config.option<ConfigOptionFloat>("prime_volume", true);
|
||||
float wipe_volume = volume_option->value;
|
||||
|
@ -4809,6 +4810,7 @@ int CLI::run(int argc, char **argv)
|
|||
ConfigOption *wipe_tower_brim_width_opt = m_print_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());
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format("arrange wipe_tower: wp_brim_width %1%")%wp_brim_width;
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
namespace Slic3r
|
||||
{
|
||||
static const double wipe_tower_wall_infill_overlap = 0.0;
|
||||
static const double wipe_tower_wall_infill_overlap_new = -0.2;
|
||||
static constexpr double WIPE_TOWER_RESOLUTION = 0.0375;
|
||||
#define SCALED_WIPE_TOWER_RESOLUTION (WIPE_TOWER_RESOLUTION / SCALING_FACTOR)
|
||||
inline float align_round(float value, float base)
|
||||
|
@ -1268,7 +1267,7 @@ WipeTower::ToolChangeResult WipeTower::construct_block_tcr(WipeTowerWriter &writ
|
|||
|
||||
// BBS
|
||||
const std::map<float, float> WipeTower::min_depth_per_height = {
|
||||
{10.f, 10.f}, {100.f, 20.f}, {180.f, 40.f}, {250.f, 50.f}, {350.f, 60.f}
|
||||
{0.f,0.f}, {100.f, 20.f}, {180.f, 40.f}, {250.f, 50.f}, {350.f, 60.f}
|
||||
};
|
||||
|
||||
float WipeTower::get_limit_depth_by_height(float max_height)
|
||||
|
@ -1307,6 +1306,11 @@ float WipeTower::get_limit_depth_by_height(float max_height)
|
|||
return min_wipe_tower_depth;
|
||||
}
|
||||
|
||||
float WipeTower::get_auto_brim_by_height(float max_height) {
|
||||
if (max_height < 100) return max_height/100.f * 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) :
|
||||
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)),
|
||||
|
@ -1464,7 +1468,8 @@ Vec2f WipeTower::get_next_pos(const WipeTower::box_coordinates &cleaning_box, fl
|
|||
|
||||
Vec2f res;
|
||||
int index = m_cur_layer_id % 4;
|
||||
Vec2f offset = m_use_gap_wall ? Vec2f(5 * m_perimeter_width, 0) : Vec2f{0, 0};
|
||||
//Vec2f offset = m_use_gap_wall ? Vec2f(5 * m_perimeter_width, 0) : Vec2f{0, 0};
|
||||
Vec2f offset = Vec2f{0, 0};
|
||||
switch (index % 4) {
|
||||
case 0:
|
||||
res = offset +cleaning_box.ld + pos_offset;
|
||||
|
@ -2707,6 +2712,7 @@ WipeTower::NozzleChangeResult WipeTower::nozzle_change_new(int old_filament_id,
|
|||
};
|
||||
|
||||
float nozzle_change_speed = 60.0f * m_filpar[m_current_tool].max_e_speed / m_extrusion_flow;
|
||||
//float nozzle_change_speed = is_first_layer() ? std::min(m_first_layer_speed * 60.f, 4800.f) : 4800.f;
|
||||
if (is_tpu_filament(m_current_tool)) {
|
||||
nozzle_change_speed *= 0.25;
|
||||
}
|
||||
|
@ -3202,23 +3208,23 @@ void WipeTower::toolchange_wipe_new(WipeTowerWriter &writer, const box_coordinat
|
|||
float ironing_length = 3.;
|
||||
if (i == 0 && m_use_gap_wall) { // BBS: add ironing after extruding start
|
||||
if (m_left_to_right) {
|
||||
float dx = xr + wipe_tower_wall_infill_overlap_new * m_perimeter_width - writer.pos().x();
|
||||
float dx = xr + wipe_tower_wall_infill_overlap * m_perimeter_width - writer.pos().x();
|
||||
if (abs(dx) < ironing_length) ironing_length = abs(dx);
|
||||
writer.extrude(writer.x() + ironing_length, writer.y(), wipe_speed);
|
||||
writer.retract(retract_length, retract_speed);
|
||||
writer.travel(writer.x() - 1.5 * ironing_length, writer.y(), 600.);
|
||||
writer.travel(writer.x() + 1.5 * ironing_length, writer.y(), 240.);
|
||||
writer.retract(-retract_length, retract_speed);
|
||||
writer.extrude(xr + wipe_tower_wall_infill_overlap_new * m_perimeter_width, writer.y(), wipe_speed);
|
||||
writer.extrude(xr + wipe_tower_wall_infill_overlap * m_perimeter_width, writer.y(), wipe_speed);
|
||||
} else {
|
||||
float dx = xl - wipe_tower_wall_infill_overlap_new * m_perimeter_width - writer.pos().x();
|
||||
float dx = xl - wipe_tower_wall_infill_overlap * m_perimeter_width - writer.pos().x();
|
||||
if (abs(dx) < ironing_length) ironing_length = abs(dx);
|
||||
writer.extrude(writer.x() - ironing_length, writer.y(), wipe_speed);
|
||||
writer.retract(retract_length, retract_speed);
|
||||
writer.travel(writer.x() + 1.5 * ironing_length, writer.y(), 600.);
|
||||
writer.travel(writer.x() - 1.5 * ironing_length, writer.y(), 240.);
|
||||
writer.retract(-retract_length, retract_speed);
|
||||
writer.extrude(xl - wipe_tower_wall_infill_overlap_new * m_perimeter_width, writer.y(), wipe_speed);
|
||||
writer.extrude(xl - wipe_tower_wall_infill_overlap * m_perimeter_width, writer.y(), wipe_speed);
|
||||
}
|
||||
} else {
|
||||
if (m_left_to_right)
|
||||
|
@ -3440,6 +3446,7 @@ void WipeTower::generate_wipe_tower_blocks()
|
|||
|
||||
void WipeTower::plan_tower_new()
|
||||
{
|
||||
if (m_wipe_tower_brim_width < 0) m_wipe_tower_brim_width = get_auto_brim_by_height(m_wipe_tower_height);
|
||||
if (m_use_rib_wall) {
|
||||
// recalculate wipe_tower_with and layer's depth
|
||||
generate_wipe_tower_blocks();
|
||||
|
|
|
@ -26,6 +26,7 @@ public:
|
|||
// WipeTower height to minimum depth map
|
||||
static const std::map<float, float> min_depth_per_height;
|
||||
static float get_limit_depth_by_height(float max_height);
|
||||
static float get_auto_brim_by_height(float max_height);
|
||||
|
||||
struct Extrusion
|
||||
{
|
||||
|
|
|
@ -2529,18 +2529,17 @@ bool Print::has_wipe_tower() const
|
|||
const WipeTowerData& Print::wipe_tower_data(size_t filaments_cnt) const
|
||||
{
|
||||
// If the wipe tower wasn't created yet, make sure the depth and brim_width members are set to default.
|
||||
if (! is_step_done(psWipeTower) && filaments_cnt !=0) {
|
||||
if (m_config.prime_tower_rib_wall.value) {
|
||||
double layer_height = 0.08f; // hard code layer height
|
||||
double wipe_volume = m_config.prime_volume;
|
||||
double max_height = 0;
|
||||
for (size_t obj_idx = 0; obj_idx < m_objects.size(); obj_idx++) {
|
||||
double object_z = (double) m_objects[obj_idx]->size().z();
|
||||
max_height = std::max(unscale_(object_z), max_height);
|
||||
}
|
||||
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 (m_config.prime_tower_rib_wall.value) {
|
||||
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;
|
||||
int filament_depth_count = m_config.nozzle_diameter.values.size() == 2 ? filaments_cnt : filaments_cnt - 1;
|
||||
if (filaments_cnt == 1 && enable_timelapse_print())
|
||||
|
@ -2565,7 +2564,7 @@ const WipeTowerData& Print::wipe_tower_data(size_t filaments_cnt) const
|
|||
const_cast<Print *>(this)->m_wipe_tower_data.brim_width = m_config.prime_tower_brim_width;
|
||||
}
|
||||
}
|
||||
|
||||
if (m_config.prime_tower_brim_width < 0 ) const_cast<Print *>(this)->m_wipe_tower_data.brim_width = WipeTower::get_auto_brim_by_height(max_height);
|
||||
return m_wipe_tower_data;
|
||||
}
|
||||
|
||||
|
|
|
@ -4332,10 +4332,10 @@ void PrintConfigDef::init_fff_params()
|
|||
|
||||
def = this->add("prime_tower_brim_width", coFloat);
|
||||
def->label = L("Brim width");
|
||||
def->tooltip = L("Brim width");
|
||||
def->tooltip = L("Brim width, -1 means the brim width is automatically calculated based on the height ");
|
||||
def->sidetext = L("mm");
|
||||
def->mode = comAdvanced;
|
||||
def->min = 0.;
|
||||
def->min = -1;
|
||||
def->set_default_value(new ConfigOptionFloat(3.));
|
||||
|
||||
def = this->add("prime_tower_extra_rib_length", coFloat);
|
||||
|
@ -4352,7 +4352,7 @@ void PrintConfigDef::init_fff_params()
|
|||
def->sidetext = L("mm");
|
||||
def->mode = comAdvanced;
|
||||
def->min = 0;
|
||||
def->set_default_value(new ConfigOptionFloat(4));
|
||||
def->set_default_value(new ConfigOptionFloat(8));
|
||||
|
||||
def = this->add("prime_tower_skip_points", coBool);
|
||||
def->label = L("Skip points");
|
||||
|
|
|
@ -5350,10 +5350,12 @@ GLCanvas3D::WipeTowerInfo GLCanvas3D::get_wipe_tower_info(int plate_idx) const
|
|||
float wt_brim_width = preset.config.opt_float("prime_tower_brim_width");
|
||||
|
||||
const BoundingBoxf3& bb = vol->bounding_box();
|
||||
if (wt_brim_width < 0) wt_brim_width = WipeTower::get_auto_brim_by_height((float)bb.max.z());
|
||||
wti.m_bb = BoundingBoxf{to_2d(bb.min), to_2d(bb.max)};
|
||||
wti.m_bb.offset(wt_brim_width);
|
||||
|
||||
float brim_width = wxGetApp().preset_bundle->prints.get_edited_preset().config.opt_float("prime_tower_brim_width");
|
||||
if (brim_width < 0) brim_width = WipeTower::get_auto_brim_by_height((float) bb.max.z());
|
||||
wti.m_bb.offset((brim_width));
|
||||
|
||||
// BBS: the wipe tower pos might be outside bed
|
||||
|
|
|
@ -1512,6 +1512,7 @@ arrangement::ArrangePolygon PartPlate::estimate_wipe_tower_polygon(const Dynamic
|
|||
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());
|
||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format("arrange wipe_tower: wp_brim_width %1%") % wp_brim_width;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue