Merge branch '4.1'

This commit is contained in:
Ghostkeeper 2019-05-06 11:47:41 +02:00
commit fca21834dd
No known key found for this signature in database
GPG Key ID: 86BEF881AE2CF276
2 changed files with 11 additions and 31 deletions

View File

@ -116,11 +116,11 @@ class CuraSceneNode(SceneNode):
if self._mesh_data:
self._aabb = self._mesh_data.getExtents(self.getWorldTransformation())
for child in self._children:
for child in self.getAllChildren():
if child.callDecoration("isNonPrintingMesh"):
# Non-printing-meshes inside a group should not affect push apart or drop to build plate
continue
if not child._mesh_data:
if not child.getMeshData():
# Nodes without mesh data should not affect bounding boxes of their parents.
continue
if self._aabb is None:

View File

@ -1,9 +1,7 @@
# Copyright (c) 2019 Ultimaker B.V.
# The PostProcessingPlugin is released under the terms of the AGPLv3 or higher.
from typing import Optional, Tuple
from UM.Logger import Logger
from typing import List
from ..Script import Script
class FilamentChange(Script):
@ -65,9 +63,10 @@ class FilamentChange(Script):
}
}"""
def execute(self, data: list):
"""data is a list. Each index contains a layer"""
## Inserts the filament change g-code at specific layer numbers.
# \param data A list of layers of g-code.
# \return A similar list, with filament change commands inserted.
def execute(self, data: List[str]):
layer_nums = self.getSettingValueByKey("layer_number")
initial_retract = self.getSettingValueByKey("initial_retract")
later_retract = self.getSettingValueByKey("later_retract")
@ -88,32 +87,13 @@ class FilamentChange(Script):
if y_pos is not None:
color_change = color_change + (" Y%.2f" % y_pos)
color_change = color_change + " ; Generated by FilamentChange plugin"
color_change = color_change + " ; Generated by FilamentChange plugin\n"
layer_targets = layer_nums.split(",")
if len(layer_targets) > 0:
for layer_num in layer_targets:
layer_num = int(layer_num.strip())
layer_num = int(layer_num.strip()) + 1
if layer_num <= len(data):
index, layer_data = self._searchLayerData(data, layer_num - 1)
if layer_data is None:
Logger.log("e", "Could not find the layer {layer_num}".format(layer_num = layer_num))
continue
lines = layer_data.split("\n")
lines.insert(2, color_change)
final_line = "\n".join(lines)
data[index] = final_line
data[layer_num] = color_change + data[layer_num]
return data
## This method returns the data corresponding with the indicated layer number, looking in the gcode for
# the occurrence of this layer number.
def _searchLayerData(self, data: list, layer_num: int) -> Tuple[int, Optional[str]]:
for index, layer_data in enumerate(data):
first_line = layer_data.split("\n")[0]
# The first line should contain the layer number at the beginning.
if first_line[:len(self._layer_keyword)] == self._layer_keyword:
# If found the layer that we are looking for, then return the data
if first_line[len(self._layer_keyword):] == str(layer_num):
return index, layer_data
return 0, None
return data