From: daid Date: Thu, 2 Jan 2014 07:41:41 +0000 (+0100) Subject: Update one-at-a-time and all-at-once printing dynamicly depending on the heighst... X-Git-Tag: 14.01~12 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=b743a9bcae823f2ae0c0e1aab8a66d01acbc3a18;p=cura.git Update one-at-a-time and all-at-once printing dynamicly depending on the heighst object. Make it possible to switch between the two modes in the tools menu. --- diff --git a/Cura/gui/mainWindow.py b/Cura/gui/mainWindow.py index 99c0b2d8..6f95f0da 100644 --- a/Cura/gui/mainWindow.py +++ b/Cura/gui/mainWindow.py @@ -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() diff --git a/Cura/gui/sceneView.py b/Cura/gui/sceneView.py index 95d4a1d5..e123ad42 100644 --- a/Cura/gui/sceneView.py +++ b/Cura/gui/sceneView.py @@ -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: diff --git a/Cura/util/objectScene.py b/Cura/util/objectScene.py index d33d461c..6a0e9375 100644 --- a/Cura/util/objectScene.py +++ b/Cura/util/objectScene.py @@ -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) diff --git a/Cura/util/profile.py b/Cura/util/profile.py index 950e84c7..558a8927 100644 --- a/Cura/util/profile.py +++ b/Cura/util/profile.py @@ -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."))