Implemented handling of complex ConfigOptionFloatOrPercent chains

by the PlaceholderParser.

Namely, all the options with the "ratio_over" reference are now handled
correctly by the PlaceholderParser with the exception
of the "first_layer_extrusion_width", which overrides speed of extrusions
by their respective extrusion type.

Also the various extrusion widths (extrusion_width, first_layer_extrusion_width,
external_perimeter_extrusion_width etc.) produce the same numbers
as if ran through the back-end, with the assumption of not overriding
layer height by the variable layer height editing tool or layer height
modifiers.
This commit is contained in:
bubnikv 2020-02-04 14:43:58 +01:00
parent 617912ecc1
commit 059bdb4711
11 changed files with 236 additions and 89 deletions

View file

@ -64,6 +64,16 @@ public:
// 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);
// Sane extrusion width defautl based on nozzle diameter.
// The defaults were derived from manual Prusa MK3 profiles.
static float auto_extrusion_width(FlowRole role, float nozzle_diameter);
// Extrusion width from full config, taking into account the defaults (when set to zero) and ratios (percentages).
// Precise value depends on layer index (1st layer vs. other layers vs. variable layer height),
// on active extruder etc. Therefore the value calculated by this function shall be used as a hint only.
static double extrusion_width(const std::string &opt_key, const ConfigOptionFloatOrPercent *opt, const ConfigOptionResolver &config, const unsigned int first_printing_extruder = 0);
static double extrusion_width(const std::string &opt_key, const ConfigOptionResolver &config, const unsigned int first_printing_extruder = 0);
};
extern Flow support_material_flow(const PrintObject *object, float layer_height = 0.f);