Skip to content

Commit

Permalink
Merge commit 'e993a26a0ec6d58a0bedb957d1af7e13f68eb4a9' into supersli…
Browse files Browse the repository at this point in the history
…cer_variant
  • Loading branch information
supermerill committed Nov 25, 2024
2 parents 535d67f + e993a26 commit cc151dd
Show file tree
Hide file tree
Showing 13 changed files with 178 additions and 49 deletions.
5 changes: 4 additions & 1 deletion resources/ui_layout/default/print.ui
Original file line number Diff line number Diff line change
Expand Up @@ -538,7 +538,10 @@ group:Wipe tower
setting:wipe_tower_cone_angle
end_line
setting:wipe_tower_bridging
setting:wipe_tower_extra_spacing
line:Purge lines
setting:label$Line width:wipe_tower_extrusion_width
setting:label$Spacing between lines:wipe_tower_extra_spacing
end_line
setting:wipe_tower_no_sparse_layers
line:Priming
setting:single_extruder_multi_material_priming
Expand Down
10 changes: 6 additions & 4 deletions src/libslic3r/ExtrusionEntity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -607,9 +607,10 @@ void SimplifyVisitor::use(ExtrusionPath3D& path3D) {
}
void SimplifyVisitor::use(ExtrusionMultiPath &multipath)
{
for (size_t i = 0;i<multipath.paths.size() ;++i) {
for (size_t i = 0; i < multipath.paths.size(); ++i) {
ExtrusionPath *path = &multipath.paths[i];
//if (min_path_size > 0 && path.length() < min_path_size) {
assert(!m_last_deleted);
path->visit(*this);
while (m_last_deleted) {
ExtrusionPath *path_merged = nullptr;
Expand All @@ -620,7 +621,7 @@ void SimplifyVisitor::use(ExtrusionMultiPath &multipath)
multipath.paths.erase(multipath.paths.begin() + i);
--i;
} else if (i + 1 < multipath.size()) {
ExtrusionPath &path_next = multipath.paths[i];
ExtrusionPath &path_next = multipath.paths[i + 1];
path->polyline.append(path_next.polyline);
// erase next
multipath.paths.erase(multipath.paths.begin() + i + 1);
Expand Down Expand Up @@ -651,7 +652,7 @@ void SimplifyVisitor::use(ExtrusionMultiPath3D &multipath3D)
multipath3D.paths.erase(multipath3D.paths.begin() + i);
--i;
} else if (i + 1 < multipath3D.size()) {
ExtrusionPath &path_next = multipath3D.paths[i];
ExtrusionPath &path_next = multipath3D.paths[i + 1];
path->polyline.append(path_next.polyline);
// erase next
multipath3D.paths.erase(multipath3D.paths.begin() + i + 1);
Expand Down Expand Up @@ -682,7 +683,7 @@ void SimplifyVisitor::use(ExtrusionLoop &loop)
loop.paths.erase(loop.paths.begin() + i);
--i;
} else if (i + 1 < loop.paths.size()) {
ExtrusionPath &path_next = loop.paths[i];
ExtrusionPath &path_next = loop.paths[i + 1];
path->polyline.append(path_next.polyline);
// erase next
loop.paths.erase(loop.paths.begin() + i + 1);
Expand All @@ -708,6 +709,7 @@ void SimplifyVisitor::use(ExtrusionEntityCollection &collection)
// erase it, without any merge.
collection.remove(i);
--i;
m_last_deleted = false;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/libslic3r/GCode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7225,7 +7225,7 @@ void GCodeGenerator::write_travel_to(std::string &gcode, Polyline& travel, std::
this->writer().set_lift(this->writer().get_position().z() - *m_new_z_target);
m_new_z_target.reset();
}
assert(is_approx(this->writer().get_unlifted_position().z(), m_layer->print_z, EPSILON));
assert(is_approx(this->writer().get_unlifted_position().z(), m_layer->print_z, EPSILON) || comment == "Travel to a Wipe Tower");
}

// generate a travel in xyz
Expand Down
2 changes: 1 addition & 1 deletion src/libslic3r/GCode/WipeTower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -763,7 +763,7 @@ void WipeTower::set_extruder(size_t idx)
m_filpar[idx].max_e_speed = (max_vol_speed / filament_area());

m_nozzle_diameter = nozzle_diameter; // all extruders are now assumed to have the same diameter
m_perimeter_width = nozzle_diameter * Width_To_Nozzle_Ratio; // all extruders are now assumed to have the same diameter
m_perimeter_width = m_config->wipe_tower_extrusion_width.get_abs_value(nozzle_diameter); // all extruders are now assumed to have the same diameter

if (m_semm) {
std::istringstream stream{m_config->filament_ramming_parameters.get_at(idx)};
Expand Down
4 changes: 2 additions & 2 deletions src/libslic3r/GCode/WipeTower.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ class WipeTower
SHAPE_REVERSED = -1
};

const float Width_To_Nozzle_Ratio = 1.25f; // desired line width (oval) in multiples of nozzle diameter - may not be actually neccessary to adjust

const float WT_EPSILON = 1e-3f;
float filament_area() const {
return m_filpar[0].filament_area; // all extruders are assumed to have the same filament diameter at this point
Expand Down Expand Up @@ -325,7 +325,7 @@ class WipeTower
Vec2f m_bed_bottom_left; // bottom-left corner coordinates (for rectangular beds)

float m_nozzle_diameter = 0.4f;
float m_perimeter_width = 0.4f * Width_To_Nozzle_Ratio; // Width of an extrusion line, also a perimeter spacing for 100% infill.
float m_perimeter_width = 0.5f; // Width of an extrusion line, also a perimeter spacing for 100% infill.
float m_extrusion_flow = 0.038f; //0.029f;// Extrusion flow is derived from m_perimeter_width, layer height and filament diameter.

// Extruder specific parameters.
Expand Down
35 changes: 32 additions & 3 deletions src/libslic3r/Geometry/ArcWelder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -892,6 +892,14 @@ Path fit_path(const Points &src_in, double tolerance, double fit_circle_percent_

void reverse(Path &path)
{
#ifdef _DEBUG
for (size_t i = 1; i < path.size(); i++) {
if (path[i].radius) {
const coordf_t computed_length = segment_length<coordf_t>(path[i - 1], path[i]);
assert(is_approx(computed_length, path[i].length, SCALED_EPSILON*1.));
}
}
#endif
if (path.size() > 1) {
auto prev = path.begin();
assert(prev->radius == 0);
Expand All @@ -909,32 +917,53 @@ void reverse(Path &path)
path.back().orientation = Orientation::Unknown;
std::reverse(path.begin(), path.end());
}
#ifdef _DEBUG
for (size_t i = 1; i < path.size(); i++) {
if(path[i].radius)
assert(is_approx(segment_length<coordf_t>(path[i-1], path[i]), path[i].length, EPSILON));
if (path[i].radius) {
const coordf_t computed_length = segment_length<coordf_t>(path[i - 1], path[i]);
assert(is_approx(computed_length, path[i].length, SCALED_EPSILON*1.));
}
}
#endif
}

double clip_start(Path &path, const coordf_t len)
{
#ifdef _DEBUG
Path ptest1 = path;
double rem1 = clip_end(ptest1, len);

for (size_t i = 1; i < path.size(); i++) {
if (path[i].radius) {
coordf_t new_length = segment_length<coordf_t>(path[i - 1], path[i]);
assert(is_approx(new_length, path[i].length, EPSILON));
}
}
#endif
reverse(path);
double remaining = clip_end(path, len);
reverse(path);
#ifdef _DEBUG
for (size_t i = 1; i < path.size(); i++) {
if (path[i].radius) {
coordf_t new_length = segment_length<coordf_t>(path[i - 1], path[i]);
assert(is_approx(new_length, path[i].length, EPSILON));
}
}
#endif
// Return remaining distance to go.
return remaining;
}

double clip_end(Path &path, coordf_t distance)
{
#ifdef _DEBUG
for (size_t i = 1; i < path.size(); i++) {
if (path[i].radius) {
coordf_t new_length = segment_length<coordf_t>(path[i - 1], path[i]);
assert(is_approx(new_length, path[i].length, EPSILON));
}
}
#endif
while (distance > 0) {
const Segment last = path.back();
path.pop_back();
Expand Down
Loading

0 comments on commit cc151dd

Please sign in to comment.