File: 1012-numpy-fromstring-deprecation.patch

package info (click to toggle)
cura 5.0.0-7
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 122,920 kB
  • sloc: python: 44,572; sh: 81; xml: 32; makefile: 16
file content (42 lines) | stat: -rw-r--r-- 2,836 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
--- a/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py
+++ b/plugins/CuraEngineBackend/ProcessSlicedLayersJob.py
@@ -140,23 +140,23 @@
 
                 extruder = polygon.extruder
 
-                line_types = numpy.fromstring(polygon.line_type, dtype = "u1")  # Convert bytearray to numpy array
+                line_types = numpy.frombuffer(polygon.line_type, dtype = "u1")  # Convert bytearray to numpy array
 
                 line_types = line_types.reshape((-1,1))
 
-                points = numpy.fromstring(polygon.points, dtype = "f4")  # Convert bytearray to numpy array
+                points = numpy.frombuffer(polygon.points, dtype = "f4")  # Convert bytearray to numpy array
                 if polygon.point_type == 0: # Point2D
                     points = points.reshape((-1,2))  # We get a linear list of pairs that make up the points, so make numpy interpret them correctly.
                 else:  # Point3D
                     points = points.reshape((-1,3))
 
-                line_widths = numpy.fromstring(polygon.line_width, dtype = "f4")  # Convert bytearray to numpy array
+                line_widths = numpy.frombuffer(polygon.line_width, dtype = "f4")  # Convert bytearray to numpy array
                 line_widths = line_widths.reshape((-1,1))  # We get a linear list of pairs that make up the points, so make numpy interpret them correctly.
 
-                line_thicknesses = numpy.fromstring(polygon.line_thickness, dtype = "f4")  # Convert bytearray to numpy array
+                line_thicknesses = numpy.frombuffer(polygon.line_thickness, dtype = "f4")  # Convert bytearray to numpy array
                 line_thicknesses = line_thicknesses.reshape((-1,1))  # We get a linear list of pairs that make up the points, so make numpy interpret them correctly.
 
-                line_feedrates = numpy.fromstring(polygon.line_feedrate, dtype = "f4")  # Convert bytearray to numpy array
+                line_feedrates = numpy.frombuffer(polygon.line_feedrate, dtype = "f4")  # Convert bytearray to numpy array
                 line_feedrates = line_feedrates.reshape((-1,1))  # We get a linear list of pairs that make up the points, so make numpy interpret them correctly.
 
                 # Create a new 3D-array, copy the 2D points over and insert the right height.
--- a/plugins/3MFReader/ThreeMFReader.py
+++ b/plugins/3MFReader/ThreeMFReader.py
@@ -123,7 +123,7 @@
         um_node.setTransformation(transformation)
         mesh_builder = MeshBuilder()
 
-        data = numpy.fromstring(savitar_node.getMeshData().getFlatVerticesAsBytes(), dtype=numpy.float32)
+        data = numpy.frombuffer(savitar_node.getMeshData().getFlatVerticesAsBytes(), dtype=numpy.float32)
 
         vertices = numpy.resize(data, (int(data.size / 3), 3))
         mesh_builder.setVertices(vertices)