Show scene boundingbox in JobSpecs

This commit is contained in:
fieldOfView 2015-11-18 11:24:21 +01:00
parent 6bfed19477
commit a1123655ff
2 changed files with 14 additions and 1 deletions

View File

@ -10,6 +10,7 @@ from UM.Scene.Platform import Platform
from UM.Math.Vector import Vector
from UM.Math.Matrix import Matrix
from UM.Math.Quaternion import Quaternion
from UM.Math.AxisAlignedBox import AxisAlignedBox
from UM.Resources import Resources
from UM.Scene.ToolHandle import ToolHandle
from UM.Scene.Iterator.DepthFirstIterator import DepthFirstIterator
@ -97,6 +98,7 @@ class CuraApplication(QtApplication):
self._i18n_catalog = None
self._previous_active_tool = None
self._platform_activity = False
self._scene_boundingbox = AxisAlignedBox()
self._job_name = None
self.getMachineManager().activeMachineInstanceChanged.connect(self._onActiveMachineChanged)
@ -240,18 +242,29 @@ class CuraApplication(QtApplication):
requestAddPrinter = pyqtSignal()
activityChanged = pyqtSignal()
sceneBoundingBoxChanged = pyqtSignal()
@pyqtProperty(bool, notify = activityChanged)
def getPlatformActivity(self):
return self._platform_activity
@pyqtProperty(str, notify = sceneBoundingBoxChanged)
def getSceneBoundingBoxString(self):
return self._i18n_catalog.i18nc("@info", "%.1f x %.1f x %.1f mm") % (self._scene_boundingbox.width.item(), self._scene_boundingbox.depth.item(), self._scene_boundingbox.height.item())
def updatePlatformActivity(self, node = None):
count = 0
scene_boundingbox = AxisAlignedBox()
for node in DepthFirstIterator(self.getController().getScene().getRoot()):
if type(node) is not SceneNode or not node.getMeshData():
continue
count += 1
scene_boundingbox += node.getBoundingBox()
if repr(self._scene_boundingbox) != repr(scene_boundingbox):
self._scene_boundingbox = scene_boundingbox
self.sceneBoundingBoxChanged.emit()
self._platform_activity = True if count > 0 else False
self.activityChanged.emit()

View File

@ -106,7 +106,7 @@ Rectangle {
anchors.right: parent.right
font: UM.Theme.fonts.small
color: UM.Theme.colors.text_subtext
text: "0.0 x 0.0 x 0.0 mm"
text: Printer.getSceneBoundingBoxString
}
Rectangle {