diff --git a/cura/Layer.py b/cura/Layer.py index 03b96f4f3a..4e38a6eba9 100644 --- a/cura/Layer.py +++ b/cura/Layer.py @@ -67,9 +67,11 @@ class Layer: def createJumps(self): return self.createMeshOrJumps(False) + # Defines the two triplets of local point indices to use to draw the two faces for each line segment in createMeshOrJump + __index_pattern = numpy.array([[0, 3, 2, 0, 1, 3]], dtype = numpy.int32 ) + def createMeshOrJumps(self, make_mesh): builder = MeshBuilder() - index_pattern = numpy.array([[0, 3, 2, 0, 1, 3]], dtype = numpy.int32 ) line_count = 0 if make_mesh: @@ -106,8 +108,8 @@ class Layer: # Create 4 points to draw each line segment, points +- normals results in 2 points each. Reshape to one point per line f_points = numpy.concatenate((points-normals, points+normals), 1).reshape((-1, 3)) - # index_pattern defines which points to use to draw the two faces for each lines egment, the following linesegment is offset by 4 - f_indices = ( index_pattern + numpy.arange(0, 4 * len(normals), 4, dtype=numpy.int32).reshape((-1, 1)) ).reshape((-1, 3)) + # __index_pattern defines which points to use to draw the two faces for each lines egment, the following linesegment is offset by 4 + f_indices = ( self.__index_pattern + numpy.arange(0, 4 * len(normals), 4, dtype=numpy.int32).reshape((-1, 1)) ).reshape((-1, 3)) f_colors = numpy.repeat(polygon.mapLineTypeToColor(line_types), 4, 0) builder.addFacesWithColor(f_points, f_indices, f_colors) diff --git a/cura/LayerPolygon.py b/cura/LayerPolygon.py index b063660198..c534592757 100644 --- a/cura/LayerPolygon.py +++ b/cura/LayerPolygon.py @@ -63,7 +63,7 @@ class LayerPolygon: def build(self, vertex_offset, index_offset, vertices, colors, indices): - if (self._build_cache_line_mesh_mask == None) or (self._build_cache_needed_points == None ): + if (self._build_cache_line_mesh_mask is None) or (self._build_cache_needed_points is None ): self.buildCache() line_mesh_mask = self._build_cache_line_mesh_mask diff --git a/plugins/CuraEngineBackend/Cura.proto b/plugins/CuraEngineBackend/Cura.proto index af4b40859d..d38f95035f 100644 --- a/plugins/CuraEngineBackend/Cura.proto +++ b/plugins/CuraEngineBackend/Cura.proto @@ -61,7 +61,7 @@ message Polygon { float line_width = 3; // The width of the line being laid down } -message LayerOptimized { +message LayerOptimized { int32 id = 1; float height = 2; // Z position float thickness = 3; // height of a single layer @@ -71,10 +71,15 @@ message LayerOptimized { message PathSegment { - int32 ordinal = 1; // The absolute ordinal of this line segment - bytes line_type = 2; // Type of line segment as an unsigned char array of length 1 or N, where N is the number of line segments in this path - bytes points = 3; // The points defining the line segments, bytes of int64[2]? array of length N+1 - bytes line_width = 4; // The widths of the line segments as bytes of a float?/int32? array of length 1 or N + int32 extruder = 1; // The extruder used for this path segment + enum PointType { + Point2D = 0; + Point3D = 1; + } + PointType point_type = 2; + bytes points = 3; // The points defining the line segments, bytes of int64[2/3]? array of length N+1 + bytes line_type = 4; // Type of line segment as an unsigned char array of length 1 or N, where N is the number of line segments in this path + bytes line_width = 5; // The widths of the line segments as bytes of a float? array of length 1 or N }