mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-06 22:47:29 -06:00
D5: Added cura-generated gcode coloring
This commit is contained in:
parent
897f01150b
commit
a795323e5f
1 changed files with 17 additions and 1 deletions
|
@ -98,6 +98,7 @@ class GCodeReader(MeshReader):
|
||||||
count = len(path)
|
count = len(path)
|
||||||
line_types = numpy.empty((count - 1, 1), numpy.int32)
|
line_types = numpy.empty((count - 1, 1), numpy.int32)
|
||||||
line_widths = numpy.empty((count - 1, 1), numpy.float32)
|
line_widths = numpy.empty((count - 1, 1), numpy.float32)
|
||||||
|
# TODO: need to calculate actual line width based on E values
|
||||||
line_widths[:, 0] = 0.5
|
line_widths[:, 0] = 0.5
|
||||||
points = numpy.empty((count, 3), numpy.float32)
|
points = numpy.empty((count, 3), numpy.float32)
|
||||||
i = 0
|
i = 0
|
||||||
|
@ -151,6 +152,7 @@ class GCodeReader(MeshReader):
|
||||||
current_y = 0
|
current_y = 0
|
||||||
current_z = 0
|
current_z = 0
|
||||||
current_e = 0
|
current_e = 0
|
||||||
|
current_block = LayerPolygon.Inset0Type
|
||||||
current_layer = 0
|
current_layer = 0
|
||||||
prev_z = 0
|
prev_z = 0
|
||||||
|
|
||||||
|
@ -169,6 +171,20 @@ class GCodeReader(MeshReader):
|
||||||
self._message.setProgress(math.floor(current_line / file_lines * 100))
|
self._message.setProgress(math.floor(current_line / file_lines * 100))
|
||||||
if len(line) == 0:
|
if len(line) == 0:
|
||||||
continue
|
continue
|
||||||
|
if line.find(";TYPE:") == 0:
|
||||||
|
type = line[6:].strip()
|
||||||
|
if type == "WALL-INNER":
|
||||||
|
current_block = LayerPolygon.InsetXType
|
||||||
|
elif type == "WALL-OUTER":
|
||||||
|
current_block = LayerPolygon.Inset0Type
|
||||||
|
elif type == "SKIN":
|
||||||
|
current_block = LayerPolygon.SkinType
|
||||||
|
elif type == "SKIRT":
|
||||||
|
current_block = LayerPolygon.SkirtType
|
||||||
|
elif type == "SUPPORT":
|
||||||
|
current_block = LayerPolygon.SupportType
|
||||||
|
elif type == "FILL":
|
||||||
|
current_block = LayerPolygon.InfillType
|
||||||
if line[0] == ";":
|
if line[0] == ";":
|
||||||
continue
|
continue
|
||||||
G = self._getInt(line, "G")
|
G = self._getInt(line, "G")
|
||||||
|
@ -190,7 +206,7 @@ class GCodeReader(MeshReader):
|
||||||
current_z = z
|
current_z = z
|
||||||
if e is not None:
|
if e is not None:
|
||||||
if e > current_e:
|
if e > current_e:
|
||||||
current_path.append([current_x, current_y, current_z, LayerPolygon.Inset0Type]) # extrusion
|
current_path.append([current_x, current_y, current_z, current_block]) # extrusion
|
||||||
else:
|
else:
|
||||||
current_path.append([current_x, current_y, current_z, LayerPolygon.MoveRetractionType]) # retraction
|
current_path.append([current_x, current_y, current_z, LayerPolygon.MoveRetractionType]) # retraction
|
||||||
current_e = e
|
current_e = e
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue