Example #1
0
    def _stitchMultiExtruder(self):
        files = []
        resultFile = open(sliceRun.getExportFilename(self.filelist[0]), "w")
        resultFile.write(';TYPE:CUSTOM\n')
        resultFile.write(profile.getAlterationFileContents('start.gcode'))
        for filename in self.filelist:
            if os.path.isfile(
                    sliceRun.getExportFilename(filename, 'multi_extrude_tmp')):
                files.append(
                    open(
                        sliceRun.getExportFilename(filename,
                                                   'multi_extrude_tmp'), "r"))
            else:
                return

        currentExtruder = 0
        resultFile.write('T%d\n' % (currentExtruder))
        layerNr = -1
        hasLine = True
        while hasLine:
            hasLine = False
            for f in files:
                layerHasLine = False
                for line in f:
                    hasLine = True
                    if line.startswith(';LAYER:'):
                        break
                    if 'Z' in line:
                        lastZ = float(re.search('Z([^\s]+)', line).group(1))
                    if not layerHasLine:
                        nextExtruder = files.index(f)
                        resultFile.write(';LAYER:%d\n' % (layerNr))
                        resultFile.write(';EXTRUDER:%d\n' % (nextExtruder))
                        if nextExtruder != currentExtruder:
                            resultFile.write(';TYPE:CUSTOM\n')
                            profile.setTempOverride('extruder', nextExtruder)
                            resultFile.write(
                                profile.getAlterationFileContents(
                                    'switchExtruder.gcode'))
                            profile.resetTempOverride()
                            currentExtruder = nextExtruder
                        layerHasLine = True
                    resultFile.write(line)
            layerNr += 1
        for f in files:
            f.close()
        for filename in self.filelist:
            os.remove(sliceRun.getExportFilename(filename,
                                                 'multi_extrude_tmp'))
        resultFile.write(';TYPE:CUSTOM\n')
        resultFile.write(profile.getAlterationFileContents('end.gcode'))
        resultFile.close()
Example #2
0
	def _stitchMultiExtruder(self):
		files = []
		resultFile = open(sliceRun.getExportFilename(self.filelist[0]), "w")
		resultFile.write(';TYPE:CUSTOM\n')
		resultFile.write(profile.getAlterationFileContents('start.gcode'))
		for filename in self.filelist:
			if os.path.isfile(sliceRun.getExportFilename(filename, 'multi_extrude_tmp')):
				files.append(open(sliceRun.getExportFilename(filename, 'multi_extrude_tmp'), "r"))
			else:
				return
		
		currentExtruder = 0
		resultFile.write('T%d\n' % (currentExtruder))
		layerNr = -1
		hasLine = True
		while hasLine:
			hasLine = False
			for f in files:
				layerHasLine = False
				for line in f:
					hasLine = True
					if line.startswith(';LAYER:'):
						break
					if 'Z' in line:
						lastZ = float(re.search('Z([^\s]+)', line).group(1))
					if not layerHasLine:
						nextExtruder = files.index(f)
						resultFile.write(';LAYER:%d\n' % (layerNr))
						resultFile.write(';EXTRUDER:%d\n' % (nextExtruder))
						if nextExtruder != currentExtruder:
							resultFile.write(';TYPE:CUSTOM\n')
							profile.setTempOverride('extruder', nextExtruder)
							resultFile.write(profile.getAlterationFileContents('switchExtruder.gcode'))
							profile.resetTempOverride()
							currentExtruder = nextExtruder
						layerHasLine = True
					resultFile.write(line)
			layerNr += 1
		for f in files:
			f.close()
		for filename in self.filelist:
			os.remove(sliceRun.getExportFilename(filename, 'multi_extrude_tmp'))
		resultFile.write(';TYPE:CUSTOM\n')
		resultFile.write(profile.getAlterationFileContents('end.gcode'))
		resultFile.close()
Example #3
0
	def __init__(self, mainWindow, parent, filelist):
		wx.Panel.__init__(self, parent, -1)
		self.mainWindow = mainWindow
		self.filelist = filelist
		self.abort = False
		
		box = wx.StaticBox(self, -1, filelist[0])
		self.sizer = wx.StaticBoxSizer(box, wx.HORIZONTAL)

		mainSizer = wx.BoxSizer(wx.VERTICAL) 
		mainSizer.Add(self.sizer, 0, flag=wx.EXPAND)

		self.statusText = wx.StaticText(self, -1, "Starting...")
		self.progressGauge = wx.Gauge(self, -1)
		self.progressGauge.SetRange(10000 * len(filelist))
		self.abortButton = wx.Button(self, -1, "X", style=wx.BU_EXACTFIT)
		self.sizer.Add(self.statusText, 2, flag=wx.ALIGN_CENTER )
		self.sizer.Add(self.progressGauge, 2)
		self.sizer.Add(self.abortButton, 0)

		self.Bind(wx.EVT_BUTTON, self.OnAbort, self.abortButton)

		self.SetSizer(mainSizer)
		self.prevStep = 'start'
		self.totalDoneFactor = 0.0
		self.startTime = time.time()
		if profile.getPreference('save_profile') == 'True':
			profile.saveGlobalProfile(self.filelist[0][: self.filelist[0].rfind('.')] + "_profile.ini")
		cmdList = []
		for filename in self.filelist:
			idx = self.filelist.index(filename)
			#print filename, idx
			if idx > 0:
				profile.setTempOverride('fan_enabled', 'False')
				profile.setTempOverride('skirt_line_count', '0')
				profile.setTempOverride('machine_center_x', profile.getProfileSettingFloat('machine_center_x') - profile.getPreferenceFloat('extruder_offset_x%d' % (idx)))
				profile.setTempOverride('machine_center_y', profile.getProfileSettingFloat('machine_center_y') - profile.getPreferenceFloat('extruder_offset_y%d' % (idx)))
				profile.setTempOverride('alternative_center', self.filelist[0])
			if len(self.filelist) > 1:
				profile.setTempOverride('add_start_end_gcode', 'False')
				profile.setTempOverride('gcode_extension', 'multi_extrude_tmp')
			cmdList.append(sliceRun.getSliceCommand(filename))
		profile.resetTempOverride()
		self.thread = WorkerThread(self, filelist, cmdList)
Example #4
0
    def __init__(self, mainWindow, parent, filelist):
        wx.Panel.__init__(self, parent, -1)
        self.mainWindow = mainWindow
        self.filelist = filelist
        self.abort = False

        box = wx.StaticBox(self, -1, filelist[0])
        self.sizer = wx.StaticBoxSizer(box, wx.HORIZONTAL)

        mainSizer = wx.BoxSizer(wx.VERTICAL)
        mainSizer.Add(self.sizer, 0, flag=wx.EXPAND)

        self.statusText = wx.StaticText(self, -1, "Starting...")
        self.progressGauge = wx.Gauge(self, -1)
        self.progressGauge.SetRange(10000 * len(filelist))
        self.abortButton = wx.Button(self, -1, "X", style=wx.BU_EXACTFIT)
        self.sizer.Add(self.statusText, 2, flag=wx.ALIGN_CENTER)
        self.sizer.Add(self.progressGauge, 2)
        self.sizer.Add(self.abortButton, 0)

        self.Bind(wx.EVT_BUTTON, self.OnAbort, self.abortButton)

        self.SetSizer(mainSizer)
        self.prevStep = 'start'
        self.totalDoneFactor = 0.0
        self.startTime = time.time()
        if profile.getPreference('save_profile') == 'True':
            profile.saveGlobalProfile(
                self.filelist[0][:self.filelist[0].rfind('.')] +
                "_profile.ini")
        cmdList = []
        for filename in self.filelist:
            idx = self.filelist.index(filename)
            #print filename, idx
            if idx > 0:
                profile.setTempOverride('fan_enabled', 'False')
                profile.setTempOverride('skirt_line_count', '0')
                profile.setTempOverride(
                    'machine_center_x',
                    profile.getProfileSettingFloat('machine_center_x') -
                    profile.getPreferenceFloat('extruder_offset_x%d' % (idx)))
                profile.setTempOverride(
                    'machine_center_y',
                    profile.getProfileSettingFloat('machine_center_y') -
                    profile.getPreferenceFloat('extruder_offset_y%d' % (idx)))
                profile.setTempOverride('alternative_center', self.filelist[0])
            if len(self.filelist) > 1:
                profile.setTempOverride('add_start_end_gcode', 'False')
                profile.setTempOverride('gcode_extension', 'multi_extrude_tmp')
            cmdList.append(sliceRun.getSliceCommand(filename))
        profile.resetTempOverride()
        self.thread = WorkerThread(self, filelist, cmdList)