mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-14 19:15:54 +08:00
add start_gcode_manual to disable automatic 'start gcode' output
supermerill/SuperSlicer#875
This commit is contained in:
parent
18aae45347
commit
99b3121425
@ -41,6 +41,8 @@ group:Advanced
|
||||
setting:variable_layer_height
|
||||
|
||||
page:Custom G-code:cog
|
||||
group:
|
||||
setting:start_gcode_manual
|
||||
height:15
|
||||
group:nolabel:Start G-code
|
||||
setting:full_width:start_gcode
|
||||
|
@ -1323,14 +1323,15 @@ void GCode::_do_export(Print& print, FILE* file, ThumbnailsGeneratorCallback thu
|
||||
|
||||
std::string start_gcode = this->placeholder_parser_process("start_gcode", print.config().start_gcode.value, initial_extruder_id);
|
||||
// Set bed temperature if the start G-code does not contain any bed temp control G-codes.
|
||||
if(this->config().gcode_flavor != gcfKlipper && print.config().first_layer_bed_temperature.get_at(initial_extruder_id) != 0)
|
||||
if( !this->config().start_gcode_manual && this->config().gcode_flavor != gcfKlipper && print.config().first_layer_bed_temperature.get_at(initial_extruder_id) != 0)
|
||||
this->_print_first_layer_bed_temperature(file, print, start_gcode, initial_extruder_id, false);
|
||||
|
||||
//init extruders
|
||||
if (!this->config().start_gcode_manual)
|
||||
this->_init_multiextruders(file, print, m_writer, tool_ordering, start_gcode);
|
||||
|
||||
// Set extruder(s) temperature before and after start G-code.
|
||||
if ((this->config().gcode_flavor != gcfKlipper || print.config().start_gcode.value.empty()) && print.config().first_layer_temperature.get_at(initial_extruder_id) != 0)
|
||||
if (!this->config().start_gcode_manual && (this->config().gcode_flavor != gcfKlipper || print.config().start_gcode.value.empty()) && print.config().first_layer_temperature.get_at(initial_extruder_id) != 0)
|
||||
this->_print_first_layer_extruder_temperatures(file, print, start_gcode, initial_extruder_id, false);
|
||||
|
||||
// adds tag for processor
|
||||
@ -1350,7 +1351,7 @@ void GCode::_do_export(Print& print, FILE* file, ThumbnailsGeneratorCallback thu
|
||||
*/
|
||||
|
||||
// Disable fan.
|
||||
if (print.config().disable_fan_first_layers.get_at(initial_extruder_id))
|
||||
if (!this->config().start_gcode_manual && print.config().disable_fan_first_layers.get_at(initial_extruder_id))
|
||||
_write(file, m_writer.set_fan(0, true, initial_extruder_id));
|
||||
//ensure fan is at the right speed
|
||||
|
||||
@ -1367,6 +1368,7 @@ void GCode::_do_export(Print& print, FILE* file, ThumbnailsGeneratorCallback thu
|
||||
m_seam_placer.init(print);
|
||||
|
||||
//activate first extruder is multi-extruder and not in start-gcode
|
||||
if (!this->config().start_gcode_manual) {
|
||||
if (m_writer.multiple_extruders) {
|
||||
//if not in gcode
|
||||
bool find = false;
|
||||
@ -1408,11 +1410,15 @@ void GCode::_do_export(Print& print, FILE* file, ThumbnailsGeneratorCallback thu
|
||||
// if we are running a single-extruder setup, just set the extruder and "return nothing"
|
||||
_write(file, this->set_extruder(initial_extruder_id, 0.));
|
||||
}
|
||||
} else {
|
||||
// the right tool should have been set by the user.
|
||||
m_writer.toolchange(initial_extruder_id);
|
||||
}
|
||||
|
||||
//write temps after custom gcodes to ensure the temperature are good. (after tool selection)
|
||||
if(print.config().first_layer_temperature.get_at(initial_extruder_id) != 0)
|
||||
if (!this->config().start_gcode_manual && print.config().first_layer_temperature.get_at(initial_extruder_id) != 0)
|
||||
this->_print_first_layer_extruder_temperatures(file, print, start_gcode, initial_extruder_id, true);
|
||||
if (print.config().first_layer_bed_temperature.get_at(initial_extruder_id) != 0)
|
||||
if (!this->config().start_gcode_manual && print.config().first_layer_bed_temperature.get_at(initial_extruder_id) != 0)
|
||||
this->_print_first_layer_bed_temperature(file, print, start_gcode, initial_extruder_id, true);
|
||||
|
||||
// Do all objects for each layer.
|
||||
@ -2699,7 +2705,10 @@ void GCode::set_origin(const Vec2d &pointf)
|
||||
|
||||
std::string GCode::preamble()
|
||||
{
|
||||
std::string gcode = m_writer.preamble();
|
||||
std::string gcode;
|
||||
|
||||
if (!this->config().start_gcode_manual)
|
||||
gcode = m_writer.preamble();
|
||||
|
||||
/* Perform a *silent* move to z_offset: we need this to initialize the Z
|
||||
position of our writer object so that any initial lift taking place
|
||||
|
@ -692,8 +692,13 @@ const std::vector<std::string>& Preset::printer_options()
|
||||
"min_length",
|
||||
//FIXME the print host keys are left here just for conversion from the Printer preset to Physical Printer preset.
|
||||
"host_type", "print_host", "printhost_apikey", "printhost_cafile", "printhost_port",
|
||||
"single_extruder_multi_material", "start_gcode", "end_gcode", "before_layer_gcode", "layer_gcode", "toolchange_gcode",
|
||||
|
||||
"single_extruder_multi_material",
|
||||
"start_gcode",
|
||||
"start_gcode_manual",
|
||||
"end_gcode",
|
||||
"before_layer_gcode",
|
||||
"layer_gcode",
|
||||
"toolchange_gcode",
|
||||
"color_change_gcode", "pause_print_gcode", "template_custom_gcode", "feature_gcode",
|
||||
"between_objects_gcode", "printer_vendor", "printer_model", "printer_variant", "printer_notes", "cooling_tube_retraction",
|
||||
"cooling_tube_length", "high_current_on_filament_swap", "parking_pos_retraction", "extra_loading_move", "max_print_height",
|
||||
|
@ -164,6 +164,7 @@ bool Print::invalidate_state_by_config_options(const std::vector<t_config_option
|
||||
"slowdown_below_layer_time",
|
||||
"standby_temperature_delta",
|
||||
"start_gcode",
|
||||
"start_gcode_manual",
|
||||
"start_filament_gcode",
|
||||
"thin_walls_speed",
|
||||
"time_estimation_compensation",
|
||||
|
@ -3475,6 +3475,14 @@ void PrintConfigDef::init_fff_params()
|
||||
def->mode = comExpert;
|
||||
def->set_default_value(new ConfigOptionString("G28 ; home all axes\nG1 Z5 F5000 ; lift nozzle\n"));
|
||||
|
||||
def = this->add("start_gcode_manual", coBool);
|
||||
def->label = L("Only custom Start G-code");
|
||||
def->category = OptionCategory::customgcode;
|
||||
def->tooltip = L("Ensure that the slicer won't add heating, fan, extruder... commands before or just after your start-gcode."
|
||||
"If set to true, you have to write a good and complete start_gcode, as no checks are made anymore.");
|
||||
def->mode = comExpert;
|
||||
def->set_default_value(new ConfigOptionBool(false));
|
||||
|
||||
def = this->add("start_filament_gcode", coStrings);
|
||||
def->label = L("Start G-code");
|
||||
def->full_label = ("Filament start G-code");
|
||||
@ -5437,7 +5445,8 @@ void PrintConfigDef::to_prusa(t_config_option_key& opt_key, std::string& value,
|
||||
"external_perimeter_extrusion_spacing",
|
||||
"infill_extrusion_spacing",
|
||||
"solid_infill_extrusion_spacing",
|
||||
"top_infill_extrusion_spacing"
|
||||
"top_infill_extrusion_spacing",
|
||||
"start_gcode_manual",
|
||||
|
||||
};
|
||||
//looks if it's to be removed, or have to be transformed
|
||||
|
@ -1089,6 +1089,7 @@ public:
|
||||
ConfigOptionFloats retract_speed;
|
||||
ConfigOptionStrings start_filament_gcode;
|
||||
ConfigOptionString start_gcode;
|
||||
ConfigOptionBool start_gcode_manual;
|
||||
ConfigOptionBool single_extruder_multi_material;
|
||||
ConfigOptionBool single_extruder_multi_material_priming;
|
||||
ConfigOptionBool wipe_tower_no_sparse_layers;
|
||||
@ -1202,6 +1203,7 @@ protected:
|
||||
OPT_PTR(single_extruder_multi_material_priming);
|
||||
OPT_PTR(wipe_tower_no_sparse_layers);
|
||||
OPT_PTR(start_gcode);
|
||||
OPT_PTR(start_gcode_manual);
|
||||
OPT_PTR(start_filament_gcode);
|
||||
OPT_PTR(tool_name);
|
||||
OPT_PTR(toolchange_gcode);
|
||||
|
Loading…
x
Reference in New Issue
Block a user