mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-23 00:31:11 -06:00
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
11 changed files with 316 additions and 41 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue