Include wipe tower in skirt
This commit is contained in:
parent
9a9c3bac39
commit
aba743de41
3 changed files with 64 additions and 14 deletions
|
@ -138,7 +138,7 @@ BoundingBoxf get_wipe_tower_extrusions_extents(const Print &print, const coordf_
|
||||||
// We need to get position and angle of the wipe tower to transform them to actual position.
|
// We need to get position and angle of the wipe tower to transform them to actual position.
|
||||||
Transform2d trafo =
|
Transform2d trafo =
|
||||||
Eigen::Translation2d(print.config().wipe_tower_x.value, print.config().wipe_tower_y.value) *
|
Eigen::Translation2d(print.config().wipe_tower_x.value, print.config().wipe_tower_y.value) *
|
||||||
Eigen::Rotation2Dd(print.config().wipe_tower_rotation_angle.value);
|
Eigen::Rotation2Dd(Geometry::deg2rad(print.config().wipe_tower_rotation_angle.value));
|
||||||
|
|
||||||
BoundingBoxf bbox;
|
BoundingBoxf bbox;
|
||||||
for (const std::vector<WipeTower::ToolChangeResult> &tool_changes : print.wipe_tower_data().tool_changes) {
|
for (const std::vector<WipeTower::ToolChangeResult> &tool_changes : print.wipe_tower_data().tool_changes) {
|
||||||
|
@ -160,6 +160,43 @@ BoundingBoxf get_wipe_tower_extrusions_extents(const Print &print, const coordf_
|
||||||
return bbox;
|
return bbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns a vector of points of a projection of the wipe tower for the layers <= max_print_z.
|
||||||
|
// The projection does not contain the priming regions.
|
||||||
|
std::vector<Vec2d> get_wipe_tower_extrusions_points(const Print &print, const coordf_t max_print_z)
|
||||||
|
{
|
||||||
|
// Wipe tower extrusions are saved as if the tower was at the origin with no rotation
|
||||||
|
// We need to get position and angle of the wipe tower to transform them to actual position.
|
||||||
|
Transform2d trafo =
|
||||||
|
Eigen::Translation2d(print.config().wipe_tower_x.value, print.config().wipe_tower_y.value) *
|
||||||
|
Eigen::Rotation2Dd(Geometry::deg2rad(print.config().wipe_tower_rotation_angle.value));
|
||||||
|
|
||||||
|
BoundingBoxf bbox;
|
||||||
|
for (const std::vector<WipeTower::ToolChangeResult> &tool_changes : print.wipe_tower_data().tool_changes) {
|
||||||
|
if (!tool_changes.empty() && tool_changes.front().print_z > max_print_z)
|
||||||
|
break;
|
||||||
|
for (const WipeTower::ToolChangeResult &tcr : tool_changes) {
|
||||||
|
for (size_t i = 1; i < tcr.extrusions.size(); ++i) {
|
||||||
|
const WipeTower::Extrusion &e = tcr.extrusions[i];
|
||||||
|
if (e.width > 0) {
|
||||||
|
Vec2d delta = 0.5 * Vec2d(e.width, e.width);
|
||||||
|
Vec2d p1 = Vec2d((&e - 1)->pos.x, (&e - 1)->pos.y);
|
||||||
|
Vec2d p2 = Vec2d(e.pos.x, e.pos.y);
|
||||||
|
bbox.merge(p1.cwiseMin(p2) - delta);
|
||||||
|
bbox.merge(p1.cwiseMax(p2) + delta);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<Vec2d> points;
|
||||||
|
points.push_back(trafo * Vec2d(bbox.min.x(), bbox.max.y()));
|
||||||
|
points.push_back(trafo * Vec2d(bbox.max.x(), bbox.max.y()));
|
||||||
|
points.push_back(trafo * Vec2d(bbox.max.x(), bbox.min.y()));
|
||||||
|
points.push_back(trafo * Vec2d(bbox.min.x(), bbox.min.y()));
|
||||||
|
|
||||||
|
return points;
|
||||||
|
}
|
||||||
|
|
||||||
// Returns a bounding box of the wipe tower priming extrusions.
|
// Returns a bounding box of the wipe tower priming extrusions.
|
||||||
BoundingBoxf get_wipe_tower_priming_extrusions_extents(const Print &print)
|
BoundingBoxf get_wipe_tower_priming_extrusions_extents(const Print &print)
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,6 +22,10 @@ BoundingBoxf get_print_object_extrusions_extents(const PrintObject &print_object
|
||||||
// The projection does not contain the priming regions.
|
// The projection does not contain the priming regions.
|
||||||
BoundingBoxf get_wipe_tower_extrusions_extents(const Print &print, const coordf_t max_print_z);
|
BoundingBoxf get_wipe_tower_extrusions_extents(const Print &print, const coordf_t max_print_z);
|
||||||
|
|
||||||
|
// Returns a vector of points of a projection of the wipe tower for the layers <= max_print_z.
|
||||||
|
// The projection does not contain the priming regions.
|
||||||
|
std::vector<Vec2d> get_wipe_tower_extrusions_points(const Print &print, const coordf_t max_print_z);
|
||||||
|
|
||||||
// Returns a bounding box of the wipe tower priming extrusions.
|
// Returns a bounding box of the wipe tower priming extrusions.
|
||||||
BoundingBoxf get_wipe_tower_priming_extrusions_extents(const Print &print);
|
BoundingBoxf get_wipe_tower_priming_extrusions_extents(const Print &print);
|
||||||
|
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "SupportMaterial.hpp"
|
#include "SupportMaterial.hpp"
|
||||||
#include "GCode.hpp"
|
#include "GCode.hpp"
|
||||||
#include "GCode/WipeTower.hpp"
|
#include "GCode/WipeTower.hpp"
|
||||||
|
#include "GCode/PrintExtents.hpp"
|
||||||
#include "Utils.hpp"
|
#include "Utils.hpp"
|
||||||
|
|
||||||
//#include "PrintExport.hpp"
|
//#include "PrintExport.hpp"
|
||||||
|
@ -143,10 +144,7 @@ bool Print::invalidate_state_by_config_options(const std::vector<t_config_option
|
||||||
"use_relative_e_distances",
|
"use_relative_e_distances",
|
||||||
"use_volumetric_e",
|
"use_volumetric_e",
|
||||||
"variable_layer_height",
|
"variable_layer_height",
|
||||||
"wipe",
|
"wipe"
|
||||||
"wipe_tower_x",
|
|
||||||
"wipe_tower_y",
|
|
||||||
"wipe_tower_rotation_angle"
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::unordered_set<std::string> steps_ignore;
|
static std::unordered_set<std::string> steps_ignore;
|
||||||
|
@ -167,7 +165,10 @@ bool Print::invalidate_state_by_config_options(const std::vector<t_config_option
|
||||||
|| opt_key == "skirt_height"
|
|| opt_key == "skirt_height"
|
||||||
|| opt_key == "skirt_distance"
|
|| opt_key == "skirt_distance"
|
||||||
|| opt_key == "min_skirt_length"
|
|| opt_key == "min_skirt_length"
|
||||||
|| opt_key == "ooze_prevention") {
|
|| opt_key == "ooze_prevention"
|
||||||
|
|| opt_key == "wipe_tower_x"
|
||||||
|
|| opt_key == "wipe_tower_y"
|
||||||
|
|| opt_key == "wipe_tower_rotation_angle") {
|
||||||
steps.emplace_back(psSkirt);
|
steps.emplace_back(psSkirt);
|
||||||
} else if (opt_key == "brim_width") {
|
} else if (opt_key == "brim_width") {
|
||||||
steps.emplace_back(psBrim);
|
steps.emplace_back(psBrim);
|
||||||
|
@ -208,6 +209,7 @@ bool Print::invalidate_state_by_config_options(const std::vector<t_config_option
|
||||||
|| opt_key == "extra_loading_move"
|
|| opt_key == "extra_loading_move"
|
||||||
|| opt_key == "z_offset") {
|
|| opt_key == "z_offset") {
|
||||||
steps.emplace_back(psWipeTower);
|
steps.emplace_back(psWipeTower);
|
||||||
|
steps.emplace_back(psSkirt);
|
||||||
} else if (
|
} else if (
|
||||||
opt_key == "first_layer_extrusion_width"
|
opt_key == "first_layer_extrusion_width"
|
||||||
|| opt_key == "min_layer_height"
|
|| opt_key == "min_layer_height"
|
||||||
|
@ -1186,6 +1188,8 @@ std::string Print::validate() const
|
||||||
return L("The Wipe Tower is currently only supported with the relative extruder addressing (use_relative_e_distances=1).");
|
return L("The Wipe Tower is currently only supported with the relative extruder addressing (use_relative_e_distances=1).");
|
||||||
if (m_config.ooze_prevention)
|
if (m_config.ooze_prevention)
|
||||||
return L("Ooze prevention is currently not supported with the wipe tower enabled.");
|
return L("Ooze prevention is currently not supported with the wipe tower enabled.");
|
||||||
|
if (m_config.use_volumetric_e)
|
||||||
|
return L("The Wipe Tower currently does not support volumetric E (use_volumetric_e=0).");
|
||||||
|
|
||||||
if (m_objects.size() > 1) {
|
if (m_objects.size() > 1) {
|
||||||
bool has_custom_layering = false;
|
bool has_custom_layering = false;
|
||||||
|
@ -1502,6 +1506,14 @@ void Print::process()
|
||||||
obj->infill();
|
obj->infill();
|
||||||
for (PrintObject *obj : m_objects)
|
for (PrintObject *obj : m_objects)
|
||||||
obj->generate_support_material();
|
obj->generate_support_material();
|
||||||
|
if (this->set_started(psWipeTower)) {
|
||||||
|
m_wipe_tower_data.clear();
|
||||||
|
if (this->has_wipe_tower()) {
|
||||||
|
//this->set_status(95, L("Generating wipe tower"));
|
||||||
|
this->_make_wipe_tower();
|
||||||
|
}
|
||||||
|
this->set_done(psWipeTower);
|
||||||
|
}
|
||||||
if (this->set_started(psSkirt)) {
|
if (this->set_started(psSkirt)) {
|
||||||
m_skirt.clear();
|
m_skirt.clear();
|
||||||
if (this->has_skirt()) {
|
if (this->has_skirt()) {
|
||||||
|
@ -1518,14 +1530,6 @@ void Print::process()
|
||||||
}
|
}
|
||||||
this->set_done(psBrim);
|
this->set_done(psBrim);
|
||||||
}
|
}
|
||||||
if (this->set_started(psWipeTower)) {
|
|
||||||
m_wipe_tower_data.clear();
|
|
||||||
if (this->has_wipe_tower()) {
|
|
||||||
//this->set_status(95, L("Generating wipe tower"));
|
|
||||||
this->_make_wipe_tower();
|
|
||||||
}
|
|
||||||
this->set_done(psWipeTower);
|
|
||||||
}
|
|
||||||
BOOST_LOG_TRIVIAL(info) << "Slicing process finished." << log_memory_info();
|
BOOST_LOG_TRIVIAL(info) << "Slicing process finished." << log_memory_info();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1602,6 +1606,11 @@ void Print::_make_skirt()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Include the wipe tower.
|
||||||
|
if (has_wipe_tower())
|
||||||
|
for (const Vec2d& point : get_wipe_tower_extrusions_points(*this, skirt_height_z))
|
||||||
|
points.push_back(Point(scale_(point.x()), scale_(point.y())));
|
||||||
|
|
||||||
if (points.size() < 3)
|
if (points.size() < 3)
|
||||||
// At least three points required for a convex hull.
|
// At least three points required for a convex hull.
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue