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

github.com/Ultimaker/CuraEngine.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGhostkeeper <rubend@tutanota.com>2022-04-15 19:35:59 +0300
committerGhostkeeper <rubend@tutanota.com>2022-04-15 19:35:59 +0300
commitb649a4bcebeede367704a59189f7e88e8ab16fd3 (patch)
treef2563fea20375b94b207f40d716cdd14661b9988
parent0823c4729cda4a7d5554438da6fcbaf78f3692e0 (diff)
Send support structures for visualisationimmediate_visualization
-rw-r--r--src/FffPolygonGenerator.cpp11
-rw-r--r--src/TreeSupport.cpp20
-rw-r--r--src/sliceDataStorage.h1
-rw-r--r--src/support.cpp10
4 files changed, 37 insertions, 5 deletions
diff --git a/src/FffPolygonGenerator.cpp b/src/FffPolygonGenerator.cpp
index 6350e7c19..bcec45a8f 100644
--- a/src/FffPolygonGenerator.cpp
+++ b/src/FffPolygonGenerator.cpp
@@ -244,16 +244,25 @@ bool FffPolygonGenerator::sliceModel(MeshGroup* meshgroup, TimeKeeper& timeKeepe
generateMultipleVolumesOverlap(slicerList);
storage.print_layer_count = 0;
+ size_t tallest_mesh_idx = 0;
for (unsigned int meshIdx = 0; meshIdx < slicerList.size(); meshIdx++)
{
Mesh& mesh = scene.current_mesh_group->meshes[meshIdx];
Slicer* slicer = slicerList[meshIdx];
if (!mesh.settings.get<bool>("anti_overhang_mesh") && !mesh.settings.get<bool>("infill_mesh") && !mesh.settings.get<bool>("cutting_mesh"))
{
- storage.print_layer_count = std::max(storage.print_layer_count, slicer->layers.size());
+ if(slicer->layers.size() > storage.print_layer_count)
+ {
+ storage.print_layer_count = slicer->layers.size();
+ tallest_mesh_idx = meshIdx;
+ }
}
}
storage.support.supportLayers.resize(storage.print_layer_count);
+ for(size_t layer_idx = 0; layer_idx < storage.print_layer_count; ++layer_idx)
+ {
+ storage.support.supportLayers[layer_idx].z = slicerList[tallest_mesh_idx]->layers[layer_idx].z;
+ }
storage.meshes.reserve(slicerList.size()); // causes there to be no resize in meshes so that the pointers in sliceMeshStorage._config to retraction_config don't get invalidated.
for (unsigned int meshIdx = 0; meshIdx < slicerList.size(); meshIdx++)
diff --git a/src/TreeSupport.cpp b/src/TreeSupport.cpp
index 6edfa7f29..866a5f7a0 100644
--- a/src/TreeSupport.cpp
+++ b/src/TreeSupport.cpp
@@ -1,7 +1,8 @@
-//Copyright (c) 2021 Ultimaker B.V.
+//Copyright (c) 2022 Ultimaker B.V.
//CuraEngine is released under the terms of the AGPLv3 or higher.
#include "Application.h" //To get settings.
+#include "communication/Communication.h"
#include "ExtruderTrain.h"
#include "Slice.h"
#include "sliceDataStorage.h"
@@ -139,15 +140,26 @@ void TreeSupport::drawCircles(SliceDataStorage& storage, const std::vector<std::
support_layer.add(circle);
}
}
+
+ //We smooth this support as much as possible without altering single circles. So we remove any line less than the side length of those circles.
+ const double diameter_angle_scale_factor_this_layer = static_cast<double>(storage.support.supportLayers.size() - layer_nr - tip_layers) * diameter_angle_scale_factor; //Maximum scale factor.
+ support_layer.simplify(circle_side_length * (1 + diameter_angle_scale_factor_this_layer), resolution); //Don't deviate more than the collision resolution so that the lines still stack properly.
+
+ //Send to front-end for visualization.
+ if(!support_layer.empty())
+ {
+ for(Communication* channel : Application::getInstance().communications)
+ {
+ channel->sendStructurePolygon(support_layer, StructureType::Support, layer_nr, storage.support.supportLayers[layer_nr].z);
+ }
+ }
+
support_layer = support_layer.unionPolygons();
roof_layer = roof_layer.unionPolygons();
const size_t z_collision_layer = static_cast<size_t>(std::max(0, static_cast<int>(layer_nr) - static_cast<int>(z_distance_bottom_layers) + 1)); //Layer to test against to create a Z-distance.
support_layer = support_layer.difference(volumes_.getCollision(0, z_collision_layer)); //Subtract the model itself (sample 0 is with 0 diameter but proper X/Y offset).
roof_layer = roof_layer.difference(volumes_.getCollision(0, z_collision_layer));
support_layer = support_layer.difference(roof_layer);
- //We smooth this support as much as possible without altering single circles. So we remove any line less than the side length of those circles.
- const double diameter_angle_scale_factor_this_layer = static_cast<double>(storage.support.supportLayers.size() - layer_nr - tip_layers) * diameter_angle_scale_factor; //Maximum scale factor.
- support_layer.simplify(circle_side_length * (1 + diameter_angle_scale_factor_this_layer), resolution); //Don't deviate more than the collision resolution so that the lines still stack properly.
//Subtract support floors.
if (mesh_group_settings.get<bool>("support_bottom_enable"))
diff --git a/src/sliceDataStorage.h b/src/sliceDataStorage.h
index 658932fb5..45bcdd19e 100644
--- a/src/sliceDataStorage.h
+++ b/src/sliceDataStorage.h
@@ -209,6 +209,7 @@ public:
Polygons support_mesh_drop_down; //!< Areas from support meshes which should be supported by more support
Polygons support_mesh; //!< Areas from support meshes which should NOT be supported by more support
Polygons anti_overhang; //!< Areas where no overhang should be detected.
+ coord_t z; //!< Z coordinate at which this layer gets printed.
/*!
* Exclude the given polygons from the support infill areas and update the SupportInfillParts.
diff --git a/src/support.cpp b/src/support.cpp
index 23e611ffb..ae76de110 100644
--- a/src/support.cpp
+++ b/src/support.cpp
@@ -11,6 +11,7 @@
#endif // _OPENMP
#include "Application.h" //To get settings.
+#include "communication/Communication.h"
#include "ExtruderTrain.h"
#include "Slice.h"
#include "slicer.h"
@@ -666,6 +667,15 @@ void AreaSupport::generateSupportAreas(SliceDataStorage& storage)
{
Polygons& support_areas = global_support_areas_per_layer[layer_idx];
support_areas = support_areas.unionPolygons();
+
+ //Send to front-end for visualization.
+ if(!support_areas.empty())
+ {
+ for(Communication* channel : Application::getInstance().communications)
+ {
+ channel->sendStructurePolygon(support_areas, StructureType::Support, layer_idx, storage.support.supportLayers[layer_idx].z);
+ }
+ }
}
// handle support interface