diff --git a/Commands/TransferMeshCommand.py b/Commands/TransferMeshCommand.py index 93349d853d..11791986f8 100644 --- a/Commands/TransferMeshCommand.py +++ b/Commands/TransferMeshCommand.py @@ -6,7 +6,16 @@ class TransferMeshCommand(Command): super(TransferMeshCommand,self).__init__() def send(self, mesh_data): - vertices = mesh_data.getVertices() + vertices = mesh_data.getVerticesList() + self._socket.sendCommand(0x00200001, len(vertices)) # Tell other side that mesh with num vertices is going to be sent. + command = TransferVertCommand(self._socket) - for vertex in vertices: - command.send(vertex) \ No newline at end of file + command.send(vertices) + + + def recieve(self): + command_id, data = self._socket.getNextCommand() + if(command_id is not 0x00200001): + print("Wrong command!") + return None + unpacked_data = struct(' \ No newline at end of file diff --git a/Commands/TransferMeshesCommand.py b/Commands/TransferMeshesCommand.py index b6ad579818..23ec09f9af 100644 --- a/Commands/TransferMeshesCommand.py +++ b/Commands/TransferMeshesCommand.py @@ -6,7 +6,14 @@ class TransferMeshesCommand(Command): super(TransferMeshesCommand,self).__init__() def send(self, meshes): + self._socket.sendCommand(0x00200000,len(meshes)) # Tell other side that n meshes are going to be sent. command = TransferMeshCommand(self._socket) for mesh in meshes: command.send(mesh) - \ No newline at end of file + + def recieve(self, num_meshes): + meshes = [] + command = TransferMeshCommand(self._socket) + for x in range(0,num_meshes): + meshes.append(command.recieve()) + return meshes \ No newline at end of file diff --git a/Commands/TransferVertCommand.py b/Commands/TransferVertCommand.py deleted file mode 100644 index ec2fb52bf6..0000000000 --- a/Commands/TransferVertCommand.py +++ /dev/null @@ -1,8 +0,0 @@ -from Cura.Backend.Command import Command - -class TransferVertCommand(Command): - def __init__(self): - super(TransferVertCommand,self).__init__() - - def send(self, vertex): - self._socket.sendData(self._id, vertex.toString()) \ No newline at end of file diff --git a/Commands/TransferVerticeListCommand.py b/Commands/TransferVerticeListCommand.py new file mode 100644 index 0000000000..20b1bf3dc0 --- /dev/null +++ b/Commands/TransferVerticeListCommand.py @@ -0,0 +1,8 @@ +from Cura.Backend.Command import Command + +class TransferVerticeListCommand(Command): + def __init__(self): + super(TransferVertCommand,self).__init__() + + def send(self, vertices): + self._socet.sendCommandPacked(0x00200002, vertices.toString()) # Send vertex list \ No newline at end of file