mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 13:25:56 +08:00
Custom G-code editor: removed internal parsing of wipe tower gcode
This commit is contained in:
parent
b8bb7f2716
commit
c66929387e
@ -2103,7 +2103,7 @@ public:
|
||||
out.push_back(kvp.first);
|
||||
return out;
|
||||
}
|
||||
bool empty() { return options.empty(); }
|
||||
bool empty() const { return options.empty(); }
|
||||
|
||||
// Iterate through all of the CLI options and write them to a stream.
|
||||
std::ostream& print_cli_help(
|
||||
|
@ -1008,7 +1008,7 @@ void WipeTower::toolchange_Change(
|
||||
// This is where we want to place the custom gcodes. We will use placeholders for this.
|
||||
// These will be substituted by the actual gcodes when the gcode is generated.
|
||||
//writer.append("[end_filament_gcode]\n");
|
||||
writer.append("[toolchange_gcode]\n");
|
||||
writer.append("[toolchange_gcode_from_wipe_tower_generator]\n");
|
||||
|
||||
// Travel to where we assume we are. Custom toolchange or some special T code handling (parking extruder etc)
|
||||
// gcode could have left the extruder somewhere, we cannot just start extruding. We should also inform the
|
||||
|
@ -3,6 +3,8 @@
|
||||
#include "../GCode.hpp"
|
||||
#include "../libslic3r.h"
|
||||
|
||||
#include "boost/algorithm/string/replace.hpp"
|
||||
|
||||
namespace Slic3r::GCode {
|
||||
|
||||
static inline Point wipe_tower_point_to_object_point(GCodeGenerator &gcodegen, const Vec2f& wipe_tower_pt)
|
||||
@ -81,19 +83,15 @@ std::string WipeTowerIntegration::append_tcr(GCodeGenerator &gcodegen, const Wip
|
||||
if (gcodegen.config().wipe_tower)
|
||||
deretraction_str = gcodegen.unretract();
|
||||
}
|
||||
|
||||
|
||||
|
||||
assert(toolchange_gcode_str.empty() || toolchange_gcode_str.back() == '\n');
|
||||
assert(deretraction_str.empty() || deretraction_str.back() == '\n');
|
||||
|
||||
// Insert the toolchange and deretraction gcode into the generated gcode.
|
||||
DynamicConfig config;
|
||||
config.set_key_value("toolchange_gcode", new ConfigOptionString(toolchange_gcode_str));
|
||||
config.set_key_value("deretraction_from_wipe_tower_generator", new ConfigOptionString(deretraction_str));
|
||||
std::string tcr_gcode, tcr_escaped_gcode = gcodegen.placeholder_parser_process("tcr_rotated_gcode", tcr_rotated_gcode, new_extruder_id, &config);
|
||||
unescape_string_cstyle(tcr_escaped_gcode, tcr_gcode);
|
||||
boost::replace_first(tcr_rotated_gcode, "[toolchange_gcode_from_wipe_tower_generator]", toolchange_gcode_str);
|
||||
boost::replace_first(tcr_rotated_gcode, "[deretraction_from_wipe_tower_generator]", deretraction_str);
|
||||
std::string tcr_gcode;
|
||||
unescape_string_cstyle(tcr_rotated_gcode, tcr_gcode);
|
||||
gcode += tcr_gcode;
|
||||
if (! toolchange_gcode_str.empty() && toolchange_gcode_str.back() != '\n')
|
||||
toolchange_gcode_str += '\n';
|
||||
|
||||
// A phony move to the end position at the wipe tower.
|
||||
gcodegen.writer().travel_to_xy(end_pos.cast<double>());
|
||||
|
@ -5275,8 +5275,6 @@ static std::map<t_custom_gcode_key, t_config_option_keys> s_CustomGcodeSpecificP
|
||||
{"before_layer_gcode", {"layer_num", "layer_z", "max_layer_z"}},
|
||||
{"layer_gcode", {"layer_num", "layer_z", "max_layer_z"}},
|
||||
{"toolchange_gcode", {"layer_num", "layer_z", "max_layer_z", "previous_extruder", "next_extruder", "toolchange_z"}},
|
||||
// some internal g_code ?
|
||||
{"tcr_rotated_gcode", {"toolchange_gcode", "deretraction_from_wipe_tower_generator"}},
|
||||
};
|
||||
|
||||
const std::map<t_custom_gcode_key, t_config_option_keys>& custom_gcode_specific_placeholders()
|
||||
@ -5315,16 +5313,6 @@ CustomGcodeSpecificConfigDef::CustomGcodeSpecificConfigDef()
|
||||
def = this->add("toolchange_z", coFloat);
|
||||
def->label = L("");
|
||||
def->tooltip = L("");
|
||||
|
||||
// I'm not sure if next options are really needed
|
||||
|
||||
def = this->add("toolchange_gcode", coString);
|
||||
def->label = L("");
|
||||
def->tooltip = L("");
|
||||
|
||||
def = this->add("deretraction_from_wipe_tower_generator", coString);
|
||||
def->label = L("");
|
||||
def->tooltip = L("");
|
||||
}
|
||||
|
||||
const CustomGcodeSpecificConfigDef custom_gcode_specific_config_def;
|
||||
|
Loading…
x
Reference in New Issue
Block a user