From: Jaime van Kessel Date: Wed, 13 Nov 2013 16:26:16 +0000 (+0100) Subject: Added clipcheck for UM2 X-Git-Tag: 13.11.2~12 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=acc88dbd97f348435f620e85caeca4c3dfb8a8da;p=cura.git Added clipcheck for UM2 --- diff --git a/Cura/gui/sceneView.py b/Cura/gui/sceneView.py index 5974fd8b..209a0084 100644 --- a/Cura/gui/sceneView.py +++ b/Cura/gui/sceneView.py @@ -1323,12 +1323,63 @@ void main(void) else: glColor4ub(5 * 8 / 10, 171 * 8 / 10, 231 * 8 / 10, 128) glBegin(GL_QUADS) - glVertex3f(x1, y1, -0.02) + glVertex3f(x1, y1, -0.02) #Draw bit below z0 to prevent zfighting. glVertex3f(x2, y1, -0.02) glVertex3f(x2, y2, -0.02) glVertex3f(x1, y2, -0.02) glEnd() - #if UM2, draw bat-area zone for head. THe head can't stop there, because its bat-area. + + if machine == 'ultimaker2': + + glColor4ub(127, 127, 127, 200) + #if UM2, draw bat-area zone for head. THe head can't stop there, because its bat-area. + #UpperRight + clipWidth = 50; + clipHeight = 35; + posX = sx / 2 - clipWidth; + posY = sy / 2 - clipHeight; + glBegin(GL_QUADS) + glVertex3f(posX, posY, 0.1) + glVertex3f(posX+clipWidth, posY, 0.1) + glVertex3f(posX+clipWidth, posY+clipHeight, 0.1) + glVertex3f(posX, posY+clipHeight, 0.1) + glEnd() + #UpperLeft + clipWidth = 55; + clipHeight = 35; + posX = -sx / 2; + posY = sy / 2 - clipHeight; + glBegin(GL_QUADS) + glVertex3f(posX, posY, 0.1) + glVertex3f(posX+clipWidth, posY, 0.1) + glVertex3f(posX+clipWidth, posY+clipHeight, 0.1) + glVertex3f(posX, posY+clipHeight, 0.1) + glEnd() + #LowerRight + clipWidth = 50; + clipHeight = 5; + posX = sx / 2 - clipWidth; + posY = -sy / 2; + glBegin(GL_QUADS) + glVertex3f(posX, posY, 0.1) + glVertex3f(posX+clipWidth, posY, 0.1) + glVertex3f(posX+clipWidth, posY+clipHeight, 0.1) + glVertex3f(posX, posY+clipHeight, 0.1) + glEnd() + #LowerLeft + clipWidth = 55; + clipHeight = 5; + posX = -sx / 2; + posY = -sy / 2; + glBegin(GL_QUADS) + glVertex3f(posX, posY, 0.1) + glVertex3f(posX+clipWidth, posY, 0.1) + glVertex3f(posX+clipWidth, posY+clipHeight, 0.1) + glVertex3f(posX, posY+clipHeight, 0.1) + glEnd() + + + glDisable(GL_BLEND) glDisable(GL_CULL_FACE) diff --git a/Cura/util/objectScene.py b/Cura/util/objectScene.py index 0d205808..27e03014 100644 --- a/Cura/util/objectScene.py +++ b/Cura/util/objectScene.py @@ -1,6 +1,7 @@ __copyright__ = "Copyright (C) 2013 David Braam - Released under terms of the AGPLv3 License" import random import numpy +from Cura.util import profile class _objectOrder(object): def __init__(self, order, todo): @@ -226,6 +227,22 @@ class Scene(object): return False if p[1] + s[1] > self._machineSize[1] / 2: return False + + #Do clip Check for UM2. + machine = profile.getMachineSetting('machine_type') + if(machine == "ultimaker2"): + #lowerRight clip check + if p[0] - s[0] < -self._machineSize[0] / 2 + 50 and p[1] - s[1] < -self._machineSize[1]/2 + 5: + return False + #UpperRight + if p[0] - s[0] < -self._machineSize[0] / 2 + 50 and p[1] + s[1] > self._machineSize[1]/2 - 35: + return False + #LowerLeft + if p[0] + s[0] > self._machineSize[0] / 2 - 55 and p[1] - s[1] < -self._machineSize[1]/2 + 5: + return False + #UpperLeft + if p[0] + s[0] > self._machineSize[0] / 2 - 55 and p[1] + s[1] > self._machineSize[1]/2 - 35: + return False return True def _findFreePositionFor(self, obj):