Initial definition of PresetHints C++ class and Perl binding, ported the cooling logic hints to C++.
Removed Perl Flow::new_from_spacing bindings. Some Fill C++11 beautification. Fix of a support_material_1st_layer_flow, brim_flow and skirt_flow logic to use the extrusion_width if both first_layer_extrusion_width and support_material_extrusion_width are undefined. Documented the extrusion width logic in the config tooltips, including the default values.
This commit is contained in:
parent
5fb54ed1f3
commit
9a0100d6de
@ -26,6 +26,7 @@ include_directories(${LIBDIR}/libslic3r)
|
||||
if(WIN32)
|
||||
# BOOST_ALL_NO_LIB: Avoid the automatic linking of Boost libraries on Windows. Rather rely on explicit linking.
|
||||
add_definitions(-D_USE_MATH_DEFINES -D_WIN32 -DBOOST_ALL_NO_LIB)
|
||||
# -D_ITERATOR_DEBUG_LEVEL)
|
||||
endif()
|
||||
|
||||
add_definitions(-DwxUSE_UNICODE -D_UNICODE -DUNICODE)
|
||||
@ -172,6 +173,8 @@ add_library(libslic3r_gui STATIC
|
||||
${LIBDIR}/slic3r/GUI/Preset.hpp
|
||||
${LIBDIR}/slic3r/GUI/PresetBundle.cpp
|
||||
${LIBDIR}/slic3r/GUI/PresetBundle.hpp
|
||||
${LIBDIR}/slic3r/GUI/PresetHints.cpp
|
||||
${LIBDIR}/slic3r/GUI/PresetHints.hpp
|
||||
${LIBDIR}/slic3r/GUI/GUI.cpp
|
||||
${LIBDIR}/slic3r/GUI/GUI.hpp
|
||||
)
|
||||
|
@ -179,14 +179,6 @@ sub new_from_width {
|
||||
);
|
||||
}
|
||||
|
||||
sub new_from_spacing {
|
||||
my ($class, %args) = @_;
|
||||
|
||||
return $class->_new_from_spacing(
|
||||
@args{qw(spacing nozzle_diameter layer_height bridge)},
|
||||
);
|
||||
}
|
||||
|
||||
package Slic3r::Surface;
|
||||
|
||||
sub new {
|
||||
|
@ -149,8 +149,7 @@ void make_fill(LayerRegion &layerm, ExtrusionEntityCollection &out)
|
||||
// );
|
||||
}
|
||||
|
||||
for (Surfaces::const_iterator surface_it = surfaces.begin(); surface_it != surfaces.end(); ++ surface_it) {
|
||||
const Surface &surface = *surface_it;
|
||||
for (const Surface &surface : surfaces) {
|
||||
if (surface.surface_type == stInternalVoid)
|
||||
continue;
|
||||
InfillPattern fill_pattern = layerm.region()->config.fill_pattern.value;
|
||||
@ -262,10 +261,10 @@ void make_fill(LayerRegion &layerm, ExtrusionEntityCollection &out)
|
||||
// Unpacks the collection, creates multiple collections per path.
|
||||
// The path type could be ExtrusionPath, ExtrusionLoop or ExtrusionEntityCollection.
|
||||
// Why the paths are unpacked?
|
||||
for (ExtrusionEntitiesPtr::iterator thin_fill = layerm.thin_fills.entities.begin(); thin_fill != layerm.thin_fills.entities.end(); ++ thin_fill) {
|
||||
for (const ExtrusionEntity *thin_fill : layerm.thin_fills.entities) {
|
||||
ExtrusionEntityCollection &collection = *(new ExtrusionEntityCollection());
|
||||
out.entities.push_back(&collection);
|
||||
collection.entities.push_back((*thin_fill)->clone());
|
||||
collection.entities.push_back(thin_fill->clone());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -154,10 +154,11 @@ Flow support_material_flow(const PrintObject *object, float layer_height)
|
||||
|
||||
Flow support_material_1st_layer_flow(const PrintObject *object, float layer_height)
|
||||
{
|
||||
const auto &width = (object->print()->config.first_layer_extrusion_width.value > 0) ? object->print()->config.first_layer_extrusion_width : object->config.support_material_extrusion_width;
|
||||
return Flow::new_from_config_width(
|
||||
frSupportMaterial,
|
||||
// The width parameter accepted by new_from_config_width is of type ConfigOptionFloatOrPercent, the Flow class takes care of the percent to value substitution.
|
||||
(object->print()->config.first_layer_extrusion_width.value > 0) ? object->print()->config.first_layer_extrusion_width : object->config.support_material_extrusion_width,
|
||||
(width.value > 0) ? width : object->config.extrusion_width,
|
||||
float(object->print()->config.nozzle_diameter.get_at(object->config.support_material_extruder-1)),
|
||||
(layer_height > 0.f) ? layer_height : float(object->config.first_layer_height.get_abs_value(object->config.layer_height.value)),
|
||||
false);
|
||||
|
@ -52,6 +52,9 @@ public:
|
||||
coord_t scaled_spacing(const Flow &other) const { return coord_t(scale_(this->spacing(other))); };
|
||||
|
||||
static Flow new_from_config_width(FlowRole role, const ConfigOptionFloatOrPercent &width, float nozzle_diameter, float height, 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
|
||||
// to fit a region with integer number of lines.
|
||||
static Flow new_from_spacing(float spacing, float nozzle_diameter, float height, bool bridge);
|
||||
};
|
||||
|
||||
|
@ -707,7 +707,10 @@ double Print::skirt_first_layer_height() const
|
||||
Flow Print::brim_flow() const
|
||||
{
|
||||
ConfigOptionFloatOrPercent width = this->config.first_layer_extrusion_width;
|
||||
if (width.value == 0) width = this->regions.front()->config.perimeter_extrusion_width;
|
||||
if (width.value == 0)
|
||||
width = this->regions.front()->config.perimeter_extrusion_width;
|
||||
if (width.value == 0)
|
||||
width = this->objects.front()->config.extrusion_width;
|
||||
|
||||
/* We currently use a random region's perimeter extruder.
|
||||
While this works for most cases, we should probably consider all of the perimeter
|
||||
@ -726,7 +729,10 @@ Flow Print::brim_flow() const
|
||||
Flow Print::skirt_flow() const
|
||||
{
|
||||
ConfigOptionFloatOrPercent width = this->config.first_layer_extrusion_width;
|
||||
if (width.value == 0) width = this->regions.front()->config.perimeter_extrusion_width;
|
||||
if (width.value == 0)
|
||||
width = this->regions.front()->config.perimeter_extrusion_width;
|
||||
if (width.value == 0)
|
||||
width = this->objects.front()->config.extrusion_width;
|
||||
|
||||
/* We currently use a random object's support material extruder.
|
||||
While this works for most cases, we should probably consider all of the support material
|
||||
|
@ -243,9 +243,8 @@ PrintConfigDef::PrintConfigDef()
|
||||
def->label = "External perimeters";
|
||||
def->category = "Extrusion Width";
|
||||
def->tooltip = "Set this to a non-zero value to set a manual extrusion width for external perimeters. "
|
||||
"If left zero, an automatic value will be used that maximizes accuracy "
|
||||
"of the external visible surfaces. If expressed as percentage (for example 200%) "
|
||||
"it will be computed over layer height.";
|
||||
"If left zero, default extrusion width will be used if set, otherwise 1.125 x nozzle diameter will be used. "
|
||||
"If expressed as percentage (for example 200%), it will be computed over layer height.";
|
||||
def->sidetext = "mm or % (leave 0 for default)";
|
||||
def->cli = "external-perimeter-extrusion-width=s";
|
||||
def->default_value = new ConfigOptionFloatOrPercent(0, false);
|
||||
@ -352,9 +351,10 @@ PrintConfigDef::PrintConfigDef()
|
||||
def = this->add("extrusion_width", coFloatOrPercent);
|
||||
def->label = "Default extrusion width";
|
||||
def->category = "Extrusion Width";
|
||||
def->tooltip = "Set this to a non-zero value to set a manual extrusion width. If left to zero, "
|
||||
"Slic3r calculates a width automatically. If expressed as percentage (for example: 230%) "
|
||||
"it will be computed over layer height.";
|
||||
def->tooltip = "Set this to a non-zero value to allow a manual extrusion width. "
|
||||
"If left to zero, Slic3r derives extrusion widths from the nozzle diameter "
|
||||
"(see the tooltips for perimeter extrusion width, infill extrusion width etc). "
|
||||
"If expressed as percentage (for example: 230%), it will be computed over layer height.";
|
||||
def->sidetext = "mm or % (leave 0 for auto)";
|
||||
def->cli = "extrusion-width=s";
|
||||
def->default_value = new ConfigOptionFloatOrPercent(0, false);
|
||||
@ -567,7 +567,7 @@ PrintConfigDef::PrintConfigDef()
|
||||
def->tooltip = "Set this to a non-zero value to set a manual extrusion width for first layer. "
|
||||
"You can use this to force fatter extrudates for better adhesion. If expressed "
|
||||
"as percentage (for example 120%) it will be computed over first layer height. "
|
||||
"If set to zero, it will use the Default Extrusion Width.";
|
||||
"If set to zero, it will use the default extrusion width.";
|
||||
def->sidetext = "mm or % (leave 0 for default)";
|
||||
def->cli = "first-layer-extrusion-width=s";
|
||||
def->ratio_over = "first_layer_height";
|
||||
@ -681,6 +681,7 @@ PrintConfigDef::PrintConfigDef()
|
||||
def->label = "Infill";
|
||||
def->category = "Extrusion Width";
|
||||
def->tooltip = "Set this to a non-zero value to set a manual extrusion width for infill. "
|
||||
"If left zero, default extrusion width will be used if set, otherwise 1.125 x nozzle diameter will be used. "
|
||||
"You may want to use fatter extrudates to speed up the infill and make your parts stronger. "
|
||||
"If expressed as percentage (for example 90%) it will be computed over layer height.";
|
||||
def->sidetext = "mm or % (leave 0 for default)";
|
||||
@ -938,6 +939,7 @@ PrintConfigDef::PrintConfigDef()
|
||||
def->category = "Extrusion Width";
|
||||
def->tooltip = "Set this to a non-zero value to set a manual extrusion width for perimeters. "
|
||||
"You may want to use thinner extrudates to get more accurate surfaces. "
|
||||
"If left zero, default extrusion width will be used if set, otherwise 1.125 x nozzle diameter will be used. "
|
||||
"If expressed as percentage (for example 200%) it will be computed over layer height.";
|
||||
def->sidetext = "mm or % (leave 0 for default)";
|
||||
def->cli = "perimeter-extrusion-width=s";
|
||||
@ -1259,9 +1261,9 @@ PrintConfigDef::PrintConfigDef()
|
||||
def = this->add("solid_infill_extrusion_width", coFloatOrPercent);
|
||||
def->label = "Solid infill";
|
||||
def->category = "Extrusion Width";
|
||||
def->tooltip = "Set this to a non-zero value to set a manual extrusion width for infill "
|
||||
"for solid surfaces. If expressed as percentage (for example 90%) it will be computed "
|
||||
"over layer height.";
|
||||
def->tooltip = "Set this to a non-zero value to set a manual extrusion width for infill for solid surfaces. "
|
||||
"If left zero, default extrusion width will be used if set, otherwise 1.125 x nozzle diameter will be used. "
|
||||
"If expressed as percentage (for example 90%) it will be computed over layer height.";
|
||||
def->sidetext = "mm or % (leave 0 for default)";
|
||||
def->cli = "solid-infill-extrusion-width=s";
|
||||
def->default_value = new ConfigOptionFloatOrPercent(0, false);
|
||||
@ -1422,6 +1424,7 @@ PrintConfigDef::PrintConfigDef()
|
||||
def->label = "Support material";
|
||||
def->category = "Extrusion Width";
|
||||
def->tooltip = "Set this to a non-zero value to set a manual extrusion width for support material. "
|
||||
"If left zero, default extrusion width will be used if set, otherwise nozzle diameter will be used. "
|
||||
"If expressed as percentage (for example 90%) it will be computed over layer height.";
|
||||
def->sidetext = "mm or % (leave 0 for default)";
|
||||
def->cli = "support-material-extrusion-width=s";
|
||||
@ -1580,10 +1583,10 @@ PrintConfigDef::PrintConfigDef()
|
||||
def = this->add("top_infill_extrusion_width", coFloatOrPercent);
|
||||
def->label = "Top solid infill";
|
||||
def->category = "Extrusion Width";
|
||||
def->tooltip = "Set this to a non-zero value to set a manual extrusion width "
|
||||
"for infill for top surfaces. You may want to use thinner extrudates "
|
||||
"to fill all narrow regions and get a smoother finish. If expressed "
|
||||
"as percentage (for example 90%) it will be computed over layer height.";
|
||||
def->tooltip = "Set this to a non-zero value to set a manual extrusion width for infill for top surfaces. "
|
||||
"You may want to use thinner extrudates to fill all narrow regions and get a smoother finish. "
|
||||
"If left zero, default extrusion width will be used if set, otherwise nozzle diameter will be used. "
|
||||
"If expressed as percentage (for example 90%) it will be computed over layer height.";
|
||||
def->sidetext = "mm or % (leave 0 for default)";
|
||||
def->cli = "top-infill-extrusion-width=s";
|
||||
def->default_value = new ConfigOptionFloatOrPercent(0, false);
|
||||
|
@ -61,6 +61,7 @@ REGISTER_CLASS(GLVolumeCollection, "GUI::_3DScene::GLVolume::Collection");
|
||||
REGISTER_CLASS(Preset, "GUI::Preset");
|
||||
REGISTER_CLASS(PresetCollection, "GUI::PresetCollection");
|
||||
REGISTER_CLASS(PresetBundle, "GUI::PresetBundle");
|
||||
REGISTER_CLASS(PresetHints, "GUI::PresetHints");
|
||||
|
||||
SV* ConfigBase__as_hash(ConfigBase* THIS)
|
||||
{
|
||||
|
254
xs/src/slic3r/GUI/PresetHints.cpp
Normal file
254
xs/src/slic3r/GUI/PresetHints.cpp
Normal file
@ -0,0 +1,254 @@
|
||||
//#undef NDEBUGc
|
||||
#include <cassert>
|
||||
|
||||
#include "PresetBundle.hpp"
|
||||
#include "PresetHints.hpp"
|
||||
#include "Flow.hpp"
|
||||
|
||||
#include <boost/algorithm/string/predicate.hpp>
|
||||
|
||||
#include "../../libslic3r/libslic3r.h"
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
std::string PresetHints::cooling_description(const Preset &preset)
|
||||
{
|
||||
std::string out;
|
||||
char buf[4096];
|
||||
if (preset.config.opt_bool("cooling", 0)) {
|
||||
int slowdown_below_layer_time = preset.config.opt_int("slowdown_below_layer_time", 0);
|
||||
int min_fan_speed = preset.config.opt_int("min_fan_speed", 0);
|
||||
int max_fan_speed = preset.config.opt_int("max_fan_speed", 0);
|
||||
int min_print_speed = int(preset.config.opt_float("min_print_speed", 0) + 0.5);
|
||||
int fan_below_layer_time = preset.config.opt_int("fan_below_layer_time", 0);
|
||||
sprintf(buf, "If estimated layer time is below ~%ds, fan will run at %d%% and print speed will be reduced so that no less than %ds are spent on that layer (however, speed will never be reduced below %dmm/s).",
|
||||
slowdown_below_layer_time, max_fan_speed, slowdown_below_layer_time, min_print_speed);
|
||||
out += buf;
|
||||
if (fan_below_layer_time > slowdown_below_layer_time) {
|
||||
sprintf(buf, "\nIf estimated layer time is greater, but still below ~%ds, fan will run at a proportionally decreasing speed between %d%% and %d%%.",
|
||||
fan_below_layer_time, max_fan_speed, min_fan_speed);
|
||||
out += buf;
|
||||
}
|
||||
out += "\nDuring the other layers, fan ";
|
||||
} else {
|
||||
out = "Fan ";
|
||||
}
|
||||
if (preset.config.opt_bool("fan_always_on", 0)) {
|
||||
int disable_fan_first_layers = preset.config.opt_int("disable_fan_first_layers", 0);
|
||||
int min_fan_speed = preset.config.opt_int("min_fan_speed", 0);
|
||||
sprintf(buf, "will always run at %d% ", min_fan_speed);
|
||||
out += buf;
|
||||
if (disable_fan_first_layers > 1) {
|
||||
sprintf(buf, "except for the first %d layers", disable_fan_first_layers);
|
||||
out += buf;
|
||||
}
|
||||
else if (disable_fan_first_layers == 1)
|
||||
out += "except for the first layer";
|
||||
} else
|
||||
out += "will be turned off.";
|
||||
|
||||
return out;
|
||||
}
|
||||
|
||||
std::string PresetHints::maximum_volumetric_flow_description(const PresetBundle &preset_bundle)
|
||||
{
|
||||
// Find out, to which nozzle index is the current filament profile assigned.
|
||||
unsigned int idx_nozzle = 0;
|
||||
for (; idx_nozzle < (unsigned int)preset_bundle.filaments.size(); ++ idx_nozzle)
|
||||
if (preset_bundle.filament_presets[idx_nozzle] == preset_bundle.filaments.get_selected_preset().name)
|
||||
break;
|
||||
if (idx_nozzle == (unsigned int)preset_bundle.filaments.size())
|
||||
// The current filament preset is not active for any extruder.
|
||||
idx_nozzle = (unsigned int)-1;
|
||||
|
||||
const DynamicPrintConfig &print_config = preset_bundle.prints .get_edited_preset().config;
|
||||
const DynamicPrintConfig &filament_config = preset_bundle.filaments.get_edited_preset().config;
|
||||
const DynamicPrintConfig &printer_config = preset_bundle.printers .get_edited_preset().config;
|
||||
|
||||
// Current printer values.
|
||||
double nozzle_diameter = printer_config.opt_float("nozzle_diameter", idx_nozzle);
|
||||
|
||||
// Print config values
|
||||
double layer_height = print_config.get_abs_value("layer_height", nozzle_diameter);
|
||||
double first_layer_height = print_config.get_abs_value("first_layer_height", layer_height);
|
||||
double support_material_speed = print_config.opt_float("support_material_speed");
|
||||
double support_material_interface_speed = print_config.get_abs_value("support_material_interface_speed", support_material_speed);
|
||||
double bridge_speed = print_config.opt_float("bridge_speed");
|
||||
double bridge_flow_ratio = print_config.opt_float("bridge_flow_ratio");
|
||||
double perimeter_speed = print_config.opt_float("perimeter_speed");
|
||||
double external_perimeter_speed = print_config.get_abs_value("external_perimeter_speed", perimeter_speed);
|
||||
double gap_fill_speed = print_config.opt_float("gap_fill_speed");
|
||||
double infill_speed = print_config.opt_float("infill_speed");
|
||||
double small_perimeter_speed = print_config.get_abs_value("small_perimeter_speed", perimeter_speed);
|
||||
double solid_infill_speed = print_config.get_abs_value("solid_infill_speed", infill_speed);
|
||||
double top_solid_infill_speed = print_config.get_abs_value("top_solid_infill_speed", solid_infill_speed);
|
||||
// Maximum print speed when auto-speed is enabled by setting any of the above speed values to zero.
|
||||
double max_print_speed = print_config.opt_float("max_print_speed");
|
||||
// Maximum volumetric speed allowed for the print profile.
|
||||
double max_volumetric_speed = print_config.opt_float("max_volumetric_speed");
|
||||
|
||||
const auto &extrusion_width = print_config.get_abs_value("extrusion_width");
|
||||
const auto &support_material_extrusion_width = *print_config.option<ConfigOptionFloatOrPercent>("support_material_extrusion_width");
|
||||
const auto &external_perimeter_extrusion_width = *print_config.option<ConfigOptionFloatOrPercent>("external_perimeter_extrusion_width");
|
||||
const auto &infill_extrusion_width = *print_config.option<ConfigOptionFloatOrPercent>("infill_extrusion_width");
|
||||
const auto &solid_infill_extrusion_width = *print_config.option<ConfigOptionFloatOrPercent>("solid_infill_extrusion_width");
|
||||
const auto &perimeter_extrusion_width = *print_config.option<ConfigOptionFloatOrPercent>("perimeter_extrusion_width");
|
||||
const auto &top_infill_extrusion_width = *print_config.option<ConfigOptionFloatOrPercent>("top_infill_extrusion_width");
|
||||
const auto &first_layer_extrusion_width = *print_config.option<ConfigOptionFloatOrPercent>("first_layer_extrusion_width");
|
||||
|
||||
int perimeter_extruder = print_config.opt_int("perimeter_extruder");
|
||||
int infill_extruder = print_config.opt_int("infill_extruder");
|
||||
int solid_infill_extruder = print_config.opt_int("solid_infill_extruder");
|
||||
int support_material_extruder = print_config.opt_int("support_material_extruder");
|
||||
int support_material_interface_extruder = print_config.opt_int("support_material_interface_extruder");
|
||||
|
||||
// Current filament values
|
||||
double filament_diameter = filament_config.opt_float("filament_diameter", 0);
|
||||
double extrusion_multiplier = filament_config.opt_float("extrusion_multiplier", 0);
|
||||
double filament_max_volumetric_speed = filament_config.opt_float("filament_max_volumetric_speed", 0);
|
||||
|
||||
|
||||
auto external_perimeter_flow = Flow::new_from_config_width(frExternalPerimeter, external_perimeter_extrusion_width, (float)nozzle_diameter, (float)layer_height, 0);
|
||||
auto perimeter_flow = Flow::new_from_config_width(frPerimeter, perimeter_extrusion_width, (float)nozzle_diameter, (float)layer_height, 0);
|
||||
auto infill_flow = Flow::new_from_config_width(frInfill, infill_extrusion_width, (float)nozzle_diameter, (float)layer_height, 0);
|
||||
auto solid_infill_flow = Flow::new_from_config_width(frInfill, solid_infill_extrusion_width, (float)nozzle_diameter, (float)layer_height, 0);
|
||||
auto top_solid_infill_flow = Flow::new_from_config_width(frInfill, top_infill_extrusion_width, (float)nozzle_diameter, (float)layer_height, 0);
|
||||
// auto support_material_flow = Flow::new_from_config_width(frSupportMaterial, ,
|
||||
// (float)nozzle_diameter, (float)layer_height, 0);
|
||||
auto support_material_interface_flow = Flow::new_from_config_width(frSupportMaterialInterface, *print_config.option<ConfigOptionFloatOrPercent>("support_material_extrusion_width"),
|
||||
(float)nozzle_diameter, (float)layer_height, 0);
|
||||
|
||||
std::string out;
|
||||
out="Hu";
|
||||
return out;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static create_flow(FlowRole role, ConfigOptionFloatOrPercent &width, double layer_height, bool bridge, bool first_layer, double width) const
|
||||
{
|
||||
ConfigOptionFloatOrPercent config_width;
|
||||
if (width != -1) {
|
||||
// use the supplied custom width, if any
|
||||
config_width.value = width;
|
||||
config_width.percent = false;
|
||||
} else {
|
||||
// otherwise, get extrusion width from configuration
|
||||
// (might be an absolute value, or a percent value, or zero for auto)
|
||||
if (first_layer && this->_print->config.first_layer_extrusion_width.value > 0) {
|
||||
config_width = this->_print->config.first_layer_extrusion_width;
|
||||
} else if (role == frExternalPerimeter) {
|
||||
config_width = this->config.external_perimeter_extrusion_width;
|
||||
} else if (role == frPerimeter) {
|
||||
config_width = this->config.perimeter_extrusion_width;
|
||||
} else if (role == frInfill) {
|
||||
config_width = this->config.infill_extrusion_width;
|
||||
} else if (role == frSolidInfill) {
|
||||
config_width = this->config.solid_infill_extrusion_width;
|
||||
} else if (role == frTopSolidInfill) {
|
||||
config_width = this->config.top_infill_extrusion_width;
|
||||
} else {
|
||||
CONFESS("Unknown role");
|
||||
}
|
||||
}
|
||||
if (config_width.value == 0) {
|
||||
config_width = object.config.extrusion_width;
|
||||
}
|
||||
|
||||
// get the configured nozzle_diameter for the extruder associated
|
||||
// to the flow role requested
|
||||
size_t extruder = 0; // 1-based
|
||||
if (role == frPerimeter || role == frExternalPerimeter) {
|
||||
extruder = this->config.perimeter_extruder;
|
||||
} else if (role == frInfill) {
|
||||
extruder = this->config.infill_extruder;
|
||||
} else if (role == frSolidInfill || role == frTopSolidInfill) {
|
||||
extruder = this->config.solid_infill_extruder;
|
||||
} else {
|
||||
CONFESS("Unknown role $role");
|
||||
}
|
||||
double nozzle_diameter = this->_print->config.nozzle_diameter.get_at(extruder-1);
|
||||
|
||||
return Flow::new_from_config_width(role, config_width, nozzle_diameter, layer_height, bridge ? (float)this->config.bridge_flow_ratio : 0.0);
|
||||
}
|
||||
|
||||
if (first_layer && this->_print->config.first_layer_extrusion_width.value > 0) {
|
||||
config_width = this->_print->config.first_layer_extrusion_width;
|
||||
auto flow = Flow::new_from_config_width(frExternalPerimeter, const ConfigOptionFloatOrPercent &width, float nozzle_diameter, float height, float bridge_flow_ratio);
|
||||
|
||||
|
||||
|
||||
Flow Print::skirt_flow() const
|
||||
{
|
||||
ConfigOptionFloatOrPercent width = this->config.first_layer_extrusion_width;
|
||||
if (width.value == 0) width = this->regions.front()->config.perimeter_extrusion_width;
|
||||
|
||||
/* We currently use a random object's support material extruder.
|
||||
While this works for most cases, we should probably consider all of the support material
|
||||
extruders and take the one with, say, the smallest index;
|
||||
The same logic should be applied to the code that selects the extruder during G-code
|
||||
generation as well. */
|
||||
return Flow::new_from_config_width(
|
||||
frPerimeter,
|
||||
width,
|
||||
this->config.nozzle_diameter.get_at(this->objects.front()->config.support_material_extruder-1),
|
||||
this->skirt_first_layer_height(),
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
Flow Print::brim_flow() const
|
||||
{
|
||||
ConfigOptionFloatOrPercent width = this->config.first_layer_extrusion_width;
|
||||
if (width.value == 0) width = this->regions.front()->config.perimeter_extrusion_width;
|
||||
|
||||
/* We currently use a random region's perimeter extruder.
|
||||
While this works for most cases, we should probably consider all of the perimeter
|
||||
extruders and take the one with, say, the smallest index.
|
||||
The same logic should be applied to the code that selects the extruder during G-code
|
||||
generation as well. */
|
||||
return Flow::new_from_config_width(
|
||||
frPerimeter,
|
||||
width,
|
||||
this->config.nozzle_diameter.get_at(this->regions.front()->config.perimeter_extruder-1),
|
||||
this->skirt_first_layer_height(),
|
||||
0
|
||||
);
|
||||
}
|
||||
|
||||
Flow support_material_flow(const PrintObject *object, float layer_height)
|
||||
{
|
||||
return Flow::new_from_config_width(
|
||||
frSupportMaterial,
|
||||
// The width parameter accepted by new_from_config_width is of type ConfigOptionFloatOrPercent, the Flow class takes care of the percent to value substitution.
|
||||
(support_material_extrusion_width.value > 0) ? support_material_extrusion_width : extrusion_width,
|
||||
// if object->config.support_material_extruder == 0 (which means to not trigger tool change, but use the current extruder instead), get_at will return the 0th component.
|
||||
float(nozzle_diameter.get_at(support_material_extruder-1)),
|
||||
(layer_height > 0.f) ? layer_height : float(layer_height.value),
|
||||
false);
|
||||
}
|
||||
|
||||
Flow support_material_1st_layer_flow(const PrintObject *object, float layer_height)
|
||||
{
|
||||
return Flow::new_from_config_width(
|
||||
frSupportMaterial,
|
||||
// The width parameter accepted by new_from_config_width is of type ConfigOptionFloatOrPercent, the Flow class takes care of the percent to value substitution.
|
||||
(first_layer_extrusion_width.value > 0) ? first_layer_extrusion_width : support_material_extrusion_width,
|
||||
float(nozzle_diameter.get_at(object->config.support_material_extruder-1)),
|
||||
(layer_height > 0.f) ? layer_height : float(first_layer_height)),
|
||||
false);
|
||||
}
|
||||
|
||||
Flow support_material_interface_flow(const PrintObject *object, float layer_height)
|
||||
{
|
||||
return Flow::new_from_config_width(
|
||||
frSupportMaterialInterface,
|
||||
// The width parameter accepted by new_from_config_width is of type ConfigOptionFloatOrPercent, the Flow class takes care of the percent to value substitution.
|
||||
(support_material_extrusion_width > 0) ? support_material_extrusion_width : extrusion_width,
|
||||
// if object->config.support_material_interface_extruder == 0 (which means to not trigger tool change, but use the current extruder instead), get_at will return the 0th component.
|
||||
float(nozzle_diameter.get_at(object->config.support_material_interface_extruder-1)),
|
||||
layer_height,
|
||||
false);
|
||||
}
|
||||
#endif
|
||||
|
||||
}; // namespace Slic3r
|
25
xs/src/slic3r/GUI/PresetHints.hpp
Normal file
25
xs/src/slic3r/GUI/PresetHints.hpp
Normal file
@ -0,0 +1,25 @@
|
||||
#ifndef slic3r_PresetHints_hpp_
|
||||
#define slic3r_PresetHints_hpp_
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "PresetBundle.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
// GUI utility functions to produce hint messages from the current profile.
|
||||
class PresetHints
|
||||
{
|
||||
public:
|
||||
// Produce a textual description of the cooling logic of a currently active filament.
|
||||
static std::string cooling_description(const Preset &preset);
|
||||
// Produce a textual description of the maximum flow achived for the current configuration
|
||||
// (the current printer, filament and print settigns).
|
||||
// This description will be useful for getting a gut feeling for the maximum volumetric
|
||||
// print speed achievable with the extruder.
|
||||
static std::string maximum_volumetric_flow_description(const PresetBundle &preset_bundle);
|
||||
};
|
||||
|
||||
} // namespace Slic3r
|
||||
|
||||
#endif /* slic3r_PresetHints_hpp_ */
|
@ -46,18 +46,6 @@ _new_from_width(CLASS, role, width, nozzle_diameter, height, bridge_flow_ratio)
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
Flow*
|
||||
_new_from_spacing(CLASS, spacing, nozzle_diameter, height, bridge)
|
||||
char* CLASS;
|
||||
float spacing;
|
||||
float nozzle_diameter;
|
||||
float height;
|
||||
bool bridge;
|
||||
CODE:
|
||||
RETVAL = new Flow(Flow::new_from_spacing(spacing, nozzle_diameter, height, bridge));
|
||||
OUTPUT:
|
||||
RETVAL
|
||||
|
||||
%}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user