chiark / gitweb /
Added clipcheck for UM2
authorJaime van Kessel <nallath@gmail.com>
Wed, 13 Nov 2013 16:26:16 +0000 (17:26 +0100)
committerJaime van Kessel <nallath@gmail.com>
Wed, 13 Nov 2013 16:26:16 +0000 (17:26 +0100)
Cura/gui/sceneView.py
Cura/util/objectScene.py

index 5974fd8b674ec483fd4e22d382d8f52fe01d7fd3..209a00849c56a1e24823c1ec068878db7c2acb4c 100644 (file)
@@ -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)
 
index 0d2058086da1a9cfa7ac6fcc0ef290892934fdc3..27e03014e0e64ce4b7714a2d7998a9817598d7ba 100644 (file)
@@ -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):