mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-09 07:56:24 -06:00
more moonraker support
This commit is contained in:
parent
b8fb80c17f
commit
eebb69d3ae
8 changed files with 39 additions and 35 deletions
|
@ -1164,10 +1164,10 @@ namespace DoExport {
|
|||
print_statistics.clear();
|
||||
print_statistics.total_toolchanges = std::max(0, wipe_tower_data.number_of_toolchanges);
|
||||
if (! extruders.empty()) {
|
||||
//std::pair<std::string, unsigned int> out_filament_used_mm ("; filament used [mm] = ", 0);
|
||||
//std::pair<std::string, unsigned int> out_filament_used_cm3("; filament used [cm3] = ", 0);
|
||||
//std::pair<std::string, unsigned int> out_filament_used_g ("; filament used [g] = ", 0);
|
||||
//std::pair<std::string, unsigned int> out_filament_cost ("; filament cost = ", 0);
|
||||
std::pair<std::string, unsigned int> out_filament_used_mm ("; filament used [mm] = ", 0);
|
||||
std::pair<std::string, unsigned int> out_filament_used_cm3("; filament used [cm3] = ", 0);
|
||||
std::pair<std::string, unsigned int> out_filament_used_g ("; filament used [g] = ", 0);
|
||||
std::pair<std::string, unsigned int> out_filament_cost ("; filament cost = ", 0);
|
||||
for (const Extruder &extruder : extruders) {
|
||||
double used_filament = extruder.used_filament() + (has_wipe_tower ? wipe_tower_data.used_filament[extruder.id()] : 0.f);
|
||||
double extruded_volume = extruder.extruded_volume() + (has_wipe_tower ? wipe_tower_data.used_filament[extruder.id()] * 2.4052f : 0.f); // assumes 1.75mm filament diameter
|
||||
|
@ -1187,14 +1187,14 @@ namespace DoExport {
|
|||
dst.first += buf;
|
||||
++ dst.second;
|
||||
};
|
||||
//append(out_filament_used_mm, "%.2lf", used_filament);
|
||||
//append(out_filament_used_cm3, "%.2lf", extruded_volume * 0.001);
|
||||
append(out_filament_used_mm, "%.2lf", used_filament);
|
||||
append(out_filament_used_cm3, "%.2lf", extruded_volume * 0.001);
|
||||
if (filament_weight > 0.) {
|
||||
print_statistics.total_weight = print_statistics.total_weight + filament_weight;
|
||||
//append(out_filament_used_g, "%.2lf", filament_weight);
|
||||
append(out_filament_used_g, "%.2lf", filament_weight);
|
||||
if (filament_cost > 0.) {
|
||||
print_statistics.total_cost = print_statistics.total_cost + filament_cost;
|
||||
//append(out_filament_cost, "%.2lf", filament_cost);
|
||||
append(out_filament_cost, "%.2lf", filament_cost);
|
||||
}
|
||||
}
|
||||
print_statistics.total_used_filament += used_filament;
|
||||
|
@ -1202,12 +1202,12 @@ namespace DoExport {
|
|||
print_statistics.total_wipe_tower_filament += has_wipe_tower ? used_filament - extruder.used_filament() : 0.;
|
||||
print_statistics.total_wipe_tower_cost += has_wipe_tower ? (extruded_volume - extruder.extruded_volume())* extruder.filament_density() * 0.001 * extruder.filament_cost() * 0.001 : 0.;
|
||||
}
|
||||
//filament_stats_string_out += out_filament_used_mm.first;
|
||||
//filament_stats_string_out += "\n" + out_filament_used_cm3.first;
|
||||
//if (out_filament_used_g.second)
|
||||
//filament_stats_string_out += "\n" + out_filament_used_g.first;
|
||||
//if (out_filament_cost.second)
|
||||
// filament_stats_string_out += "\n" + out_filament_cost.first;
|
||||
filament_stats_string_out += out_filament_used_mm.first;
|
||||
filament_stats_string_out += "\n" + out_filament_used_cm3.first;
|
||||
if (out_filament_used_g.second)
|
||||
filament_stats_string_out += "\n" + out_filament_used_g.first;
|
||||
if (out_filament_cost.second)
|
||||
filament_stats_string_out += "\n" + out_filament_cost.first;
|
||||
}
|
||||
return filament_stats_string_out;
|
||||
}
|
||||
|
@ -1353,17 +1353,24 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
|||
// Append full config, delimited by two 'phony' configuration keys CONFIG_BLOCK_START and CONFIG_BLOCK_END.
|
||||
// The delimiters are structured as configuration key / value pairs to be parsable by older versions of PrusaSlicer G-code viewer.
|
||||
{
|
||||
file.write_format("; hack-fix: write fake slicer info here so that Moonraker will extract thumbs.\n");
|
||||
file.write_format("; %s\n\n",std::string(std::string("generated by SuperSlicer " SLIC3R_VERSION " on " ) + Slic3r::Utils::utc_timestamp()).c_str());
|
||||
file.write("; CONFIG_BLOCK_START\n");
|
||||
std::string full_config;
|
||||
append_full_config(print, full_config);
|
||||
if (!full_config.empty())
|
||||
file.write(full_config);
|
||||
|
||||
// SoftFever: write compatiple image
|
||||
std::vector<int> temps_per_bed;
|
||||
int first_layer_bed_temperature = 0;
|
||||
get_bed_temperature(0, true, temps_per_bed, first_layer_bed_temperature);
|
||||
file.write_format("; first_layer_bed_temperature = %d\n", first_layer_bed_temperature);
|
||||
file.write_format("; first_layer_temperature = %d\n", print.config().nozzle_temperature_initial_layer.get_at(0));
|
||||
file.write("; CONFIG_BLOCK_END\n\n");
|
||||
}
|
||||
|
||||
//BBS: add plate id into thumbnail render logic
|
||||
file.write_format("; hack-fix: write fake slicer info here so that Moonraker will extract thumbs.\n");
|
||||
file.write_format("; %s\n\n",std::string(std::string("generated by PrusaSlicer " SLIC3R_VERSION " on " ) + Slic3r::Utils::utc_timestamp()).c_str());
|
||||
DoExport::export_thumbnails_to_file(thumbnail_cb, print.get_plate_index(), { Vec2d(300, 300) },
|
||||
[&file](const char* sz) { file.write(sz); },
|
||||
[&print]() { print.throw_if_canceled(); });
|
||||
|
@ -1373,8 +1380,6 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
|||
const PrintObject *first_object = print.objects().front();
|
||||
const double layer_height = first_object->config().layer_height.value;
|
||||
const double initial_layer_print_height = print.config().initial_layer_print_height.value;
|
||||
//BBS: remove useless information in gcode file
|
||||
#if 0
|
||||
for (size_t region_id = 0; region_id < print.num_print_regions(); ++ region_id) {
|
||||
const PrintRegion ®ion = print.get_print_region(region_id);
|
||||
file.write_format("; external perimeters extrusion width = %.2fmm\n", region.flow(*first_object, frExternalPerimeter, layer_height).width());
|
||||
|
@ -1388,8 +1393,6 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
|||
file.write_format("; first layer extrusion width = %.2fmm\n", region.flow(*first_object, frPerimeter, initial_layer_print_height, true).width());
|
||||
file.write_format("\n");
|
||||
}
|
||||
print.throw_if_canceled();
|
||||
#endif
|
||||
|
||||
file.write_format("; EXECUTABLE_BLOCK_START\n");
|
||||
// adds tags for time estimators
|
||||
|
@ -1800,11 +1803,14 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
|||
m_writer.extruders(),
|
||||
// Modifies
|
||||
print.m_print_statistics));
|
||||
//file.write("\n");
|
||||
//file.write_format("; total filament weight [g] = %.2lf\n", print.m_print_statistics.total_weight);
|
||||
//file.write_format("; total filament cost = %.2lf\n", print.m_print_statistics.total_cost);
|
||||
//if (print.m_print_statistics.total_toolchanges > 0)
|
||||
// file.write_format("; total filament change = %i\n", print.m_print_statistics.total_toolchanges);
|
||||
file.write("\n");
|
||||
file.write_format("; total filament used [g] = %.2lf\n", print.m_print_statistics.total_weight);
|
||||
file.write_format("; total filament cost = %.2lf\n", print.m_print_statistics.total_cost);
|
||||
if (print.m_print_statistics.total_toolchanges > 0)
|
||||
file.write_format("; total filament change = %i\n", print.m_print_statistics.total_toolchanges);
|
||||
|
||||
file.write_format("; total layers count = %i\n", m_layer_count);
|
||||
file.write_format(";%s\n", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Estimated_Printing_Time_Placeholder).c_str());
|
||||
|
||||
print.throw_if_canceled();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue