mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-07 23:17:35 -06:00
estimate tower size
This commit is contained in:
parent
6ff9ff03db
commit
cd3bbdb5f5
4 changed files with 20 additions and 8 deletions
|
@ -2181,14 +2181,25 @@ 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 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 (! is_step_done(psWipeTower) && filaments_cnt !=0) {
|
||||||
if (is_BBL_printer()) { // BBS
|
if (true || is_BBL_printer()) { // 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;
|
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 {
|
||||||
const_cast<Print *>(this)->m_wipe_tower_data.depth = wipe_volume * (filaments_cnt - 1) / (layer_height * width);
|
auto scale = m_config.flush_multiplier;
|
||||||
|
// Calculating depth should take into account currently set wiping volumes.
|
||||||
|
// For a long time, the initial preview would just use 900/width per toolchange (15mm on a 60mm wide tower)
|
||||||
|
// and it worked well enough. Let's try to do slightly better by accounting for the purging volumes.
|
||||||
|
std::vector<std::vector<float>> wipe_volumes = WipeTower2::extract_wipe_volumes(m_config);
|
||||||
|
std::vector<float> max_wipe_volumes;
|
||||||
|
for (const std::vector<float> &v : wipe_volumes)
|
||||||
|
max_wipe_volumes.emplace_back(scale*(*std::max_element(v.begin(), v.end())));
|
||||||
|
float maximum = std::accumulate(max_wipe_volumes.begin(), max_wipe_volumes.end(), 0.f);
|
||||||
|
maximum = maximum * filaments_cnt / max_wipe_volumes.size();
|
||||||
|
|
||||||
|
const_cast<Print *>(this)->m_wipe_tower_data.depth = maximum * (filaments_cnt - 1) / (layer_height * width);
|
||||||
}
|
}
|
||||||
const_cast<Print *>(this)->m_wipe_tower_data.brim_width = m_config.prime_tower_brim_width;
|
const_cast<Print *>(this)->m_wipe_tower_data.brim_width = m_config.prime_tower_brim_width;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2637,12 +2637,13 @@ 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;
|
// float v = dynamic_cast<const ConfigOptionFloat*>(m_config->option("prime_volume"))->value;
|
||||||
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;
|
const auto& wipe_tower_data = print->wipe_tower_data(filaments_count);
|
||||||
Vec3d wipe_tower_size = ppl.get_plate(plate_id)->estimate_wipe_tower_size(w, v);
|
float brim_width = wipe_tower_data.brim_width;
|
||||||
|
Vec3d wipe_tower_size = ppl.get_plate(plate_id)->estimate_wipe_tower_size(w, wipe_tower_data.depth);
|
||||||
|
|
||||||
const float margin = 15.f;
|
const float margin = 15.f;
|
||||||
BoundingBoxf3 plate_bbox = wxGetApp().plater()->get_partplate_list().get_plate(plate_id)->get_bounding_box();
|
BoundingBoxf3 plate_bbox = wxGetApp().plater()->get_partplate_list().get_plate(plate_id)->get_bounding_box();
|
||||||
|
|
|
@ -1549,7 +1549,7 @@ std::vector<int> PartPlate::get_used_extruders()
|
||||||
return used_extruders;
|
return used_extruders;
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec3d PartPlate::estimate_wipe_tower_size(const double w, const double wipe_volume) const
|
Vec3d PartPlate::estimate_wipe_tower_size(const double w, const double d) const
|
||||||
{
|
{
|
||||||
Vec3d wipe_tower_size;
|
Vec3d wipe_tower_size;
|
||||||
std::vector<int> plate_extruders = get_extruders(true);
|
std::vector<int> plate_extruders = get_extruders(true);
|
||||||
|
@ -1579,7 +1579,7 @@ Vec3d PartPlate::estimate_wipe_tower_size(const double w, const double wipe_volu
|
||||||
auto timelapse_type = dconfig.option<ConfigOptionEnum<TimelapseType>>("timelapse_type");
|
auto timelapse_type = dconfig.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_extruders.size() - 1) / (layer_height * w);
|
double depth = d;
|
||||||
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();
|
||||||
|
|
|
@ -285,7 +285,7 @@ public:
|
||||||
ModelInstance* get_instance(int obj_id, int instance_id);
|
ModelInstance* get_instance(int obj_id, int instance_id);
|
||||||
|
|
||||||
Vec3d get_origin() { return m_origin; }
|
Vec3d get_origin() { return m_origin; }
|
||||||
Vec3d estimate_wipe_tower_size(const double w, const double wipe_volume) const;
|
Vec3d estimate_wipe_tower_size(const double w, const double d) const;
|
||||||
std::vector<int> get_extruders(bool conside_custom_gcode = false) const;
|
std::vector<int> get_extruders(bool conside_custom_gcode = false) const;
|
||||||
std::vector<int> get_extruders_under_cli(bool conside_custom_gcode, DynamicPrintConfig& full_config) const;
|
std::vector<int> get_extruders_under_cli(bool conside_custom_gcode, DynamicPrintConfig& full_config) const;
|
||||||
std::vector<int> get_extruders_without_support(bool conside_custom_gcode = false) const;
|
std::vector<int> get_extruders_without_support(bool conside_custom_gcode = false) const;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue