mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-06-04 11:14:21 +08:00
Set up more scene stuff in PrinterApplication
This commit is contained in:
parent
3c4250c6fb
commit
35a67b6d25
@ -2,6 +2,8 @@ from Cura.Qt.QtApplication import QtApplication
|
|||||||
from Cura.Scene.SceneNode import SceneNode
|
from Cura.Scene.SceneNode import SceneNode
|
||||||
from Cura.Scene.Camera import Camera
|
from Cura.Scene.Camera import Camera
|
||||||
from Cura.Math.Vector import Vector
|
from Cura.Math.Vector import Vector
|
||||||
|
from Cura.Math.Matrix import Matrix
|
||||||
|
from Cura.Resources import Resources
|
||||||
|
|
||||||
import os.path
|
import os.path
|
||||||
|
|
||||||
@ -20,21 +22,45 @@ class PrinterApplication(QtApplication):
|
|||||||
|
|
||||||
root = self.getController().getScene().getRoot()
|
root = self.getController().getScene().getRoot()
|
||||||
mesh = SceneNode(root)
|
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 = Camera('3d', root)
|
||||||
camera.translate(Vector(0, 5, 5))
|
camera.translate(Vector(0, 150, 150))
|
||||||
camera.rotateByAngleAxis(45, Vector(1, 0, 0))
|
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 = Camera('left', root)
|
||||||
camera.translate(Vector(5, 0, 0))
|
camera.translate(Vector(150, 0, 0))
|
||||||
camera.rotateByAngleAxis(-90, Vector(0, 1, 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)
|
camera.setLocked(True)
|
||||||
|
|
||||||
self.getController().getScene().setActiveCamera('3d')
|
self.getController().getScene().setActiveCamera('3d')
|
||||||
|
|
||||||
self.log('i',"Application started")
|
|
||||||
|
|
||||||
self.setMainQml(os.path.dirname(__file__) + "/Printer.qml")
|
self.setMainQml(os.path.dirname(__file__) + "/Printer.qml")
|
||||||
self.initializeEngine()
|
self.initializeEngine()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user