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

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Prado Gesto <d.pradogesto@ultimaker.com>2018-10-04 19:03:01 +0300
committerDiego Prado Gesto <d.pradogesto@ultimaker.com>2018-10-04 19:03:01 +0300
commit866110d70c4379ab86131b2a031da69bed4c4fe7 (patch)
tree5babcb75f41aa7fda6f451678b4a58d9371b6377 /plugins/CuraEngineBackend/ProcessSlicedLayersJob.py
parentd91d0fab10f1e26698599d1aa426c2d99ef5bbd3 (diff)
Take into account that can be empty layers below the model when the
setting Remove empty layers is disabled. The empty layers are skipped if they are at the bottom. Also keeps the models printed with raft showing correclty. Contributes to CURA-5768.
Diffstat (limited to 'plugins/CuraEngineBackend/ProcessSlicedLayersJob.py')
-rw-r--r--plugins/CuraEngineBackend/ProcessSlicedLayersJob.py33
1 files changed, 23 insertions, 10 deletions
diff --git a/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py b/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py
index 3953625c7e..594bf3a43e 100644
--- a/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py
+++ b/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py
@@ -2,6 +2,7 @@
#Cura is released under the terms of the LGPLv3 or higher.
import gc
+import sys
from UM.Job import Job
from UM.Application import Application
@@ -95,23 +96,35 @@ class ProcessSlicedLayersJob(Job):
layer_count = len(self._layers)
# Find the minimum layer number
+ # When disabling the remove empty first layers setting, the minimum layer number will be a positive
+ # value. In that case the first empty layers will be discarded and start processing layers from the
+ # first layer with data.
# When using a raft, the raft layers are sent as layers < 0. Instead of allowing layers < 0, we
- # instead simply offset all other layers so the lowest layer is always 0. It could happens that
- # the first raft layer has value -8 but there are just 4 raft (negative) layers.
- min_layer_number = 0
+ # simply offset all other layers so the lowest layer is always 0. It could happens that the first
+ # raft layer has value -8 but there are just 4 raft (negative) layers.
+ min_layer_number = sys.maxsize
negative_layers = 0
for layer in self._layers:
- if layer.id < min_layer_number:
- min_layer_number = layer.id
- if layer.id < 0:
- negative_layers += 1
+ if layer.repeatedMessageCount("path_segment") > 0:
+ if layer.id < min_layer_number:
+ min_layer_number = layer.id
+ if layer.id < 0:
+ negative_layers += 1
current_layer = 0
for layer in self._layers:
- # Negative layers are offset by the minimum layer number, but the positive layers are just
- # offset by the number of negative layers so there is no layer gap between raft and model
- abs_layer_number = layer.id + abs(min_layer_number) if layer.id < 0 else layer.id + negative_layers
+ # If the layer is below the minimum, it means that there is no data, so that we don't create a layer
+ # data. However, if there are empty layers in between, we compute them.
+ if layer.id < min_layer_number:
+ continue
+
+ # Layers are offset by the minimum layer number. In case the raft (negative layers) is being used,
+ # then the absolute layer number is adjusted by removing the empty layers that can be in between raft
+ # and the model
+ abs_layer_number = layer.id - min_layer_number
+ if layer.id >= 0 and negative_layers != 0:
+ abs_layer_number += (min_layer_number + negative_layers)
layer_data.addLayer(abs_layer_number)
this_layer = layer_data.getLayer(abs_layer_number)