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:
authorJack Ha <j.ha@ultimaker.com>2016-12-28 13:30:59 +0300
committerJack Ha <j.ha@ultimaker.com>2016-12-28 13:30:59 +0300
commit9904dad07b17aacdc7175d82f98a1ac161609ba4 (patch)
treeb64a41c9de74f098e0a29897063940e3f1e1f61f /cura/LayerPolygon.py
parentc12e6da3ac5224ae72111ae21a1e648f321c5e2d (diff)
Added line thickness to layer view
Diffstat (limited to 'cura/LayerPolygon.py')
-rw-r--r--cura/LayerPolygon.py11
1 files changed, 8 insertions, 3 deletions
diff --git a/cura/LayerPolygon.py b/cura/LayerPolygon.py
index 27b9a9c11d..628fd78350 100644
--- a/cura/LayerPolygon.py
+++ b/cura/LayerPolygon.py
@@ -64,8 +64,9 @@ class LayerPolygon:
self._vertex_begin = 0
self._vertex_end = numpy.sum( self._build_cache_needed_points )
-
- def build(self, vertex_offset, index_offset, vertices, colors, indices):
+ ## build
+ # line_thicknesses: array with type as index and thickness as value
+ def build(self, vertex_offset, index_offset, vertices, colors, line_dimensions, indices, thickness):
if (self._build_cache_line_mesh_mask is None) or (self._build_cache_needed_points is None ):
self.buildCache()
@@ -84,9 +85,13 @@ class LayerPolygon:
# Points are picked based on the index list to get the vertices needed.
vertices[self._vertex_begin:self._vertex_end, :] = self._data[index_list, :]
# Create an array with colors for each vertex and remove the color data for the points that has been thrown away.
- colors[self._vertex_begin:self._vertex_end, :] = numpy.tile(self._colors, (1, 2)).reshape((-1, 4))[needed_points_list.ravel()]
+ colors[self._vertex_begin:self._vertex_end, :] = numpy.tile(self._colors, (1, 2)).reshape((-1, 4))[needed_points_list.ravel()]
colors[self._vertex_begin:self._vertex_end, :] *= numpy.array([[0.5, 0.5, 0.5, 1.0]], numpy.float32)
+ # Create an array with line widths for each vertex.
+ line_dimensions[self._vertex_begin:self._vertex_end, :] = numpy.tile(self._line_widths, (1, 2)).reshape((-1, 1))[needed_points_list.ravel()]
+ line_dimensions[self._vertex_begin:self._vertex_end, 1] = thickness
+
# The relative values of begin and end indices have already been set in buildCache, so we only need to offset them to the parents offset.
self._index_begin += index_offset
self._index_end += index_offset