mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-09 07:56:22 -06:00
Use the new Job class to process the sliced polygons received from backend
This commit is contained in:
parent
ecd8a8d2a3
commit
ae63fdf58c
1 changed files with 12 additions and 11 deletions
|
@ -5,6 +5,7 @@ from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
|
||||||
from UM.Preferences import Preferences
|
from UM.Preferences import Preferences
|
||||||
|
|
||||||
from . import Cura_pb2
|
from . import Cura_pb2
|
||||||
|
from . import ProcessSlicedObjectListJob
|
||||||
|
|
||||||
class CuraEngineBackend(Backend):
|
class CuraEngineBackend(Backend):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
@ -35,23 +36,23 @@ class CuraEngineBackend(Backend):
|
||||||
meshData = object.getMeshData()
|
meshData = object.getMeshData()
|
||||||
|
|
||||||
obj = msg.objects.add()
|
obj = msg.objects.add()
|
||||||
obj.vertices = meshData.getVerticesAsByteArray()
|
obj.id = id(object)
|
||||||
|
|
||||||
if meshData.hasNormals():
|
verts = meshData.getVertices()
|
||||||
obj.normals = meshData.getNormalsAsByteArray()
|
verts[:,[1,2]] = verts[:,[2,1]]
|
||||||
|
obj.vertices = verts.tostring()
|
||||||
|
|
||||||
if meshData.hasIndices():
|
#if meshData.hasNormals():
|
||||||
obj.indices = meshData.getIndicesAsByteArray()
|
#obj.normals = meshData.getNormalsAsByteArray()
|
||||||
|
|
||||||
|
#if meshData.hasIndices():
|
||||||
|
#obj.indices = meshData.getIndicesAsByteArray()
|
||||||
|
|
||||||
self._socket.sendMessage(msg)
|
self._socket.sendMessage(msg)
|
||||||
|
|
||||||
def _onSlicedObjectListMessage(self, message):
|
def _onSlicedObjectListMessage(self, message):
|
||||||
print('Received Sliced Objects')
|
job = ProcessSlicedObjectListJob.ProcessSlicedObjectListJob(message)
|
||||||
|
job.start()
|
||||||
for object in message.objects:
|
|
||||||
print('Object:', object.id)
|
|
||||||
for layer in object.layers:
|
|
||||||
print(' Layer:', layer.id)
|
|
||||||
|
|
||||||
def _onProgressMessage(self, message):
|
def _onProgressMessage(self, message):
|
||||||
self.processingProgress.emit(message.amount)
|
self.processingProgress.emit(message.amount)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue