|
OOFEM 3.0
|
The Printer class is used to process G-code commands and manage the printer state. More...
#include <Printer.h>
Public Types | |
| using | CommandCallback = std::function<void( const GCodeCommand & )> |
Public Member Functions | |
| Printer (PrinterOptions options) | |
| Constructor for Printer using PrinterOptions. | |
| PrintStatistics | getStatistics () const |
| Get the printer statistics. | |
| void | registerCallback (const std::string &commandCode, CommandCallback callback) |
| Register a callback function for a specific G-code command. | |
| void | addCommandToQueue (const GCodeCommand &command) |
| Add a G-code command to the command queue. | |
| void | popCommandFromQueue () |
| Remove the first G-code command from the command queue. | |
| void | processCommand (const GCodeCommand &command) |
| Process a G-code command. | |
| VoxelGrid & | getGrid () |
| std::array< double, 4 > | calculatePosition (std::array< double, 4 > position, const std::optional< double > &xValue, const std::optional< double > &yValue, const std::optional< double > &zValue) |
| Calculate the new position of the printer based on the given values. | |
| std::array< double, 3 > | calculateDirectorVector (const std::array< double, 4 > &position_prev, const std::array< double, 4 > &position_next) |
| Calculate the director vector between two positions. | |
| double | calculateMoveTime (double distance, double vs, double v, double ve) |
| Calculate the time taken to move a certain distance with given velocities. | |
| const Model | get_model (std::array< double, 4 > start, std::array< double, 4 > end, double h, double w) |
| void | handleG1Command (const GCodeCommand &command) |
| Handle the G1 command to manage printer positions. | |
| void | handleM83Command (const GCodeCommand &command) |
| Handle the M83 command to set the extruder positioning mode to relative. | |
| Printer () | |
| Constructor to register default callbacks. | |
Public Attributes | |
| double | depositionTemperature = 235. |
| double | heatBedTemperature = 60. |
| double | chamberTemperature = 30. |
| double | heatTransferFilmCoefficient = 10. |
| double | depositedMaterialHeatPower = 4200000.0 |
Private Member Functions | |
| void | registerCallbacks () |
Private Attributes | |
| VoxelGrid | voxelGrid = { { 0.5, 0.5, 0.5 }, { 1000, 1000, 1000 } } |
| std::map< std::string, CommandCallback > | commandCallbacks |
| std::vector< GCodeCommand > | commandQueue |
| PrintStatistics | statistics |
| std::array< double, 4 > | position = { 0.0, 0.0, 0.0, 0.0 } |
| ExtruderPositioning | positioning = ExtruderPositioning::Absolute |
| ExtruderPositioning | extruder_positioning = ExtruderPositioning::Absolute |
| VelocityModel | velocity_model = VelocityModel::Trapezoidal |
| double | feedrate = 1000.0 |
| double | real_feedrate = 0.0 |
| double | max_acceleration [4] = { 500.0, 500.0, 100.0, 5000.0 } |
| double | max_jerk [4] = { 8.0, 8.0, 0.4, 5.0 } |
| LayerHeightModel | layer_height_model = LayerHeightModel::Constant |
| double | layer_height = 0.2 |
| double | nozzle_diameter = 0.4 |
| double | filament_diameter = 1.75 |
| double | extrusion_multiplier = 1.0 |
| double | extrusion_width = nozzle_diameter * 1.2 |
The Printer class is used to process G-code commands and manage the printer state.
| using Printer::CommandCallback = std::function<void( const GCodeCommand & )> |
|
inline |
Constructor for Printer using PrinterOptions.
Definition at line 85 of file Printer.h.
References chamberTemperature, PrinterOptions::chamberTemperature, depositedMaterialHeatPower, PrinterOptions::depositedMaterialHeatPower, depositionTemperature, PrinterOptions::depositionTemperature, extrusion_width, PrinterOptions::extrusionWidth, filament_diameter, PrinterOptions::filamentDiameter, heatBedTemperature, PrinterOptions::heatBedTemperature, heatTransferFilmCoefficient, PrinterOptions::heatTransferFilmCoefficient, layer_height, layer_height_model, PrinterOptions::layerHeight, PrinterOptions::layerHeightModel, registerCallbacks(), PrinterOptions::sizes, PrinterOptions::steps, velocity_model, PrinterOptions::velocityModel, and voxelGrid.
|
inline |
Constructor to register default callbacks.
Definition at line 458 of file Printer.h.
References registerCallbacks().
|
inline |
Add a G-code command to the command queue.
| command | The G-code command to be added. |
Definition at line 127 of file Printer.h.
References commandQueue.
|
inline |
Calculate the director vector between two positions.
| position_prev | The previous position. |
| position_next | The next position. |
Definition at line 205 of file Printer.h.
Referenced by handleG1Command().
|
inline |
Calculate the time taken to move a certain distance with given velocities.
| distance | The distance to be moved. |
| vs | The starting velocity. |
| v | The target velocity. |
| ve | The ending velocity. |
Definition at line 232 of file Printer.h.
References max_acceleration.
Referenced by handleG1Command().
|
inline |
Calculate the new position of the printer based on the given values.
| position | The current position of the printer. |
| xValue | The optional X-axis value. |
| yValue | The optional Y-axis value. |
| zValue | The optional Z-axis value. |
Definition at line 171 of file Printer.h.
References position, positioning, and Relative.
Referenced by handleG1Command().
|
inline |
Definition at line 243 of file Printer.h.
References modelfrompolygons().
Referenced by handleG1Command().
|
inline |
|
inline |
Get the printer statistics.
Definition at line 108 of file Printer.h.
References statistics.
|
inline |
Handle the G1 command to manage printer positions.
| command | The G-code command. |
Definition at line 291 of file Printer.h.
References calculateDirectorVector(), calculateMoveTime(), calculatePosition(), commandQueue, Constant, csgintersection(), extruder_positioning, extrusion_width, feedrate, filament_diameter, get_model(), VoxelGrid::get_model(), getGrid(), layer_height, layer_height_model, M_PI, max_jerk, GCodeCommand::param_double(), position, real_feedrate, Relative, statistics, Model::volume(), and voxelGrid.
Referenced by registerCallbacks().
|
inline |
Handle the M83 command to set the extruder positioning mode to relative.
| command | The G-code command. |
Definition at line 450 of file Printer.h.
References extruder_positioning, and Relative.
Referenced by registerCallbacks().
|
inline |
Remove the first G-code command from the command queue.
Definition at line 135 of file Printer.h.
References commandQueue.
|
inline |
Process a G-code command.
| command | The G-code command to be processed. |
Definition at line 145 of file Printer.h.
References commandCallbacks, GCodeCommand::getCode(), and statistics.
|
inline |
Register a callback function for a specific G-code command.
| commandCode | The G-code command code. |
| callback | The callback function to be registered. |
Definition at line 118 of file Printer.h.
References commandCallbacks.
Referenced by registerCallbacks().
|
inlineprivate |
Definition at line 464 of file Printer.h.
References handleG1Command(), handleM83Command(), and registerCallback().
| double Printer::chamberTemperature = 30. |
|
private |
Map of command codes to callback functions.
Definition at line 472 of file Printer.h.
Referenced by processCommand(), and registerCallback().
|
private |
Queue of G-code commands to be processed.
Definition at line 473 of file Printer.h.
Referenced by addCommandToQueue(), handleG1Command(), and popCommandFromQueue().
| double Printer::depositedMaterialHeatPower = 4200000.0 |
| double Printer::depositionTemperature = 235. |
|
private |
The positioning mode of the extruder (E axis).
Definition at line 479 of file Printer.h.
Referenced by handleG1Command(), and handleM83Command().
|
private |
|
private |
Current extrusion width
Definition at line 496 of file Printer.h.
Referenced by handleG1Command(), and Printer().
|
private |
The current desired velocity of the printer.
Definition at line 483 of file Printer.h.
Referenced by handleG1Command().
|
private |
Filament diameter, not used
Definition at line 494 of file Printer.h.
Referenced by handleG1Command(), and Printer().
| double Printer::heatBedTemperature = 60. |
| double Printer::heatTransferFilmCoefficient = 10. |
|
private |
The layer height value.
Definition at line 492 of file Printer.h.
Referenced by handleG1Command(), and Printer().
|
private |
The layer height model of the printer.
Definition at line 491 of file Printer.h.
Referenced by handleG1Command(), and Printer().
|
private |
The maximum acceleration for X, Y, Z, and E axes.
Definition at line 487 of file Printer.h.
Referenced by calculateMoveTime().
|
private |
Definition at line 488 of file Printer.h.
Referenced by handleG1Command().
|
private |
|
private |
The position of the print head in X, Y, Z, and E axes.
Definition at line 477 of file Printer.h.
Referenced by calculatePosition(), and handleG1Command().
|
private |
The positioning mode of the printhead in space (XYZ).
Definition at line 478 of file Printer.h.
Referenced by calculatePosition().
|
private |
The real velocity of the printer.
Definition at line 484 of file Printer.h.
Referenced by handleG1Command().
|
private |
The printer statistics.
Definition at line 474 of file Printer.h.
Referenced by getStatistics(), handleG1Command(), and processCommand().
|
private |
|
private |