mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-18 22:31:13 -06:00
Merge remote-tracking branch 'origin/enh-port-edit-gcode-dlg' into enh-port-edit-gcode-dlg
This commit is contained in:
commit
b619e5bf8e
66 changed files with 962 additions and 966 deletions
|
@ -44,6 +44,8 @@ void ExtrusionLine::simplify(const int64_t smallest_line_segment_squared, const
|
|||
if (junctions.size() <= min_path_size)
|
||||
return;
|
||||
|
||||
// TODO: allow for the first point to be removed in case of simplifying closed Extrusionlines.
|
||||
|
||||
/* ExtrusionLines are treated as (open) polylines, so in case an ExtrusionLine is actually a closed polygon, its
|
||||
* starting and ending points will be equal (or almost equal). Therefore, the simplification of the ExtrusionLine
|
||||
* should not touch the first and last points. As a result, start simplifying from point at index 1.
|
||||
|
@ -52,16 +54,12 @@ void ExtrusionLine::simplify(const int64_t smallest_line_segment_squared, const
|
|||
// Starting junction should always exist in the simplified path
|
||||
new_junctions.emplace_back(junctions.front());
|
||||
|
||||
ExtrusionJunction previous = junctions.front();
|
||||
/* For open ExtrusionLines the last junction cannot be taken into consideration when checking the points at index 1.
|
||||
* For closed ExtrusionLines, the first and last junctions are the same, so use the prior to last juction.
|
||||
/* Initially, previous_previous is always the same as previous because, for open ExtrusionLines the last junction
|
||||
* cannot be taken into consideration when checking the points at index 1. For closed ExtrusionLines, the first and
|
||||
* last junctions are anyway the same.
|
||||
* */
|
||||
ExtrusionJunction previous_previous = this->is_closed ? junctions[junctions.size() - 2] : junctions.front();
|
||||
|
||||
/* TODO: When deleting, combining, or modifying junctions, it would
|
||||
* probably be good to set the new junction's width to a weighted average
|
||||
* of the junctions it is derived from.
|
||||
*/
|
||||
ExtrusionJunction previous_previous = junctions.front();
|
||||
ExtrusionJunction previous = junctions.front();
|
||||
|
||||
/* When removing a vertex, we check the height of the triangle of the area
|
||||
being removed from the original polygon by the simplification. However,
|
||||
|
@ -78,20 +76,16 @@ void ExtrusionLine::simplify(const int64_t smallest_line_segment_squared, const
|
|||
From this area we compute the height of the representative triangle using
|
||||
the standard formula for a triangle area: A = .5*b*h
|
||||
*/
|
||||
const ExtrusionJunction& initial = junctions[1];
|
||||
const ExtrusionJunction& initial = junctions.at(1);
|
||||
int64_t accumulated_area_removed = int64_t(previous.p.x()) * int64_t(initial.p.y()) - int64_t(previous.p.y()) * int64_t(initial.p.x()); // Twice the Shoelace formula for area of polygon per line segment.
|
||||
|
||||
// For a closed polygon we process the last point, which is the same as the first point.
|
||||
for (size_t point_idx = 1; point_idx < junctions.size() - (this->is_closed ? 0 : 1); point_idx++)
|
||||
for (size_t point_idx = 1; point_idx < junctions.size() - 1; point_idx++)
|
||||
{
|
||||
// For the last point of a closed polygon, use the first point of the new polygon in case we modified it.
|
||||
const bool is_last = point_idx + 1 == junctions.size();
|
||||
const ExtrusionJunction& current = is_last ? new_junctions[0] : junctions[point_idx];
|
||||
const ExtrusionJunction& current = junctions[point_idx];
|
||||
|
||||
// Spill over in case of overflow, unless the [next] vertex will then be equal to [previous].
|
||||
const bool spill_over = this->is_closed && point_idx + 2 >= junctions.size() &&
|
||||
point_idx + 2 - junctions.size() < new_junctions.size();
|
||||
ExtrusionJunction& next = spill_over ? new_junctions[point_idx + 2 - junctions.size()] : junctions[point_idx + 1];
|
||||
const bool spill_over = point_idx + 1 == junctions.size() && new_junctions.size() > 1;
|
||||
ExtrusionJunction& next = spill_over ? new_junctions[0] : junctions[point_idx + 1];
|
||||
|
||||
const int64_t removed_area_next = int64_t(current.p.x()) * int64_t(next.p.y()) - int64_t(current.p.y()) * int64_t(next.p.x()); // Twice the Shoelace formula for area of polygon per line segment.
|
||||
const int64_t negative_area_closing = int64_t(next.p.x()) * int64_t(previous.p.y()) - int64_t(next.p.y()) * int64_t(previous.p.x()); // Area between the origin and the short-cutting segment
|
||||
|
@ -139,18 +133,12 @@ void ExtrusionLine::simplify(const int64_t smallest_line_segment_squared, const
|
|||
// We should instead move this point to a location where both edges are kept and then remove the previous point that we wanted to keep.
|
||||
// By taking the intersection of these two lines, we get a point that preserves the direction (so it makes the corner a bit more pointy).
|
||||
// We just need to be sure that the intersection point does not introduce an artifact itself.
|
||||
// o < prev_prev
|
||||
// |
|
||||
// o < prev
|
||||
// \ < short segment
|
||||
// intersection > + o-------------------o < next
|
||||
// ^ current
|
||||
Point intersection_point;
|
||||
bool has_intersection = Line(previous_previous.p, previous.p).intersection_infinite(Line(current.p, next.p), &intersection_point);
|
||||
if (!has_intersection
|
||||
|| Line::distance_to_infinite_squared(intersection_point, previous.p, current.p) > double(allowed_error_distance_squared)
|
||||
|| (intersection_point - previous.p).cast<int64_t>().squaredNorm() > smallest_line_segment_squared // The intersection point is way too far from the 'previous'
|
||||
|| (intersection_point - current.p).cast<int64_t>().squaredNorm() > smallest_line_segment_squared) // and 'current' points, so it shouldn't replace 'current'
|
||||
|| (intersection_point - next.p).cast<int64_t>().squaredNorm() > smallest_line_segment_squared) // and 'next' points, so it shouldn't replace 'current'
|
||||
{
|
||||
// We can't find a better spot for it, but the size of the line is more than 5 micron.
|
||||
// So the only thing we can do here is leave it in...
|
||||
|
@ -186,14 +174,15 @@ void ExtrusionLine::simplify(const int64_t smallest_line_segment_squared, const
|
|||
new_junctions.push_back(current);
|
||||
}
|
||||
|
||||
if (this->is_closed) {
|
||||
/* The first and last points should be the same for a closed polygon.
|
||||
* We processed the last point above, so copy it into the first point.
|
||||
*/
|
||||
new_junctions.front().p = new_junctions.back().p;
|
||||
} else {
|
||||
// Ending junction (vertex) should always exist in the simplified path
|
||||
new_junctions.emplace_back(junctions.back());
|
||||
// Ending junction (vertex) should always exist in the simplified path
|
||||
new_junctions.emplace_back(junctions.back());
|
||||
|
||||
/* In case this is a closed polygon (instead of a poly-line-segments), the invariant that the first and last points are the same should be enforced.
|
||||
* Since one of them didn't move, and the other can't have been moved further than the constraints, if originally equal, they can simply be equated.
|
||||
*/
|
||||
if ((junctions.front().p - junctions.back().p).cast<int64_t>().squaredNorm() == 0)
|
||||
{
|
||||
new_junctions.back().p = junctions.front().p;
|
||||
}
|
||||
|
||||
junctions = new_junctions;
|
||||
|
|
|
@ -85,8 +85,6 @@ set(lisbslic3r_sources
|
|||
ExtrusionEntity.hpp
|
||||
ExtrusionEntityCollection.cpp
|
||||
ExtrusionEntityCollection.hpp
|
||||
ExtrusionRole.cpp
|
||||
ExtrusionRole.hpp
|
||||
ExtrusionSimulator.cpp
|
||||
ExtrusionSimulator.hpp
|
||||
FileParserError.hpp
|
||||
|
|
|
@ -1,94 +0,0 @@
|
|||
///|/ Copyright (c) Prusa Research 2023 Pavel Mikuš @Godrak, Oleksandra Iushchenko @YuSanka, Vojtěch Bubník @bubnikv
|
||||
///|/
|
||||
///|/ PrusaSlicer is released under the terms of the AGPLv3 or higher
|
||||
///|/
|
||||
#include "ExtrusionRole.hpp"
|
||||
#include "I18N.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <cassert>
|
||||
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
// Convert a rich bitmask based ExtrusionRole to a less expressive ordinal GCodeExtrusionRole.
|
||||
// GCodeExtrusionRole is to be serialized into G-code and deserialized by G-code viewer,
|
||||
GCodeExtrusionRole extrusion_role_to_gcode_extrusion_role(ExtrusionRole role)
|
||||
{
|
||||
if (role == erNone) return GCodeExtrusionRole::None;
|
||||
if (role == erOverhangPerimeter) return GCodeExtrusionRole::OverhangPerimeter;
|
||||
if (role == erExternalPerimeter) return GCodeExtrusionRole::ExternalPerimeter;
|
||||
if (role == erPerimeter) return GCodeExtrusionRole::Perimeter;
|
||||
if (role == erInternalInfill) return GCodeExtrusionRole::InternalInfill;
|
||||
if (role == erSolidInfill) return GCodeExtrusionRole::SolidInfill;
|
||||
if (role == erTopSolidInfill) return GCodeExtrusionRole::TopSolidInfill;
|
||||
if (role == erIroning) return GCodeExtrusionRole::Ironing;
|
||||
if (role == erBridgeInfill) return GCodeExtrusionRole::BridgeInfill;
|
||||
if (role == erGapFill) return GCodeExtrusionRole::GapFill;
|
||||
if (role == erSkirt) return GCodeExtrusionRole::Skirt;
|
||||
if (role == erSupportMaterial) return GCodeExtrusionRole::SupportMaterial;
|
||||
if (role == erSupportMaterialInterface) return GCodeExtrusionRole::SupportMaterialInterface;
|
||||
if (role == erWipeTower) return GCodeExtrusionRole::WipeTower;
|
||||
assert(false);
|
||||
return GCodeExtrusionRole::None;
|
||||
}
|
||||
|
||||
std::string gcode_extrusion_role_to_string(GCodeExtrusionRole role)
|
||||
{
|
||||
switch (role) {
|
||||
case GCodeExtrusionRole::None : return L("Unknown");
|
||||
case GCodeExtrusionRole::Perimeter : return L("Perimeter");
|
||||
case GCodeExtrusionRole::ExternalPerimeter : return L("External perimeter");
|
||||
case GCodeExtrusionRole::OverhangPerimeter : return L("Overhang perimeter");
|
||||
case GCodeExtrusionRole::InternalInfill : return L("Internal infill");
|
||||
case GCodeExtrusionRole::SolidInfill : return L("Solid infill");
|
||||
case GCodeExtrusionRole::TopSolidInfill : return L("Top solid infill");
|
||||
case GCodeExtrusionRole::Ironing : return L("Ironing");
|
||||
case GCodeExtrusionRole::BridgeInfill : return L("Bridge infill");
|
||||
case GCodeExtrusionRole::GapFill : return L("Gap fill");
|
||||
case GCodeExtrusionRole::Skirt : return L("Skirt/Brim");
|
||||
case GCodeExtrusionRole::SupportMaterial : return L("Support material");
|
||||
case GCodeExtrusionRole::SupportMaterialInterface : return L("Support material interface");
|
||||
case GCodeExtrusionRole::WipeTower : return L("Wipe tower");
|
||||
case GCodeExtrusionRole::Custom : return L("Custom");
|
||||
default : assert(false);
|
||||
}
|
||||
return {};
|
||||
}
|
||||
|
||||
GCodeExtrusionRole string_to_gcode_extrusion_role(const std::string_view role)
|
||||
{
|
||||
if (role == L("Perimeter"))
|
||||
return GCodeExtrusionRole::Perimeter;
|
||||
else if (role == L("External perimeter"))
|
||||
return GCodeExtrusionRole::ExternalPerimeter;
|
||||
else if (role == L("Overhang perimeter"))
|
||||
return GCodeExtrusionRole::OverhangPerimeter;
|
||||
else if (role == L("Internal infill"))
|
||||
return GCodeExtrusionRole::InternalInfill;
|
||||
else if (role == L("Solid infill"))
|
||||
return GCodeExtrusionRole::SolidInfill;
|
||||
else if (role == L("Top solid infill"))
|
||||
return GCodeExtrusionRole::TopSolidInfill;
|
||||
else if (role == L("Ironing"))
|
||||
return GCodeExtrusionRole::Ironing;
|
||||
else if (role == L("Bridge infill"))
|
||||
return GCodeExtrusionRole::BridgeInfill;
|
||||
else if (role == L("Gap fill"))
|
||||
return GCodeExtrusionRole::GapFill;
|
||||
else if (role == L("Skirt") || role == L("Skirt/Brim")) // "Skirt" is for backward compatibility with 2.3.1 and earlier
|
||||
return GCodeExtrusionRole::Skirt;
|
||||
else if (role == L("Support material"))
|
||||
return GCodeExtrusionRole::SupportMaterial;
|
||||
else if (role == L("Support material interface"))
|
||||
return GCodeExtrusionRole::SupportMaterialInterface;
|
||||
else if (role == L("Wipe tower"))
|
||||
return GCodeExtrusionRole::WipeTower;
|
||||
else if (role == L("Custom"))
|
||||
return GCodeExtrusionRole::Custom;
|
||||
else
|
||||
return GCodeExtrusionRole::None;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,83 +0,0 @@
|
|||
///|/ Copyright (c) 2023 Robert Schiele @schiele
|
||||
///|/ Copyright (c) Prusa Research 2023 Vojtěch Bubník @bubnikv
|
||||
///|/
|
||||
///|/ PrusaSlicer is released under the terms of the AGPLv3 or higher
|
||||
///|/
|
||||
#ifndef slic3r_ExtrusionRole_hpp_
|
||||
#define slic3r_ExtrusionRole_hpp_
|
||||
|
||||
#include "enum_bitmask.hpp"
|
||||
#include "ExtrusionEntity.hpp"
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <cstdint>
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
enum class ExtrusionRoleModifier : uint16_t {
|
||||
// 1) Extrusion types
|
||||
// Perimeter (external, inner, ...)
|
||||
Perimeter,
|
||||
// Infill (top / bottom / solid inner / sparse inner / bridging inner ...)
|
||||
Infill,
|
||||
// Variable width extrusion
|
||||
Thin,
|
||||
// Support material extrusion
|
||||
Support,
|
||||
Skirt,
|
||||
Wipe,
|
||||
// 2) Extrusion modifiers
|
||||
External,
|
||||
Solid,
|
||||
Ironing,
|
||||
Bridge,
|
||||
// 3) Special types
|
||||
// Indicator that the extrusion role was mixed from multiple differing extrusion roles,
|
||||
// for example from Support and SupportInterface.
|
||||
Mixed,
|
||||
// Stopper, there should be maximum 16 modifiers defined for uint16_t bit mask.
|
||||
Count
|
||||
};
|
||||
// There should be maximum 16 modifiers defined for uint16_t bit mask.
|
||||
static_assert(int(ExtrusionRoleModifier::Count) <= 16, "ExtrusionRoleModifier: there must be maximum 16 modifiers defined to fit a 16 bit bitmask");
|
||||
|
||||
using ExtrusionRoleModifiers = enum_bitmask<ExtrusionRoleModifier>;
|
||||
ENABLE_ENUM_BITMASK_OPERATORS(ExtrusionRoleModifier);
|
||||
|
||||
|
||||
|
||||
// Be careful when editing this list as many parts of the code depend
|
||||
// on the values of these ordinars, for example
|
||||
// GCodeViewer::Extrusion_Role_Colors
|
||||
enum class GCodeExtrusionRole : uint8_t {
|
||||
None,
|
||||
Perimeter,
|
||||
ExternalPerimeter,
|
||||
OverhangPerimeter,
|
||||
InternalInfill,
|
||||
SolidInfill,
|
||||
TopSolidInfill,
|
||||
Ironing,
|
||||
BridgeInfill,
|
||||
GapFill,
|
||||
Skirt,
|
||||
SupportMaterial,
|
||||
SupportMaterialInterface,
|
||||
WipeTower,
|
||||
// Custom (user defined) G-code block, for example start / end G-code.
|
||||
Custom,
|
||||
// Stopper to count number of enums.
|
||||
Count
|
||||
};
|
||||
|
||||
// Convert a rich bitmask based ExtrusionRole to a less expressive ordinal GCodeExtrusionRole.
|
||||
// GCodeExtrusionRole is to be serialized into G-code and deserialized by G-code viewer,
|
||||
GCodeExtrusionRole extrusion_role_to_gcode_extrusion_role(ExtrusionRole role);
|
||||
|
||||
std::string gcode_extrusion_role_to_string(GCodeExtrusionRole role);
|
||||
GCodeExtrusionRole string_to_gcode_extrusion_role(const std::string_view role);
|
||||
|
||||
}
|
||||
|
||||
#endif // slic3r_ExtrusionRole_hpp_
|
|
@ -4177,7 +4177,7 @@ LayerResult GCode::process_layer(
|
|||
m_last_obj_copy = this_object_copy;
|
||||
this->set_origin(unscale(offset));
|
||||
//FIXME the following code prints regions in the order they are defined, the path is not optimized in any way.
|
||||
bool is_infill_first =print.config().is_infill_first;
|
||||
bool is_infill_first =m_config.is_infill_first;
|
||||
|
||||
auto has_infill = [](const std::vector<ObjectByExtruder::Island::Region> &by_region) {
|
||||
for (auto region : by_region) {
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
///|/
|
||||
///|/ PrusaSlicer is released under the terms of the AGPLv3 or higher
|
||||
///|/
|
||||
#include <iostream>
|
||||
#include <memory.h>
|
||||
#include <cstring>
|
||||
#include <cfloat>
|
||||
|
@ -45,7 +46,7 @@ PressureEqualizer::PressureEqualizer(const Slic3r::GCodeConfig &config) : m_use_
|
|||
m_current_extruder = 0;
|
||||
// Zero the position of the XYZE axes + the current feed
|
||||
memset(m_current_pos, 0, sizeof(float) * 5);
|
||||
m_current_extrusion_role = GCodeExtrusionRole::None;
|
||||
m_current_extrusion_role = ExtrusionRole::erNone;
|
||||
// Expect the first command to fill the nozzle (deretract).
|
||||
m_retracted = true;
|
||||
|
||||
|
@ -74,7 +75,7 @@ PressureEqualizer::PressureEqualizer(const Slic3r::GCodeConfig &config) : m_use_
|
|||
}
|
||||
|
||||
// Don't regulate the pressure before and after ironing.
|
||||
for (const GCodeExtrusionRole er : {GCodeExtrusionRole::Ironing}) {
|
||||
for (const ExtrusionRole er : {ExtrusionRole::erIroning}) {
|
||||
m_max_volumetric_extrusion_rate_slopes[size_t(er)].negative = 0;
|
||||
m_max_volumetric_extrusion_rate_slopes[size_t(er)].positive = 0;
|
||||
}
|
||||
|
@ -260,7 +261,7 @@ bool PressureEqualizer::process_line(const char *line, const char *line_end, GCo
|
|||
if (strncmp(line, EXTRUSION_ROLE_TAG.data(), EXTRUSION_ROLE_TAG.length()) == 0) {
|
||||
line += EXTRUSION_ROLE_TAG.length();
|
||||
int role = atoi(line);
|
||||
m_current_extrusion_role = GCodeExtrusionRole(role);
|
||||
m_current_extrusion_role = ExtrusionRole(role);
|
||||
#ifdef PRESSURE_EQUALIZER_DEBUG
|
||||
++line_idx;
|
||||
#endif
|
||||
|
@ -589,8 +590,7 @@ void PressureEqualizer::adjust_volumetric_rate(const size_t fist_line_idx, const
|
|||
if (line_idx == fist_line_idx || !m_gcode_lines[line_idx].extruding())
|
||||
// Nothing to do, the last move is not extruding.
|
||||
return;
|
||||
|
||||
std::array<float, size_t(GCodeExtrusionRole::Count)> feedrate_per_extrusion_role{};
|
||||
std::array<float, size_t(ExtrusionRole::erCount)> feedrate_per_extrusion_role{};
|
||||
feedrate_per_extrusion_role.fill(std::numeric_limits<float>::max());
|
||||
feedrate_per_extrusion_role[int(m_gcode_lines[line_idx].extrusion_role)] = m_gcode_lines[line_idx].volumetric_extrusion_rate_start;
|
||||
|
||||
|
@ -600,7 +600,7 @@ void PressureEqualizer::adjust_volumetric_rate(const size_t fist_line_idx, const
|
|||
if (!m_gcode_lines[idx_prev].extruding())
|
||||
break;
|
||||
// Don't decelerate before ironing.
|
||||
if (m_gcode_lines[line_idx].extrusion_role == GCodeExtrusionRole::Ironing) { line_idx = idx_prev;
|
||||
if (m_gcode_lines[line_idx].extrusion_role == ExtrusionRole::erIroning) { line_idx = idx_prev;
|
||||
continue;
|
||||
}
|
||||
// Volumetric extrusion rate at the start of the succeding segment.
|
||||
|
@ -609,10 +609,10 @@ void PressureEqualizer::adjust_volumetric_rate(const size_t fist_line_idx, const
|
|||
line_idx = idx_prev;
|
||||
GCodeLine &line = m_gcode_lines[line_idx];
|
||||
|
||||
for (size_t iRole = 1; iRole < size_t(GCodeExtrusionRole::Count); ++ iRole) {
|
||||
for (size_t iRole = 1; iRole < size_t(ExtrusionRole::erCount); ++ iRole) {
|
||||
const float &rate_slope = m_max_volumetric_extrusion_rate_slopes[iRole].negative;
|
||||
if (rate_slope == 0 || feedrate_per_extrusion_role[iRole] == std::numeric_limits<float>::max())
|
||||
continue; // The negative rate is unlimited or the rate for GCodeExtrusionRole iRole is unlimited.
|
||||
continue; // The negative rate is unlimited or the rate for ExtrusionRole iRole is unlimited.
|
||||
|
||||
float rate_end = feedrate_per_extrusion_role[iRole];
|
||||
if (iRole == size_t(line.extrusion_role) && rate_succ < rate_end)
|
||||
|
@ -620,7 +620,7 @@ void PressureEqualizer::adjust_volumetric_rate(const size_t fist_line_idx, const
|
|||
rate_end = rate_succ;
|
||||
|
||||
// don't alter the flow rate for these extrusion types
|
||||
if (!line.adjustable_flow || line.extrusion_role == GCodeExtrusionRole::BridgeInfill || line.extrusion_role == GCodeExtrusionRole::Ironing) {
|
||||
if (!line.adjustable_flow || line.extrusion_role == ExtrusionRole::erBridgeInfill || line.extrusion_role == ExtrusionRole::erIroning) {
|
||||
rate_end = line.volumetric_extrusion_rate_end;
|
||||
} else if (line.volumetric_extrusion_rate_end > rate_end) {
|
||||
line.volumetric_extrusion_rate_end = rate_end;
|
||||
|
@ -644,7 +644,7 @@ void PressureEqualizer::adjust_volumetric_rate(const size_t fist_line_idx, const
|
|||
}
|
||||
// feedrate_per_extrusion_role[iRole] = (iRole == line.extrusion_role) ? line.volumetric_extrusion_rate_start : rate_start;
|
||||
// Don't store feed rate for ironing
|
||||
if (line.extrusion_role != GCodeExtrusionRole::Ironing)
|
||||
if (line.extrusion_role != ExtrusionRole::erIroning)
|
||||
feedrate_per_extrusion_role[iRole] = line.volumetric_extrusion_rate_start;
|
||||
}
|
||||
}
|
||||
|
@ -659,7 +659,7 @@ void PressureEqualizer::adjust_volumetric_rate(const size_t fist_line_idx, const
|
|||
if (!m_gcode_lines[idx_next].extruding())
|
||||
break;
|
||||
// Don't accelerate after ironing.
|
||||
if (m_gcode_lines[line_idx].extrusion_role == GCodeExtrusionRole::Ironing) {
|
||||
if (m_gcode_lines[line_idx].extrusion_role == ExtrusionRole::erIroning) {
|
||||
line_idx = idx_next;
|
||||
continue;
|
||||
}
|
||||
|
@ -668,14 +668,14 @@ void PressureEqualizer::adjust_volumetric_rate(const size_t fist_line_idx, const
|
|||
line_idx = idx_next;
|
||||
GCodeLine &line = m_gcode_lines[line_idx];
|
||||
|
||||
for (size_t iRole = 1; iRole < size_t(GCodeExtrusionRole::Count); ++ iRole) {
|
||||
for (size_t iRole = 1; iRole < size_t(ExtrusionRole::erCount); ++ iRole) {
|
||||
const float &rate_slope = m_max_volumetric_extrusion_rate_slopes[iRole].positive;
|
||||
if (rate_slope == 0 || feedrate_per_extrusion_role[iRole] == std::numeric_limits<float>::max())
|
||||
continue; // The positive rate is unlimited or the rate for GCodeExtrusionRole iRole is unlimited.
|
||||
continue; // The positive rate is unlimited or the rate for ExtrusionRole iRole is unlimited.
|
||||
|
||||
float rate_start = feedrate_per_extrusion_role[iRole];
|
||||
// don't alter the flow rate for these extrusion types
|
||||
if (!line.adjustable_flow || line.extrusion_role == GCodeExtrusionRole::BridgeInfill || line.extrusion_role == GCodeExtrusionRole::Ironing) {
|
||||
if (!line.adjustable_flow || line.extrusion_role == ExtrusionRole::erBridgeInfill || line.extrusion_role == ExtrusionRole::erIroning) {
|
||||
rate_start = line.volumetric_extrusion_rate_start;
|
||||
} else if (iRole == size_t(line.extrusion_role) && rate_prec < rate_start)
|
||||
rate_start = rate_prec;
|
||||
|
@ -701,7 +701,7 @@ void PressureEqualizer::adjust_volumetric_rate(const size_t fist_line_idx, const
|
|||
}
|
||||
// feedrate_per_extrusion_role[iRole] = (iRole == line.extrusion_role) ? line.volumetric_extrusion_rate_end : rate_end;
|
||||
// Don't store feed rate for ironing
|
||||
if (line.extrusion_role != GCodeExtrusionRole::Ironing)
|
||||
if (line.extrusion_role != ExtrusionRole::erIroning)
|
||||
feedrate_per_extrusion_role[iRole] = line.volumetric_extrusion_rate_end;
|
||||
}
|
||||
}
|
||||
|
@ -785,7 +785,7 @@ void PressureEqualizer::push_line_to_output(const size_t line_idx, const float n
|
|||
GCodeG1Formatter feedrate_formatter;
|
||||
feedrate_formatter.emit_f(new_feedrate);
|
||||
feedrate_formatter.emit_string(std::string(EXTRUDE_SET_SPEED_TAG.data(), EXTRUDE_SET_SPEED_TAG.length()));
|
||||
if (line.extrusion_role == GCodeExtrusionRole::ExternalPerimeter)
|
||||
if (line.extrusion_role == ExtrusionRole::erExternalPerimeter)
|
||||
feedrate_formatter.emit_string(std::string(EXTERNAL_PERIMETER_TAG.data(), EXTERNAL_PERIMETER_TAG.length()));
|
||||
push_to_output(feedrate_formatter);
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
#include "../libslic3r.h"
|
||||
#include "../PrintConfig.hpp"
|
||||
#include "../ExtrusionRole.hpp"
|
||||
|
||||
#include <queue>
|
||||
|
||||
|
@ -70,7 +69,7 @@ private:
|
|||
float positive;
|
||||
float negative;
|
||||
};
|
||||
ExtrusionRateSlope m_max_volumetric_extrusion_rate_slopes[size_t(GCodeExtrusionRole::Count)];
|
||||
ExtrusionRateSlope m_max_volumetric_extrusion_rate_slopes[size_t(ExtrusionRole::erCount)];
|
||||
float m_max_volumetric_extrusion_rate_slope_positive;
|
||||
float m_max_volumetric_extrusion_rate_slope_negative;
|
||||
|
||||
|
@ -82,7 +81,7 @@ private:
|
|||
// X,Y,Z,E,F
|
||||
float m_current_pos[5];
|
||||
size_t m_current_extruder;
|
||||
GCodeExtrusionRole m_current_extrusion_role;
|
||||
ExtrusionRole m_current_extrusion_role;
|
||||
bool m_retracted;
|
||||
bool m_use_relative_e_distances;
|
||||
|
||||
|
@ -158,7 +157,7 @@ private:
|
|||
// Index of the active extruder.
|
||||
size_t extruder_id;
|
||||
// Extrusion role of this segment.
|
||||
GCodeExtrusionRole extrusion_role;
|
||||
ExtrusionRole extrusion_role;
|
||||
|
||||
// Current volumetric extrusion rate.
|
||||
float volumetric_extrusion_rate;
|
||||
|
|
|
@ -1047,7 +1047,7 @@ float WipingExtrusions::mark_wiping_extrusions(const Print& print, unsigned int
|
|||
if (!object->config().flush_into_infill && !object->config().flush_into_objects && !object->config().flush_into_support)
|
||||
continue;
|
||||
bool wipe_into_infill_only = !object->config().flush_into_objects && object->config().flush_into_infill;
|
||||
bool is_infill_first = print.config().is_infill_first;
|
||||
bool is_infill_first = region.config().is_infill_first;
|
||||
if (is_infill_first != perimeters_done || wipe_into_infill_only) {
|
||||
for (const ExtrusionEntity* ee : layerm->fills.entities) { // iterate through all infill Collections
|
||||
auto* fill = dynamic_cast<const ExtrusionEntityCollection*>(ee);
|
||||
|
@ -1160,7 +1160,7 @@ void WipingExtrusions::ensure_perimeters_infills_order(const Print& print)
|
|||
if (!object->config().flush_into_infill && !object->config().flush_into_objects)
|
||||
continue;
|
||||
|
||||
bool is_infill_first = print.config().is_infill_first;
|
||||
bool is_infill_first = region.config().is_infill_first;
|
||||
for (const ExtrusionEntity* ee : layerm->fills.entities) { // iterate through all infill Collections
|
||||
auto* fill = dynamic_cast<const ExtrusionEntityCollection*>(ee);
|
||||
|
||||
|
|
|
@ -1731,7 +1731,7 @@ void PerimeterGenerator::process_classic()
|
|||
// if brim will be printed, reverse the order of perimeters so that
|
||||
// we continue inwards after having finished the brim
|
||||
// TODO: add test for perimeter order
|
||||
bool is_outer_wall_first = this->object_config->wall_sequence == WallSequence::OuterInner;
|
||||
bool is_outer_wall_first = this->config->wall_sequence == WallSequence::OuterInner;
|
||||
if (is_outer_wall_first ||
|
||||
//BBS: always print outer wall first when there indeed has brim.
|
||||
(this->layer_id == 0 &&
|
||||
|
@ -1739,7 +1739,7 @@ void PerimeterGenerator::process_classic()
|
|||
this->object_config->brim_width.value > 0))
|
||||
entities.reverse();
|
||||
// SoftFever: sandwich mode
|
||||
else if (this->object_config->wall_sequence == WallSequence::InnerOuterInner)
|
||||
else if (this->config->wall_sequence == WallSequence::InnerOuterInner)
|
||||
if (entities.entities.size() > 1){
|
||||
int last_outer=0;
|
||||
int outer = 0;
|
||||
|
@ -2036,12 +2036,12 @@ void PerimeterGenerator::process_arachne()
|
|||
int direction = -1;
|
||||
|
||||
bool is_outer_wall_first =
|
||||
this->object_config->wall_sequence == WallSequence::OuterInner ||
|
||||
this->object_config->wall_sequence == WallSequence::InnerOuterInner;
|
||||
this->config->wall_sequence == WallSequence::OuterInner ||
|
||||
this->config->wall_sequence == WallSequence::InnerOuterInner;
|
||||
|
||||
if (layer_id == 0){ // disable inner outer inner algorithm after the first layer
|
||||
is_outer_wall_first =
|
||||
this->object_config->wall_sequence == WallSequence::OuterInner;
|
||||
this->config->wall_sequence == WallSequence::OuterInner;
|
||||
}
|
||||
if (is_outer_wall_first) {
|
||||
start_perimeter = 0;
|
||||
|
@ -2169,7 +2169,7 @@ void PerimeterGenerator::process_arachne()
|
|||
}
|
||||
|
||||
// printf("New Layer: Layer ID %d\n",layer_id); //debug - new layer
|
||||
if (this->object_config->wall_sequence == WallSequence::InnerOuterInner && layer_id > 0) { // only enable inner outer inner algorithm after first layer
|
||||
if (this->config->wall_sequence == WallSequence::InnerOuterInner && layer_id > 0) { // only enable inner outer inner algorithm after first layer
|
||||
if (ordered_extrusions.size() > 2) { // 3 walls minimum needed to do inner outer inner ordering
|
||||
int position = 0; // index to run the re-ordering for multiple external perimeters in a single island.
|
||||
int arr_i, arr_j = 0; // indexes to run through the walls in the for loops
|
||||
|
|
|
@ -753,7 +753,6 @@ PRINT_CONFIG_CLASS_DEFINE(
|
|||
// BBS
|
||||
((ConfigOptionBool, flush_into_infill))
|
||||
((ConfigOptionBool, flush_into_support))
|
||||
((ConfigOptionEnum<WallSequence>, wall_sequence))
|
||||
// BBS
|
||||
((ConfigOptionFloat, tree_support_branch_distance))
|
||||
((ConfigOptionFloat, tree_support_tip_diameter))
|
||||
|
@ -903,6 +902,9 @@ PRINT_CONFIG_CLASS_DEFINE(
|
|||
((ConfigOptionBool, overhang_reverse))
|
||||
((ConfigOptionBool, overhang_reverse_internal_only))
|
||||
((ConfigOptionFloatOrPercent, overhang_reverse_threshold))
|
||||
|
||||
((ConfigOptionEnum<WallSequence>, wall_sequence))
|
||||
((ConfigOptionBool, is_infill_first))
|
||||
)
|
||||
|
||||
PRINT_CONFIG_CLASS_DEFINE(
|
||||
|
@ -1179,7 +1181,6 @@ PRINT_CONFIG_CLASS_DERIVED_DEFINE(
|
|||
|
||||
((ConfigOptionBools, activate_chamber_temp_control))
|
||||
((ConfigOptionInts , chamber_temperature))
|
||||
((ConfigOptionBool, is_infill_first))
|
||||
|
||||
((ConfigOptionFloat, preferred_orientation))
|
||||
|
||||
|
|
|
@ -916,6 +916,7 @@ bool PrintObject::invalidate_state_by_config_options(
|
|||
|| opt_key == "min_width_top_surface"
|
||||
|| opt_key == "only_one_wall_first_layer"
|
||||
|| opt_key == "extra_perimeters_on_overhangs"
|
||||
|| opt_key == "detect_overhang_wall"
|
||||
|| opt_key == "initial_layer_line_width"
|
||||
|| opt_key == "inner_wall_line_width"
|
||||
|| opt_key == "infill_wall_overlap"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue