mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-14 02:07:54 -06:00

* 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 https://github.com/prusa3d/PrusaSlicer/pull/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 131fb94c6b
.
---------
Co-authored-by: MGunlogson <MGunlogson@users.noreply.github.com>
Co-authored-by: Vojtech Bubnik <bubnikv@gmail.com>
91 lines
4.3 KiB
C++
91 lines
4.3 KiB
C++
#ifndef slic3r_enum_bitmask_hpp_
|
|
#define slic3r_enum_bitmask_hpp_
|
|
|
|
// enum_bitmask for passing a set of attributes to a function in a type safe way.
|
|
// Adapted from https://gpfault.net/posts/typesafe-bitmasks.txt.html
|
|
// with hints from https://www.strikerx3.dev/cpp/2019/02/27/typesafe-enum-class-bitmasks-in-cpp.html
|
|
|
|
#include <type_traits>
|
|
|
|
namespace Slic3r {
|
|
|
|
// enum_bitmasks can only be used with enums.
|
|
template<class option_type, typename = typename std::enable_if<std::is_enum<option_type>::value>::type>
|
|
class enum_bitmask {
|
|
// The type we'll use for storing the value of our bitmask should be the same as the enum's underlying type.
|
|
using underlying_type = typename std::underlying_type<option_type>::type;
|
|
|
|
// This method helps us avoid having to explicitly set enum values to powers of two.
|
|
static constexpr underlying_type mask_value(option_type o) { return 1 << static_cast<underlying_type>(o); }
|
|
|
|
// Private ctor to be used internally.
|
|
explicit constexpr enum_bitmask(underlying_type o) : m_bits(o) {}
|
|
|
|
public:
|
|
// Default ctor creates a bitmask with no options selected.
|
|
constexpr enum_bitmask() : m_bits(0) {}
|
|
|
|
// Creates a enum_bitmask with just one bit set.
|
|
// This ctor is intentionally non-explicit, to allow passing an options to a function:
|
|
// FunctionExpectingBitmask(Options::Opt1)
|
|
constexpr enum_bitmask(option_type o) : m_bits(mask_value(o)) {}
|
|
|
|
// Set the bit corresponding to the given option.
|
|
constexpr enum_bitmask operator|(option_type t) const { return enum_bitmask(m_bits | mask_value(t)); }
|
|
|
|
// Combine with another enum_bitmask of the same type.
|
|
constexpr enum_bitmask operator|(enum_bitmask<option_type> t) const { return enum_bitmask(m_bits | t.m_bits); }
|
|
|
|
// Set the bit corresponding to the given option.
|
|
constexpr void operator|=(option_type t) { m_bits = enum_bitmask(m_bits | mask_value(t)); }
|
|
|
|
// Combine with another enum_bitmask of the same type.
|
|
constexpr void operator|=(enum_bitmask<option_type> t) { m_bits = enum_bitmask(m_bits | t.m_bits); }
|
|
|
|
// Get the value of the bit corresponding to the given option.
|
|
constexpr bool operator&(option_type t) const { return m_bits & mask_value(t); }
|
|
constexpr bool has(option_type t) const { return m_bits & mask_value(t); }
|
|
|
|
constexpr bool operator==(const enum_bitmask r) const { return m_bits == r.m_bits; }
|
|
constexpr bool operator!=(const enum_bitmask r) const { return m_bits != r.m_bits; }
|
|
// For sorting by the enum values.
|
|
constexpr bool lower(const enum_bitmask r) const { return m_bits < r.m_bits; }
|
|
|
|
private:
|
|
underlying_type m_bits = 0;
|
|
};
|
|
|
|
// For enabling free functions producing enum_bitmask<> type from bit operations on enums.
|
|
template<typename Enum> struct is_enum_bitmask_type { static const bool enable = false; };
|
|
#define ENABLE_ENUM_BITMASK_OPERATORS(x) template<> struct is_enum_bitmask_type<x> { static const bool enable = true; };
|
|
template<class Enum> inline constexpr bool is_enum_bitmask_type_v = is_enum_bitmask_type<Enum>::enable;
|
|
|
|
// Creates an enum_bitmask from two options, convenient for passing of options to a function:
|
|
// FunctionExpectingBitmask(Options::Opt1 | Options::Opt2 | Options::Opt3)
|
|
template <class option_type>
|
|
constexpr std::enable_if_t<is_enum_bitmask_type_v<option_type>, enum_bitmask<option_type>> operator|(option_type lhs, option_type rhs) {
|
|
static_assert(std::is_enum_v<option_type>);
|
|
return enum_bitmask<option_type>{lhs} | rhs;
|
|
}
|
|
|
|
template <class option_type>
|
|
constexpr std::enable_if_t<is_enum_bitmask_type_v<option_type>, enum_bitmask<option_type>> operator|(option_type lhs, enum_bitmask<option_type> rhs) {
|
|
static_assert(std::is_enum_v<option_type>);
|
|
return enum_bitmask<option_type>{lhs} | rhs;
|
|
}
|
|
|
|
template <class option_type>
|
|
constexpr std::enable_if_t<is_enum_bitmask_type_v<option_type>, enum_bitmask<option_type>> only_if(bool condition, option_type opt) {
|
|
static_assert(std::is_enum_v<option_type>);
|
|
return condition ? enum_bitmask<option_type>{opt} : enum_bitmask<option_type>{};
|
|
}
|
|
|
|
template <class option_type>
|
|
constexpr std::enable_if_t<is_enum_bitmask_type_v<option_type>, enum_bitmask<option_type>> only_if(bool condition, enum_bitmask<option_type> opt) {
|
|
static_assert(std::is_enum_v<option_type>);
|
|
return condition ? opt : enum_bitmask<option_type>{};
|
|
}
|
|
|
|
} // namespace Slic3r
|
|
|
|
#endif // slic3r_enum_bitmask_hpp_
|