mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-21 00:51:56 -06:00
Preview - Visualization of wipe mones
This commit is contained in:
parent
d5e6b17d70
commit
0e6acbc0e2
8 changed files with 161 additions and 0 deletions
|
@ -256,6 +256,10 @@ namespace Slic3r {
|
|||
|
||||
// subdivide the retraction in segments
|
||||
if (!wipe_path.empty()) {
|
||||
#if ENABLE_SHOW_WIPE_MOVES
|
||||
// add tag for processor
|
||||
gcode += ";" + GCodeProcessor::Wipe_Start_Tag + "\n";
|
||||
#endif // ENABLE_SHOW_WIPE_MOVES
|
||||
for (const Line& line : wipe_path.lines()) {
|
||||
double segment_length = line.length();
|
||||
/* Reduce retraction length a bit to avoid effective retraction speed to be greater than the configured one
|
||||
|
@ -270,6 +274,10 @@ namespace Slic3r {
|
|||
"wipe and retract"
|
||||
);
|
||||
}
|
||||
#if ENABLE_SHOW_WIPE_MOVES
|
||||
// add tag for processor
|
||||
gcode += ";" + GCodeProcessor::Wipe_End_Tag + "\n";
|
||||
#endif // ENABLE_SHOW_WIPE_MOVES
|
||||
gcodegen.set_last_pos(wipe_path.points.back());
|
||||
}
|
||||
|
||||
|
|
|
@ -25,6 +25,10 @@ static const float DEFAULT_ACCELERATION = 1500.0f; // Prusa Firmware 1_75mm_MK2
|
|||
namespace Slic3r {
|
||||
|
||||
const std::string GCodeProcessor::Extrusion_Role_Tag = "TYPE:";
|
||||
#if ENABLE_SHOW_WIPE_MOVES
|
||||
const std::string GCodeProcessor::Wipe_Start_Tag = "WIPE_START";
|
||||
const std::string GCodeProcessor::Wipe_End_Tag = "WIPE_END";
|
||||
#endif // ENABLE_SHOW_WIPE_MOVES
|
||||
const std::string GCodeProcessor::Height_Tag = "HEIGHT:";
|
||||
const std::string GCodeProcessor::Layer_Change_Tag = "LAYER_CHANGE";
|
||||
const std::string GCodeProcessor::Color_Change_Tag = "COLOR_CHANGE";
|
||||
|
@ -35,6 +39,11 @@ const std::string GCodeProcessor::First_Line_M73_Placeholder_Tag = "; _
|
|||
const std::string GCodeProcessor::Last_Line_M73_Placeholder_Tag = "; _GP_LAST_LINE_M73_PLACEHOLDER";
|
||||
const std::string GCodeProcessor::Estimated_Printing_Time_Placeholder_Tag = "; _GP_ESTIMATED_PRINTING_TIME_PLACEHOLDER";
|
||||
|
||||
#if ENABLE_SHOW_WIPE_MOVES
|
||||
const float GCodeProcessor::Wipe_Width = 0.05f;
|
||||
const float GCodeProcessor::Wipe_Height = 0.05f;
|
||||
#endif // ENABLE_SHOW_WIPE_MOVES
|
||||
|
||||
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
|
||||
const std::string GCodeProcessor::Width_Tag = "WIDTH:";
|
||||
const std::string GCodeProcessor::Mm3_Per_Mm_Tag = "MM3_PER_MM:";
|
||||
|
@ -725,6 +734,9 @@ void GCodeProcessor::reset()
|
|||
m_end_position = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
m_origin = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
m_cached_position.reset();
|
||||
#if ENABLE_SHOW_WIPE_MOVES
|
||||
m_wiping = false;
|
||||
#endif // ENABLE_SHOW_WIPE_MOVES
|
||||
|
||||
m_feedrate = 0.0f;
|
||||
m_width = 0.0f;
|
||||
|
@ -806,6 +818,16 @@ void GCodeProcessor::process_file(const std::string& filename, bool apply_postpr
|
|||
process_gcode_line(line);
|
||||
});
|
||||
|
||||
#if ENABLE_SHOW_WIPE_MOVES
|
||||
// update width/height of wipe moves
|
||||
for (MoveVertex& move : m_result.moves) {
|
||||
if (move.type == EMoveType::Wipe) {
|
||||
move.width = Wipe_Width;
|
||||
move.height = Wipe_Height;
|
||||
}
|
||||
}
|
||||
#endif // ENABLE_SHOW_WIPE_MOVES
|
||||
|
||||
// process the time blocks
|
||||
for (size_t i = 0; i < static_cast<size_t>(PrintEstimatedTimeStatistics::ETimeMode::Count); ++i) {
|
||||
TimeMachine& machine = m_time_processor.machines[i];
|
||||
|
@ -1031,6 +1053,20 @@ void GCodeProcessor::process_tags(const std::string_view comment)
|
|||
return;
|
||||
}
|
||||
|
||||
#if ENABLE_SHOW_WIPE_MOVES
|
||||
// wipe start tag
|
||||
if (starts_with(comment, Wipe_Start_Tag)) {
|
||||
m_wiping = true;
|
||||
return;
|
||||
}
|
||||
|
||||
// wipe end tag
|
||||
if (starts_with(comment, Wipe_End_Tag)) {
|
||||
m_wiping = false;
|
||||
return;
|
||||
}
|
||||
#endif // ENABLE_SHOW_WIPE_MOVES
|
||||
|
||||
if ((!m_producers_enabled || m_producer == EProducer::PrusaSlicer) &&
|
||||
starts_with(comment, Height_Tag)) {
|
||||
// height tag
|
||||
|
@ -1427,7 +1463,13 @@ void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line)
|
|||
auto move_type = [this](const AxisCoords& delta_pos) {
|
||||
EMoveType type = EMoveType::Noop;
|
||||
|
||||
#if ENABLE_SHOW_WIPE_MOVES
|
||||
if (m_wiping)
|
||||
type = EMoveType::Wipe;
|
||||
else if (delta_pos[E] < 0.0f)
|
||||
#else
|
||||
if (delta_pos[E] < 0.0f)
|
||||
#endif // ENABLE_SHOW_WIPE_MOVES
|
||||
type = (delta_pos[X] != 0.0f || delta_pos[Y] != 0.0f || delta_pos[Z] != 0.0f) ? EMoveType::Travel : EMoveType::Retract;
|
||||
else if (delta_pos[E] > 0.0f) {
|
||||
if (delta_pos[X] == 0.0f && delta_pos[Y] == 0.0f)
|
||||
|
|
|
@ -24,6 +24,9 @@ namespace Slic3r {
|
|||
Pause_Print,
|
||||
Custom_GCode,
|
||||
Travel,
|
||||
#if ENABLE_SHOW_WIPE_MOVES
|
||||
Wipe,
|
||||
#endif // ENABLE_SHOW_WIPE_MOVES
|
||||
Extrude,
|
||||
Count
|
||||
};
|
||||
|
@ -69,6 +72,10 @@ namespace Slic3r {
|
|||
{
|
||||
public:
|
||||
static const std::string Extrusion_Role_Tag;
|
||||
#if ENABLE_SHOW_WIPE_MOVES
|
||||
static const std::string Wipe_Start_Tag;
|
||||
static const std::string Wipe_End_Tag;
|
||||
#endif // ENABLE_SHOW_WIPE_MOVES
|
||||
static const std::string Height_Tag;
|
||||
static const std::string Layer_Change_Tag;
|
||||
static const std::string Color_Change_Tag;
|
||||
|
@ -78,6 +85,11 @@ namespace Slic3r {
|
|||
static const std::string Last_Line_M73_Placeholder_Tag;
|
||||
static const std::string Estimated_Printing_Time_Placeholder_Tag;
|
||||
|
||||
#if ENABLE_SHOW_WIPE_MOVES
|
||||
static const float Wipe_Width;
|
||||
static const float Wipe_Height;
|
||||
#endif // ENABLE_SHOW_WIPE_MOVES
|
||||
|
||||
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
|
||||
static const std::string Width_Tag;
|
||||
static const std::string Mm3_Per_Mm_Tag;
|
||||
|
@ -390,6 +402,9 @@ namespace Slic3r {
|
|||
AxisCoords m_end_position; // mm
|
||||
AxisCoords m_origin; // mm
|
||||
CachedPosition m_cached_position;
|
||||
#if ENABLE_SHOW_WIPE_MOVES
|
||||
bool m_wiping;
|
||||
#endif // ENABLE_SHOW_WIPE_MOVES
|
||||
|
||||
float m_feedrate; // mm/s
|
||||
float m_width; // mm
|
||||
|
|
|
@ -74,4 +74,11 @@
|
|||
#define ENABLE_SHOW_OPTION_POINT_LAYERS (1 && ENABLE_GCODE_VIEWER && ENABLE_2_3_0_ALPHA4)
|
||||
|
||||
|
||||
//===================
|
||||
// 2.3.0.beta1 techs
|
||||
//===================
|
||||
#define ENABLE_2_3_0_BETA1 1
|
||||
|
||||
#define ENABLE_SHOW_WIPE_MOVES (1 && ENABLE_GCODE_VIEWER && ENABLE_2_3_0_BETA1)
|
||||
|
||||
#endif // _prusaslicer_technologies_h_
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue