mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-25 07:34:03 -06:00
WIP to G-code export parallelization through pipelining:
New class GCodeOutputStream as a G-code consumer. In the following steps the GCodeOutputStream will be pipelined with GCodeProcessor.
This commit is contained in:
parent
32733b7db9
commit
b5a007a683
2 changed files with 107 additions and 93 deletions
|
@ -184,13 +184,39 @@ public:
|
|||
};
|
||||
|
||||
private:
|
||||
void _do_export(Print &print, FILE *file, ThumbnailsGeneratorCallback thumbnail_cb);
|
||||
class GCodeOutputStream {
|
||||
public:
|
||||
GCodeOutputStream(FILE *f) : f(f) {}
|
||||
~GCodeOutputStream() { this->close(); }
|
||||
|
||||
bool is_open() const { return f; }
|
||||
bool is_error() const { return ::ferror(f); }
|
||||
|
||||
void flush() { ::fflush(f); }
|
||||
void close() { if (f) ::fclose(f); }
|
||||
|
||||
// Write a string into a file.
|
||||
void write(const std::string& what) { this->write(what.c_str()); }
|
||||
void write(const char* what);
|
||||
|
||||
// Write a string into a file.
|
||||
// Add a newline, if the string does not end with a newline already.
|
||||
// Used to export a custom G-code section processed by the PlaceholderParser.
|
||||
void writeln(const std::string& what);
|
||||
|
||||
// Formats and write into a file the given data.
|
||||
void write_format(const char* format, ...);
|
||||
|
||||
private:
|
||||
FILE *f = nullptr;
|
||||
};
|
||||
void _do_export(Print &print, GCodeOutputStream &file, ThumbnailsGeneratorCallback thumbnail_cb);
|
||||
|
||||
static std::vector<LayerToPrint> collect_layers_to_print(const PrintObject &object);
|
||||
static std::vector<std::pair<coordf_t, std::vector<LayerToPrint>>> collect_layers_to_print(const Print &print);
|
||||
void process_layer(
|
||||
// Write into the output file.
|
||||
FILE *file,
|
||||
GCodeOutputStream &file,
|
||||
const Print &print,
|
||||
// Set of object & print layers of the same PrintObject and with the same print_z.
|
||||
const std::vector<LayerToPrint> &layers,
|
||||
|
@ -358,22 +384,10 @@ private:
|
|||
// Processor
|
||||
GCodeProcessor m_processor;
|
||||
|
||||
// Write a string into a file.
|
||||
void _write(FILE* file, const std::string& what) { this->_write(file, what.c_str()); }
|
||||
void _write(FILE* file, const char *what);
|
||||
|
||||
// Write a string into a file.
|
||||
// Add a newline, if the string does not end with a newline already.
|
||||
// Used to export a custom G-code section processed by the PlaceholderParser.
|
||||
void _writeln(FILE* file, const std::string& what);
|
||||
|
||||
// Formats and write into a file the given data.
|
||||
void _write_format(FILE* file, const char* format, ...);
|
||||
|
||||
std::string _extrude(const ExtrusionPath &path, std::string description = "", double speed = -1);
|
||||
void print_machine_envelope(FILE *file, Print &print);
|
||||
void _print_first_layer_bed_temperature(FILE *file, Print &print, const std::string &gcode, unsigned int first_printing_extruder_id, bool wait);
|
||||
void _print_first_layer_extruder_temperatures(FILE *file, Print &print, const std::string &gcode, unsigned int first_printing_extruder_id, bool wait);
|
||||
void print_machine_envelope(GCodeOutputStream &file, Print &print);
|
||||
void _print_first_layer_bed_temperature(GCodeOutputStream &file, Print &print, const std::string &gcode, unsigned int first_printing_extruder_id, bool wait);
|
||||
void _print_first_layer_extruder_temperatures(GCodeOutputStream &file, Print &print, const std::string &gcode, unsigned int first_printing_extruder_id, bool wait);
|
||||
// On the first printing layer. This flag triggers first layer speeds.
|
||||
bool on_first_layer() const { return m_layer != nullptr && m_layer->id() == 0; }
|
||||
// To control print speed of 1st object layer over raft interface.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue