chiark / gitweb /
Fix the dual-extrusion heatup bug. Fix the copy-file failed issue.
authordaid303 <daid303@gmail.com>
Wed, 5 Jun 2013 11:58:57 +0000 (13:58 +0200)
committerdaid303 <daid303@gmail.com>
Wed, 5 Jun 2013 11:58:57 +0000 (13:58 +0200)
Cura/gui/sceneView.py
Cura/util/sliceEngine.py

index 55025cf2fceac1aecf8e57dd698f01347da9243f..70bdce2cd7f1c8c2d11e54af7ce59088b93723b0 100644 (file)
@@ -164,7 +164,7 @@ class SceneView(openglGui.glGuiPanel):
        def showPrintWindow(self, button):
                if button == 1:
                        if machineCom.machineIsConnected():
-                               printWindow.printFile(self._gcode.filename)
+                               printWindow.printFile(self._gcodeFilename)
                        elif len(removableStorage.getPossibleSDcardDrives()) > 0:
                                drives = removableStorage.getPossibleSDcardDrives()
                                if len(drives) > 1:
@@ -178,12 +178,12 @@ class SceneView(openglGui.glGuiPanel):
                                        drive = drives[0]
                                filename = os.path.basename(profile.getPreference('lastFile'))
                                filename = filename[0:filename.rfind('.')] + '.gcode'
-                               threading.Thread(target=self._copyFile,args=(self._gcode.filename, drive[1] + filename, drive[1])).start()
+                               threading.Thread(target=self._copyFile,args=(self._gcodeFilename, drive[1] + filename, drive[1])).start()
                        else:
                                self.showSaveGCode()
                if button == 3:
                        menu = wx.Menu()
-                       self.Bind(wx.EVT_MENU, lambda e: printWindow.printFile(self._gcode.filename), menu.Append(-1, 'Print with USB'))
+                       self.Bind(wx.EVT_MENU, lambda e: printWindow.printFile(self._gcodeFilename), menu.Append(-1, 'Print with USB'))
                        self.Bind(wx.EVT_MENU, lambda e: self.showSaveGCode(), menu.Append(-1, 'Save GCode...'))
                        self.Bind(wx.EVT_MENU, lambda e: self._showSliceLog(), menu.Append(-1, 'Slice engine log...'))
                        self.PopupMenu(menu)
@@ -201,7 +201,7 @@ class SceneView(openglGui.glGuiPanel):
                filename = dlg.GetPath()
                dlg.Destroy()
 
-               threading.Thread(target=self._copyFile,args=(self._gcode.filename, filename)).start()
+               threading.Thread(target=self._copyFile,args=(self._gcodeFilename, filename)).start()
 
        def _copyFile(self, fileA, fileB, allowEject = False):
                try:
@@ -216,6 +216,8 @@ class SceneView(openglGui.glGuiPanel):
                                                self.printButton.setProgressBar(float(fsrc.tell()) / size)
                                                self._queueRefresh()
                except:
+                       import sys
+                       print sys.exc_info()
                        self.notification.message("Failed to save")
                else:
                        if allowEject:
@@ -307,7 +309,7 @@ class SceneView(openglGui.glGuiPanel):
        def OnScaleMax(self, button):
                if self._selectedObj is None:
                        return
-               self._selectedObj.scaleUpTo(self._machineSize - numpy.array(profile.calculateObjectSizeOffsets() + [0.0], numpy.float32) * 2)
+               self._selectedObj.scaleUpTo(self._machineSize - numpy.array(profile.calculateObjectSizeOffsets() + [0.0], numpy.float32) * 2 - numpy.array([1,1,1], numpy.float32))
                self._scene.pushFree()
                self._selectObject(self._selectedObj)
                self.updateProfileToControls()
@@ -1206,11 +1208,11 @@ void main(void)
                                a = numpy.concatenate((a[:-1], a[1:]), 1)
                                a = a.reshape((len(a) * 2, 3))
                                pointList = numpy.concatenate((pointList, a))
