-
-
Notifications
You must be signed in to change notification settings - Fork 939
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Porting of Pressure Equalizer feature from Prusa Slicer 2.6.x (#2161)
* Overhang perimeter handling Updated code to handle overhang perimeters as an overhang and not as a bridge. * Preparing to add curled extrusions identification * Porting curling calculations from Prusa Slier 2.6.1 * Prototype 1 - slowdown extended to detect curled edges and further reduce speed First prototype of the code submitted. * Working prototype - 2 Code is now finally working - external perimeters are slowed down as needed when there is likelyhood of curling up. ToDo: 1. Reslicing the model causes the algorithm not to run - need to find where this fails to trigger the call for this. 2. Slowdown of internal perimeters not working yet. * Updated to use overhang wall speed instead of bridging speed for this algorithm * Fixed bug in speed calculation and tweaked parameters for high speed printer Fixed bug in speed calculation and tweaked parameters for high speed printer * Attempting to fix "set started" not being set * Parameter tweak after print tests * Fixed estimation not running when model is re-sliced. * Removing debug printf statements and fixed threading flag. * Fixed threading * Parameter tweaks following print tests * Made this as an option in the GUI * Reintroduced handling of bridges as per original design * UI line toggling when option makes sense to be visible. * Fixed bug in field visibility & made it default to off * Code optimisation * Initial commit of code from Prusa Slicer 2.6.1 * Ported ExtrusionRole from Prusa Slicer 2.6.1 * fix compile errors * Update GCode.hpp * code changes to invoke pressure equalizer * attempting to trigger pressure equalizer (Not compiling) * Update Fill.cpp * Update Fill.cpp * Pressure equaliser layer result update * Further commits * Merged PR prusa3d/PrusaSlicer#9622 * First complete working version * Update PressureEqualizer.cpp * Implemented parameter in GUI * Toggle fields according to compatibility * Updated UI toggles between extrusion rate slope and arc fitting. * Updated tooltip * Introduced parameter smoothing segment length This parameter influences the number of division a line will undergo in response to the requirement to adhere to the extrusion rate flow adjustment. * Internal parameter and tool tip tweaking * Parameter and tool tip tweaking * Updated parameters and tooltip following testing. * Sync PressureEq with latest PrusaSlicer * Revert "Sync PressureEq with latest PrusaSlicer" This reverts commit 131fb94. --------- Co-authored-by: MGunlogson <[email protected]> Co-authored-by: Vojtech Bubnik <[email protected]>
- Loading branch information
1 parent
78a8bad
commit cf84619
Showing
14 changed files
with
826 additions
and
433 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
///|/ 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; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
///|/ 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_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.