Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer
This commit is contained in:
commit
26eaa8af1e
@ -427,39 +427,44 @@ std::string WipeTowerIntegration::post_process_wipe_tower_moves(const WipeTower:
|
|||||||
Vec2f pos = tcr.start_pos;
|
Vec2f pos = tcr.start_pos;
|
||||||
Vec2f transformed_pos = pos;
|
Vec2f transformed_pos = pos;
|
||||||
Vec2f old_pos(-1000.1f, -1000.1f);
|
Vec2f old_pos(-1000.1f, -1000.1f);
|
||||||
|
std::string never_skip_tag = WipeTower::never_skip_tag();
|
||||||
|
|
||||||
while (gcode_str) {
|
while (gcode_str) {
|
||||||
std::getline(gcode_str, line); // we read the gcode line by line
|
std::getline(gcode_str, line); // we read the gcode line by line
|
||||||
|
|
||||||
// All G1 commands should be translated and rotated
|
// All G1 commands should be translated and rotated. X and Y coords are
|
||||||
|
// only pushed to the output when they differ from last time.
|
||||||
|
// WT generator can override this by appending the never_skip_tag
|
||||||
if (line.find("G1 ") == 0) {
|
if (line.find("G1 ") == 0) {
|
||||||
|
bool never_skip = false;
|
||||||
|
auto it = line.find(never_skip_tag);
|
||||||
|
if (it != std::string::npos) {
|
||||||
|
// remove the tag and remember we saw it
|
||||||
|
never_skip = true;
|
||||||
|
line.erase(it, it+never_skip_tag.size());
|
||||||
|
}
|
||||||
std::ostringstream line_out;
|
std::ostringstream line_out;
|
||||||
std::istringstream line_str(line);
|
std::istringstream line_str(line);
|
||||||
line_str >> std::noskipws; // don't skip whitespace
|
line_str >> std::noskipws; // don't skip whitespace
|
||||||
char ch = 0;
|
char ch = 0;
|
||||||
while (line_str >> ch) {
|
while (line_str >> ch) {
|
||||||
if (ch == 'X')
|
if (ch == 'X' || ch =='Y')
|
||||||
line_str >> pos.x();
|
line_str >> (ch == 'X' ? pos.x() : pos.y());
|
||||||
else
|
else
|
||||||
if (ch == 'Y')
|
line_out << ch;
|
||||||
line_str >> pos.y();
|
|
||||||
else
|
|
||||||
line_out << ch;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
transformed_pos = pos;
|
transformed_pos = Eigen::Rotation2Df(angle) * pos + translation;
|
||||||
transformed_pos = Eigen::Rotation2Df(angle) * transformed_pos;
|
|
||||||
transformed_pos += translation;
|
|
||||||
|
|
||||||
if (transformed_pos != old_pos) {
|
if (transformed_pos != old_pos || never_skip) {
|
||||||
line = line_out.str();
|
line = line_out.str();
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << std::fixed << std::setprecision(3) << "G1 ";
|
oss << std::fixed << std::setprecision(3) << "G1 ";
|
||||||
if (transformed_pos.x() != old_pos.x())
|
if (transformed_pos.x() != old_pos.x() || never_skip)
|
||||||
oss << " X" << transformed_pos.x() - extruder_offset.x();
|
oss << " X" << transformed_pos.x() - extruder_offset.x();
|
||||||
if (transformed_pos.y() != old_pos.y())
|
if (transformed_pos.y() != old_pos.y() || never_skip)
|
||||||
oss << " Y" << transformed_pos.y() - extruder_offset.y();
|
oss << " Y" << transformed_pos.y() - extruder_offset.y();
|
||||||
|
oss << " ";
|
||||||
line.replace(line.find("G1 "), 3, oss.str());
|
line.replace(line.find("G1 "), 3, oss.str());
|
||||||
old_pos = transformed_pos;
|
old_pos = transformed_pos;
|
||||||
}
|
}
|
||||||
|
@ -1004,9 +1004,10 @@ void WipeTower::toolchange_Change(
|
|||||||
writer.append("[toolchange_gcode]\n");
|
writer.append("[toolchange_gcode]\n");
|
||||||
|
|
||||||
// Travel to where we assume we are. Custom toolchange or some special T code handling (parking extruder etc)
|
// 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.
|
// gcode could have left the extruder somewhere, we cannot just start extruding. We should also inform the
|
||||||
Vec2f current_pos = writer.pos_rotated();
|
// postprocessor that we absolutely want to have this in the gcode, even if it thought it is the same as before.
|
||||||
writer.append(std::string("G1 X") + std::to_string(current_pos.x()) + " Y" + std::to_string(current_pos.y()) + "\n");
|
Vec2f current_pos = writer.pos_rotated();
|
||||||
|
writer.append(std::string("G1 X") + std::to_string(current_pos.x()) + " Y" + std::to_string(current_pos.y()) + never_skip_tag() + "\n");
|
||||||
|
|
||||||
// The toolchange Tn command will be inserted later, only in case that the user does
|
// The toolchange Tn command will be inserted later, only in case that the user does
|
||||||
// not provide a custom toolchange gcode.
|
// not provide a custom toolchange gcode.
|
||||||
|
@ -17,9 +17,12 @@ class PrintConfig;
|
|||||||
enum GCodeFlavor : unsigned char;
|
enum GCodeFlavor : unsigned char;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class WipeTower
|
class WipeTower
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
static char const* never_skip_tag() { return "_GCODE_WIPE_TOWER_NEVER_SKIP_TAG"; }
|
||||||
|
|
||||||
struct Extrusion
|
struct Extrusion
|
||||||
{
|
{
|
||||||
Extrusion(const Vec2f &pos, float width, unsigned int tool) : pos(pos), width(width), tool(tool) {}
|
Extrusion(const Vec2f &pos, float width, unsigned int tool) : pos(pos), width(width), tool(tool) {}
|
||||||
@ -96,6 +99,8 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Switch to a next layer.
|
// Switch to a next layer.
|
||||||
void set_layer(
|
void set_layer(
|
||||||
// Print height of this layer.
|
// Print height of this layer.
|
||||||
|
@ -1680,11 +1680,18 @@ void Print::_make_skirt()
|
|||||||
if (has_wipe_tower() && ! m_wipe_tower_data.tool_changes.empty()) {
|
if (has_wipe_tower() && ! m_wipe_tower_data.tool_changes.empty()) {
|
||||||
double width = m_config.wipe_tower_width + 2*m_wipe_tower_data.brim_width;
|
double width = m_config.wipe_tower_width + 2*m_wipe_tower_data.brim_width;
|
||||||
double depth = m_wipe_tower_data.depth + 2*m_wipe_tower_data.brim_width;
|
double depth = m_wipe_tower_data.depth + 2*m_wipe_tower_data.brim_width;
|
||||||
Vec2d pt = Vec2d(m_config.wipe_tower_x-m_wipe_tower_data.brim_width, m_config.wipe_tower_y-m_wipe_tower_data.brim_width);
|
Vec2d pt = Vec2d(-m_wipe_tower_data.brim_width, -m_wipe_tower_data.brim_width);
|
||||||
points.push_back(Point(scale_(pt.x()), scale_(pt.y())));
|
|
||||||
points.push_back(Point(scale_(pt.x()+width), scale_(pt.y())));
|
std::vector<Vec2d> pts;
|
||||||
points.push_back(Point(scale_(pt.x()+width), scale_(pt.y()+depth)));
|
pts.push_back(Vec2d(pt.x(), pt.y()));
|
||||||
points.push_back(Point(scale_(pt.x()), scale_(pt.y()+depth)));
|
pts.push_back(Vec2d(pt.x()+width, pt.y()));
|
||||||
|
pts.push_back(Vec2d(pt.x()+width, pt.y()+depth));
|
||||||
|
pts.push_back(Vec2d(pt.x(), pt.y()+depth));
|
||||||
|
for (Vec2d& pt : pts) {
|
||||||
|
pt = Eigen::Rotation2Dd(Geometry::deg2rad(m_config.wipe_tower_rotation_angle.value)) * pt;
|
||||||
|
pt += Vec2d(m_config.wipe_tower_x.value, m_config.wipe_tower_y.value);
|
||||||
|
points.push_back(Point(scale_(pt.x()), scale_(pt.y())));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (points.size() < 3)
|
if (points.size() < 3)
|
||||||
|
@ -185,7 +185,9 @@ bool GUI_App::on_init_inner()
|
|||||||
wxCHECK_MSG(wxDirExists(resources_dir), false,
|
wxCHECK_MSG(wxDirExists(resources_dir), false,
|
||||||
wxString::Format("Resources path does not exist or is not a directory: %s", resources_dir));
|
wxString::Format("Resources path does not exist or is not a directory: %s", resources_dir));
|
||||||
|
|
||||||
SetAppName(SLIC3R_APP_KEY);
|
// Profiles for the alpha are stored into the PrusaSlicer-alpha directory to not mix with the current release.
|
||||||
|
// SetAppName(SLIC3R_APP_KEY);
|
||||||
|
SetAppName(SLIC3R_APP_KEY "-alpha");
|
||||||
SetAppDisplayName(SLIC3R_APP_NAME);
|
SetAppDisplayName(SLIC3R_APP_NAME);
|
||||||
|
|
||||||
// Enable this to get the default Win32 COMCTRL32 behavior of static boxes.
|
// Enable this to get the default Win32 COMCTRL32 behavior of static boxes.
|
||||||
|
Loading…
Reference in New Issue
Block a user