Solved merge conflict in cherry-pick CURA-3390

This commit is contained in:
Jack Ha 2017-03-15 13:14:51 +01:00
parent fb2c318a0a
commit ea0c55fff1

View file

@ -2,6 +2,7 @@
# Cura is released under the terms of the AGPLv3 or higher. # Cura is released under the terms of the AGPLv3 or higher.
from UM.Application import Application from UM.Application import Application
from UM.Job import Job
from UM.Logger import Logger from UM.Logger import Logger
from UM.Math.AxisAlignedBox import AxisAlignedBox from UM.Math.AxisAlignedBox import AxisAlignedBox
from UM.Math.Vector import Vector from UM.Math.Vector import Vector
@ -174,11 +175,20 @@ class GCodeReader(MeshReader):
def _processGCode(self, G, line, position, path): def _processGCode(self, G, line, position, path):
func = getattr(self, "_gCode%s" % G, None) func = getattr(self, "_gCode%s" % G, None)
x = self._getFloat(line, "X")
y = self._getFloat(line, "Y")
z = self._getFloat(line, "Z")
e = self._getFloat(line, "E")
if func is not None: if func is not None:
s = line.upper().split(" ")
x, y, z, e = None, None, None, None
for item in s[1:]:
if not item:
continue
if item[0] == "X":
x = float(item[1:])
if item[0] == "Y":
y = float(item[1:])
if item[0] == "Z":
z = float(item[1:])
if item[0] == "E":
e = float(item[1:])
if (x is not None and x < 0) or (y is not None and y < 0): if (x is not None and x < 0) or (y is not None and y < 0):
self._center_is_zero = True self._center_is_zero = True
params = self._position(x, y, z, e) params = self._position(x, y, z, e)
@ -280,11 +290,16 @@ class GCodeReader(MeshReader):
if T is not None: if T is not None:
current_position = self._processTCode(T, line, current_position, current_path) current_position = self._processTCode(T, line, current_position, current_path)
if current_line % 32 == 0:
Job.yieldThread()
if not self._is_layers_in_file and len(current_path) > 1 and current_position[2] > 0: if not self._is_layers_in_file and len(current_path) > 1 and current_position[2] > 0:
if self._createPolygon(current_position[2], current_path): if self._createPolygon(current_position[2], current_path):
self._layer_number += 1 self._layer_number += 1
current_path.clear() current_path.clear()
material_color_map = numpy.zeros((10, 4), dtype = numpy.float32) material_color_map = numpy.zeros((10, 4), dtype = numpy.float32)
material_color_map[0, :] = [0.0, 0.7, 0.9, 1.0] material_color_map[0, :] = [0.0, 0.7, 0.9, 1.0]
material_color_map[1, :] = [0.7, 0.9, 0.0, 1.0] material_color_map[1, :] = [0.7, 0.9, 0.0, 1.0]