ENH: update flush data for H2D
1.Alsoe set default flush from support to 700 jira: STUDIO-10595 Signed-off-by: xun.zhang <xun.zhang@bambulab.com> Change-Id: I0d0a85cdac5e63b787c16b35ed6c05afc885a715
This commit is contained in:
parent
c74cd2a15f
commit
5fea5e6696
|
@ -0,0 +1,83 @@
|
|||
colors
|
||||
#000000 #FFFFFF #545454 #8E9089 #C12E1F #F4EE2A #0A2989 #FF6A13 #0086D6 #F7E6DE #00AE42
|
||||
src dst flush
|
||||
#000000 #FFFFFF 900
|
||||
#000000 #545454 330
|
||||
#000000 #8E9089 570
|
||||
#000000 #C12E1F 660
|
||||
#000000 #F4EE2A 900
|
||||
#000000 #0A2989 480
|
||||
#000000 #FF6A13 900
|
||||
#000000 #0086D6 630
|
||||
#000000 #F7E6DE 900
|
||||
#000000 #00AE42 660
|
||||
#FFFFFF #000000 90
|
||||
#FFFFFF #545454 120
|
||||
#FFFFFF #F4EE2A 120
|
||||
#FFFFFF #0A2989 150
|
||||
#FFFFFF #FF6A13 120
|
||||
#FFFFFF #00AE42 120
|
||||
#545454 #000000 90
|
||||
#545454 #FFFFFF 780
|
||||
#545454 #8E9089 210
|
||||
#545454 #C12E1F 270
|
||||
#545454 #F4EE2A 390
|
||||
#545454 #0A2989 120
|
||||
#545454 #FF6A13 360
|
||||
#545454 #0086D6 300
|
||||
#545454 #00AE42 330
|
||||
#8E9089 #000000 210
|
||||
#8E9089 #FFFFFF 450
|
||||
#8E9089 #545454 180
|
||||
#8E9089 #F4EE2A 360
|
||||
#8E9089 #0A2989 210
|
||||
#8E9089 #FF6A13 300
|
||||
#8E9089 #00AE42 210
|
||||
#C12E1F #000000 120
|
||||
#C12E1F #FFFFFF 720
|
||||
#C12E1F #545454 270
|
||||
#C12E1F #8E9089 480
|
||||
#C12E1F #F4EE2A 540
|
||||
#C12E1F #0A2989 300
|
||||
#C12E1F #FF6A13 330
|
||||
#C12E1F #F7E6DE 690
|
||||
#C12E1F #00AE42 600
|
||||
#F4EE2A #000000 150
|
||||
#F4EE2A #FFFFFF 870
|
||||
#F4EE2A #545454 330
|
||||
#F4EE2A #0A2989 330
|
||||
#F4EE2A #FF6A13 150
|
||||
#F4EE2A #0086D6 420
|
||||
#0A2989 #000000 90
|
||||
#0A2989 #FFFFFF 630
|
||||
#0A2989 #545454 150
|
||||
#0A2989 #8E9089 390
|
||||
#0A2989 #C12E1F 450
|
||||
#0A2989 #F4EE2A 510
|
||||
#0A2989 #FF6A13 480
|
||||
#0A2989 #0086D6 300
|
||||
#0A2989 #00AE42 660
|
||||
#FF6A13 #000000 90
|
||||
#FF6A13 #FFFFFF 570
|
||||
#FF6A13 #545454 180
|
||||
#FF6A13 #F4EE2A 390
|
||||
#FF6A13 #0A2989 270
|
||||
#FF6A13 #0086D6 360
|
||||
#FF6A13 #F7E6DE 330
|
||||
#FF6A13 #00AE42 300
|
||||
#0086D6 #000000 120
|
||||
#0086D6 #FFFFFF 600
|
||||
#0086D6 #545454 150
|
||||
#0086D6 #8E9089 390
|
||||
#0086D6 #C12E1F 420
|
||||
#0086D6 #F4EE2A 480
|
||||
#0086D6 #0A2989 120
|
||||
#0086D6 #FF6A13 330
|
||||
#0086D6 #F7E6DE 450
|
||||
#0086D6 #00AE42 180
|
||||
#00AE42 #000000 90
|
||||
#00AE42 #FFFFFF 630
|
||||
#00AE42 #545454 210
|
||||
#00AE42 #F4EE2A 360
|
||||
#00AE42 #0A2989 210
|
||||
#00AE42 #0086D6 360
|
|
@ -0,0 +1,85 @@
|
|||
colors
|
||||
#000000 #FFFFFF #545454 #8E9089 #C12E1F #F4EE2A #0A2989 #FF6A13 #0086D6 #F7E6DE #00AE42
|
||||
src dst flush
|
||||
#000000 #FFFFFF 900
|
||||
#000000 #545454 270
|
||||
#000000 #8E9089 510
|
||||
#000000 #C12E1F 900
|
||||
#000000 #F4EE2A 900
|
||||
#000000 #0A2989 360
|
||||
#000000 #FF6A13 900
|
||||
#000000 #0086D6 630
|
||||
#000000 #00AE42 780
|
||||
#FFFFFF #000000 90
|
||||
#FFFFFF #545454 90
|
||||
#FFFFFF #8E9089 180
|
||||
#FFFFFF #F4EE2A 150
|
||||
#FFFFFF #0A2989 60
|
||||
#FFFFFF #FF6A13 150
|
||||
#FFFFFF #00AE42 150
|
||||
#545454 #000000 90
|
||||
#545454 #8E9089 240
|
||||
#545454 #C12E1F 360
|
||||
#545454 #F4EE2A 390
|
||||
#545454 #0A2989 180
|
||||
#545454 #FF6A13 300
|
||||
#545454 #0086D6 270
|
||||
#545454 #F7E6DE 330
|
||||
#545454 #00AE42 390
|
||||
#8E9089 #000000 210
|
||||
#8E9089 #FFFFFF 390
|
||||
#8E9089 #545454 150
|
||||
#8E9089 #F4EE2A 330
|
||||
#8E9089 #0A2989 330
|
||||
#8E9089 #00AE42 240
|
||||
#C12E1F #000000 90
|
||||
#C12E1F #FFFFFF 780
|
||||
#C12E1F #545454 360
|
||||
#C12E1F #8E9089 510
|
||||
#C12E1F #F4EE2A 600
|
||||
#C12E1F #0A2989 420
|
||||
#C12E1F #FF6A13 390
|
||||
#C12E1F #0086D6 450
|
||||
#C12E1F #F7E6DE 600
|
||||
#C12E1F #00AE42 510
|
||||
#F4EE2A #000000 90
|
||||
#F4EE2A #FFFFFF 690
|
||||
#F4EE2A #545454 390
|
||||
#F4EE2A #8E9089 480
|
||||
#F4EE2A #0A2989 390
|
||||
#F4EE2A #FF6A13 180
|
||||
#F4EE2A #0086D6 450
|
||||
#0A2989 #000000 90
|
||||
#0A2989 #FFFFFF 630
|
||||
#0A2989 #545454 300
|
||||
#0A2989 #8E9089 450
|
||||
#0A2989 #C12E1F 450
|
||||
#0A2989 #F4EE2A 510
|
||||
#0A2989 #FF6A13 420
|
||||
#0A2989 #0086D6 330
|
||||
#0A2989 #00AE42 390
|
||||
#FF6A13 #000000 90
|
||||
#FF6A13 #FFFFFF 420
|
||||
#FF6A13 #545454 90
|
||||
#FF6A13 #8E9089 360
|
||||
#FF6A13 #C12E1F 180
|
||||
#FF6A13 #F4EE2A 180
|
||||
#FF6A13 #0A2989 210
|
||||
#FF6A13 #0086D6 360
|
||||
#FF6A13 #00AE42 240
|
||||
#0086D6 #000000 90
|
||||
#0086D6 #FFFFFF 510
|
||||
#0086D6 #545454 150
|
||||
#0086D6 #8E9089 420
|
||||
#0086D6 #C12E1F 420
|
||||
#0086D6 #F4EE2A 420
|
||||
#0086D6 #0A2989 120
|
||||
#0086D6 #FF6A13 390
|
||||
#0086D6 #00AE42 300
|
||||
#00AE42 #FFFFFF 570
|
||||
#00AE42 #545454 270
|
||||
#00AE42 #8E9089 480
|
||||
#00AE42 #F4EE2A 450
|
||||
#00AE42 #0A2989 270
|
||||
#00AE42 #FF6A13 300
|
||||
#00AE42 #0086D6 390
|
|
@ -3338,7 +3338,8 @@ int CLI::run(int argc, char **argv)
|
|||
unsigned char to_rgb[4] = {};
|
||||
Slic3r::GUI::BitmapCache::parse_color4(to_color, to_rgb);
|
||||
|
||||
Slic3r::FlushVolCalculator calculator(min_flush_volumes[from_idx], Slic3r::g_max_flush_volume);
|
||||
NozzleVolumeType volume_type=NozzleVolumeType(m_print_config.option<ConfigOptionEnumsGeneric>("nozzle_volume_type")->values[nozzle_id]);
|
||||
Slic3r::FlushVolCalculator calculator(min_flush_volumes[from_idx], Slic3r::g_max_flush_volume, new_extruder_count > 1, volume_type);
|
||||
|
||||
flushing_volume = calculator.calc_flush_vol(from_rgb[3], from_rgb[0], from_rgb[1], from_rgb[2], to_rgb[3], to_rgb[0], to_rgb[1], to_rgb[2]);
|
||||
if (is_from_support) { flushing_volume = std::max(Slic3r::g_min_flush_volume_from_support, flushing_volume); }
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
|
||||
namespace Slic3r {
|
||||
|
||||
const int g_min_flush_volume_from_support = 420.f;
|
||||
const int g_min_flush_volume_from_support = 700;
|
||||
const int g_flush_volume_to_support = 230;
|
||||
|
||||
const int g_max_flush_volume = 800;
|
||||
const int g_max_flush_volume = 900;
|
||||
|
||||
static float to_radians(float degree)
|
||||
{
|
||||
|
@ -39,60 +39,72 @@ static float DeltaHS_BBS(float h1, float s1, float v1, float h2, float s2, float
|
|||
return std::min(1.2f, dxy);
|
||||
}
|
||||
|
||||
FlushVolCalculator::FlushVolCalculator(int min, int max, float multiplier)
|
||||
FlushVolCalculator::FlushVolCalculator(int min, int max, bool is_multi_extruder, NozzleVolumeType volume_type, float multiplier)
|
||||
:m_min_flush_vol(min), m_max_flush_vol(max), m_multiplier(multiplier)
|
||||
{
|
||||
if (!is_multi_extruder) {
|
||||
m_machine_type = FlushPredict::Standard;
|
||||
return;
|
||||
}
|
||||
|
||||
if (volume_type == NozzleVolumeType::nvtHighFlow)
|
||||
m_machine_type = FlushPredict::DualHighFlow;
|
||||
else
|
||||
m_machine_type = FlushPredict::DualStandard;
|
||||
}
|
||||
|
||||
bool FlushVolCalculator::get_flush_vol_from_data(unsigned char src_r, unsigned char src_g, unsigned char src_b,
|
||||
unsigned char dst_r, unsigned char dst_g, unsigned char dst_b, float& flush)
|
||||
{
|
||||
GenericFlushPredictor pd(m_machine_type);
|
||||
FlushPredict::RGBColor src(src_r, src_g, src_b);
|
||||
FlushPredict::RGBColor dst(dst_r, dst_g, dst_b);
|
||||
|
||||
return pd.predict(src, dst, flush);
|
||||
}
|
||||
|
||||
int FlushVolCalculator::calc_flush_vol_rgb(unsigned char src_r, unsigned char src_g, unsigned char src_b,
|
||||
unsigned char dst_r, unsigned char dst_g, unsigned char dst_b)
|
||||
{
|
||||
auto& pd = FlushVolPredictor::get_instance();
|
||||
float ret_flush_volume = 0;
|
||||
FlushPredict::RGBColor src(src_r, src_g, src_b);
|
||||
FlushPredict::RGBColor dst(dst_r, dst_g, dst_b);
|
||||
bool success = pd.predict(src, dst, ret_flush_volume);
|
||||
// if we could find the color pair from dataset, we need to recalculate
|
||||
if (!success) {
|
||||
float src_r_f, src_g_f, src_b_f, dst_r_f, dst_g_f, dst_b_f;
|
||||
float from_hsv_h, from_hsv_s, from_hsv_v;
|
||||
float to_hsv_h, to_hsv_s, to_hsv_v;
|
||||
float flush_volume;
|
||||
if(m_machine_type == FlushPredict::Standard && get_flush_vol_from_data(src_r, src_g, src_b, dst_r, dst_g, dst_b, flush_volume))
|
||||
return flush_volume;
|
||||
float src_r_f, src_g_f, src_b_f, dst_r_f, dst_g_f, dst_b_f;
|
||||
float from_hsv_h, from_hsv_s, from_hsv_v;
|
||||
float to_hsv_h, to_hsv_s, to_hsv_v;
|
||||
|
||||
src_r_f = (float)src_r / 255.f;
|
||||
src_g_f = (float)src_g / 255.f;
|
||||
src_b_f = (float)src_b / 255.f;
|
||||
dst_r_f = (float)dst_r / 255.f;
|
||||
dst_g_f = (float)dst_g / 255.f;
|
||||
dst_b_f = (float)dst_b / 255.f;
|
||||
src_r_f = (float)src_r / 255.f;
|
||||
src_g_f = (float)src_g / 255.f;
|
||||
src_b_f = (float)src_b / 255.f;
|
||||
dst_r_f = (float)dst_r / 255.f;
|
||||
dst_g_f = (float)dst_g / 255.f;
|
||||
dst_b_f = (float)dst_b / 255.f;
|
||||
|
||||
// Calculate color distance in HSV color space
|
||||
RGB2HSV(src_r_f, src_g_f,src_b_f, &from_hsv_h, &from_hsv_s, &from_hsv_v);
|
||||
RGB2HSV(dst_r_f, dst_g_f, dst_b_f, &to_hsv_h, &to_hsv_s, &to_hsv_v);
|
||||
float hs_dist = DeltaHS_BBS(from_hsv_h, from_hsv_s, from_hsv_v, to_hsv_h, to_hsv_s, to_hsv_v);
|
||||
// Calculate color distance in HSV color space
|
||||
RGB2HSV(src_r_f, src_g_f, src_b_f, &from_hsv_h, &from_hsv_s, &from_hsv_v);
|
||||
RGB2HSV(dst_r_f, dst_g_f, dst_b_f, &to_hsv_h, &to_hsv_s, &to_hsv_v);
|
||||
float hs_dist = DeltaHS_BBS(from_hsv_h, from_hsv_s, from_hsv_v, to_hsv_h, to_hsv_s, to_hsv_v);
|
||||
|
||||
// 1. Color difference is more obvious if the dest color has high luminance
|
||||
// 2. Color difference is more obvious if the source color has low luminance
|
||||
float from_lumi = get_luminance(src_r_f, src_g_f, src_b_f);
|
||||
float to_lumi = get_luminance(dst_r_f, dst_g_f, dst_b_f);
|
||||
float lumi_flush = 0.f;
|
||||
if (to_lumi >= from_lumi) {
|
||||
lumi_flush = std::pow(to_lumi - from_lumi, 0.7f) * 560.f;
|
||||
}
|
||||
else {
|
||||
lumi_flush = (from_lumi - to_lumi) * 80.f;
|
||||
|
||||
float inter_hsv_v = 0.67 * to_hsv_v + 0.33 * from_hsv_v;
|
||||
hs_dist = std::min(inter_hsv_v, hs_dist);
|
||||
}
|
||||
float hs_flush = 230.f * hs_dist;
|
||||
|
||||
float flush_volume = calc_triangle_3rd_edge(hs_flush, lumi_flush, 120.f);
|
||||
flush_volume = std::max(flush_volume, 60.f);
|
||||
|
||||
ret_flush_volume = flush_volume;
|
||||
// 1. Color difference is more obvious if the dest color has high luminance
|
||||
// 2. Color difference is more obvious if the source color has low luminance
|
||||
float from_lumi = get_luminance(src_r_f, src_g_f, src_b_f);
|
||||
float to_lumi = get_luminance(dst_r_f, dst_g_f, dst_b_f);
|
||||
float lumi_flush = 0.f;
|
||||
if (to_lumi >= from_lumi) {
|
||||
lumi_flush = std::pow(to_lumi - from_lumi, 0.7f) * 560.f;
|
||||
}
|
||||
else {
|
||||
lumi_flush = (from_lumi - to_lumi) * 80.f;
|
||||
|
||||
return ret_flush_volume;
|
||||
float inter_hsv_v = 0.67 * to_hsv_v + 0.33 * from_hsv_v;
|
||||
hs_dist = std::min(inter_hsv_v, hs_dist);
|
||||
}
|
||||
float hs_flush = 230.f * hs_dist;
|
||||
|
||||
flush_volume = calc_triangle_3rd_edge(hs_flush, lumi_flush, 120.f);
|
||||
flush_volume = std::max(flush_volume, 60.f);
|
||||
|
||||
return flush_volume;
|
||||
}
|
||||
|
||||
int FlushVolCalculator::calc_flush_vol(unsigned char src_a, unsigned char src_r, unsigned char src_g, unsigned char src_b,
|
||||
|
@ -106,8 +118,12 @@ int FlushVolCalculator::calc_flush_vol(unsigned char src_a, unsigned char src_r,
|
|||
dst_r = dst_g = dst_b = 255;
|
||||
}
|
||||
|
||||
float flush_volume = calc_flush_vol_rgb(src_r, src_g, src_b, dst_r, dst_g, dst_b);
|
||||
float flush_volume;
|
||||
if(m_machine_type != FlushPredict::Standard && get_flush_vol_from_data(src_r, src_g, src_b, dst_r, dst_g, dst_b, flush_volume))
|
||||
return std::min((int)flush_volume, m_max_flush_vol);
|
||||
|
||||
|
||||
flush_volume = calc_flush_vol_rgb(src_r, src_g, src_b, dst_r, dst_g, dst_b);
|
||||
flush_volume += m_min_flush_vol;
|
||||
return std::min((int)flush_volume, m_max_flush_vol);
|
||||
}
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
#define slic3r_FlushVolCalc_hpp_
|
||||
|
||||
#include "libslic3r.h"
|
||||
#include "Config.hpp"
|
||||
#include "FlushVolPredictor.hpp"
|
||||
#include "PrintConfig.hpp"
|
||||
|
||||
|
||||
namespace Slic3r {
|
||||
|
@ -15,7 +15,7 @@ extern const int g_max_flush_volume;
|
|||
class FlushVolCalculator
|
||||
{
|
||||
public:
|
||||
FlushVolCalculator(int min, int max, float multiplier = 1.0f);
|
||||
FlushVolCalculator(int min, int max, bool is_multi_extruder, NozzleVolumeType volume_type, float multiplier = 1.0f);
|
||||
~FlushVolCalculator()
|
||||
{
|
||||
}
|
||||
|
@ -23,14 +23,17 @@ public:
|
|||
int calc_flush_vol(unsigned char src_a, unsigned char src_r, unsigned char src_g, unsigned char src_b,
|
||||
unsigned char dst_a, unsigned char dst_r, unsigned char dst_g, unsigned char dst_b);
|
||||
|
||||
|
||||
int calc_flush_vol_rgb(unsigned char src_r,unsigned char src_g,unsigned char src_b,
|
||||
unsigned char dst_r, unsigned char dst_g, unsigned char dst_b);
|
||||
|
||||
bool get_flush_vol_from_data(unsigned char src_r, unsigned char src_g, unsigned char src_b,
|
||||
unsigned char dst_r, unsigned char dst_g, unsigned char dst_b, float& flush);
|
||||
|
||||
private:
|
||||
int m_min_flush_vol;
|
||||
int m_max_flush_vol;
|
||||
float m_multiplier;
|
||||
FlushPredict::FlushMachineType m_machine_type;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -167,6 +167,20 @@ namespace FlushPredict
|
|||
}
|
||||
|
||||
|
||||
class FlushVolPredictor
|
||||
{
|
||||
using RGB = FlushPredict::RGBColor;
|
||||
public:
|
||||
bool predict(const RGB& from,const RGB& to , float& flush);
|
||||
FlushVolPredictor(const std::string& data_file);
|
||||
FlushVolPredictor() = default;
|
||||
private:
|
||||
uint64_t generate_hash_key(const RGB& from, const RGB& to);
|
||||
std::unordered_map<uint64_t, float> m_flush_map;
|
||||
std::vector<RGB> m_colors;
|
||||
bool m_valid{ false };
|
||||
};
|
||||
|
||||
uint64_t FlushVolPredictor::generate_hash_key(const RGB& from, const RGB& to)
|
||||
{
|
||||
uint64_t key = 0;
|
||||
|
@ -284,9 +298,32 @@ bool FlushVolPredictor::predict(const RGB& from, const RGB& to, float& flush)
|
|||
return true;
|
||||
}
|
||||
|
||||
FlushVolPredictor& FlushVolPredictor::get_instance()
|
||||
|
||||
static std::unordered_map<FlushPredict::FlushMachineType, FlushVolPredictor> predictor_instances;
|
||||
|
||||
GenericFlushPredictor::GenericFlushPredictor(const MachineType& type)
|
||||
{
|
||||
static std::string prefix = Slic3r::resources_dir();
|
||||
static FlushVolPredictor instance(prefix + "/flush/flush_data.txt");
|
||||
return instance;
|
||||
auto iter = predictor_instances.find(type);
|
||||
if (iter != predictor_instances.end())
|
||||
predictor = &iter->second;
|
||||
else {
|
||||
std::string path = Slic3r::resources_dir();
|
||||
if (type == MachineType::DualHighFlow)
|
||||
path += "/flush/flush_data_dual_highflow.txt";
|
||||
else if (type == MachineType::DualStandard)
|
||||
path += "/flush/flush_data_dual_standard.txt";
|
||||
else
|
||||
path += "/flush/flush_data_standard.txt";
|
||||
predictor_instances[type] = FlushVolPredictor(path);
|
||||
|
||||
predictor = &predictor_instances[type];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool GenericFlushPredictor::predict(const RGB& from, const RGB& to, float& flush)
|
||||
{
|
||||
if (!predictor)
|
||||
return false;
|
||||
return predictor->predict(from, to, flush);
|
||||
}
|
||||
|
|
|
@ -8,6 +8,14 @@
|
|||
|
||||
namespace FlushPredict
|
||||
{
|
||||
enum FlushMachineType
|
||||
{
|
||||
Standard,
|
||||
DualStandard,
|
||||
DualHighFlow
|
||||
};
|
||||
|
||||
|
||||
struct RGBColor
|
||||
{
|
||||
unsigned char r{ 0 };
|
||||
|
@ -35,25 +43,17 @@ namespace FlushPredict
|
|||
|
||||
}
|
||||
|
||||
class FlushVolPredictor;
|
||||
|
||||
// Singleton pattern
|
||||
class FlushVolPredictor
|
||||
class GenericFlushPredictor
|
||||
{
|
||||
using RGB = FlushPredict::RGBColor;
|
||||
using MachineType = FlushPredict::FlushMachineType;
|
||||
public:
|
||||
bool predict(const RGB& from,const RGB& to , float& flush);
|
||||
static FlushVolPredictor& get_instance();
|
||||
explicit GenericFlushPredictor(const MachineType& type);
|
||||
bool predict(const RGB& from, const RGB& to, float& flush);
|
||||
private:
|
||||
FlushVolPredictor(const std::string& data_file);
|
||||
FlushVolPredictor(const FlushVolPredictor&) = delete;
|
||||
FlushVolPredictor& operator=(const FlushVolPredictor&) = delete;
|
||||
~FlushVolPredictor() = default;
|
||||
|
||||
uint64_t generate_hash_key(const RGB& from, const RGB& to);
|
||||
private:
|
||||
std::unordered_map<uint64_t, float> m_flush_map;
|
||||
std::vector<RGB> m_colors;
|
||||
bool m_valid;
|
||||
FlushVolPredictor* predictor{ nullptr };
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -3525,6 +3525,8 @@ void Sidebar::auto_calc_flushing_volumes_internal(const int modify_id, const int
|
|||
const auto& full_config = wxGetApp().preset_bundle->full_config();
|
||||
auto& ams_multi_color_filament = preset_bundle->ams_multi_color_filment;
|
||||
size_t extruder_nums = preset_bundle->get_printer_extruder_count();
|
||||
bool is_multi_extruder = extruder_nums > 1;
|
||||
NozzleVolumeType volume_type=NozzleVolumeType(full_config.option<ConfigOptionEnumsGeneric>("nozzle_volume_type")->values[extruder_id]);
|
||||
|
||||
std::vector<double> init_matrix = get_flush_volumes_matrix((project_config.option<ConfigOptionFloats>("flush_volumes_matrix"))->values, extruder_id, extruder_nums);
|
||||
|
||||
|
@ -3562,7 +3564,7 @@ void Sidebar::auto_calc_flushing_volumes_internal(const int modify_id, const int
|
|||
// from to modify
|
||||
int from_idx = i;
|
||||
if (from_idx != modify_id) {
|
||||
Slic3r::FlushVolCalculator calculator(min_flush_volumes[from_idx], m_max_flush_volume);
|
||||
Slic3r::FlushVolCalculator calculator(min_flush_volumes[from_idx], m_max_flush_volume, is_multi_extruder,volume_type);
|
||||
int flushing_volume = 0;
|
||||
bool is_from_support = is_support_filament(from_idx);
|
||||
bool is_to_support = is_support_filament(modify_id);
|
||||
|
@ -3587,7 +3589,7 @@ void Sidebar::auto_calc_flushing_volumes_internal(const int modify_id, const int
|
|||
// modify to to
|
||||
int to_idx = i;
|
||||
if (to_idx != modify_id) {
|
||||
Slic3r::FlushVolCalculator calculator(min_flush_volumes[modify_id], m_max_flush_volume);
|
||||
Slic3r::FlushVolCalculator calculator(min_flush_volumes[modify_id], m_max_flush_volume, is_multi_extruder, volume_type);
|
||||
bool is_from_support = is_support_filament(modify_id);
|
||||
bool is_to_support = is_support_filament(to_idx);
|
||||
int flushing_volume = 0;
|
||||
|
|
|
@ -55,7 +55,7 @@ wxString WipingDialog::BuildTableObjStr()
|
|||
}
|
||||
|
||||
for (int idx = 0; idx < nozzle_num; ++idx) {
|
||||
obj["min_flush_volumes"].push_back(*min_element(m_extra_flush_volume[idx].begin(), m_extra_flush_volume[idx].end()));
|
||||
obj["min_flush_volumes"].push_back(0);
|
||||
obj["max_flush_volumes"].push_back(m_max_flush_volume);
|
||||
}
|
||||
|
||||
|
@ -205,9 +205,9 @@ WipingDialog::WipingDialog(wxWindow* parent, const std::vector<std::vector<int>>
|
|||
}
|
||||
|
||||
|
||||
int WipingDialog::CalcFlushingVolume(const wxColour& from, const wxColour& to, int min_flush_volume)
|
||||
int WipingDialog::CalcFlushingVolume(const wxColour& from, const wxColour& to, int min_flush_volume ,bool is_multi_extruder, NozzleVolumeType volume_type)
|
||||
{
|
||||
Slic3r::FlushVolCalculator calculator(min_flush_volume, Slic3r::g_max_flush_volume);
|
||||
Slic3r::FlushVolCalculator calculator(min_flush_volume, Slic3r::g_max_flush_volume, is_multi_extruder, volume_type);
|
||||
return calculator.calc_flush_vol(from.Alpha(), from.Red(), from.Green(), from.Blue(), to.Alpha(), to.Red(), to.Green(), to.Blue());
|
||||
}
|
||||
|
||||
|
@ -223,6 +223,8 @@ WipingDialog::VolumeMatrix WipingDialog::CalcFlushingVolumes(int extruder_id)
|
|||
for (auto color_str : filament_color_strs)
|
||||
filament_colors.emplace_back(color_str);
|
||||
|
||||
NozzleVolumeType volume_type = NozzleVolumeType(full_config.option<ConfigOptionEnumsGeneric>("nozzle_volume_type")->values[extruder_id]);
|
||||
bool is_multi_extruder = preset_bundle->get_printer_extruder_count() > 1;
|
||||
// Support for multi-color filament
|
||||
for (int i = 0; i < filament_colors.size(); ++i) {
|
||||
std::vector<wxColour> single_filament;
|
||||
|
@ -262,7 +264,7 @@ WipingDialog::VolumeMatrix WipingDialog::CalcFlushingVolumes(int extruder_id)
|
|||
const wxColour& from = multi_colors[from_idx][i];
|
||||
for (int j = 0; j < multi_colors[to_idx].size(); ++j) {
|
||||
const wxColour& to = multi_colors[to_idx][j];
|
||||
int volume = CalcFlushingVolume(from, to, m_extra_flush_volume[extruder_id][from_idx]);
|
||||
int volume = CalcFlushingVolume(from, to, m_extra_flush_volume[extruder_id][from_idx], is_multi_extruder, volume_type);
|
||||
flushing_volume = std::max(flushing_volume, volume);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
#define _WIPE_TOWER_DIALOG_H_
|
||||
|
||||
#include <wx/webview.h>
|
||||
|
||||
#include "libslic3r/PrintConfig.hpp"
|
||||
|
||||
class WipingDialog : public wxDialog
|
||||
{
|
||||
|
@ -16,7 +16,7 @@ public:
|
|||
bool GetSubmitFlag() const { return m_submit_flag; }
|
||||
|
||||
private:
|
||||
int CalcFlushingVolume(const wxColour& from_, const wxColour& to_, int min_flush_volume);
|
||||
int CalcFlushingVolume(const wxColour& from_, const wxColour& to_, int min_flush_volume, bool is_multi_extruder, Slic3r::NozzleVolumeType volume_type);
|
||||
wxString BuildTableObjStr();
|
||||
wxString BuildTextObjStr();
|
||||
void StoreFlushData(int extruder_num, const std::vector<std::vector<double>>& flush_volume_vecs, const std::vector<double>& flush_multipliers);
|
||||
|
|
Loading…
Reference in New Issue