mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-09 07:56:24 -06:00
Omit BBL specific gcodes for other machines
This commit is contained in:
parent
bab4f443e2
commit
b7572b9004
4 changed files with 134 additions and 49 deletions
|
@ -908,6 +908,11 @@ void GCode::do_export(Print* print, const char* path, GCodeProcessorResult* resu
|
||||||
BOOST_LOG_TRIVIAL(info) << boost::format("Will export G-code to %1% soon")%path;
|
BOOST_LOG_TRIVIAL(info) << boost::format("Will export G-code to %1% soon")%path;
|
||||||
print->set_started(psGCodeExport);
|
print->set_started(psGCodeExport);
|
||||||
|
|
||||||
|
if (print->is_BBL_printer())
|
||||||
|
gcode_label_objects = false;
|
||||||
|
else
|
||||||
|
gcode_label_objects = true;
|
||||||
|
|
||||||
// check if any custom gcode contains keywords used by the gcode processor to
|
// check if any custom gcode contains keywords used by the gcode processor to
|
||||||
// produce time estimation and gcode toolpaths
|
// produce time estimation and gcode toolpaths
|
||||||
std::vector<std::pair<std::string, std::string>> validation_res = DoExport::validate_custom_gcode(*print);
|
std::vector<std::pair<std::string, std::string>> validation_res = DoExport::validate_custom_gcode(*print);
|
||||||
|
@ -1285,7 +1290,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
||||||
|
|
||||||
// modifies m_silent_time_estimator_enabled
|
// modifies m_silent_time_estimator_enabled
|
||||||
DoExport::init_gcode_processor(print.config(), m_processor, m_silent_time_estimator_enabled);
|
DoExport::init_gcode_processor(print.config(), m_processor, m_silent_time_estimator_enabled);
|
||||||
|
const bool is_bbl_printers = print.is_BBL_printer();
|
||||||
// resets analyzer's tracking data
|
// resets analyzer's tracking data
|
||||||
m_last_height = 0.f;
|
m_last_height = 0.f;
|
||||||
m_last_layer_z = 0.f;
|
m_last_layer_z = 0.f;
|
||||||
|
@ -1349,18 +1354,49 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
||||||
file.write_format(";%s\n", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Estimated_Printing_Time_Placeholder).c_str());
|
file.write_format(";%s\n", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Estimated_Printing_Time_Placeholder).c_str());
|
||||||
file.write_format("; HEADER_BLOCK_END\n\n");
|
file.write_format("; HEADER_BLOCK_END\n\n");
|
||||||
|
|
||||||
//BBS: write global config at the beginning of gcode file because printer need these config information
|
|
||||||
// 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());
|
|
||||||
}
|
|
||||||
|
|
||||||
//BBS: add plate id into thumbnail render logic
|
// BBS: write global config at the beginning of gcode file because printer
|
||||||
DoExport::export_thumbnails_to_file(thumbnail_cb, print.get_plate_index(), { Vec2d(300, 300) },
|
// need these config information
|
||||||
[&file](const char* sz) { file.write(sz); },
|
// Append full config, delimited by two 'phony' configuration keys
|
||||||
[&print]() { print.throw_if_canceled(); });
|
// 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.
|
||||||
|
{
|
||||||
|
if (is_bbl_printers) {
|
||||||
|
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");
|
||||||
|
} else {
|
||||||
|
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());
|
||||||
|
|
||||||
|
// BBS: add plate id into thumbnail render logic
|
||||||
|
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(); });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Write some terse information on the slicing parameters.
|
// Write some terse information on the slicing parameters.
|
||||||
|
@ -1504,7 +1540,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
||||||
m_placeholder_parser.set("first_layer_print_max", new ConfigOptionFloats({ bbox.max.x(), bbox.max.y() }));
|
m_placeholder_parser.set("first_layer_print_max", new ConfigOptionFloats({ bbox.max.x(), bbox.max.y() }));
|
||||||
m_placeholder_parser.set("first_layer_print_size", new ConfigOptionFloats({ bbox.size().x(), bbox.size().y() }));
|
m_placeholder_parser.set("first_layer_print_size", new ConfigOptionFloats({ bbox.size().x(), bbox.size().y() }));
|
||||||
}
|
}
|
||||||
|
float outer_wall_volumetric_speed = 0.0f;
|
||||||
{
|
{
|
||||||
int curr_bed_type = m_config.curr_bed_type.getInt();
|
int curr_bed_type = m_config.curr_bed_type.getInt();
|
||||||
|
|
||||||
|
@ -1528,7 +1564,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
||||||
}
|
}
|
||||||
Flow outer_wall_flow = Flow(outer_wall_line_width, m_config.layer_height, m_config.nozzle_diameter.get_at(initial_extruder_id));
|
Flow outer_wall_flow = Flow(outer_wall_line_width, m_config.layer_height, m_config.nozzle_diameter.get_at(initial_extruder_id));
|
||||||
float outer_wall_speed = print.default_region_config().outer_wall_speed.value;
|
float outer_wall_speed = print.default_region_config().outer_wall_speed.value;
|
||||||
float outer_wall_volumetric_speed = outer_wall_speed * outer_wall_flow.mm3_per_mm();
|
outer_wall_volumetric_speed = outer_wall_speed * outer_wall_flow.mm3_per_mm();
|
||||||
if (outer_wall_volumetric_speed > filament_max_volumetric_speed)
|
if (outer_wall_volumetric_speed > filament_max_volumetric_speed)
|
||||||
outer_wall_volumetric_speed = filament_max_volumetric_speed;
|
outer_wall_volumetric_speed = filament_max_volumetric_speed;
|
||||||
m_placeholder_parser.set("outer_wall_volumetric_speed", new ConfigOptionFloat(outer_wall_volumetric_speed));
|
m_placeholder_parser.set("outer_wall_volumetric_speed", new ConfigOptionFloat(outer_wall_volumetric_speed));
|
||||||
|
@ -1591,12 +1627,20 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
||||||
if (this->m_objsWithBrim.empty() && this->m_objSupportsWithBrim.empty()) m_brim_done = true;
|
if (this->m_objsWithBrim.empty() && this->m_objSupportsWithBrim.empty()) m_brim_done = true;
|
||||||
|
|
||||||
//BBS: open spaghetti detector
|
//BBS: open spaghetti detector
|
||||||
// if (print.config().spaghetti_detector.value)
|
if (is_bbl_printers) {
|
||||||
file.write("M981 S1 P20000 ;open spaghetti detector\n");
|
// if (print.config().spaghetti_detector.value)
|
||||||
if(m_config.enable_pressure_advance.value)
|
file.write("M981 S1 P20000 ;open spaghetti detector\n");
|
||||||
{
|
file.write_format("M900 K%.3f M%0.3f ; Override pressure advance value\n",
|
||||||
file.write_format("M900 K%.3f ; Override pressure advance value\n",m_config.pressure_advance.values.front());
|
m_config.pressure_advance.values.front(),
|
||||||
|
outer_wall_volumetric_speed / (1.75 * 1.75 / 4 * 3.14) *
|
||||||
|
m_config.pressure_advance.values.front());
|
||||||
|
} else {
|
||||||
|
if (m_config.enable_pressure_advance.value) {
|
||||||
|
file.write_format("M900 K%.3f ; Override pressure advance value\n",
|
||||||
|
m_config.pressure_advance.values.front());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do all objects for each layer.
|
// Do all objects for each layer.
|
||||||
if (print.config().print_sequence == PrintSequence::ByObject) {
|
if (print.config().print_sequence == PrintSequence::ByObject) {
|
||||||
size_t finished_objects = 0;
|
size_t finished_objects = 0;
|
||||||
|
@ -1659,7 +1703,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
||||||
this->process_layers(print, tool_ordering, collect_layers_to_print(object), *print_object_instance_sequential_active - object.instances().data(), file, prime_extruder);
|
this->process_layers(print, tool_ordering, collect_layers_to_print(object), *print_object_instance_sequential_active - object.instances().data(), file, prime_extruder);
|
||||||
//BBS: close powerlost recovery
|
//BBS: close powerlost recovery
|
||||||
{
|
{
|
||||||
if (m_second_layer_things_done) {
|
if (is_bbl_printers && m_second_layer_things_done) {
|
||||||
file.write("; close powerlost recovery\n");
|
file.write("; close powerlost recovery\n");
|
||||||
file.write("M1003 S0\n");
|
file.write("M1003 S0\n");
|
||||||
}
|
}
|
||||||
|
@ -1730,7 +1774,7 @@ void GCode::_do_export(Print& print, GCodeOutputStream &file, ThumbnailsGenerato
|
||||||
this->process_layers(print, tool_ordering, print_object_instances_ordering, layers_to_print, file);
|
this->process_layers(print, tool_ordering, print_object_instances_ordering, layers_to_print, file);
|
||||||
//BBS: close powerlost recovery
|
//BBS: close powerlost recovery
|
||||||
{
|
{
|
||||||
if (m_second_layer_things_done) {
|
if (is_bbl_printers && m_second_layer_things_done) {
|
||||||
file.write("; close powerlost recovery\n");
|
file.write("; close powerlost recovery\n");
|
||||||
file.write("M1003 S0\n");
|
file.write("M1003 S0\n");
|
||||||
}
|
}
|
||||||
|
@ -1796,27 +1840,40 @@ 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");
|
if (!is_bbl_printers) {
|
||||||
file.write("; CONFIG_BLOCK_START\n");
|
file.write("\n");
|
||||||
std::string full_config;
|
file.write("; CONFIG_BLOCK_START\n");
|
||||||
append_full_config(print, full_config);
|
std::string full_config;
|
||||||
if (!full_config.empty())
|
append_full_config(print, full_config);
|
||||||
|
if (!full_config.empty())
|
||||||
file.write(full_config);
|
file.write(full_config);
|
||||||
|
|
||||||
// SoftFever: write compatiple image
|
// SoftFever: write compatiple info
|
||||||
std::vector<int> temps_per_bed;
|
std::vector<int> temps_per_bed;
|
||||||
int first_layer_bed_temperature = 0;
|
int first_layer_bed_temperature = 0;
|
||||||
get_bed_temperature(0, true, temps_per_bed, first_layer_bed_temperature);
|
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_bed_temperature = %d\n",
|
||||||
file.write_format("; first_layer_temperature = %d\n", print.config().nozzle_temperature_initial_layer.get_at(0));
|
first_layer_bed_temperature);
|
||||||
file.write("; CONFIG_BLOCK_END\n\n");
|
file.write_format(
|
||||||
file.write_format("; total filament used [g] = %.2lf\n", print.m_print_statistics.total_weight);
|
"; first_layer_temperature = %d\n",
|
||||||
file.write_format("; total filament cost = %.2lf\n", print.m_print_statistics.total_cost);
|
print.config().nozzle_temperature_initial_layer.get_at(0));
|
||||||
if (print.m_print_statistics.total_toolchanges > 0)
|
file.write("; CONFIG_BLOCK_END\n\n");
|
||||||
file.write_format("; total filament change = %i\n", print.m_print_statistics.total_toolchanges);
|
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("; total layers count = %i\n", m_layer_count);
|
||||||
file.write_format(";%s\n", GCodeProcessor::reserved_tag(GCodeProcessor::ETags::Estimated_Printing_Time_Placeholder).c_str());
|
file.write_format(
|
||||||
|
";%s\n",
|
||||||
|
GCodeProcessor::reserved_tag(
|
||||||
|
GCodeProcessor::ETags::Estimated_Printing_Time_Placeholder)
|
||||||
|
.c_str());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
print.throw_if_canceled();
|
print.throw_if_canceled();
|
||||||
}
|
}
|
||||||
|
@ -2522,20 +2579,21 @@ GCode::LayerResult GCode::process_layer(
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! first_layer && ! m_second_layer_things_done) {
|
if (! first_layer && ! m_second_layer_things_done) {
|
||||||
//BBS: open powerlost recovery
|
if (print.is_BBL_printer()) {
|
||||||
|
// BBS: open powerlost recovery
|
||||||
{
|
{
|
||||||
gcode += "; open powerlost recovery\n";
|
gcode += "; open powerlost recovery\n";
|
||||||
gcode += "M1003 S1\n";
|
gcode += "M1003 S1\n";
|
||||||
}
|
}
|
||||||
// BBS: open first layer inspection at second layer
|
// BBS: open first layer inspection at second layer
|
||||||
if (print.config().scan_first_layer.value) {
|
if (print.config().scan_first_layer.value) {
|
||||||
// BBS: retract first to avoid droping when scan model
|
// BBS: retract first to avoid droping when scan model
|
||||||
gcode += this->retract();
|
gcode += this->retract();
|
||||||
gcode += "M976 S1 P1 ; scan model before printing 2nd layer\n";
|
gcode += "M976 S1 P1 ; scan model before printing 2nd layer\n";
|
||||||
gcode += "M400 P100\n";
|
gcode += "M400 P100\n";
|
||||||
gcode += this->unretract();
|
gcode += this->unretract();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
//BBS: reset acceleration at sencond layer
|
//BBS: reset acceleration at sencond layer
|
||||||
if (m_config.default_acceleration.value > 0 && m_config.initial_layer_acceleration.value > 0) {
|
if (m_config.default_acceleration.value > 0 && m_config.initial_layer_acceleration.value > 0) {
|
||||||
double acceleration = m_config.default_acceleration.value;
|
double acceleration = m_config.default_acceleration.value;
|
||||||
|
|
|
@ -728,7 +728,11 @@ public:
|
||||||
// Return 4 wipe tower corners in the world coordinates (shifted and rotated), including the wipe tower brim.
|
// Return 4 wipe tower corners in the world coordinates (shifted and rotated), including the wipe tower brim.
|
||||||
std::vector<Point> first_layer_wipe_tower_corners(bool check_wipe_tower_existance=true) const;
|
std::vector<Point> first_layer_wipe_tower_corners(bool check_wipe_tower_existance=true) const;
|
||||||
|
|
||||||
protected:
|
//SoftFever
|
||||||
|
bool &is_BBL_printer() { return m_isBBLPrinter; }
|
||||||
|
const bool is_BBL_printer() const { return m_isBBLPrinter; }
|
||||||
|
|
||||||
|
protected:
|
||||||
// Invalidates the step, and its depending steps in Print.
|
// Invalidates the step, and its depending steps in Print.
|
||||||
bool invalidate_step(PrintStep step);
|
bool invalidate_step(PrintStep step);
|
||||||
|
|
||||||
|
@ -751,6 +755,9 @@ private:
|
||||||
PrintObjectPtrs m_objects;
|
PrintObjectPtrs m_objects;
|
||||||
PrintRegionPtrs m_print_regions;
|
PrintRegionPtrs m_print_regions;
|
||||||
|
|
||||||
|
//SoftFever
|
||||||
|
bool m_isBBLPrinter;
|
||||||
|
|
||||||
// Ordered collections of extrusion paths to build skirt loops and brim.
|
// Ordered collections of extrusion paths to build skirt loops and brim.
|
||||||
ExtrusionEntityCollection m_skirt;
|
ExtrusionEntityCollection m_skirt;
|
||||||
// BBS: collecting extrusion paths to build brim by objs
|
// BBS: collecting extrusion paths to build brim by objs
|
||||||
|
|
|
@ -183,6 +183,13 @@ std::string BackgroundSlicingProcess::output_filepath_for_project(const boost::f
|
||||||
void BackgroundSlicingProcess::process_fff()
|
void BackgroundSlicingProcess::process_fff()
|
||||||
{
|
{
|
||||||
assert(m_print == m_fff_print);
|
assert(m_print == m_fff_print);
|
||||||
|
PresetBundle &preset_bundle = *wxGetApp().preset_bundle;
|
||||||
|
|
||||||
|
m_fff_print->is_BBL_printer() =
|
||||||
|
preset_bundle.printers.get_edited_preset().is_bbl_vendor_preset(
|
||||||
|
&preset_bundle);
|
||||||
|
|
||||||
|
|
||||||
//BBS: add the logic to process from an existed gcode file
|
//BBS: add the logic to process from an existed gcode file
|
||||||
if (m_print->finished()) {
|
if (m_print->finished()) {
|
||||||
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(" %1%: skip slicing, to process previous gcode file")%__LINE__;
|
BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(" %1%: skip slicing, to process previous gcode file")%__LINE__;
|
||||||
|
|
|
@ -918,10 +918,23 @@ void Sidebar::update_all_preset_comboboxes()
|
||||||
ams_btn->Show();
|
ams_btn->Show();
|
||||||
//update print button default value for bbl or third-party printer
|
//update print button default value for bbl or third-party printer
|
||||||
wxGetApp().mainframe->set_print_button_to_default(MainFrame::PrintSelectType::ePrintPlate);
|
wxGetApp().mainframe->set_print_button_to_default(MainFrame::PrintSelectType::ePrintPlate);
|
||||||
|
MonitorPanel *curr_monitor = wxGetApp().mainframe->m_monitor;
|
||||||
|
if(wxGetApp().mainframe->m_tabpanel->GetPage(3) !=
|
||||||
|
curr_monitor){
|
||||||
|
wxGetApp().mainframe->m_tabpanel->InsertPage(3,
|
||||||
|
curr_monitor, _L("Device"),
|
||||||
|
std::string("tab_monitor_active"),
|
||||||
|
std::string("tab_monitor_active"));
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
connection_btn->Show();
|
connection_btn->Show();
|
||||||
ams_btn->Hide();
|
ams_btn->Hide();
|
||||||
wxGetApp().mainframe->set_print_button_to_default(MainFrame::PrintSelectType::eSendGcode);
|
wxGetApp().mainframe->set_print_button_to_default(MainFrame::PrintSelectType::eSendGcode);
|
||||||
|
MonitorPanel *curr_monitor = wxGetApp().mainframe->m_monitor;
|
||||||
|
if (wxGetApp().mainframe->m_tabpanel->GetPage(3) == curr_monitor) {
|
||||||
|
wxGetApp().mainframe->m_tabpanel->RemovePage(3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the print choosers to only contain the compatible presets, update the dirty flags.
|
// Update the print choosers to only contain the compatible presets, update the dirty flags.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue