chiark / gitweb /
Update one-at-a-time and all-at-once printing dynamicly depending on the heighst...
authordaid <daid303@gmail.com>
Thu, 2 Jan 2014 07:41:41 +0000 (08:41 +0100)
committerdaid <daid303@gmail.com>
Thu, 2 Jan 2014 07:41:41 +0000 (08:41 +0100)
Cura/gui/mainWindow.py
Cura/gui/sceneView.py
Cura/util/objectScene.py
Cura/util/profile.py

index 99c0b2d85537ed406741adf8d54e49621020d407..6f95f0da6e71e841d318cba27f9c3233b8373bd7 100644 (file)
@@ -122,6 +122,17 @@ class mainWindow(wx.Frame):
 
                i = toolsMenu.Append(-1, _("Copy profile to clipboard"))
                self.Bind(wx.EVT_MENU, self.onCopyProfileClipboard,i)
+
+               toolsMenu.AppendSeparator()
+               self.allAtOnceItem = toolsMenu.Append(-1, _("Print all at once"), kind=wx.ITEM_RADIO)
+               self.Bind(wx.EVT_MENU, self.onOneAtATimeSwitch, self.allAtOnceItem)
+               self.oneAtATime = toolsMenu.Append(-1, _("Print one at a time"), kind=wx.ITEM_RADIO)
+               self.Bind(wx.EVT_MENU, self.onOneAtATimeSwitch, self.oneAtATime)
+               if profile.getPreference('oneAtATime') == 'True':
+                       self.oneAtATime.Check(True)
+               else:
+                       self.allAtOnceItem.Check(True)
+
                self.menubar.Append(toolsMenu, _("Tools"))
 
                #Machine menu for machine configuration/tooling
@@ -311,6 +322,12 @@ class mainWindow(wx.Frame):
                        self.headOffsetWizardMenuItem.Enable(False)
                self.scene.updateProfileToControls()
 
+       def onOneAtATimeSwitch(self, e):
+               profile.putPreference('oneAtATime', self.oneAtATime.IsChecked())
+               if self.oneAtATime.IsChecked() and profile.getMachineSettingFloat('extruder_head_size_height') < 1:
+                       wx.MessageBox(_('For "One at a time" printing, you need to have entered the correct head size and gantry height in the machine settings'), _('One at a time warning'), wx.OK | wx.ICON_WARNING)
+               self.scene.updateProfileToControls()
+
        def OnPreferences(self, e):
                prefDialog = preferencesDialog.preferencesDialog(self)
                prefDialog.Centre()
index 95d4a1d52dc2080e449070fcc0f4b1a79cc8a0d5..e123ad4291d8c28e5c00718a6dcf02ca4ffe60cc 100644 (file)
@@ -1262,20 +1262,21 @@ void main(void)
                                                glVertex3f(p[0], p[1], 0)
                                        glEnd()
                                        glPopMatrix()
-                               glPushMatrix()
-                               glColor4f(0,0,0,0.06)
-                               glTranslatef(self._selectedObj.getPosition()[0], self._selectedObj.getPosition()[1], 0)
-                               glBegin(GL_TRIANGLE_FAN)
-                               for p in self._selectedObj._printAreaHull[::-1]:
-                                       glVertex3f(p[0], p[1], 0)
-                               glEnd()
-                               glBegin(GL_TRIANGLE_FAN)
-                               for p in self._selectedObj._headAreaMinHull[::-1]:
-                                       glVertex3f(p[0], p[1], 0)
-                               glEnd()
+                               if self._scene.isOneAtATime():
+                                       glPushMatrix()
+                                       glColor4f(0,0,0,0.06)
+                                       glTranslatef(self._selectedObj.getPosition()[0], self._selectedObj.getPosition()[1], 0)
+                                       glBegin(GL_TRIANGLE_FAN)
+                                       for p in self._selectedObj._printAreaHull[::-1]:
+                                               glVertex3f(p[0], p[1], 0)
+                                       glEnd()
+                                       glBegin(GL_TRIANGLE_FAN)
+                                       for p in self._selectedObj._headAreaMinHull[::-1]:
+                                               glVertex3f(p[0], p[1], 0)
+                                       glEnd()
+                                       glPopMatrix()
                                glDepthMask(True)
                                glDisable(GL_CULL_FACE)
-                               glPopMatrix()
 
                        #Draw the outline of the selected object, on top of everything else except the GUI.
                        if self._selectedObj is not None and self._selectedObj._loadAnim is None:
index d33d461c32bae1759fd07e65338f04feaa2f0f2a..6a0e93759d80372851a30cb2e22caf8cfc8cd281 100644 (file)
@@ -137,7 +137,10 @@ class Scene(object):
                self._headSizeOffsets[0] = min(xMin, xMax)
                self._headSizeOffsets[1] = min(yMin, yMax)
                self._gantryHeight = gantryHeight
-               self._oneAtATime = self._gantryHeight > 0
+               self._oneAtATime = self._gantryHeight > 0 and profile.getPreference('oneAtATime') == 'True'
+               for obj in self._objectList:
+                       if obj.getSize()[2] > self._gantryHeight:
+                               self._oneAtATime = False
 
                headArea = numpy.array([[-xMin,-yMin],[ xMax,-yMin],[ xMax, yMax],[-xMin, yMax]], numpy.float32)
 
@@ -147,6 +150,9 @@ class Scene(object):
                else:
                        obj.setHeadArea(headArea, self._headSizeOffsets)
 
+       def isOneAtATime(self):
+               return self._oneAtATime
+
        def setExtruderOffset(self, extruderNr, offsetX, offsetY):
                self._extruderOffset[extruderNr] = numpy.array([offsetX, offsetY], numpy.float32)
 
index 950e84c7867adf3d9eb9cacb351753fe969b1493..558a8927d649beddd228310f7afa6155c93999de 100644 (file)
@@ -330,6 +330,7 @@ G92 E0
 """, str, 'alteration', 'alteration')
 
 setting('startMode', 'Simple', ['Simple', 'Normal'], 'preference', 'hidden')
+setting('oneAtATime', 'True', bool, 'preference', 'hidden')
 setting('lastFile', os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'resources', 'example', 'UltimakerRobot_support.stl')), str, 'preference', 'hidden')
 setting('save_profile', 'False', bool, 'preference', 'hidden').setLabel(_("Save profile on slice"), _("When slicing save the profile as [stl_file]_profile.ini next to the model."))
 setting('filament_cost_kg', '0', float, 'preference', 'hidden').setLabel(_("Cost (price/kg)"), _("Cost of your filament per kg, to estimate the cost of the final print."))