Removed unused option in LayerPolygon, added comments

This commit is contained in:
Jack Ha 2017-02-08 11:24:41 +01:00
parent 6c19bc1c16
commit 50ba236e66
3 changed files with 15 additions and 7 deletions

View file

@ -48,8 +48,10 @@ class LayerDataBuilder(MeshBuilder):
self._layers[layer].setThickness(thickness)
# material color map: [r, g, b, a] for each extruder row.
# line_type_brightness: compatibility layer view uses line type brightness of 0.5
## Return the layer data as LayerData.
#
# \param material_color_map: [r, g, b, a] for each extruder row.
# \param line_type_brightness: compatibility layer view uses line type brightness of 0.5
def build(self, material_color_map, line_type_brightness = 1.0):
vertex_count = 0
index_count = 0
@ -75,9 +77,12 @@ class LayerDataBuilder(MeshBuilder):
self.addColors(colors)
self.addIndices(indices.flatten())
# Note: we're using numpy indexing here.
# See also: https://docs.scipy.org/doc/numpy/reference/arrays.indexing.html
material_colors = numpy.zeros((line_dimensions.shape[0], 4), dtype=numpy.float32)
for extruder_nr in range(material_color_map.shape[0]):
material_colors[extruders == extruder_nr] = material_color_map[extruder_nr]
# Set material_colors with indices where line_types (also numpy array) == MoveCombingType
material_colors[line_types == LayerPolygon.MoveCombingType] = colors[line_types == LayerPolygon.MoveCombingType]
material_colors[line_types == LayerPolygon.MoveRetractionType] = colors[line_types == LayerPolygon.MoveRetractionType]

View file

@ -19,10 +19,13 @@ class LayerPolygon:
__jump_map = numpy.logical_or(numpy.logical_or(numpy.arange(11) == NoneType, numpy.arange(11) == MoveCombingType), numpy.arange(11) == MoveRetractionType)
## LayerPolygon
# line_thicknesses: array with type as index and thickness as value
def __init__(self, mesh, extruder, line_types, data, line_widths, line_thicknesses):
self._mesh = mesh
## LayerPolygon, used in ProcessSlicedLayersJob
# \param extruder
# \param line_types array with line_types
# \param data new_points
# \param line_widths array with line widths
# \param line_thicknesses: array with type as index and thickness as value
def __init__(self, extruder, line_types, data, line_widths, line_thicknesses):
self._extruder = extruder
self._types = line_types
self._data = data

View file

@ -139,7 +139,7 @@ class ProcessSlicedLayersJob(Job):
new_points[:, 1] = points[:, 2]
new_points[:, 2] = -points[:, 1]
this_poly = LayerPolygon.LayerPolygon(layer_data, extruder, line_types, new_points, line_widths, line_thicknesses)
this_poly = LayerPolygon.LayerPolygon(extruder, line_types, new_points, line_widths, line_thicknesses)
this_poly.buildCache()
this_layer.polygons.append(this_poly)