chiark / gitweb /
Fix when there is no object loaded, remove debug print.
authorDaid <daid303@gmail.com>
Tue, 25 Sep 2012 10:24:47 +0000 (12:24 +0200)
committerDaid <daid303@gmail.com>
Tue, 25 Sep 2012 10:24:47 +0000 (12:24 +0200)
Cura/cura_sf/skeinforge_application/skeinforge_plugins/craft_plugins/dimension.py
Cura/gui/preview3d.py

index bea355349a8fb10903551b79a7e5d6d4e1b4cb36..dad96bccc205b7994b0143352faa165c07b14c86 100644 (file)
@@ -242,7 +242,6 @@ class DimensionSkein:
                                                distance -= 10.0
                                                e = self.getExtrusionDistanceString(10.0, splitLine)
                                                extra += self.distanceFeedRate.getLinearGcodeMovementWithFeedRate(self.feedRateMinute, self.oldLocation.dropAxis(), self.oldLocation.z) + e + '\n'
-                                       print extra, line, distance
                                        line = extra + line
                        self.oldLocation = location
                else:
index 3899d08f1a14a40f7165d360125a3715c14b4ceb..567ddf8e28c76b15bdf1d39ac05fadbd274b13c7 100644 (file)
@@ -429,17 +429,18 @@ class PreviewGLCanvas(glcanvas.GLCanvas):
                self.objColor[3] = profile.getPreferenceColour('model_colour3')\r
 \r
        def OnMouseMotion(self,e):\r
-               size = (self.parent.objectsMaxV - self.parent.objectsMinV)\r
-               sizeXY = math.sqrt((size[0] * size[0]) + (size[1] * size[1]))\r
-               \r
-               p0 = numpy.array(gluUnProject(e.GetX(), self.viewport[1] + self.viewport[3] - e.GetY(), 0, self.modelMatrix, self.projMatrix, self.viewport))\r
-               p1 = numpy.array(gluUnProject(e.GetX(), self.viewport[1] + self.viewport[3] - e.GetY(), 1, self.modelMatrix, self.projMatrix, self.viewport))\r
-               cursorZ0 = p0 - (p1 - p0) * (p0[2] / (p1[2] - p0[2]))\r
-               cursorXY = math.sqrt((cursorZ0[0] * cursorZ0[0]) + (cursorZ0[1] * cursorZ0[1]))\r
-               if cursorXY >= sizeXY * 0.7 and cursorXY <= sizeXY * 0.7 + 3:\r
-                       self.SetCursor(wx.StockCursor(wx.CURSOR_SIZING))\r
-               else:\r
-                       self.SetCursor(wx.StockCursor(wx.CURSOR_DEFAULT))\r
+               if self.parent.objectsMaxV != None:\r
+                       size = (self.parent.objectsMaxV - self.parent.objectsMinV)\r
+                       sizeXY = math.sqrt((size[0] * size[0]) + (size[1] * size[1]))\r
+                       \r
+                       p0 = numpy.array(gluUnProject(e.GetX(), self.viewport[1] + self.viewport[3] - e.GetY(), 0, self.modelMatrix, self.projMatrix, self.viewport))\r
+                       p1 = numpy.array(gluUnProject(e.GetX(), self.viewport[1] + self.viewport[3] - e.GetY(), 1, self.modelMatrix, self.projMatrix, self.viewport))\r
+                       cursorZ0 = p0 - (p1 - p0) * (p0[2] / (p1[2] - p0[2]))\r
+                       cursorXY = math.sqrt((cursorZ0[0] * cursorZ0[0]) + (cursorZ0[1] * cursorZ0[1]))\r
+                       if cursorXY >= sizeXY * 0.7 and cursorXY <= sizeXY * 0.7 + 3:\r
+                               self.SetCursor(wx.StockCursor(wx.CURSOR_SIZING))\r
+                       else:\r
+                               self.SetCursor(wx.StockCursor(wx.CURSOR_DEFAULT))\r
 \r
                if e.Dragging() and e.LeftIsDown():\r
                        if self.dragType == '':\r
@@ -701,20 +702,21 @@ class PreviewGLCanvas(glcanvas.GLCanvas):
                glTranslate(self.parent.machineCenter.x, self.parent.machineCenter.y, 0)\r
                \r
                #Draw the rotate circle\r
-               glDisable(GL_LIGHTING)\r
-               glDisable(GL_CULL_FACE)\r
-               glEnable(GL_BLEND)\r
-               glBegin(GL_TRIANGLE_STRIP)\r
-               size = (self.parent.objectsMaxV - self.parent.objectsMinV)\r
-               sizeXY = math.sqrt((size[0] * size[0]) + (size[1] * size[1]))\r
-               for i in xrange(0, 64+1):\r
-                       f = i if i < 64/2 else 64 - i\r
-                       glColor4ub(255,int(f*255/(64/2)),0,128)\r
-                       glVertex3f(sizeXY * 0.7 * math.cos(i/32.0*math.pi), sizeXY * 0.7 * math.sin(i/32.0*math.pi),0.1)\r
-                       glColor4ub(  0,128,0,128)\r
-                       glVertex3f((sizeXY * 0.7 + 3) * math.cos(i/32.0*math.pi), (sizeXY * 0.7 + 3) * math.sin(i/32.0*math.pi),0.1)\r
-               glEnd()\r
-               glEnable(GL_CULL_FACE)\r
+               if self.parent.objectsMaxV != None:\r
+                       glDisable(GL_LIGHTING)\r
+                       glDisable(GL_CULL_FACE)\r
+                       glEnable(GL_BLEND)\r
+                       glBegin(GL_TRIANGLE_STRIP)\r
+                       size = (self.parent.objectsMaxV - self.parent.objectsMinV)\r
+                       sizeXY = math.sqrt((size[0] * size[0]) + (size[1] * size[1]))\r
+                       for i in xrange(0, 64+1):\r
+                               f = i if i < 64/2 else 64 - i\r
+                               glColor4ub(255,int(f*255/(64/2)),0,128)\r
+                               glVertex3f(sizeXY * 0.7 * math.cos(i/32.0*math.pi), sizeXY * 0.7 * math.sin(i/32.0*math.pi),0.1)\r
+                               glColor4ub(  0,128,0,128)\r
+                               glVertex3f((sizeXY * 0.7 + 3) * math.cos(i/32.0*math.pi), (sizeXY * 0.7 + 3) * math.sin(i/32.0*math.pi),0.1)\r
+                       glEnd()\r
+                       glEnable(GL_CULL_FACE)\r
                \r
                glPopMatrix()\r
                \r