Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsupermerill <merill@free.fr>2022-07-24 19:01:35 +0300
committersupermerill <merill@free.fr>2022-08-10 22:00:39 +0300
commit4a55b3418d3e1424a93c7d70874a910349356abb (patch)
tree66ca3841cec43e5df2a13e04101498a249a6b063 /src/libslic3r
parentc5dbc6d342020c2e5dc2639ed324180f88f354cc (diff)
Fix extrusion hint when using default extrusion.
supermerill/SuperSlicer#2968
Diffstat (limited to 'src/libslic3r')
-rw-r--r--src/libslic3r/Config.cpp7
-rw-r--r--src/libslic3r/Flow.cpp60
-rw-r--r--src/libslic3r/Flow.hpp13
-rw-r--r--src/libslic3r/GCode/WipeTower.cpp17
-rw-r--r--src/libslic3r/GCode/WipeTower.hpp4
-rw-r--r--src/libslic3r/Print.cpp2
-rw-r--r--src/libslic3r/PrintConfig.cpp90
-rw-r--r--src/libslic3r/PrintConfig.hpp2
8 files changed, 143 insertions, 52 deletions
diff --git a/src/libslic3r/Config.cpp b/src/libslic3r/Config.cpp
index e2b13c9a7..c603e316a 100644
--- a/src/libslic3r/Config.cpp
+++ b/src/libslic3r/Config.cpp
@@ -838,8 +838,11 @@ double ConfigBase::get_abs_value(const t_config_option_key &opt_key, double rati
// Get stored option value.
const ConfigOption *raw_opt = this->option(opt_key);
assert(raw_opt != nullptr);
- if (raw_opt->type() != coFloatOrPercent)
- throw ConfigurationError("ConfigBase::get_abs_value(): opt_key is not of coFloatOrPercent");
+ if (raw_opt->type() != coFloatOrPercent) {
+ if(raw_opt->type() != coPercent)
+ throw ConfigurationError("ConfigBase::get_abs_value(): opt_key is not of coFloatOrPercent");
+ return static_cast<const ConfigOptionPercent*>(raw_opt)->get_abs_value(ratio_over);
+ }
// Compute absolute value.
return static_cast<const ConfigOptionFloatOrPercent*>(raw_opt)->get_abs_value(ratio_over);
}
diff --git a/src/libslic3r/Flow.cpp b/src/libslic3r/Flow.cpp
index a0323a52c..15b443481 100644
--- a/src/libslic3r/Flow.cpp
+++ b/src/libslic3r/Flow.cpp
@@ -148,20 +148,20 @@ const ConfigOptionFloatOrPercent* Flow::extrusion_option(const std::string& opt_
}
// external_perimeter_extrusion_width default is perimeter_extrusion_width
- if (opt->value == 0. && boost::starts_with(opt_key, "external_perimeter_extrusion_width")) {
- // The role specific extrusion width value was set to zero, try the role non-specific extrusion width.
- opt = config.option<ConfigOptionFloatOrPercent>("perimeter_extrusion_width");
- if (opt == nullptr)
- throw_on_missing_variable(opt_key, "perimeter_extrusion_width");
- }
+ //if (opt->value == 0. && boost::starts_with(opt_key, "external_perimeter_extrusion_width")) {
+ // // The role specific extrusion width value was set to zero, try the role non-specific extrusion width.
+ // opt = config.option<ConfigOptionFloatOrPercent>("perimeter_extrusion_width");
+ // if (opt == nullptr)
+ // throw_on_missing_variable(opt_key, "perimeter_extrusion_width");
+ //}
// top_infill_extrusion_width default is solid_infill_extrusion_width
- if (opt->value == 0. && boost::starts_with(opt_key, "top_infill_extrusion_width")) {
- // The role specific extrusion width value was set to zero, try the role non-specific extrusion width.
- opt = config.option<ConfigOptionFloatOrPercent>("solid_infill_extrusion_width");
- if (opt == nullptr)
- throw_on_missing_variable(opt_key, "perimeter_extrusion_width");
- }
+ //if (opt->value == 0. && boost::starts_with(opt_key, "top_infill_extrusion_width")) {
+ // // The role specific extrusion width value was set to zero, try the role non-specific extrusion width.
+ // opt = config.option<ConfigOptionFloatOrPercent>("solid_infill_extrusion_width");
+ // if (opt == nullptr)
+ // throw_on_missing_variable(opt_key, "solid_infill_extrusion_width");
+ //}
if (opt->value == 0.) {
// The role specific extrusion width value was set to zero, try the role non-specific extrusion width.
@@ -179,6 +179,42 @@ double Flow::extrusion_width(const std::string& opt_key, const ConfigOptionResol
return extrusion_width(opt_key, config.option<ConfigOptionFloatOrPercent>(opt_key), config, first_printing_extruder);
}
+Flow Flow::new_from_config(FlowRole role, const DynamicConfig& print_config, float nozzle_diameter, float layer_height, float filament_max_overlap, bool first_layer) {
+
+ ConfigOptionFloatOrPercent config_width;
+ // Get extrusion width from configuration.
+ float overlap = 1.f;
+ // (might be an absolute value, or a percent value, or zero for auto)
+ if (role == frExternalPerimeter) {
+ config_width = print_config.opt<ConfigOptionFloatOrPercent>("external_perimeter_extrusion_width");
+ overlap = (float)print_config.get_abs_value("external_perimeter_overlap", 1.);
+ } else if (role == frPerimeter) {
+ config_width = print_config.opt<ConfigOptionFloatOrPercent>("perimeter_extrusion_width");
+ overlap = (float)print_config.get_abs_value("perimeter_overlap", 1.);
+ } else if (role == frInfill) {
+ config_width = print_config.opt<ConfigOptionFloatOrPercent>("infill_extrusion_width");
+ } else if (role == frSolidInfill) {
+ config_width = print_config.opt<ConfigOptionFloatOrPercent>("solid_infill_extrusion_width");
+ overlap = (float)print_config.get_abs_value("solid_infill_overlap", 1.);
+ } else if (role == frTopSolidInfill) {
+ config_width = print_config.opt<ConfigOptionFloatOrPercent>("top_infill_extrusion_width");
+ overlap = (float)print_config.get_abs_value("solid_infill_overlap", 1.);
+ } else {
+ throw Slic3r::InvalidArgument("Unknown role");
+ }
+ if (first_layer && print_config.get_abs_value("first_layer_extrusion_width", 1) > 0) {
+ config_width = print_config.opt<ConfigOptionFloatOrPercent>("first_layer_extrusion_width");
+ }
+
+ if (config_width.value == 0)
+ config_width = print_config.opt<ConfigOptionFloatOrPercent>("extrusion_width");
+
+ // Get the configured nozzle_diameter for the extruder associated to the flow role requested.
+ // Here this->extruder(role) - 1 may underflow to MAX_INT, but then the get_at() will follback to zero'th element, so everything is all right.
+ return Flow::new_from_config_width(role, config_width, nozzle_diameter, layer_height, std::min(overlap, filament_max_overlap));
+ //bridge ? (float)m_config.bridge_flow_ratio.get_abs_value(1) : 0.0f);
+}
+
// This constructor builds a Flow object from an extrusion width config setting
// and other context properties.
Flow Flow::new_from_config_width(FlowRole role, const ConfigOptionFloatOrPercent &width, float nozzle_diameter, float height, float spacing_ratio, float bridge_flow_ratio)
diff --git a/src/libslic3r/Flow.hpp b/src/libslic3r/Flow.hpp
index 4be0ea8a0..d0d5448cd 100644
--- a/src/libslic3r/Flow.hpp
+++ b/src/libslic3r/Flow.hpp
@@ -108,10 +108,6 @@ public:
Flow with_cross_section(float area) const;
Flow with_flow_ratio(double ratio) const { return this->with_cross_section(this->mm3_per_mm() * ratio); }
- static Flow bridging_flow(float dmr, float nozzle_diameter) { return Flow { dmr, dmr, bridge_extrusion_spacing(dmr), nozzle_diameter, 0, true }; }
-
- static Flow new_from_config_width(FlowRole role, const ConfigOptionFloatOrPercent& width, float nozzle_diameter, float height, float spacing_ratio);
-
// Spacing of extrusions with rounded extrusion model.
static float rounded_rectangle_extrusion_spacing(float width, float height);
// Width of extrusions with rounded extrusion model.
@@ -119,7 +115,7 @@ public:
// Spacing of round thread extrusions.
static float bridge_extrusion_spacing(float dmr);
- // Sane extrusion width defautl based on nozzle diameter.
+ // Sane extrusion width default based on nozzle diameter.
// The defaults were derived from manual Prusa MK3 profiles.
static float auto_extrusion_width(FlowRole role, float nozzle_diameter);
@@ -130,8 +126,13 @@ public:
static double extrusion_width(const std::string &opt_key, const ConfigOptionResolver &config, const unsigned int first_printing_extruder = 0);
static const ConfigOptionFloatOrPercent* extrusion_option(const std::string& opt_key, const ConfigOptionResolver& config);
+ // like PrintRegion::flow() but with print settings from a DynamicConfig
+ static Flow new_from_config(FlowRole role, const DynamicConfig& print_config, float nozzle_diameter, float layer_height, float filament_max_overlap, bool first_layer);
-/// old constructors
+ //low level constructor
+ static Flow new_from_config_width(FlowRole role, const ConfigOptionFloatOrPercent& width, float nozzle_diameter, float height, float spacing_ratio);
+ static Flow bridging_flow(float dmr, float nozzle_diameter) { return Flow{ dmr, dmr, bridge_extrusion_spacing(dmr), nozzle_diameter, 0, true }; }
+/// old constructors don't use them. They are used by the good constructors from PrintRegion or the default_flow().
static Flow new_from_config_width(FlowRole role, const ConfigOptionFloatOrPercent& width, float nozzle_diameter, float height, float spacing_ratio, float bridge_flow_ratio);
// Create a flow from the spacing of extrusion lines.
// This method is used exclusively to calculate new flow of 100% infill, where the extrusion width was allowed to scale
diff --git a/src/libslic3r/GCode/WipeTower.cpp b/src/libslic3r/GCode/WipeTower.cpp
index 3f9fa3791..815b419e8 100644
--- a/src/libslic3r/GCode/WipeTower.cpp
+++ b/src/libslic3r/GCode/WipeTower.cpp
@@ -615,9 +615,10 @@ WipeTower::ToolChangeResult WipeTower::construct_tcr(WipeTowerWriter& writer,
-WipeTower::WipeTower(const PrintConfig& config, const PrintObjectConfig& object_config, const std::vector<std::vector<float>>& wiping_matrix, size_t initial_tool) :
+WipeTower::WipeTower(const PrintConfig& config, const PrintObjectConfig& default_object_config, const PrintRegionConfig& default_region_config, const std::vector<std::vector<float>>& wiping_matrix, size_t initial_tool) :
m_config(&config),
- m_object_config(&object_config),
+ m_object_config(&default_object_config),
+ m_region_config(&default_region_config),
m_semm(config.single_extruder_multi_material.value),
m_wipe_tower_pos(config.wipe_tower_x, config.wipe_tower_y),
m_wipe_tower_width(float(config.wipe_tower_width)),
@@ -1396,7 +1397,17 @@ WipeTower::ToolChangeResult WipeTower::finish_layer()
// brim (first layer only)
if (first_layer) {
box_coordinates box = wt_box;
- const Slic3r::Flow brim_flow = Flow::new_from_config_width(FlowRole::frPerimeter, m_object_config->first_layer_extrusion_width, m_nozzle_diameter, m_layer_height, 1,0); //don't care of spacing and bridge
+ //same as print::brimflow()
+ PrintRegionConfig brim_region_config = *m_region_config;
+ brim_region_config.parent = m_object_config;
+ const Slic3r::Flow brim_flow =
+ Flow::new_from_config_width(
+ frPerimeter,
+ *Flow::extrusion_option("brim_extrusion_width", brim_region_config),
+ (float)m_nozzle_diameter,
+ (float)m_layer_height,
+ (m_current_tool < m_config->nozzle_diameter.values.size()) ? m_object_config->get_computed_value("filament_max_overlap", m_current_tool) : 1
+ );
const coordf_t spacing = brim_flow.spacing();
// How many perimeters shall the brim have?
size_t loops_num = (m_wipe_tower_brim_width + spacing / 2) / spacing;
diff --git a/src/libslic3r/GCode/WipeTower.hpp b/src/libslic3r/GCode/WipeTower.hpp
index 7230a6590..632fce037 100644
--- a/src/libslic3r/GCode/WipeTower.hpp
+++ b/src/libslic3r/GCode/WipeTower.hpp
@@ -15,6 +15,7 @@ namespace Slic3r
class WipeTowerWriter;
class PrintConfig;
class PrintObjectConfig;
+class PrintRegionConfig;
enum GCodeFlavor : unsigned char;
@@ -126,7 +127,7 @@ public:
// y -- y coordinates of wipe tower in mm ( left bottom corner )
// width -- width of wipe tower in mm ( default 60 mm - leave as it is )
// wipe_area -- space available for one toolchange in mm
- WipeTower(const PrintConfig& config, const PrintObjectConfig& object_config, const std::vector<std::vector<float>>& wiping_matrix, size_t initial_tool);
+ WipeTower(const PrintConfig& config, const PrintObjectConfig& default_object_config, const PrintRegionConfig& default_region_config, const std::vector<std::vector<float>>& wiping_matrix, size_t initial_tool);
// Set the extruder properties.
void set_extruder(size_t idx);
@@ -263,6 +264,7 @@ private:
const PrintConfig* m_config;
const PrintObjectConfig* m_object_config;
+ const PrintRegionConfig* m_region_config;
bool m_semm = true; // Are we using a single extruder multimaterial printer?
Vec2f m_wipe_tower_pos; // Left front corner of the wipe tower in mm.
float m_wipe_tower_width; // Width of the wipe tower.
diff --git a/src/libslic3r/Print.cpp b/src/libslic3r/Print.cpp
index 333b33d01..b2f4ed9bf 100644
--- a/src/libslic3r/Print.cpp
+++ b/src/libslic3r/Print.cpp
@@ -1533,7 +1533,7 @@ void Print::_make_wipe_tower()
this->throw_if_canceled();
// Initialize the wipe tower.
- WipeTower wipe_tower(m_config, m_default_object_config, wipe_volumes, m_wipe_tower_data.tool_ordering.first_extruder());
+ WipeTower wipe_tower(m_config, m_default_object_config, m_default_region_config, wipe_volumes, m_wipe_tower_data.tool_ordering.first_extruder());
//wipe_tower.set_retract();
diff --git a/src/libslic3r/PrintConfig.cpp b/src/libslic3r/PrintConfig.cpp
index 041508e65..f463b002a 100644
--- a/src/libslic3r/PrintConfig.cpp
+++ b/src/libslic3r/PrintConfig.cpp
@@ -7739,11 +7739,11 @@ const TYPE* find_option(const t_config_option_key &opt_key, DynamicPrintConfig*
return nullptr;
}
-std::set<const DynamicPrintConfig*> DynamicPrintConfig::update_phony(const std::vector<DynamicPrintConfig*> config_collection) {
+std::set<const DynamicPrintConfig*> DynamicPrintConfig::update_phony(const std::vector<DynamicPrintConfig*> config_collection, bool exclude_default_extrusion /*= false*/) {
std::set<const DynamicPrintConfig*> something_changed;
//update width/spacing links
const char* widths[] = { "", "external_perimeter_", "perimeter_", "infill_", "solid_infill_", "top_infill_", "support_material_", "first_layer_", "skirt_" };
- for (size_t i = 0; i < sizeof(widths) / sizeof(widths[i]); ++i) {
+ for (size_t i = exclude_default_extrusion?1:0; i < sizeof(widths) / sizeof(widths[i]); ++i) {
std::string key_width(widths[i]);
key_width += "extrusion_width";
std::string key_spacing(widths[i]);
@@ -7950,9 +7950,13 @@ std::set<const DynamicPrintConfig*> DynamicPrintConfig::value_changed(const t_co
if (width_option) {
width_option->set_phony(false);
spacing_option->set_phony(true);
- Flow flow = Flow::new_from_config_width(FlowRole::frPerimeter, width_option->value == 0 ? *default_width_option : *width_option, max_nozzle_diameter, layer_height_option->value, overlap_ratio, 0);
- if (flow.width() < flow.height()) flow.with_height(flow.width());
- spacing_option->value = (width_option->percent) ? std::round(100 * flow.spacing() / max_nozzle_diameter) : (std::round(flow.spacing() * 10000) / 10000);
+ if (width_option->value == 0)
+ spacing_option->value = 0;
+ else {
+ Flow flow = Flow::new_from_config_width(FlowRole::frPerimeter, width_option->value == 0 ? *default_width_option : *width_option, max_nozzle_diameter, layer_height_option->value, overlap_ratio, 0);
+ if (flow.width() < flow.height()) flow.with_height(flow.width());
+ spacing_option->value = (width_option->percent) ? std::round(100 * flow.spacing() / max_nozzle_diameter) : (std::round(flow.spacing() * 10000) / 10000);
+ }
spacing_option->percent = width_option->percent;
something_changed = true;
}
@@ -7962,9 +7966,13 @@ std::set<const DynamicPrintConfig*> DynamicPrintConfig::value_changed(const t_co
if (width_option) {
width_option->set_phony(false);
spacing_option->set_phony(true);
- Flow flow = Flow::new_from_config_width(FlowRole::frPerimeter, width_option->value == 0 ? *default_width_option : *width_option, max_nozzle_diameter, layer_height_option->value, overlap_ratio, 0);
- if (flow.width() < flow.height()) flow.with_height(flow.width());
- spacing_option->value = (width_option->percent) ? std::round(100 * flow.spacing() / max_nozzle_diameter) : (std::round(flow.spacing() * 10000) / 10000);
+ if (width_option->value == 0)
+ spacing_option->value = 0;
+ else {
+ Flow flow = Flow::new_from_config_width(FlowRole::frPerimeter, width_option->value == 0 ? *default_width_option : *width_option, max_nozzle_diameter, layer_height_option->value, overlap_ratio, 0);
+ if (flow.width() < flow.height()) flow.with_height(flow.width());
+ spacing_option->value = (width_option->percent) ? std::round(100 * flow.spacing() / max_nozzle_diameter) : (std::round(flow.spacing() * 10000) / 10000);
+ }
spacing_option->percent = width_option->percent;
something_changed = true;
}
@@ -7975,10 +7983,14 @@ std::set<const DynamicPrintConfig*> DynamicPrintConfig::value_changed(const t_co
if (width_option && perimeter_overlap_option) {
width_option->set_phony(false);
spacing_option->set_phony(true);
- Flow flow = Flow::new_from_config_width(FlowRole::frExternalPerimeter, width_option->value == 0 ? *default_width_option : *width_option , max_nozzle_diameter, layer_height_option->value, overlap_ratio, 0);
- if (flow.width() < flow.height()) flow = flow.with_height(flow.width());
- flow = flow.with_spacing_ratio(std::min(flow.spacing_ratio(), (float)perimeter_overlap_option->get_abs_value(1)));
- spacing_option->value = (width_option->percent) ? std::round(100 * flow.spacing() / max_nozzle_diameter) : (std::round(flow.spacing() * 10000) / 10000);
+ if (width_option->value == 0)
+ spacing_option->value = 0;
+ else {
+ Flow flow = Flow::new_from_config_width(FlowRole::frExternalPerimeter, width_option->value == 0 ? *default_width_option : *width_option , max_nozzle_diameter, layer_height_option->value, overlap_ratio, 0);
+ if (flow.width() < flow.height()) flow = flow.with_height(flow.width());
+ flow = flow.with_spacing_ratio(std::min(flow.spacing_ratio(), (float)perimeter_overlap_option->get_abs_value(1)));
+ spacing_option->value = (width_option->percent) ? std::round(100 * flow.spacing() / max_nozzle_diameter) : (std::round(flow.spacing() * 10000) / 10000);
+ }
spacing_option->percent = width_option->percent;
something_changed = true;
}
@@ -7989,10 +8001,14 @@ std::set<const DynamicPrintConfig*> DynamicPrintConfig::value_changed(const t_co
if (width_option && external_perimeter_overlap_option) {
width_option->set_phony(false);
spacing_option->set_phony(true);
- Flow ext_perimeter_flow = Flow::new_from_config_width(FlowRole::frPerimeter, width_option->value == 0 ? *default_width_option : *width_option, max_nozzle_diameter, layer_height_option->value, overlap_ratio, 0);
- if (ext_perimeter_flow.width() < ext_perimeter_flow.height()) ext_perimeter_flow = ext_perimeter_flow.with_height(ext_perimeter_flow.width());
- ext_perimeter_flow = ext_perimeter_flow.with_spacing_ratio(std::min(ext_perimeter_flow.spacing_ratio() * 0.5f, float(external_perimeter_overlap_option->get_abs_value(0.5))));
- spacing_option->value = (width_option->percent) ? std::round(100 * ext_perimeter_flow.spacing() / max_nozzle_diameter) : (std::round(ext_perimeter_flow.spacing() * 10000) / 10000);
+ if (width_option->value == 0)
+ spacing_option->value = 0;
+ else {
+ Flow ext_perimeter_flow = Flow::new_from_config_width(FlowRole::frPerimeter, width_option->value == 0 ? *default_width_option : *width_option, max_nozzle_diameter, layer_height_option->value, overlap_ratio, 0);
+ if (ext_perimeter_flow.width() < ext_perimeter_flow.height()) ext_perimeter_flow = ext_perimeter_flow.with_height(ext_perimeter_flow.width());
+ ext_perimeter_flow = ext_perimeter_flow.with_spacing_ratio(std::min(ext_perimeter_flow.spacing_ratio() * 0.5f, float(external_perimeter_overlap_option->get_abs_value(0.5))));
+ spacing_option->value = (width_option->percent) ? std::round(100 * ext_perimeter_flow.spacing() / max_nozzle_diameter) : (std::round(ext_perimeter_flow.spacing() * 10000) / 10000);
+ }
spacing_option->percent = width_option->percent;
something_changed = true;
}
@@ -8002,9 +8018,13 @@ std::set<const DynamicPrintConfig*> DynamicPrintConfig::value_changed(const t_co
if (width_option) {
width_option->set_phony(false);
spacing_option->set_phony(true);
- Flow flow = Flow::new_from_config_width(FlowRole::frInfill, width_option->value == 0 ? *default_width_option : *width_option, max_nozzle_diameter, layer_height_option->value, overlap_ratio, 0);
- if (flow.width() < flow.height()) flow = flow.with_height(flow.width());
- spacing_option->value = (width_option->percent) ? std::round(100 * flow.spacing() / max_nozzle_diameter) : (std::round(flow.spacing() * 10000) / 10000);
+ if (width_option->value == 0)
+ spacing_option->value = 0;
+ else {
+ Flow flow = Flow::new_from_config_width(FlowRole::frInfill, width_option->value == 0 ? *default_width_option : *width_option, max_nozzle_diameter, layer_height_option->value, overlap_ratio, 0);
+ if (flow.width() < flow.height()) flow = flow.with_height(flow.width());
+ spacing_option->value = (width_option->percent) ? std::round(100 * flow.spacing() / max_nozzle_diameter) : (std::round(flow.spacing() * 10000) / 10000);
+ }
spacing_option->percent = width_option->percent;
something_changed = true;
}
@@ -8015,10 +8035,14 @@ std::set<const DynamicPrintConfig*> DynamicPrintConfig::value_changed(const t_co
if (width_option) {
width_option->set_phony(false);
spacing_option->set_phony(true);
- Flow flow = Flow::new_from_config_width(FlowRole::frSolidInfill, width_option->value == 0 ? *default_width_option : *width_option, max_nozzle_diameter, layer_height_option->value, overlap_ratio, 0);
- if (flow.width() < flow.height()) flow = flow.with_height(flow.width());
- flow = flow.with_spacing_ratio(std::min(flow.spacing_ratio(), float(solid_infill_overlap_option->get_abs_value(1.))));
- spacing_option->value = (width_option->percent) ? std::round(100 * flow.spacing() / max_nozzle_diameter) : (std::round(flow.spacing() * 10000) / 10000);
+ if (width_option->value == 0)
+ spacing_option->value = 0;
+ else {
+ Flow flow = Flow::new_from_config_width(FlowRole::frSolidInfill, width_option->value == 0 ? *default_width_option : *width_option, max_nozzle_diameter, layer_height_option->value, overlap_ratio, 0);
+ if (flow.width() < flow.height()) flow = flow.with_height(flow.width());
+ flow = flow.with_spacing_ratio(std::min(flow.spacing_ratio(), float(solid_infill_overlap_option->get_abs_value(1.))));
+ spacing_option->value = (width_option->percent) ? std::round(100 * flow.spacing() / max_nozzle_diameter) : (std::round(flow.spacing() * 10000) / 10000);
+ }
spacing_option->percent = width_option->percent;
something_changed = true;
}
@@ -8028,9 +8052,13 @@ std::set<const DynamicPrintConfig*> DynamicPrintConfig::value_changed(const t_co
if (width_option) {
width_option->set_phony(false);
spacing_option->set_phony(true);
- Flow flow = Flow::new_from_config_width(FlowRole::frTopSolidInfill, width_option->value == 0 ? *default_width_option : *width_option, max_nozzle_diameter, layer_height_option->value, overlap_ratio, 0);
- if (flow.width() < flow.height()) flow = flow.with_height(flow.width());
- spacing_option->value = (width_option->percent) ? std::round(100 * flow.spacing() / max_nozzle_diameter) : (std::round(flow.spacing() * 10000) / 10000);
+ if (width_option->value == 0)
+ spacing_option->value = 0;
+ else {
+ Flow flow = Flow::new_from_config_width(FlowRole::frTopSolidInfill, width_option->value == 0 ? *default_width_option : *width_option, max_nozzle_diameter, layer_height_option->value, overlap_ratio, 0);
+ if (flow.width() < flow.height()) flow = flow.with_height(flow.width());
+ spacing_option->value = (width_option->percent) ? std::round(100 * flow.spacing() / max_nozzle_diameter) : (std::round(flow.spacing() * 10000) / 10000);
+ }
spacing_option->percent = width_option->percent;
something_changed = true;
}
@@ -8074,6 +8102,16 @@ std::set<const DynamicPrintConfig*> DynamicPrintConfig::value_changed(const t_co
}
}
}
+ //update phony counterpark of 0-set fields
+ // now they show 0, no need to update them
+ //if (opt_key == "extrusion_width" || opt_key == "extrusion_spacing") {
+ // for (auto conf : config_collection) {
+ // if (conf->option("extrusion_width"))
+ // if (!conf->update_phony(config_collection, true).empty())
+ // return { conf };
+ // }
+ // return {};
+ //}
if(something_changed)
return { this };
return {};
diff --git a/src/libslic3r/PrintConfig.hpp b/src/libslic3r/PrintConfig.hpp
index 568c00181..e233d309d 100644
--- a/src/libslic3r/PrintConfig.hpp
+++ b/src/libslic3r/PrintConfig.hpp
@@ -392,7 +392,7 @@ public:
/// <param name="opt_key">name of the changed option</param>
/// <return> configs that have at least a change</param>
std::set<const DynamicPrintConfig*> value_changed(const t_config_option_key& opt_key, const std::vector<DynamicPrintConfig*> config_collection);
- std::set<const DynamicPrintConfig*> update_phony(const std::vector<DynamicPrintConfig*> config_collection);
+ std::set<const DynamicPrintConfig*> update_phony(const std::vector<DynamicPrintConfig*> config_collection, bool exclude_default_extrusion = false);
};
void handle_legacy_sla(DynamicPrintConfig& config);