Class for processing G-code layers with adaptive pressure advance. More...
#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/libslic3r/GCode/AdaptivePAProcessor.hpp>
Public Member Functions | |
| AdaptivePAProcessor (GCode &gcodegen) | |
| Constructor for AdaptivePAProcessor. | |
| std::string | process_layer (std::string &&gcode) |
| Processes a layer of G-code and applies adaptive pressure advance. | |
| void | resetPreviousPA (double PA) |
| Manually sets adaptive PA internal value. | |
Static Public Member Functions | |
| static std::string | validate_adaptive_pa_model (const std::string &model_str) |
| Validates an adaptive pressure advance model string. | |
Private Member Functions | |
| AdaptivePAInterpolator * | getInterpolator (unsigned int config_index) |
| Get the PA interpolator attached to the specified filament config index. | |
Private Attributes | |
| GCode & | m_gcodegen |
| Reference to the GCode object. | |
| std::unordered_map< unsigned int, std::unique_ptr< AdaptivePAInterpolator > > | m_AdaptivePAInterpolators |
| Map between Interpolator objects and filament config indices (null when adaptive PA is off). | |
| const PrintConfig & | m_config |
| Reference to the print configuration. | |
| double | m_last_predicted_pa |
| Last predicted pressure advance value. | |
| double | m_max_next_feedrate |
| Maximum feed rate (speed) for the upcomming island. If no speed is found, the previous island speed is used. | |
| double | m_next_feedrate |
| First feed rate (speed) for the upcomming island. | |
| double | m_current_feedrate |
| Current, latest feedrate. | |
| int | m_last_config_index |
| Filament config index of the last PA_CHANGE tag. | |
| bool | m_enabled {false} |
| Whether any filament config index has both PA and adaptive PA on, the only ones that emit PA_CHANGE tags. | |
| std::regex | m_pa_change_pattern |
| Regular expression to detect PA_CHANGE pattern. | |
| std::regex | m_g1_f_pattern |
| Regular expression to detect G1 F pattern. | |
| std::smatch | m_match |
| Match results for regular expressions. | |
Class for processing G-code layers with adaptive pressure advance.
| Slic3r::AdaptivePAProcessor::AdaptivePAProcessor | ( | GCode & | gcodegen | ) |
Constructor for AdaptivePAProcessor.
This constructor initializes the AdaptivePAProcessor with a reference to a GCode object. It also initializes the configuration reference, pressure advance interpolation object, and regular expression patterns used for processing the G-code.
| gcodegen | A reference to the GCode object that generates the G-code. |
References m_config, m_current_feedrate, m_enabled, m_g1_f_pattern, m_gcodegen, m_last_config_index, m_last_predicted_pa, m_max_next_feedrate, m_next_feedrate, and m_pa_change_pattern.
|
private |
Get the PA interpolator attached to the specified filament config index.
| config_index | The filament config index (one per filament and extruder variant) for which the PA interpolation model is to be returned. |
References m_AdaptivePAInterpolators, and m_config.
Referenced by process_layer().
| std::string Slic3r::AdaptivePAProcessor::process_layer | ( | std::string && | gcode | ) |
Processes a layer of G-code and applies adaptive pressure advance.
This method processes the G-code for a single layer, identifying the appropriate pressure advance settings and applying them based on the current state and configurations.
| gcode | A string containing the G-code for the layer. |
References EPSILON, getInterpolator(), AdaptivePAInterpolator::isInitialised(), m_config, m_current_feedrate, m_enabled, m_gcodegen, m_last_config_index, m_last_predicted_pa, m_match, m_max_next_feedrate, m_next_feedrate, and m_pa_change_pattern.
|
inline |
Manually sets adaptive PA internal value.
This method manually sets the adaptive PA internally held value. Call this when changing tools or in any other case where the internally assumed last PA value may be incorrect
References m_last_predicted_pa.
|
static |
Validates an adaptive pressure advance model string.
Checks that:
| model_str | The model string to validate (typically from config) |
References _u8L, and Slic3r::format().
Referenced by Slic3r::GUI::ConfigManipulation::check_adaptive_pressure_advance_model(), and Slic3r::Print::validate().
|
private |
Map between Interpolator objects and filament config indices (null when adaptive PA is off).
Referenced by getInterpolator().
|
private |
Reference to the print configuration.
Referenced by AdaptivePAProcessor(), getInterpolator(), and process_layer().
|
private |
Current, latest feedrate.
Referenced by AdaptivePAProcessor(), and process_layer().
|
private |
Whether any filament config index has both PA and adaptive PA on, the only ones that emit PA_CHANGE tags.
Referenced by AdaptivePAProcessor(), and process_layer().
|
private |
Regular expression to detect G1 F pattern.
Referenced by AdaptivePAProcessor().
|
private |
Reference to the GCode object.
Referenced by AdaptivePAProcessor(), and process_layer().
|
private |
Filament config index of the last PA_CHANGE tag.
Referenced by AdaptivePAProcessor(), and process_layer().
|
private |
Last predicted pressure advance value.
Referenced by AdaptivePAProcessor(), process_layer(), and resetPreviousPA().
|
private |
Match results for regular expressions.
Referenced by process_layer().
|
private |
Maximum feed rate (speed) for the upcomming island. If no speed is found, the previous island speed is used.
Referenced by AdaptivePAProcessor(), and process_layer().
|
private |
First feed rate (speed) for the upcomming island.
Referenced by AdaptivePAProcessor(), and process_layer().
|
private |
Regular expression to detect PA_CHANGE pattern.
Referenced by AdaptivePAProcessor(), and process_layer().