diff --git a/PrinterApplication.py b/PrinterApplication.py index 95a249a061..a5b47c9934 100644 --- a/PrinterApplication.py +++ b/PrinterApplication.py @@ -2,6 +2,8 @@ from Cura.Qt.QtApplication import QtApplication from Cura.Scene.SceneNode import SceneNode from Cura.Scene.Camera import Camera from Cura.Math.Vector import Vector +from Cura.Math.Matrix import Matrix +from Cura.Resources import Resources import os.path @@ -20,21 +22,45 @@ class PrinterApplication(QtApplication): root = self.getController().getScene().getRoot() mesh = SceneNode(root) - mesh.setMeshData(self.getMeshFileHandler().read("plugins/FileHandlers/STLReader/simpleTestCube.stl",self.getStorageDevice('local'))) + mesh.setMeshData(self.getMeshFileHandler().read(Resources.getMesh("ultimaker2_platform.stl"), self.getStorageDevice('local'))) + + mesh2 = SceneNode(mesh) + mesh2.setMeshData(self.getMeshFileHandler().read(Resources.getMesh("sphere.obj"), self.getStorageDevice('local'))) + mesh2.translate(Vector(0, 50, 0)) + mesh2.scale(20) camera = Camera('3d', root) - camera.translate(Vector(0, 5, 5)) - camera.rotateByAngleAxis(45, Vector(1, 0, 0)) + camera.translate(Vector(0, 150, 150)) + proj = Matrix() + proj.setOrtho(-200, 200, -200, 200, -500, 500) + camera.setProjectionMatrix(proj) + camera.rotateByAngleAxis(-45, Vector(1, 0, 0)) camera = Camera('left', root) - camera.translate(Vector(5, 0, 0)) + camera.translate(Vector(150, 0, 0)) camera.rotateByAngleAxis(-90, Vector(0, 1, 0)) + proj = Matrix() + proj.setOrtho(-200, 200, -200, 200, -500, 500) + camera.setProjectionMatrix(proj) + camera.setLocked(True) + + camera = Camera('top', root) + camera.translate(Vector(0, 150, 0)) + camera.rotateByAngleAxis(-90, Vector(1, 0, 0)) + proj = Matrix() + proj.setOrtho(-200, 200, -200, 200, -500, 500) + camera.setProjectionMatrix(proj) + camera.setLocked(True) + + camera = Camera('front', root) + camera.translate(Vector(0, 0, 150)) + proj = Matrix() + proj.setOrtho(-200, 200, -200, 200, -500, 500) + camera.setProjectionMatrix(proj) camera.setLocked(True) self.getController().getScene().setActiveCamera('3d') - self.log('i',"Application started") - self.setMainQml(os.path.dirname(__file__) + "/Printer.qml") self.initializeEngine()