Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorenricoturri1966 <enricoturri@seznam.cz>2022-01-06 16:10:18 +0300
committerenricoturri1966 <enricoturri@seznam.cz>2022-01-06 16:10:18 +0300
commit9676b8adbfcf950716ee95fbeac5b6a20d967391 (patch)
tree96b51595c4e9fe518399e1f18666fbc51a31ec9a
parent2b66a81ee168f8a2b1020677001360cf9301a872 (diff)
parentac90d3d5c2cb7ba7bc85bb4a9f1e62174ce49c5d (diff)
Merge remote-tracking branch 'origin/et_spiral_vase_layers'
-rw-r--r--src/libslic3r/GCode/GCodeProcessor.cpp37
-rw-r--r--src/libslic3r/GCode/GCodeProcessor.hpp6
-rw-r--r--src/libslic3r/Technologies.hpp9
-rw-r--r--src/slic3r/GUI/GCodeViewer.cpp10
-rw-r--r--src/slic3r/GUI/GCodeViewer.hpp8
5 files changed, 65 insertions, 5 deletions
diff --git a/src/libslic3r/GCode/GCodeProcessor.cpp b/src/libslic3r/GCode/GCodeProcessor.cpp
index 79eca1aa3..33c1c31f3 100644
--- a/src/libslic3r/GCode/GCodeProcessor.cpp
+++ b/src/libslic3r/GCode/GCodeProcessor.cpp
@@ -726,6 +726,9 @@ void GCodeProcessorResult::reset() {
filament_diameters = std::vector<float>(MIN_EXTRUDERS_COUNT, DEFAULT_FILAMENT_DIAMETER);
filament_densities = std::vector<float>(MIN_EXTRUDERS_COUNT, DEFAULT_FILAMENT_DENSITY);
custom_gcode_per_print_z = std::vector<CustomGCode::Item>();
+#if ENABLE_SPIRAL_VASE_LAYERS
+ spiral_vase_layers = std::vector<std::pair<float, std::pair<size_t, size_t>>>();
+#endif // ENABLE_SPIRAL_VASE_LAYERS
time = 0;
}
#else
@@ -741,6 +744,9 @@ void GCodeProcessorResult::reset() {
filament_diameters = std::vector<float>(MIN_EXTRUDERS_COUNT, DEFAULT_FILAMENT_DIAMETER);
filament_densities = std::vector<float>(MIN_EXTRUDERS_COUNT, DEFAULT_FILAMENT_DENSITY);
custom_gcode_per_print_z = std::vector<CustomGCode::Item>();
+#if ENABLE_SPIRAL_VASE_LAYERS
+ spiral_vase_layers = std::vector<std::pair<float, std::pair<size_t, size_t>>>();
+#endif // ENABLE_SPIRAL_VASE_LAYERS
}
#endif // ENABLE_GCODE_VIEWER_STATISTICS
@@ -882,6 +888,12 @@ void GCodeProcessor::apply_config(const PrintConfig& config)
m_first_layer_height = std::abs(first_layer_height->value);
m_result.max_print_height = config.max_print_height;
+
+#if ENABLE_SPIRAL_VASE_LAYERS
+ const ConfigOptionBool* spiral_vase = config.option<ConfigOptionBool>("spiral_vase");
+ if (spiral_vase != nullptr)
+ m_spiral_vase_active = spiral_vase->value;
+#endif // ENABLE_SPIRAL_VASE_LAYERS
}
void GCodeProcessor::apply_config(const DynamicPrintConfig& config)
@@ -1115,6 +1127,12 @@ void GCodeProcessor::apply_config(const DynamicPrintConfig& config)
const ConfigOptionFloat* max_print_height = config.option<ConfigOptionFloat>("max_print_height");
if (max_print_height != nullptr)
m_result.max_print_height = max_print_height->value;
+
+#if ENABLE_SPIRAL_VASE_LAYERS
+ const ConfigOptionBool* spiral_vase = config.option<ConfigOptionBool>("spiral_vase");
+ if (spiral_vase != nullptr)
+ m_spiral_vase_active = spiral_vase->value;
+#endif // ENABLE_SPIRAL_VASE_LAYERS
}
void GCodeProcessor::enable_stealth_time_estimator(bool enabled)
@@ -1177,6 +1195,10 @@ void GCodeProcessor::reset()
m_options_z_corrector.reset();
+#if ENABLE_SPIRAL_VASE_LAYERS
+ m_spiral_vase_active = false;
+#endif // ENABLE_SPIRAL_VASE_LAYERS
+
#if ENABLE_GCODE_VIEWER_DATA_CHECKING
m_mm3_per_mm_compare.reset();
m_height_compare.reset();
@@ -1865,6 +1887,16 @@ void GCodeProcessor::process_tags(const std::string_view comment, bool producers
// layer change tag
if (comment == reserved_tag(ETags::Layer_Change)) {
++m_layer_id;
+#if ENABLE_SPIRAL_VASE_LAYERS
+ if (m_spiral_vase_active) {
+ assert(!m_result.moves.empty());
+ size_t move_id = m_result.moves.size() - 1;
+ if (!m_result.spiral_vase_layers.empty() && m_end_position[Z] == m_result.spiral_vase_layers.back().first)
+ m_result.spiral_vase_layers.back().second.second = move_id;
+ else
+ m_result.spiral_vase_layers.push_back({ m_end_position[Z], { move_id, move_id } });
+ }
+#endif // ENABLE_SPIRAL_VASE_LAYERS
return;
}
@@ -2670,6 +2702,11 @@ void GCodeProcessor::process_G1(const GCodeReader::GCodeLine& line)
m_seams_detector.set_first_vertex(m_result.moves.back().position - m_extruder_offsets[m_extruder_id]);
}
+#if ENABLE_SPIRAL_VASE_LAYERS
+ if (m_spiral_vase_active && !m_result.spiral_vase_layers.empty() && !m_result.moves.empty())
+ m_result.spiral_vase_layers.back().second.second = m_result.moves.size() - 1;
+#endif // ENABLE_SPIRAL_VASE_LAYERS
+
// store move
store_move_vertex(type);
}
diff --git a/src/libslic3r/GCode/GCodeProcessor.hpp b/src/libslic3r/GCode/GCodeProcessor.hpp
index c3a050985..2b6ee9cea 100644
--- a/src/libslic3r/GCode/GCodeProcessor.hpp
+++ b/src/libslic3r/GCode/GCodeProcessor.hpp
@@ -125,6 +125,9 @@ namespace Slic3r {
std::vector<float> filament_densities;
PrintEstimatedStatistics print_statistics;
std::vector<CustomGCode::Item> custom_gcode_per_print_z;
+#if ENABLE_SPIRAL_VASE_LAYERS
+ std::vector<std::pair<float, std::pair<size_t, size_t>>> spiral_vase_layers;
+#endif // ENABLE_SPIRAL_VASE_LAYERS
#if ENABLE_GCODE_VIEWER_STATISTICS
int64_t time{ 0 };
@@ -532,6 +535,9 @@ namespace Slic3r {
SeamsDetector m_seams_detector;
OptionsZCorrector m_options_z_corrector;
size_t m_last_default_color_id;
+#if ENABLE_SPIRAL_VASE_LAYERS
+ bool m_spiral_vase_active;
+#endif // ENABLE_SPIRAL_VASE_LAYERS
#if ENABLE_GCODE_VIEWER_STATISTICS
std::chrono::time_point<std::chrono::high_resolution_clock> m_start_time;
#endif // ENABLE_GCODE_VIEWER_STATISTICS
diff --git a/src/libslic3r/Technologies.hpp b/src/libslic3r/Technologies.hpp
index ef975461e..8f372e7c5 100644
--- a/src/libslic3r/Technologies.hpp
+++ b/src/libslic3r/Technologies.hpp
@@ -58,4 +58,13 @@
#define ENABLE_ENHANCED_PRINT_VOLUME_FIT (1 && ENABLE_2_4_0_BETA2)
+//================
+// 2.4.1.rc techs
+//================
+#define ENABLE_2_4_1_RC 1
+
+// Enable detection of layers for spiral vase prints
+#define ENABLE_SPIRAL_VASE_LAYERS (1 && ENABLE_2_4_1_RC)
+
+
#endif // _prusaslicer_technologies_h_
diff --git a/src/slic3r/GUI/GCodeViewer.cpp b/src/slic3r/GUI/GCodeViewer.cpp
index 06370de6e..52c1bf929 100644
--- a/src/slic3r/GUI/GCodeViewer.cpp
+++ b/src/slic3r/GUI/GCodeViewer.cpp
@@ -2040,6 +2040,16 @@ void GCodeViewer::load_toolpaths(const GCodeProcessorResult& gcode_result)
sort_remove_duplicates(m_extruder_ids);
m_extruder_ids.shrink_to_fit();
+#if ENABLE_SPIRAL_VASE_LAYERS
+ // replace layers for spiral vase mode
+ if (!gcode_result.spiral_vase_layers.empty()) {
+ m_layers.reset();
+ for (const auto& layer : gcode_result.spiral_vase_layers) {
+ m_layers.append(layer.first, { layer.second.first, layer.second.second });
+ }
+ }
+#endif // ENABLE_SPIRAL_VASE_LAYERS
+
// set layers z range
if (!m_layers.empty())
m_layers_z_range = { 0, static_cast<unsigned int>(m_layers.size() - 1) };
diff --git a/src/slic3r/GUI/GCodeViewer.hpp b/src/slic3r/GUI/GCodeViewer.hpp
index c56e88c88..a67208f10 100644
--- a/src/slic3r/GUI/GCodeViewer.hpp
+++ b/src/slic3r/GUI/GCodeViewer.hpp
@@ -448,9 +448,8 @@ class GCodeViewer
size_t first{ 0 };
size_t last{ 0 };
- bool operator == (const Endpoints& other) const {
- return first == other.first && last == other.last;
- }
+ bool operator == (const Endpoints& other) const { return first == other.first && last == other.last; }
+ bool operator != (const Endpoints& other) const { return !operator==(other); }
};
private:
@@ -479,9 +478,8 @@ class GCodeViewer
bool operator != (const Layers& other) const {
if (m_zs != other.m_zs)
return true;
- if (!(m_endpoints == other.m_endpoints))
+ if (m_endpoints != other.m_endpoints)
return true;
-
return false;
}
};