mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-09 15:57:55 -06:00
more moonraker support
This commit is contained in:
parent
b8fb80c17f
commit
eebb69d3ae
8 changed files with 39 additions and 35 deletions
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "Anycubic",
|
"name": "Anycubic",
|
||||||
"version": "01.02.00.01",
|
"version": "01.02.00.02",
|
||||||
"force_update": "0",
|
"force_update": "0",
|
||||||
"description": "Anycubic configurations",
|
"description": "Anycubic configurations",
|
||||||
"machine_model_list": [
|
"machine_model_list": [
|
||||||
|
|
|
@ -129,6 +129,7 @@
|
||||||
"silent_mode": "0",
|
"silent_mode": "0",
|
||||||
"single_extruder_multi_material": "1",
|
"single_extruder_multi_material": "1",
|
||||||
"change_filament_gcode": "",
|
"change_filament_gcode": "",
|
||||||
|
"before_layer_change_gcode": ";BEFORE_LAYER_CHANGE\n;[layer_z]\nG92 E0\n",
|
||||||
"layer_change_gcode": "",
|
"layer_change_gcode": "",
|
||||||
"machine_pause_gcode": "M400 U1\n",
|
"machine_pause_gcode": "M400 U1\n",
|
||||||
"wipe": [
|
"wipe": [
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "Voron",
|
"name": "Voron",
|
||||||
"version": "01.02.00.02",
|
"version": "01.02.00.03",
|
||||||
"force_update": "0",
|
"force_update": "0",
|
||||||
"description": "Voron configurations",
|
"description": "Voron configurations",
|
||||||
"machine_model_list": [
|
"machine_model_list": [
|
||||||
|
|
|
@ -133,6 +133,7 @@
|
||||||
"machine_start_gcode": "M190 S0\nM104 S0\nPRINT_START EXTRUDER=[nozzle_temperature_initial_layer] BED=[bed_temperature_initial_layer_single]\n; You can use following code instead if your PRINT_START macro support Chamber and print area bedmesh\n; PRINT_START EXTRUDER=[nozzle_temperature_initial_layer] BED=[bed_temperature_initial_layer_single] Chamber=[chamber_temperature] PRINT_MIN={first_layer_print_min[0]},{first_layer_print_min[1]} PRINT_MAX={first_layer_print_max[0]},{first_layer_print_max[1]}",
|
"machine_start_gcode": "M190 S0\nM104 S0\nPRINT_START EXTRUDER=[nozzle_temperature_initial_layer] BED=[bed_temperature_initial_layer_single]\n; You can use following code instead if your PRINT_START macro support Chamber and print area bedmesh\n; PRINT_START EXTRUDER=[nozzle_temperature_initial_layer] BED=[bed_temperature_initial_layer_single] Chamber=[chamber_temperature] PRINT_MIN={first_layer_print_min[0]},{first_layer_print_min[1]} PRINT_MAX={first_layer_print_max[0]},{first_layer_print_max[1]}",
|
||||||
"machine_end_gcode": "PRINT_END",
|
"machine_end_gcode": "PRINT_END",
|
||||||
"layer_change_gcode": "",
|
"layer_change_gcode": "",
|
||||||
|
"before_layer_change_gcode": ";BEFORE_LAYER_CHANGE\n;[layer_z]\nG92 E0\n",
|
||||||
"scan_first_layer": "0",
|
"scan_first_layer": "0",
|
||||||
"nozzle_type": "hardened_steel",
|
"nozzle_type": "hardened_steel",
|
||||||
"auxiliary_fan": "0"
|
"auxiliary_fan": "0"
|
||||||
|
|
|
@ -1164,10 +1164,10 @@ namespace DoExport {
|
||||||
print_statistics.clear();
|
print_statistics.clear();
|
||||||
print_statistics.total_toolchanges = std::max(0, wipe_tower_data.number_of_toolchanges);
|
print_statistics.total_toolchanges = std::max(0, wipe_tower_data.number_of_toolchanges);
|
||||||
if (! extruders.empty()) {
|
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_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_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_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_cost ("; filament cost = ", 0);
|
||||||
for (const Extruder &extruder : extruders) {
|
for (const Extruder &extruder : extruders) {
|
||||||
double used_filament = extruder.used_filament() + (has_wipe_tower ? wipe_tower_data.used_filament[extruder.id()] : 0.f);
|
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
|
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.first += buf;
|
||||||
++ dst.second;
|
++ dst.second;
|
||||||
};
|
};
|
||||||
//append(out_filament_used_mm, "%.2lf", used_filament);
|
append(out_filament_used_mm, "%.2lf", used_filament);
|
||||||
//append(out_filament_used_cm3, "%.2lf", extruded_volume * 0.001);
|
append(out_filament_used_cm3, "%.2lf", extruded_volume * 0.001);
|
||||||
if (filament_weight > 0.) {
|
if (filament_weight > 0.) {
|
||||||
print_statistics.total_weight = print_statistics.total_weight + filament_weight;
|
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.) {
|
if (filament_cost > 0.) {
|
||||||
print_statistics.total_cost = print_statistics.total_cost + filament_cost;
|
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;
|
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_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.;
|
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 += out_filament_used_mm.first;
|
||||||
//filament_stats_string_out += "\n" + out_filament_used_cm3.first;
|
filament_stats_string_out += "\n" + out_filament_used_cm3.first;
|
||||||
//if (out_filament_used_g.second)
|
if (out_filament_used_g.second)
|
||||||
//filament_stats_string_out += "\n" + out_filament_used_g.first;
|
filament_stats_string_out += "\n" + out_filament_used_g.first;
|
||||||
//if (out_filament_cost.second)
|
if (out_filament_cost.second)
|
||||||
// filament_stats_string_out += "\n" + out_filament_cost.first;
|
filament_stats_string_out += "\n" + out_filament_cost.first;
|
||||||
}
|
}
|
||||||
return filament_stats_string_out;
|
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.
|
// 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.
|
// 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");
|
file.write("; CONFIG_BLOCK_START\n");
|
||||||
std::string full_config;
|
std::string full_config;
|
||||||
append_full_config(print, full_config);
|
append_full_config(print, full_config);
|
||||||
if (!full_config.empty())
|
if (!full_config.empty())
|
||||||
file.write(full_config);
|
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");
|
file.write("; CONFIG_BLOCK_END\n\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
//BBS: add plate id into thumbnail render logic
|
//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) },
|
DoExport::export_thumbnails_to_file(thumbnail_cb, print.get_plate_index(), { Vec2d(300, 300) },
|
||||||
[&file](const char* sz) { file.write(sz); },
|
[&file](const char* sz) { file.write(sz); },
|
||||||
[&print]() { print.throw_if_canceled(); });
|
[&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 PrintObject *first_object = print.objects().front();
|
||||||
const double layer_height = first_object->config().layer_height.value;
|
const double layer_height = first_object->config().layer_height.value;
|
||||||
const double initial_layer_print_height = print.config().initial_layer_print_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) {
|
for (size_t region_id = 0; region_id < print.num_print_regions(); ++ region_id) {
|
||||||
const PrintRegion ®ion = print.get_print_region(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());
|
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("; first layer extrusion width = %.2fmm\n", region.flow(*first_object, frPerimeter, initial_layer_print_height, true).width());
|
||||||
file.write_format("\n");
|
file.write_format("\n");
|
||||||
}
|
}
|
||||||
print.throw_if_canceled();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
file.write_format("; EXECUTABLE_BLOCK_START\n");
|
file.write_format("; EXECUTABLE_BLOCK_START\n");
|
||||||
// adds tags for time estimators
|
// adds tags for time estimators
|
||||||
|
@ -1800,11 +1803,14 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
||||||
m_writer.extruders(),
|
m_writer.extruders(),
|
||||||
// Modifies
|
// Modifies
|
||||||
print.m_print_statistics));
|
print.m_print_statistics));
|
||||||
//file.write("\n");
|
file.write("\n");
|
||||||
//file.write_format("; total filament weight [g] = %.2lf\n", print.m_print_statistics.total_weight);
|
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);
|
file.write_format("; total filament cost = %.2lf\n", print.m_print_statistics.total_cost);
|
||||||
//if (print.m_print_statistics.total_toolchanges > 0)
|
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 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();
|
print.throw_if_canceled();
|
||||||
}
|
}
|
||||||
|
|
|
@ -452,10 +452,7 @@ void GCodeProcessor::TimeProcessor::post_process(const std::string& filename, st
|
||||||
PrintEstimatedStatistics::ETimeMode mode = static_cast<PrintEstimatedStatistics::ETimeMode>(i);
|
PrintEstimatedStatistics::ETimeMode mode = static_cast<PrintEstimatedStatistics::ETimeMode>(i);
|
||||||
if (mode == PrintEstimatedStatistics::ETimeMode::Normal || machine.enabled) {
|
if (mode == PrintEstimatedStatistics::ETimeMode::Normal || machine.enabled) {
|
||||||
char buf[128];
|
char buf[128];
|
||||||
//sprintf(buf, "; estimated printing time (%s mode) = %s\n",
|
sprintf(buf, "; estimated printing time: %s\n", get_time_dhms(machine.time).c_str());
|
||||||
// (mode == PrintEstimatedStatistics::ETimeMode::Normal) ? "normal" : "silent",
|
|
||||||
// get_time_dhms(machine.time).c_str());
|
|
||||||
sprintf(buf, "; total estimated time: %s\n", get_time_dhms(machine.time).c_str());
|
|
||||||
ret += buf;
|
ret += buf;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -571,7 +571,7 @@ void PrintConfigDef::init_fff_params()
|
||||||
def->multiline = true;
|
def->multiline = true;
|
||||||
def->full_width = true;
|
def->full_width = true;
|
||||||
def->height = 5;
|
def->height = 5;
|
||||||
def->mode = comDevelop;
|
def->mode = comAdvanced;
|
||||||
def->set_default_value(new ConfigOptionString(""));
|
def->set_default_value(new ConfigOptionString(""));
|
||||||
|
|
||||||
def = this->add("bottom_shell_layers", coInt);
|
def = this->add("bottom_shell_layers", coInt);
|
||||||
|
|
|
@ -2911,8 +2911,8 @@ void TabPrinter::build_fff()
|
||||||
option.opt.is_code = true;
|
option.opt.is_code = true;
|
||||||
option.opt.height = gcode_field_height;//150;
|
option.opt.height = gcode_field_height;//150;
|
||||||
optgroup->append_single_option_line(option);
|
optgroup->append_single_option_line(option);
|
||||||
#if 0
|
|
||||||
optgroup = page->new_optgroup(L("Before layer change G-code"), 0);
|
optgroup = page->new_optgroup(L("Before layer change G-code"),"param_gcode", 0);
|
||||||
optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) {
|
optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) {
|
||||||
validate_custom_gcode_cb(this, optgroup, opt_key, value);
|
validate_custom_gcode_cb(this, optgroup, opt_key, value);
|
||||||
};
|
};
|
||||||
|
@ -2921,7 +2921,6 @@ void TabPrinter::build_fff()
|
||||||
option.opt.is_code = true;
|
option.opt.is_code = true;
|
||||||
option.opt.height = gcode_field_height;//150;
|
option.opt.height = gcode_field_height;//150;
|
||||||
optgroup->append_single_option_line(option);
|
optgroup->append_single_option_line(option);
|
||||||
#endif
|
|
||||||
|
|
||||||
optgroup = page->new_optgroup(L("Layer change G-code"), L"param_gcode", 0);
|
optgroup = page->new_optgroup(L("Layer change G-code"), L"param_gcode", 0);
|
||||||
optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) {
|
optgroup->m_on_change = [this, optgroup](const t_config_option_key& opt_key, const boost::any& value) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue