Set up more scene stuff in PrinterApplication

This commit is contained in:
Arjen Hiemstra 2014-12-05 13:45:40 +01:00
parent 3c4250c6fb
commit 35a67b6d25

View File

@ -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()