diff options
author | bubnikv <bubnikv@gmail.com> | 2017-05-03 19:28:22 +0300 |
---|---|---|
committer | bubnikv <bubnikv@gmail.com> | 2017-05-03 19:28:22 +0300 |
commit | e90279c513a1fb1fb50bf78d7e58a74e4889d7af (patch) | |
tree | 8aa1de52f2571bc93d47524b852ff65abd7005e9 /xs/src/libslic3r/Flow.cpp | |
parent | 72ae3585e415189286cdb85f6e02e4ec150084ee (diff) |
Ported the G-code generator from Perl to C++.
Removed GCode.pm
Removed the Perl bindigns for AvoidCrossingPerimeters, OozePrevention, SpiralVase, Wipe
Changed the std::set of extruder IDs to vector of IDs.
Removed some MSVC compiler warnings, removed obnoxious compiler warnings when compiling the Perl bindings.
Diffstat (limited to 'xs/src/libslic3r/Flow.cpp')
-rw-r--r-- | xs/src/libslic3r/Flow.cpp | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/xs/src/libslic3r/Flow.cpp b/xs/src/libslic3r/Flow.cpp index c7e5f8495..d3414da57 100644 --- a/xs/src/libslic3r/Flow.cpp +++ b/xs/src/libslic3r/Flow.cpp @@ -1,4 +1,5 @@ #include "Flow.hpp" +#include "Print.hpp" #include <cmath> #include <assert.h> @@ -113,4 +114,39 @@ float Flow::_width_from_spacing(float spacing, float nozzle_diameter, float heig #endif } +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. + (object->config.support_material_extrusion_width.value > 0) ? object->config.support_material_extrusion_width : object->config.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(object->print()->config.nozzle_diameter.get_at(object->config.support_material_extruder-1)), + (layer_height > 0.f) ? layer_height : float(object->config.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. + (object->print()->config.first_layer_extrusion_width.value > 0) ? object->print()->config.first_layer_extrusion_width : object->config.support_material_extrusion_width, + float(object->print()->config.nozzle_diameter.get_at(object->config.support_material_extruder-1)), + (layer_height > 0.f) ? layer_height : object->config.first_layer_height.get_abs_value(object->config.layer_height.value), + 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. + (object->config.support_material_extrusion_width > 0) ? object->config.support_material_extrusion_width : object->config.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(object->print()->config.nozzle_diameter.get_at(object->config.support_material_interface_extruder-1)), + (layer_height > 0.f) ? layer_height : float(object->config.layer_height.value), + false); +} + } |