Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_3dconnexion
This commit is contained in:
commit
e6ce74957f
6 changed files with 66 additions and 30 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) {
|
||||||
|
|
|
@ -787,8 +787,10 @@ WipeTower::ToolChangeResult WipeTower::toolchange_Brim(bool sideOnly, float y_of
|
||||||
// The tool is supposed to be active and primed at the time when the wipe tower brim is extruded.
|
// The tool is supposed to be active and primed at the time when the wipe tower brim is extruded.
|
||||||
// Extrude 4 rounds of a brim around the future wipe tower.
|
// Extrude 4 rounds of a brim around the future wipe tower.
|
||||||
box_coordinates box(wipeTower_box);
|
box_coordinates box(wipeTower_box);
|
||||||
|
// the brim shall have 'normal' spacing with no extra void space
|
||||||
|
float spacing = m_perimeter_width - m_layer_height*float(1.-M_PI_4);
|
||||||
for (size_t i = 0; i < 4; ++ i) {
|
for (size_t i = 0; i < 4; ++ i) {
|
||||||
box.expand(m_perimeter_width - m_layer_height*float(1.-M_PI_4)); // the brim shall have 'normal' spacing with no extra void space
|
box.expand(spacing);
|
||||||
writer.travel (box.ld, 7000)
|
writer.travel (box.ld, 7000)
|
||||||
.extrude(box.lu, 2100).extrude(box.ru)
|
.extrude(box.lu, 2100).extrude(box.ru)
|
||||||
.extrude(box.rd ).extrude(box.ld);
|
.extrude(box.rd ).extrude(box.ld);
|
||||||
|
@ -800,6 +802,10 @@ WipeTower::ToolChangeResult WipeTower::toolchange_Brim(bool sideOnly, float y_of
|
||||||
writer.append("; CP WIPE TOWER FIRST LAYER BRIM END\n"
|
writer.append("; CP WIPE TOWER FIRST LAYER BRIM END\n"
|
||||||
";-----------------------------------\n");
|
";-----------------------------------\n");
|
||||||
|
|
||||||
|
// Save actual brim width to be later passed to the Print object, which will use it
|
||||||
|
// for skirt calculation and pass it to GLCanvas for precise preview box
|
||||||
|
m_wipe_tower_brim_width = wipeTower_box.ld.x() - box.ld.x() + spacing/2.f;
|
||||||
|
|
||||||
m_print_brim = false; // Mark the brim as extruded
|
m_print_brim = false; // Mark the brim as extruded
|
||||||
|
|
||||||
// Ask our writer about how much material was consumed:
|
// Ask our writer about how much material was consumed:
|
||||||
|
|
|
@ -92,6 +92,7 @@ public:
|
||||||
void generate(std::vector<std::vector<ToolChangeResult>> &result);
|
void generate(std::vector<std::vector<ToolChangeResult>> &result);
|
||||||
|
|
||||||
float get_depth() const { return m_wipe_tower_depth; }
|
float get_depth() const { return m_wipe_tower_depth; }
|
||||||
|
float get_brim_width() const { return m_wipe_tower_brim_width; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -203,6 +204,7 @@ private:
|
||||||
Vec2f m_wipe_tower_pos; // Left front corner of the wipe tower in mm.
|
Vec2f m_wipe_tower_pos; // Left front corner of the wipe tower in mm.
|
||||||
float m_wipe_tower_width; // Width of the wipe tower.
|
float m_wipe_tower_width; // Width of the wipe tower.
|
||||||
float m_wipe_tower_depth = 0.f; // Depth of the wipe tower
|
float m_wipe_tower_depth = 0.f; // Depth of the wipe tower
|
||||||
|
float m_wipe_tower_brim_width = 0.f; // Width of brim (mm)
|
||||||
float m_wipe_tower_rotation_angle = 0.f; // Wipe tower rotation angle in degrees (with respect to x axis)
|
float m_wipe_tower_rotation_angle = 0.f; // Wipe tower rotation angle in degrees (with respect to x axis)
|
||||||
float m_internal_rotation = 0.f;
|
float m_internal_rotation = 0.f;
|
||||||
float m_y_shift = 0.f; // y shift passed to writer
|
float m_y_shift = 0.f; // y shift passed to writer
|
||||||
|
|
|
@ -143,10 +143,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 +164,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 +208,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 +1187,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 +1505,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 +1529,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 +1605,17 @@ void Print::_make_skirt()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Include the wipe tower.
|
||||||
|
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 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);
|
||||||
|
points.push_back(Point(scale_(pt.x()), scale_(pt.y())));
|
||||||
|
points.push_back(Point(scale_(pt.x()+width), scale_(pt.y())));
|
||||||
|
points.push_back(Point(scale_(pt.x()+width), scale_(pt.y()+depth)));
|
||||||
|
points.push_back(Point(scale_(pt.x()), scale_(pt.y()+depth)));
|
||||||
|
}
|
||||||
|
|
||||||
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;
|
||||||
|
@ -1864,6 +1878,22 @@ bool Print::has_wipe_tower() const
|
||||||
m_config.nozzle_diameter.values.size() > 1;
|
m_config.nozzle_diameter.values.size() > 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const WipeTowerData& Print::wipe_tower_data(size_t extruders_cnt, double first_layer_height, double nozzle_diameter) const
|
||||||
|
{
|
||||||
|
// If the wipe tower wasn't created yet, make sure the depth and brim_width members are set to default.
|
||||||
|
if (! is_step_done(psWipeTower) && extruders_cnt !=0) {
|
||||||
|
|
||||||
|
float width = m_config.wipe_tower_width;
|
||||||
|
float brim_spacing = nozzle_diameter * 1.25f - first_layer_height * (1. - M_PI_4);
|
||||||
|
|
||||||
|
const_cast<Print*>(this)->m_wipe_tower_data.depth = (900.f/width) * float(extruders_cnt - 1);
|
||||||
|
const_cast<Print*>(this)->m_wipe_tower_data.brim_width = 4.5f * brim_spacing;
|
||||||
|
}
|
||||||
|
|
||||||
|
return m_wipe_tower_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void Print::_make_wipe_tower()
|
void Print::_make_wipe_tower()
|
||||||
{
|
{
|
||||||
m_wipe_tower_data.clear();
|
m_wipe_tower_data.clear();
|
||||||
|
@ -1972,6 +2002,7 @@ void Print::_make_wipe_tower()
|
||||||
m_wipe_tower_data.tool_changes.reserve(m_wipe_tower_data.tool_ordering.layer_tools().size());
|
m_wipe_tower_data.tool_changes.reserve(m_wipe_tower_data.tool_ordering.layer_tools().size());
|
||||||
wipe_tower.generate(m_wipe_tower_data.tool_changes);
|
wipe_tower.generate(m_wipe_tower_data.tool_changes);
|
||||||
m_wipe_tower_data.depth = wipe_tower.get_depth();
|
m_wipe_tower_data.depth = wipe_tower.get_depth();
|
||||||
|
m_wipe_tower_data.brim_width = wipe_tower.get_brim_width();
|
||||||
|
|
||||||
// Unload the current filament over the purge tower.
|
// Unload the current filament over the purge tower.
|
||||||
coordf_t layer_height = m_objects.front()->config().layer_height.value;
|
coordf_t layer_height = m_objects.front()->config().layer_height.value;
|
||||||
|
|
|
@ -226,6 +226,7 @@ struct WipeTowerData
|
||||||
|
|
||||||
// Depth of the wipe tower to pass to GLCanvas3D for exact bounding box:
|
// Depth of the wipe tower to pass to GLCanvas3D for exact bounding box:
|
||||||
float depth;
|
float depth;
|
||||||
|
float brim_width;
|
||||||
|
|
||||||
void clear() {
|
void clear() {
|
||||||
tool_ordering.clear();
|
tool_ordering.clear();
|
||||||
|
@ -235,6 +236,7 @@ struct WipeTowerData
|
||||||
used_filament.clear();
|
used_filament.clear();
|
||||||
number_of_toolchanges = -1;
|
number_of_toolchanges = -1;
|
||||||
depth = 0.f;
|
depth = 0.f;
|
||||||
|
brim_width = 0.f;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -314,7 +316,6 @@ public:
|
||||||
|
|
||||||
bool has_infinite_skirt() const;
|
bool has_infinite_skirt() const;
|
||||||
bool has_skirt() const;
|
bool has_skirt() const;
|
||||||
float get_wipe_tower_depth() const { return m_wipe_tower_data.depth; }
|
|
||||||
|
|
||||||
// Returns an empty string if valid, otherwise returns an error message.
|
// Returns an empty string if valid, otherwise returns an error message.
|
||||||
std::string validate() const override;
|
std::string validate() const override;
|
||||||
|
@ -353,7 +354,7 @@ public:
|
||||||
|
|
||||||
// Wipe tower support.
|
// Wipe tower support.
|
||||||
bool has_wipe_tower() const;
|
bool has_wipe_tower() const;
|
||||||
const WipeTowerData& wipe_tower_data() const { return m_wipe_tower_data; }
|
const WipeTowerData& wipe_tower_data(size_t extruders_cnt = 0, double first_layer_height = 0., double nozzle_diameter = 0.) const;
|
||||||
|
|
||||||
std::string output_filename(const std::string &filename_base = std::string()) const override;
|
std::string output_filename(const std::string &filename_base = std::string()) const override;
|
||||||
|
|
||||||
|
|
|
@ -2016,19 +2016,17 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
|
||||||
float a = dynamic_cast<const ConfigOptionFloat*>(m_config->option("wipe_tower_rotation_angle"))->value;
|
float a = dynamic_cast<const ConfigOptionFloat*>(m_config->option("wipe_tower_rotation_angle"))->value;
|
||||||
|
|
||||||
const Print *print = m_process->fff_print();
|
const Print *print = m_process->fff_print();
|
||||||
float depth = print->get_wipe_tower_depth();
|
|
||||||
|
|
||||||
// Calculate wipe tower brim spacing.
|
|
||||||
const DynamicPrintConfig &print_config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
|
const DynamicPrintConfig &print_config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
|
||||||
double layer_height = print_config.opt_float("layer_height");
|
double layer_height = print_config.opt_float("layer_height");
|
||||||
double first_layer_height = print_config.get_abs_value("first_layer_height", layer_height);
|
double first_layer_height = print_config.get_abs_value("first_layer_height", layer_height);
|
||||||
float brim_spacing = print->config().nozzle_diameter.values[0] * 1.25f - first_layer_height * (1. - M_PI_4);
|
double nozzle_diameter = print->config().nozzle_diameter.values[0];
|
||||||
|
float depth = print->wipe_tower_data(extruders_count, first_layer_height, nozzle_diameter).depth;
|
||||||
|
float brim_width = print->wipe_tower_data(extruders_count, first_layer_height, nozzle_diameter).brim_width;
|
||||||
|
|
||||||
if (!print->is_step_done(psWipeTower))
|
|
||||||
depth = (900.f/w) * (float)(extruders_count - 1);
|
|
||||||
int volume_idx_wipe_tower_new = m_volumes.load_wipe_tower_preview(
|
int volume_idx_wipe_tower_new = m_volumes.load_wipe_tower_preview(
|
||||||
1000, x, y, w, depth, (float)height, a, !print->is_step_done(psWipeTower),
|
1000, x, y, w, depth, (float)height, a, !print->is_step_done(psWipeTower),
|
||||||
brim_spacing * 4.5f, m_initialized);
|
brim_width, m_initialized);
|
||||||
if (volume_idx_wipe_tower_old != -1)
|
if (volume_idx_wipe_tower_old != -1)
|
||||||
map_glvolume_old_to_new[volume_idx_wipe_tower_old] = volume_idx_wipe_tower_new;
|
map_glvolume_old_to_new[volume_idx_wipe_tower_old] = volume_idx_wipe_tower_new;
|
||||||
}
|
}
|
||||||
|
@ -5362,20 +5360,18 @@ void GLCanvas3D::_load_fff_shells()
|
||||||
// adds wipe tower's volume
|
// adds wipe tower's volume
|
||||||
double max_z = print->objects()[0]->model_object()->get_model()->bounding_box().max(2);
|
double max_z = print->objects()[0]->model_object()->get_model()->bounding_box().max(2);
|
||||||
const PrintConfig& config = print->config();
|
const PrintConfig& config = print->config();
|
||||||
unsigned int extruders_count = config.nozzle_diameter.size();
|
size_t extruders_count = config.nozzle_diameter.size();
|
||||||
if ((extruders_count > 1) && config.wipe_tower && !config.complete_objects) {
|
if ((extruders_count > 1) && config.wipe_tower && !config.complete_objects) {
|
||||||
float depth = print->get_wipe_tower_depth();
|
|
||||||
|
|
||||||
// Calculate wipe tower brim spacing.
|
|
||||||
const DynamicPrintConfig &print_config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
|
const DynamicPrintConfig &print_config = wxGetApp().preset_bundle->prints.get_edited_preset().config;
|
||||||
double layer_height = print_config.opt_float("layer_height");
|
double layer_height = print_config.opt_float("layer_height");
|
||||||
double first_layer_height = print_config.get_abs_value("first_layer_height", layer_height);
|
double first_layer_height = print_config.get_abs_value("first_layer_height", layer_height);
|
||||||
float brim_spacing = print->config().nozzle_diameter.values[0] * 1.25f - first_layer_height * (1. - M_PI_4);
|
double nozzle_diameter = print->config().nozzle_diameter.values[0];
|
||||||
|
float depth = print->wipe_tower_data(extruders_count, first_layer_height, nozzle_diameter).depth;
|
||||||
|
float brim_width = print->wipe_tower_data(extruders_count, first_layer_height, nozzle_diameter).brim_width;
|
||||||
|
|
||||||
if (!print->is_step_done(psWipeTower))
|
|
||||||
depth = (900.f/config.wipe_tower_width) * (float)(extruders_count - 1);
|
|
||||||
m_volumes.load_wipe_tower_preview(1000, config.wipe_tower_x, config.wipe_tower_y, config.wipe_tower_width, depth, max_z, config.wipe_tower_rotation_angle,
|
m_volumes.load_wipe_tower_preview(1000, config.wipe_tower_x, config.wipe_tower_y, config.wipe_tower_width, depth, max_z, config.wipe_tower_rotation_angle,
|
||||||
!print->is_step_done(psWipeTower), brim_spacing * 4.5f, m_initialized);
|
!print->is_step_done(psWipeTower), brim_width, m_initialized);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue