mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 21:09:01 +08:00
Codestyle & removal unused imports
This commit is contained in:
parent
808df4c228
commit
94c6b23418
@ -1,10 +1,8 @@
|
||||
from .LayerPolygon import LayerPolygon
|
||||
|
||||
from UM.Math.Vector import Vector
|
||||
from UM.Mesh.MeshBuilder import MeshBuilder
|
||||
|
||||
import numpy
|
||||
|
||||
|
||||
class Layer:
|
||||
def __init__(self, layer_id):
|
||||
self._id = layer_id
|
||||
@ -81,7 +79,6 @@ class Layer:
|
||||
for polygon in self._polygons:
|
||||
line_count += polygon.jumpCount
|
||||
|
||||
|
||||
# Reserve the neccesary space for the data upfront
|
||||
builder.reserveFaceAndVertexCount(2 * line_count, 4 * line_count)
|
||||
|
||||
@ -106,13 +103,14 @@ class Layer:
|
||||
# Scale all normals by the line width of the current line so we can easily offset.
|
||||
normals *= (polygon.lineWidths[index_mask.ravel()] / 2)
|
||||
|
||||
# Create 4 points to draw each line segment, points +- normals results in 2 points each. Reshape to one point per line
|
||||
# Create 4 points to draw each line segment, points +- normals results in 2 points each.
|
||||
# After this we 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 = ( 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)
|
||||
|
||||
|
||||
return builder.build()
|
@ -2,6 +2,7 @@
|
||||
# Cura is released under the terms of the AGPLv3 or higher.
|
||||
from UM.Mesh.MeshData import MeshData
|
||||
|
||||
|
||||
## Class to holds the layer mesh and information about the layers.
|
||||
# Immutable, use LayerDataBuilder to create one of these.
|
||||
class LayerData(MeshData):
|
||||
|
@ -8,6 +8,7 @@ from .LayerData import LayerData
|
||||
|
||||
import numpy
|
||||
|
||||
|
||||
## Builder class for constructing a LayerData object
|
||||
class LayerDataBuilder(MeshBuilder):
|
||||
def __init__(self):
|
||||
|
Loading…
x
Reference in New Issue
Block a user