-#                      if path['type'] == 'retract':
-#                              a = path['points'] + numpy.array([0,0,0.01], numpy.float32)
-#                              a = numpy.concatenate((a[:-1], a[1:] + numpy.array([0,0,0.3], numpy.float32)), 1)
-#                              a = a.reshape((len(a) * 2, 3))
-#                              pointList = numpy.concatenate((pointList, a))
+                       if path['type'] == 'retract':
+                               a = path['points'] + numpy.array([0,0,0.01], numpy.float32)
+                               a = numpy.concatenate((a[:-1], a[1:] + numpy.array([0,0,1], numpy.float32)), 1)
+                               a = a.reshape((len(a) * 2, 3))
+                               pointList = numpy.concatenate((pointList, a))
                ret.append(opengl.GLVBO(pointList))
 
                return ret
index 6afd98d68e9ecac934e758d8f122f143b2fa0552..2b231da9cefe273a3287ccf4e732e55d5b1ad40e 100644 (file)
@@ -96,8 +96,13 @@ class Slicer(object):
                self.abortSlicer()
                self._callback(-1.0, False)
 
+               extruderCount = 1
+               for obj in scene.objects():
+                       if scene.checkPlatform(obj):
+                               extruderCount = max(extruderCount, len(obj._meshList))
+
                commandList = [getEngineFilename(), '-vv']
-               for k, v in self._engineSettings().iteritems():
+               for k, v in self._engineSettings(extruderCount).iteritems():
                        commandList += ['-s', '%s=%s' % (k, str(v))]
                commandList += ['-o', self._exportFilename]
                commandList += ['-b', self._binaryStorageFilename]
@@ -186,12 +191,14 @@ class Slicer(object):
                                profile.runPostProcessingPlugins(self._exportFilename)
                                self._callback(1.0, True)
                        else:
+                               for line in self._sliceLog:
+                                       print line
                                self._callback(-1.0, False)
                except:
                        pass
                self._process = None
 
-       def _engineSettings(self):
+       def _engineSettings(self, extruderCount):
                settings = {
                        'layerThickness': int(profile.getProfileSettingFloat('layer_height') * 1000),
                        'initialLayerThickness': int(profile.getProfileSettingFloat('bottom_thickness') * 1000) if profile.getProfileSettingFloat('bottom_thickness') > 0.0 else int(profile.getProfileSettingFloat('layer_height') * 1000),
@@ -220,7 +227,7 @@ class Slicer(object):
                        'minimalLayerTime': int(profile.getProfileSettingFloat('cool_min_layer_time')),
                        'minimalFeedrate': int(profile.getProfileSettingFloat('cool_min_feedrate')),
                        'coolHeadLift': 1 if profile.getProfileSetting('cool_head_lift') == 'True' else 0,
-                       'startCode': profile.getAlterationFileContents('start.gcode'),
+                       'startCode': profile.getAlterationFileContents('start.gcode', extruderCount),
                        'endCode': profile.getAlterationFileContents('end.gcode'),
 
                        'extruderOffset[1].X': int(profile.getPreferenceFloat('extruder_offset_x1') * 1000),
@@ -237,11 +244,11 @@ class Slicer(object):
                elif profile.getProfileSetting('platform_adhesion') == 'Raft':
                        settings['skirtDistance'] = 0
                        settings['skirtLineCount'] = 0
-                       settings['raftMargin'] = int(profile.getProfileSettingFloat('raft_margin') * 1000);
-                       settings['raftBaseThickness'] = int(profile.getProfileSettingFloat('raft_base_thickness') * 1000);
-                       settings['raftBaseLinewidth'] = int(profile.getProfileSettingFloat('raft_base_linewidth') * 1000);
-                       settings['raftInterfaceThickness'] = int(profile.getProfileSettingFloat('raft_interface_thickness') * 1000);
-                       settings['raftInterfaceLinewidth'] = int(profile.getProfileSettingFloat('raft_interface_linewidth') * 1000);
+                       settings['raftMargin'] = int(profile.getProfileSettingFloat('raft_margin') * 1000)
+                       settings['raftBaseThickness'] = int(profile.getProfileSettingFloat('raft_base_thickness') * 1000)
+                       settings['raftBaseLinewidth'] = int(profile.getProfileSettingFloat('raft_base_linewidth') * 1000)
+                       settings['raftInterfaceThickness'] = int(profile.getProfileSettingFloat('raft_interface_thickness') * 1000)
+                       settings['raftInterfaceLinewidth'] = int(profile.getProfileSettingFloat('raft_interface_linewidth') * 1000)
                else:
                        settings['skirtDistance'] = int(profile.getProfileSettingFloat('skirt_gap') * 1000)
                        settings['skirtLineCount'] = int(profile.getProfileSettingFloat('skirt_line_count'))