예제 #1
0
def stitchMultiExtruder(outputList, resultFile):
	print "Stitching %i files for multi-extrusion" % (len(outputList))
	currentExtruder = 0
	resultFile.write('T%d\n' % (currentExtruder))
	layerNr = -1
	hasLine = True
	outputList = map(lambda o: o.split('\n'), outputList)
	outputOrder = range(0, len(outputList))
	while hasLine:
		hasLine = False
		outputOrder.reverse()
		for outputIdx in outputOrder:
			layerHasLine = False
			while len(outputList[outputIdx]) > 0:
				line = outputList[outputIdx].pop(0)
				hasLine = True
				if line.startswith(';LAYER:'):
					break
				if 'Z' in line:
					lastZ = float(re.search('Z([^\s]+)', line).group(1))
				if not layerHasLine:
					nextExtruder = outputIdx
					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') + '\n')
						profile.resetTempOverride()
						currentExtruder = nextExtruder
					layerHasLine = True
				resultFile.write(line)
				resultFile.write('\n')
		layerNr += 1
예제 #2
0
    def setupSlice(self):
        put = profile.setTempOverride
        get = profile.getProfileSetting
        for setting in profile.settingsList:
            if not setting.isProfile():
                continue
            profile.setTempOverride(setting.getName(), setting.getDefault())

        if self.printSupport.GetValue():
            put('support', _("Exterior Only"))

        nozzle_size = float(get('nozzle_size'))
        if self.printTypeNormal.GetValue():
            put('layer_height', '0.15')
            put('layer_height', '0.15')
            put('fill_density', '20')
        elif self.printTypeLow.GetValue():
            put('wall_thickness', "0.4")
            put('layer_height', '0.20')
            put('fill_density', '15')
            put('print_speed', '60')
            put('inset0_speed', '30')
            put('insetx_speed', '35')
            put('cool_min_layer_time', '3')
            put('bottom_layer_speed', '30')
        elif self.printTypeHigh.GetValue():
            put('layer_height', '0.1')
            put('fill_density', '20')
            put('bottom_layer_speed', '15')
            put('inset0_speed', '15')
            put('insetx_speed', '25')

        elif self.printTypeJoris.GetValue():
            put('wall_thickness', nozzle_size * 1.5)

        put('filament_diameter', "1.75")
        if self.printMaterialPLA.GetValue():
            pass
        if self.printMaterialPLA_Pro.GetValue():
            put('bottom_layer_speed', '8')
            put('support_angle', "60")
        if self.printMaterialABS.GetValue():
            put('print_bed_temperature', '100')
            put('platform_adhesion', 'Brim')
            put('filament_flow', '107')
            put('print_temperature', '245')
        put('plugin_config', '')
예제 #3
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
		filesOrder = files[:]
		while hasLine:
			hasLine = False
			filesOrder.reverse()
			for f in filesOrder:
				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') + '\n')
							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()
예제 #4
0
파일: simpleMode.py 프로젝트: 3dUBU/CuraUBu
	def setupSlice(self):
		put = profile.setTempOverride
		get = profile.getProfileSetting
		for setting in profile.settingsList:
			if not setting.isProfile():
				continue
			profile.setTempOverride(setting.getName(), setting.getDefault())

		if self.printSupport.GetValue():
			put('support', _("Exterior Only"))

		nozzle_size = float(get('nozzle_size'))
		if self.printTypeNormal.GetValue():
			put('layer_height', '0.2')
			put('wall_thickness', nozzle_size * 2.0)
			put('layer_height', '0.10')
			put('fill_density', '20')
		elif self.printTypeLow.GetValue():
			put('wall_thickness', nozzle_size * 2.5)
			put('layer_height', '0.20')
			put('fill_density', '10')
			put('print_speed', '60')
			put('cool_min_layer_time', '3')
			put('bottom_layer_speed', '30')
		elif self.printTypeHigh.GetValue():
			put('wall_thickness', nozzle_size * 2.0)
			put('layer_height', '0.06')
			put('fill_density', '20')
			put('bottom_layer_speed', '15')
		elif self.printTypeJoris.GetValue():
			put('wall_thickness', nozzle_size * 1.5)

		put('filament_diameter', self.printMaterialDiameter.GetValue())
		if self.printMaterialPLA.GetValue():
			pass
		if self.printMaterialABS.GetValue():
			put('print_bed_temperature', '100')
			put('platform_adhesion', 'Brim')
			put('filament_flow', '107')
			put('print_temperature', '245')
		put('plugin_config', '')
예제 #5
0
def main():
	parser = OptionParser(usage="usage: %prog [options] <X,Y> <filename>[, <X,Y> <filename>][, ...]")
	parser.add_option("-p", "--profile", action="store", type="string", dest="profile",
					  help="Encoded profile to use for the print")
	parser.add_option("-o", "--output", action="store", type="string", dest="output",
					  help="Output filename")
	(options, args) = parser.parse_args()
	if options.output is None:
		print 'Missing output filename'
		sys.exit(1)
	if options.profile is not None:
		profile.loadGlobalProfileFromString(options.profile)
	options.output = fixUTF8(options.output)

	clearZ = 0
	resultFile = open(options.output, "w")
	for idx in xrange(0, len(args), 2):
		position = map(float, args[idx].split(','))
		if len(position) < 9 + 2:
			position = position[0:2]
			position += [1,0,0]
			position += [0,1,0]
			position += [0,0,1]
		filenames = fixUTF8(args[idx + 1]).split('|')

		profile.setTempOverride('object_center_x', position[0])
		profile.setTempOverride('object_center_y', position[1])
		if idx == 0:
			resultFile.write(';TYPE:CUSTOM\n')
			resultFile.write(profile.getAlterationFileContents('start.gcode').replace('?filename?', ' '.join(filenames).encode('ascii', 'replace')))
		else:
			resultFile.write(';TYPE:CUSTOM\n')
			n = output[-1].rfind('Z')+1
			zString = output[-1][n:n+20]
			zString = zString[0:zString.find(' ')]
			clearZ = max(clearZ, float(zString) + 10)
			profile.setTempOverride('clear_z', clearZ)
			resultFile.write(profile.getAlterationFileContents('nextobject.gcode').replace('?filename?', ' '.join(filenames).encode('ascii', 'replace')))

		output = []
		for filename in filenames:
			extruderNr = filenames.index(filename)
			profile.resetTempOverride()
			if extruderNr > 0:
				profile.setTempOverride('object_center_x', position[0] - profile.getPreferenceFloat('extruder_offset_x%d' % (extruderNr)))
				profile.setTempOverride('object_center_y', position[1] - profile.getPreferenceFloat('extruder_offset_y%d' % (extruderNr)))
				profile.setTempOverride('fan_enabled', 'False')
				profile.setTempOverride('skirt_line_count', '0')
				profile.setTempOverride('alternative_center', filenames[0])
			else:
				profile.setTempOverride('object_center_x', position[0])
				profile.setTempOverride('object_center_y', position[1])
			profile.setTempOverride('object_matrix', ','.join(map(str, position[2:11])))
			output.append(export.getOutput(filename))
			profile.resetTempOverride()
		if len(output) == 1:
			resultFile.write(output[0])
		else:
			stitchMultiExtruder(output, resultFile)
	resultFile.write(';TYPE:CUSTOM\n')
	resultFile.write(profile.getAlterationFileContents('end.gcode'))
	resultFile.close()

	print "Running plugins"
	ret = profile.runPostProcessingPlugins(options.output)
	if ret is not None:
		print ret
	print "Finalizing %s" % (os.path.basename(options.output))
예제 #6
0
파일: simpleMode.py 프로젝트: gringer/Cura
    def setupSlice(self):
        self.saveSettings()
        put = profile.setTempOverride
        get = profile.getProfileSetting
        for setting in profile.settingsList:
            if not setting.isProfile():
                continue
            profile.setTempOverride(setting.getName(), setting.getDefault())

# LulzBot Mini slice settings for use with the simple slice selection.
        if profile.getMachineSetting('machine_type') == 'lulzbot_mini':
            put('filament_diameter', '2.85')
            put('nozzle_size', '0.5')
            put('wall_thickness', '1')
            put('fill_density', '20')
            put('retraction_speed', '10')
            put('retraction_hop', '0.1')
            put('bottom_thickness', '0.425')
            put('layer0_width_factor', '125')
            put('travel_speed', '175')
            put('skirt_minimal_length', '250')
            put('brim_line_count', '10')
            put('raft_airgap', '0.5')
            put('bottom_layer_speed', '15')
            put('fan_full_height', '0.5')
            put('retraction_minimal_extrusion', '0.005')
            if self.printSupport.GetValue():
                put('support', _("Everywhere"))
                put('support_type', 'Lines')
                put('support_angle', '45')
                put('support_fill_rate', '30')
                put('support_xy_distance', '0.7')
                put('support_z_distance', '0.05')
            if self.printBrim.GetValue():
                put('platform_adhesion', 'Brim')
            if self.printMaterialHIPS.GetValue(
            ) or self.printMaterialABS.GetValue():
                put('print_temperature', '240')
                put('print_bed_temperature', '110')
                put('solid_layer_thickness', '0.8')
                put('retraction_amount', '1')
                put('fan_speed', '40')
                put(
                    'start.gcode',
                    """;This Gcode has been generated specifically for the LulzBot Mini
;Basic settings: Layer height: {layer_height} Walls: {wall_thickness} Fill: {fill_density}
;Filament Diameter: {filament_diameter}
;Nozzle Size: {nozzle_size}
G21                          ; metric values
G90                          ; absolute positioning
M82                          ; set extruder to absolute mode
M107                         ; start with the fan off
G92 E0                       ; set extruder position to 0
M140 S110                    ; get bed heating up
G28                          ; home all
M109 S150                    ; set to cleaning temp and wait
G1 Z150 E-30 F75             ; suck up XXmm of filament
M109 S170                    ; heat up rest of way
G1 X45 Y174 F11520           ; move behind scraper
G1 Z0  F1200                 ; CRITICAL: set Z to height of top of scraper
G1 X45 Y174 Z-.5 F4000       ; wiping ; plunge into wipe pad
G1 X55 Y172 Z-.5 F4000       ; wiping
G1 X45 Y174 Z0 F4000         ; wiping
G1 X55 Y172 F4000            ; wiping
G1 X45 Y174 F4000            ; wiping
G1 X55 Y172 F4000            ; wiping
G1 X45 Y174 F4000            ; wiping
G1 X55 Y172 F4000            ; wiping
G1 X60 Y174 F4000            ; wiping
G1 X80 Y172 F4000            ; wiping
G1 X60 Y174 F4000            ; wiping
G1 X80 Y172 F4000            ; wiping
G1 X60 Y174 F4000            ; wiping
G1 X90 Y172 F4000            ; wiping
G1 X80 Y174 F4000            ; wiping
G1 X100 Y172 F4000           ; wiping
G1 X80 Y174 F4000            ; wiping
G1 X100 Y172 F4000           ; wiping
G1 X80 Y174 F4000            ; wiping
G1 X100 Y172 F4000           ; wiping
G1 X110 Y174 F4000           ; wiping
G1 X100 Y172 F4000           ; wiping
G1 X110 Y174 F4000           ; wiping
G1 X100 Y172 F4000           ; wiping
G1 X110 Y174 F4000           ; wiping
G1 X115 Y172 Z-0.5 F1000     ; wipe slower and bury noz in cleanish area
G1 Z10                       ; raise z
G28 X0 Y0                    ; home x and y
M109 S170                    ; set to probing temp
M204 S300                    ; set accel for probing
G29                          ; Probe
M204 S2000                   ; set accel back to normal
G1 X5 Y15 Z10 F5000          ; get out the way
M400                         ; clear buffer
G4 S1                        ; pause
M109 S{print_temperature}    ; set extruder temp and wait
G4 S25                       ; wait for bed to temp up
G1 Z2 E0 F75                 ; extrude filament back into nozzle
M140 S{print_bed_temperature}; get bed temping up during first layer
""")
                put(
                    'end.gcode', """
M400
M104 S0                         ; Hotend off
M140 S0                         ; heated bed heater off (if you have it)
M107                            ; fans off
G92 E0                          ; set extruder to 0
G1 E-3 F300                     ; retract a bit to relieve pressure
G1 X5 Y5 Z156 F10000            ; move to cooling positioning
M190 R60                        ; wait for bed to cool
M140 S0                         ; Turn off bed temp
G1 X145 Y175 Z156 F1000         ; move to cooling positioning
M84                             ; steppers off
G90                             ; absolute positioning
;{profile_string}
""")
                if self.printMaterialHIPS.GetValue():
                    put('fan_speed_max', '50')
                    if self.printTypeLow.GetValue():
                        put('layer_height', '0.38')
                        put('print_speed', '50')
                        put('infill_speed', '70')
                        put('inset0_speed', '40')
                        put('insetx_speed', '45')
                        put('cool_min_layer_time', '15')
                        put('cool_min_feedrate', '10')
                    if self.printTypeNormal.GetValue():
                        put('layer_height', '0.25')
                        put('print_speed', '50')
                        put('infill_speed', '60')
                        put('inset0_speed', '30')
                        put('insetx_speed', '35')
                        put('cool_min_layer_time', '15')
                        put('cool_min_feedrate', '10')
                    if self.printTypeHigh.GetValue():
                        put('layer_height', '0.18')
                        put('print_speed', '30')
                        put('infill_speed', '30')
                        put('inset0_speed', '20')
                        put('insetx_speed', '25')
                        put('cool_min_layer_time', '20')
                        put('cool_min_feedrate', '5')
                if self.printMaterialABS.GetValue():
                    put('fan_speed_max', '60')
                    if self.printTypeLow.GetValue():
                        put('layer_height', '0.38')
                        put('print_speed', '85')
                        put('infill_speed', '60')
                        put('inset0_speed', '50')
                        put('insetx_speed', '55')
                        put('cool_min_feedrate', '10')
                    if self.printTypeNormal.GetValue():
                        put('layer_height', '0.25')
                        put('print_speed', '50')
                        put('infill_speed', '55')
                        put('inset0_speed', '45')
                        put('insetx_speed', '50')
                        put('cool_min_feedrate', '10')
                    if self.printTypeHigh.GetValue():
                        put('layer_height', '0.18')
                        put('print_speed', '50')
                        put('infill_speed', '40')
                        put('inset0_speed', '30')
                        put('insetx_speed', '35')
                        put('cool_min_feedrate', '5')
            elif self.printMaterialPLA.GetValue():
                put('print_temperature', '205')
                put('print_bed_temperature', '60')
                put('solid_layer_thickness', '1')
                put('print_speed', '50')
                put('retraction_amount', '1.5')
                put('bottom_layer_speed', '15')
                put('cool_min_layer_time', '20')
                put('fan_speed', '75')
                put('fan_speed_max', '100')
                put(
                    'start.gcode',
                    """;This Gcode has been generated specifically for the LulzBot Mini
;Basic settings: Layer height: {layer_height} Walls: {wall_thickness} Fill: {fill_density}
;Filament Diameter: {filament_diameter}
;Nozzle Size: {nozzle_size}
G21                          ; metric values
G90                          ; absolute positioning
M82                          ; set extruder to absolute mode
M107                         ; start with the fan off
G92 E0                       ; set extruder position to 0
M140 S{print_bed_temperature}; get bed heating up
G28                          ; home all
M109 S140                    ; set to cleaning temp and wait
G1 Z150 E-30 F75             ; suck up XXmm of filament
M109 S140                    ; heat up rest of way
G1 X45 Y174 F11520           ; move behind scraper
G1 Z0  F1200                 ; CRITICAL: set Z to height of top of scraper
G1 X45 Y174 Z-.5 F4000       ; wiping ; plunge into wipe pad
G1 X55 Y172 Z-.5 F4000       ; wiping
G1 X45 Y174 Z0 F4000         ; wiping
G1 X55 Y172 F4000            ; wiping
G1 X45 Y174 F4000            ; wiping
G1 X55 Y172 F4000            ; wiping
G1 X45 Y174 F4000            ; wiping
G1 X55 Y172 F4000            ; wiping
G1 X60 Y174 F4000            ; wiping
G1 X80 Y172 F4000            ; wiping
G1 X60 Y174 F4000            ; wiping
G1 X80 Y172 F4000            ; wiping
G1 X60 Y174 F4000            ; wiping
G1 X90 Y172 F4000            ; wiping
G1 X80 Y174 F4000            ; wiping
G1 X100 Y172 F4000           ; wiping
G1 X80 Y174 F4000            ; wiping
G1 X100 Y172 F4000           ; wiping
G1 X80 Y174 F4000            ; wiping
G1 X100 Y172 F4000           ; wiping
G1 X110 Y174 F4000           ; wiping
G1 X100 Y172 F4000           ; wiping
G1 X110 Y174 F4000           ; wiping
G1 X100 Y172 F4000           ; wiping
G1 X110 Y174 F4000           ; wiping
G1 X115 Y172 Z-0.5 F1000     ; wipe slower and bury noz in cleanish area
G1 Z10                       ; raise z
G28 X0 Y0                    ; home x and y
M109 S140                    ; set to probing temp
M204 S300                    ; Set probing acceleration
G29                          ; Probe
M204 S2000                   ; Restore standard acceleration
G1 X5 Y15 Z10 F5000          ; get out the way
G4 S1                        ; pause
M400                         ; clear buffer
M109 S{print_temperature}    ; set extruder temp and wait
G4 S15                       ; wait for bed to temp up
G1 Z2 E0 F75                 ; extrude filament back into nozzle
M140 S{print_bed_temperature}; get bed temping up during first layer
""")
                put(
                    'end.gcode', """
M400
M104 S0                                      ; hotend off
M140 S0                                      ; heated bed heater off (if you have it)
M107                                         ; fans off
G92 E5                                       ; set extruder to 5mm for retract on print end
G1 X5 Y5 Z156 E0 F10000                      ; move to cooling positioning
M190 R50                                     ; wait for bed to cool
M104 S0                                      ;
G1 X145 Y175 Z156 F1000                      ; move to cooling positioning
M84                                          ; steppers off
G90                                          ; absolute positioning
;{profile_string}
""")
                if self.printTypeLow.GetValue():
                    put('layer_height', '0.38')
                    put('cool_min_feedrate', '10')
                    put('infill_speed', '40')
                    put('inset0_speed', '30')
                    put('insetx_speed', '35')
                if self.printTypeNormal.GetValue():
                    put('layer_height', '0.25')
                    put('cool_min_feedrate', '10')
                    put('infill_speed', '40')
                    put('inset0_speed', '30')
                    put('insetx_speed', '35')
                if self.printTypeHigh.GetValue():
                    put('layer_height', '0.14')
                    put('cool_min_feedrate', '5')
                    put('infill_speed', '30')
                    put('inset0_speed', '25')
                    put('insetx_speed', '27')
### LulzBot TAZ 5 slice settings for use with the simple slice selection.
        if profile.getMachineSetting('machine_type') == 'lulzbot_TAZ_5':
            put('nozzle_size', '0.35')
            put('wall_thickness', '1.05')
            put('retraction_speed', '10')
            put('retraction_hop', '0.1')
            put('layer0_width_factor', '125')
            put('travel_speed', '175')
            put('bottom_layer_speed', '15')
            put('skirt_minimal_length', '250')
            put('fan_full_height', '0.5')
            put('brim_line_count', '10')
            put('print_temperature', '0')
            put('print_bed_temperature', '0')
            put('retraction_minimal_extrusion', '0.005')
            if self.printSupport.GetValue():
                put('support', _("Everywhere"))
                put('support_type', 'Lines')
                put('support_angle', '45')
                put('support_fill_rate', '30')
                put('support_xy_distance', '0.7')
                put('support_z_distance', '0.05')
            if self.printBrim.GetValue():
                put('platform_adhesion', 'Brim')
            put(
                'start.gcode',
                """;Sliced at: {day} {date} {time} for use with the LulzBot TAZ 5
;Basic settings: Layer height: {layer_height} Walls: {wall_thickness} Fill: {fill_density}
G21                     ;metric values
G90                     ;absolute positioning
M82                     ;set extruder to absolute mode
M107                    ;start with the fan off
G28 X0 Y0               ;move X/Y to min endstops
G28 Z0                  ;move Z to min endstops
G1 Z15.0 F{travel_speed};move the platform down 15mm
G92 E0                  ; zero the extruded length
G1 F200 E0              ; extrude 3mm of feed stock
G92 E0                  ; zero the extruded length again
G1 F{travel_speed}      ; set travel speed
M203 X192 Y208 Z3       ; speed limits
M117 Printing...        ; send message to LCD""")
            put(
                'end.gcode',
                """M400                           ; wait for buffer to clear
M104 S0                        ; hotend off
M140 S0                        ; heated bed heater off (if you have it)
M107                           ; fans off
G91                            ; relative positioning
G1 E-1 F300                    ; retract the filament a bit before lifting the nozzle, to release some of the pressure
G1 Z+0.5 E-5 X-20 Y-20 F3000   ; move Z up a bit and retract filament even more
G90                            ; absolute positioning
G1 X0 Y250                     ; move to cooling position
M84                            ; steppers off
G90                            ; absolute positioning
M117 TAZ Ready.
;{profile_string}""")
            if self.printMaterialHIPS.GetValue(
            ) or self.printMaterialABS.GetValue():
                put('retraction_amount', '1')
                put('fan_speed', '40')
            if self.printMaterialHIPS.GetValue(
            ) or self.printMaterialPLA.GetValue():
                put('raft_airgap', '0.5')
            if self.printMaterialHIPS:
                put('fan_speed_max', '50')
                put('cool_min_layer_time', '20')
                if self.printTypeLow.GetValue():
                    put('layer_height', '0.28')
                    put('solid_layer_thickness', '0.84')
                    put('infill_speed', '70')
                    put('inset0_speed', '40')
                    put('insetx_speed', '45')
                if self.printTypeNormal.GetValue():
                    put('layer_height', '0.22')
                    put('solid_layer_thickness', '0.88')
                    put('infill_speed', '50')
                    put('inset0_speed', '30')
                    put('insetx_speed', '35')
                if self.printTypeHigh.GetValue():
                    put('layer_height', '0.14')
                    put('solid_layer_thickness', '0.7')
                    put('infill_speed', '30')
                    put('inset0_speed', '20')
                    put('insetx_speed', '25')
            if self.printMaterialABS.GetValue():
                put('fan_speed_max', '60')
                put('raft_airgap', '0.35')
                if self.printTypeLow.GetValue():
                    put('layer_height', '0.28')
                    put('solid_layer_thickness', '0.84')
                    put('infill_speed', '60')
                    put('inset0_speed', '50')
                    put('insetx_speed', '55')
                    put('cool_min_layer_time', '15')
                if self.printTypeNormal.GetValue():
                    put('layer_height', '0.22')
                    put('solid_layer_thickness', '0.88')
                    put('infill_speed', '55')
                    put('inset0_speed', '45')
                    put('insetx_speed', '50')
                    put('cool_min_layer_time', '15')
                if self.printTypeHigh.GetValue():
                    put('layer_height', '0.16')
                    put('solid_layer_thickness', '0.74')
                    put('infill_speed', '40')
                    put('inset0_speed', '30')
                    put('insetx_speed', '35')
                    put('cool_min_layer_time', '20')
            if self.printMaterialPLA.GetValue():
                put('retraction_amount', '1.5')
                put('fan_speed', '75')
                put('fan_speed_max', '100')
                if self.printTypeLow.GetValue():
                    put('layer_height', '0.28')
                    put('solid_layer_thickness', '0.84')
                    put('infill_speed', '80')
                    put('inset0_speed', '60')
                    put('insetx_speed', '70')
                    put('cool_min_layer_time', '15')
                    put('cool_min_feedrate', '15')
                if self.printTypeNormal.GetValue():
                    put('layer_height', '0.21')
                    put('solid_layer_thickness', '0.84')
                    put('infill_speed', '60')
                    put('inset0_speed', '50')
                    put('insetx_speed', '55')
                    put('cool_min_layer_time', '15')
                    put('cool_min_feedrate', '10')
                if self.printTypeHigh.GetValue():
                    put('layer_height', '0.14')
                    put('solid_layer_thickness', '0.7')
                    put('infill_speed', '50')
                    put('inset0_speed', '40')
                    put('insetx_speed', '45')
                    put('cool_min_layer_time', '20')
                    put('cool_min_feedrate', '5')

### LulzBot TAZ 4 slice settings for use with the simple slice selection.
        if profile.getMachineSetting('machine_type') == 'lulzbot_TAZ_4':
            put('filament_diameter', '2.85')
            put('nozzle_size', '0.35')
            put('wall_thickness', '1.05')
            put('solid_layer_thickness', '0.84')
            put('retraction_amount', '1.5')
            put('layer0_width_factor', '125')
            put('print_temperature', '0')
            put('print_bed_temperature', '0')
            put('bottom_layer_speed', '30')
            put('travel_speed', '175')
            put('cool_min_layer_time', '15')
            put('retraction_speed', '25')
            put(
                'start.gcode',
                """;This Gcode has been generated specifically for the LulzBot TAZ 4
	;Sliced at: {day} {date} {time}
	;Basic settings: Layer height: {layer_height} Walls: {wall_thickness} Fill: {fill_density}
	;Filament Diameter: {filament_diameter}
	;Print time: {print_time}
	;M190 S{print_bed_temperature} ;Uncomment to add your own bed temperature line
	;M109 S{print_temperature} ;Uncomment to add your own temperature line
	G21        ;metric values
	G90        ;absolute positioning
	M82        ;set extruder to absolute mode
	M107       ;start with the fan off
	G28 X0 Y0  ;move X/Y to min endstops
	G28 Z0     ;move Z to min endstops
	G1 Z15.0 F{travel_speed} ;move the platform down 15mm
	G92 E0                  ;zero the extruded length
	G1 F200 E0              ;extrude 3mm of feed stock
	G92 E0                  ;zero the extruded length again
	G1 F{travel_speed}
	M203 X192 Y208 Z3 ;speed limits""")
            put(
                'end.gcode', """= M400
	M104 S0                                        ; Hotend off
	M140 S0                                        ;heated bed heater off (if you have it)
	M107                                             ; fans off
	G91                                                ;relative positioning
	G1 E-1 F300                                  ;retract the filament a bit before lifting the nozzle, to release some of the pressure
	G1 Z+0.5 E-5 X-20 Y-20 F3000    ;move Z up a bit and retract filament even more
	M84                                                 ;steppers off
	G90                                                 ;absolute positioning
	;{profile_string}""")
            if self.printSupport.GetValue():
                put('support', _("Everywhere"))
                put('support_type', 'Lines')
                put('support_angle', '45')
                put('support_fill_rate', '30')
                put('support_xy_distance', '0.7')
                put('support_z_distance', '0.05')
            if self.printBrim.GetValue():
                put('platform_adhesion', 'Brim')
            if self.printMaterialHIPS.GetValue(
            ) or self.printMaterialABS.GetValue():
                if self.printMaterialHIPS.GetValue():
                    if self.printTypeLow.GetValue():
                        put('layer_height', '0.28')
                        put('print_speed', '120')
                        put('retraction_hop', '0.1')
                        put('inset0_speed', '80')
                        put('insetx_speed', '100')
                        put('fan_full_height', '1')
                        put('fan_speed', '25')
                        put('fan_speed_max', '30')
                    if self.printTypeNormal.GetValue():
                        put('layer_height', '0.21')
                        put('print_speed', '100')
                        put('inset0_speed', '60')
                        put('insetx_speed', '80')
                        put('skirt_minimal_length', '250')
                        put('fan_full_height', '0.35')
                        put('fan_speed', '50')
                        put('fan_speed_max', '50')
                    if self.printTypeHigh.GetValue():
                        put('layer_height', '0.14')
                        put('print_speed', '60')
                        put('inset0_speed', '40')
                        put('insetx_speed', '50')
                        put('fan_full_height', '0.56')
                        put('fan_speed', '50')
                        put('fan_speed_max', '60')
                        put('cool_min_feedrate', '8')
                if self.printMaterialABS.GetValue():
                    if self.printTypeLow.GetValue():
                        put('layer_height', '0.28')
                        put('print_speed', '120')
                        put('retraction_hop', '0.1')
                        put('inset0_speed', '80')
                        put('insetx_speed', '100')
                        put('fan_full_height', '5')
                        put('fan_speed', '25')
                        put('fan_speed_max', '30')
                    if self.printTypeNormal.GetValue():
                        put('layer_height', '0.21')
                        put('print_speed', '100')
                        put('inset0_speed', '60')
                        put('insetx_speed', '80')
                        put('fan_speed', '25')
                        put('fan_speed_max', '25')
                        put('fill_overlap', '5')
                    if self.printTypeHigh.GetValue():
                        put('layer_height', '0.14')
                        put('print_speed', '60')
                        put('retraction_hop', '0.1')
                        put('inset0_speed', '40')
                        put('insetx_speed', '50')
                        put('fan_full_height', '5')
                        put('fan_speed', '40')
                        put('fan_speed_max', '75')
            elif self.printMaterialPLA.GetValue():
                if self.printTypeLow.GetValue():
                    put('layer_height', '0.28')
                    put('print_speed', '120')
                    put('retraction_hop', '0.1')
                    put('inset0_speed', '80')
                    put('insetx_speed', '100')
                    put('skirt_minimal_length', '250')
                    put('fan_full_height', '1')
                    put('fan_speed', '75')
                    put('cool_min_feedrate', '15')
                    put('fill_overlap', '0')
                if self.printTypeNormal.GetValue():
                    put('layer_height', '0.21')
                    put('print_speed', '100')
                    put('retraction_hop', '0.1')
                    put('inset0_speed', '60')
                    put('insetx_speed', '80')
                    put('skirt_minimal_length', '250')
                    put('fan_full_height', '1')
                    put('fan_speed', '75')
                    put('cool_min_feedrate', '15')
                if self.printTypeHigh.GetValue():
                    put('layer_height', '0.14')
                    put('print_speed', '60')
                    put('inset0_speed', '40')
                    put('insetx_speed', '50')
                    put('skirt_minimal_length', '0')
                    put('fan_full_height', '0.28')
                    put('fill_overlap', '10')
        elif not profile.getMachineSetting(
                'machine_type'
        ) == 'lulzbot_mini' and not profile.getMachineSetting(
                'machine_type'
        ) == 'lulzbot_TAZ_5' and not profile.getMachineSetting(
                'machine_type') == 'lulzbot_TAZ_4':
            nozzle_size = float(get('nozzle_size'))
            if self.printBrim.GetValue():
                put('platform_adhesion', 'Brim')
                put('brim_line_count', '10')
            if self.printTypeNormal.GetValue():
                put('wall_thickness', nozzle_size * 2.0)
                put('layer_height', '0.10')
                put('fill_density', '20')
            elif self.printTypeLow.GetValue():
                put('wall_thickness', nozzle_size * 2.5)
                put('layer_height', '0.20')
                put('fill_density', '10')
                put('print_speed', '60')
                put('cool_min_layer_time', '3')
                put('bottom_layer_speed', '30')
            elif self.printTypeHigh.GetValue():
                put('wall_thickness', nozzle_size * 2.0)
                put('layer_height', '0.06')
                put('fill_density', '20')
                put('bottom_layer_speed', '15')
            elif self.printTypeJoris.GetValue():
                put('wall_thickness', nozzle_size * 1.5)
            if self.printSupport.GetValue():
                put('support', _("Exterior Only"))
            put('filament_diameter', '2.85')
            if self.printMaterialPLA.GetValue():
                pass
            if self.printMaterialABS.GetValue():
                put('print_bed_temperature', '100')
                put('platform_adhesion', 'Brim')
                put('filament_flow', '107')
                put('print_temperature', '245')
예제 #7
0
파일: __main__.py 프로젝트: zifengtayu/Cura
def main():
    parser = OptionParser(
        usage=
        "usage: %prog [options] <X,Y> <filename>[, <X,Y> <filename>][, ...]")
    parser.add_option("-p",
                      "--profile",
                      action="store",
                      type="string",
                      dest="profile",
                      help="Encoded profile to use for the print")
    parser.add_option("-o",
                      "--output",
                      action="store",
                      type="string",
                      dest="output",
                      help="Output filename")
    (options, args) = parser.parse_args()
    if options.output is None:
        print 'Missing output filename'
        sys.exit(1)
    if options.profile is not None:
        profile.loadGlobalProfileFromString(options.profile)
    options.output = fixUTF8(options.output)

    clearZ = 0
    resultFile = open(options.output, "w")
    for idx in xrange(0, len(args), 2):
        position = map(float, args[idx].split(','))
        if len(position) < 9 + 2:
            position = position[0:2]
            position += [1, 0, 0]
            position += [0, 1, 0]
            position += [0, 0, 1]
        filenames = fixUTF8(args[idx + 1]).split('|')

        profile.setTempOverride('object_center_x', position[0])
        profile.setTempOverride('object_center_y', position[1])
        if idx == 0:
            resultFile.write(';TYPE:CUSTOM\n')
            resultFile.write(
                profile.getAlterationFileContents(
                    'start.gcode', len(filenames)).replace(
                        '?filename?',
                        ' '.join(filenames).encode('ascii', 'replace')))
        else:
            resultFile.write(';TYPE:CUSTOM\n')
            n = output[-1].rfind('Z') + 1
            zString = output[-1][n:n + 20]
            zString = zString[0:zString.find(' ')]
            clearZ = max(clearZ, float(zString) + 10)
            profile.setTempOverride('clear_z', clearZ)
            print position
            print profile.getAlterationFileContents('nextobject.gcode')
            resultFile.write(
                profile.getAlterationFileContents('nextobject.gcode').replace(
                    '?filename?',
                    ' '.join(filenames).encode('ascii', 'replace')))

        output = []
        for filename in filenames:
            extruderNr = filenames.index(filename)
            profile.resetTempOverride()
            if extruderNr > 0:
                profile.setTempOverride(
                    'object_center_x', position[0] -
                    profile.getPreferenceFloat('extruder_offset_x%d' %
                                               (extruderNr)))
                profile.setTempOverride(
                    'object_center_y', position[1] -
                    profile.getPreferenceFloat('extruder_offset_y%d' %
                                               (extruderNr)))
                profile.setTempOverride('fan_enabled', 'False')
                profile.setTempOverride('skirt_line_count', '0')
                profile.setTempOverride('alternative_center', filenames[0])
            else:
                profile.setTempOverride('object_center_x', position[0])
                profile.setTempOverride('object_center_y', position[1])
            profile.setTempOverride('object_matrix',
                                    ','.join(map(str, position[2:11])))
            if extruderNr > 0:
                if profile.getProfileSettingFloat('filament_diameter%d' %
                                                  (extruderNr + 1)) > 0:
                    profile.setTempOverride(
                        'filament_diameter',
                        profile.getProfileSetting('filament_diameter%d' %
                                                  (extruderNr + 1)))
            print extruderNr, profile.getPreferenceFloat(
                'extruder_offset_x%d' %
                (extruderNr)), profile.getPreferenceFloat(
                    'extruder_offset_y%d' % (extruderNr))
            output.append(export.getOutput(filename))
            profile.resetTempOverride()
        if len(output) == 1:
            resultFile.write(output[0])
        else:
            stitchMultiExtruder(output, resultFile)
    resultFile.write(';TYPE:CUSTOM\n')
    resultFile.write(profile.getAlterationFileContents('end.gcode'))
    resultFile.close()

    print "Running plugins"
    ret = profile.runPostProcessingPlugins(options.output)
    if ret is not None:
        print ret
    print "Finalizing %s" % (os.path.basename(options.output))
    if profile.getPreference('submit_slice_information') == 'True':
        filenames = fixUTF8(args[idx + 1]).split('|')
        for filename in filenames:
            m = hashlib.sha512()
            f = open(filename, "rb")
            while True:
                chunk = f.read(1024)
                if not chunk:
                    break
                m.update(chunk)
            f.close()
            data = {
                'processor': platform.processor(),
                'machine': platform.machine(),
                'platform': platform.platform(),
                'profile': profile.getGlobalProfileString(),
                'preferences': profile.getGlobalPreferencesString(),
                'modelhash': m.hexdigest(),
                'version': version.getVersion(),
            }
            try:
                f = urllib2.urlopen("http://platform.ultimaker.com/curastats/",
                                    data=urllib.urlencode(data),
                                    timeout=5)
                f.read()
                f.close()
            except:
                pass
예제 #8
0
파일: __main__.py 프로젝트: zifengtayu/Cura
def stitchMultiExtruder(outputList, resultFile):
    print "Stitching %i files for multi-extrusion" % (len(outputList))
    currentExtruder = 0
    resultFile.write('T%d\n' % (currentExtruder))
    layerNr = 0
    hasLine = True
    outputList = map(lambda o: o.split('\n'), outputList)
    outputOrder = range(0, len(outputList))
    outputSlice = []
    for n in xrange(0, len(outputList)):
        outputSlice.append([0, 0])
    currentX = 0
    currentY = 0
    currentZ = 0
    currentF = 60
    while hasLine:
        hasLine = layerNr < 1000
        for n in xrange(0, len(outputList)):
            outputSlice[n][0] = outputSlice[n][1] + 1
            outputSlice[n][1] = outputSlice[n][0]
            while outputSlice[n][1] < len(outputList[n]) and not outputList[n][
                    outputSlice[n][1]].startswith(';LAYER:'):
                outputSlice[n][1] += 1
        outputOrder = range(currentExtruder, len(outputList)) + range(
            0, currentExtruder)
        for n in outputOrder:
            if outputSlice[n][1] > outputSlice[n][0] + 1:
                nextExtruder = n
                resultFile.write(';LAYER:%d\n' % (layerNr))
                resultFile.write(';EXTRUDER:%d\n' % (nextExtruder))

                startSlice = outputSlice[n][0]
                endSlice = outputSlice[n][1]

                currentE = 0
                while startSlice < len(outputList[n]) and not isPrintingLine(
                        outputList[n][startSlice]):
                    currentE = getCodeFloat(outputList[n][startSlice], 'E',
                                            currentE)
                    currentX = getCodeFloat(outputList[n][startSlice], 'X',
                                            currentX)
                    currentY = getCodeFloat(outputList[n][startSlice], 'Y',
                                            currentY)
                    currentZ = getCodeFloat(outputList[n][startSlice], 'Z',
                                            currentZ)
                    currentF = getCodeFloat(outputList[n][startSlice], 'F',
                                            currentF)
                    startSlice += 1
                while not isPrintingLine(outputList[n][endSlice - 1]):
                    endSlice -= 1

                if nextExtruder != currentExtruder:
                    profile.setTempOverride('extruder', nextExtruder)
                    profile.setTempOverride('new_x', currentX)
                    profile.setTempOverride('new_y', currentY)
                    profile.setTempOverride('new_z', currentZ)
                    resultFile.write(
                        profile.getAlterationFileContents(
                            'switchExtruder.gcode') + '\n')
                    profile.resetTempOverride()
                    currentExtruder = nextExtruder

                for idx in xrange(outputSlice[n][0], startSlice):
                    if not 'G1' in outputList[n][idx]:
                        resultFile.write(outputList[n][idx])
                        resultFile.write('\n')

                resultFile.write(
                    'G1 X%f Y%f Z%f F%f\n' %
                    (currentX, currentY, currentZ,
                     profile.getProfileSettingFloat('travel_speed') * 60))
                resultFile.write('G1 F%f\n' % (currentF))
                resultFile.write('G92 E%f\n' % (currentE))
                for idx in xrange(startSlice, endSlice):
                    resultFile.write(outputList[n][idx])
                    resultFile.write('\n')
                    currentX = getCodeFloat(outputList[n][idx], 'X', currentX)
                    currentY = getCodeFloat(outputList[n][idx], 'Y', currentY)
                    currentZ = getCodeFloat(outputList[n][idx], 'Z', currentZ)
                    hasLine = True
                resultFile.write('G92 E0\n')
        layerNr += 1
예제 #9
0
def overridePostProcessPluginConfig(config):
	profile.setTempOverride('plugin_config', pickle.dumps(config))
예제 #10
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('object_center_x', profile.getPreferenceFloat('machine_width') / 2 - profile.getPreferenceFloat('extruder_offset_x%d' % (idx)))
				profile.setTempOverride('object_center_y', profile.getPreferenceFloat('machine_depth') / 2 - 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)
예제 #11
0
파일: __main__.py 프로젝트: NastyUser/Cura
def main():
	parser = OptionParser(usage="usage: %prog [options] <X,Y> <filename>[, <X,Y> <filename>][, ...]")
	parser.add_option("-p", "--profile", action="store", type="string", dest="profile",
					  help="Encoded profile to use for the print")
	parser.add_option("-o", "--output", action="store", type="string", dest="output",
					  help="Output filename")
	(options, args) = parser.parse_args()
	if options.output is None:
		print 'Missing output filename'
		sys.exit(1)
	if options.profile is not None:
		profile.loadGlobalProfileFromString(options.profile)
	options.output = fixUTF8(options.output)

	clearZ = 0
	resultFile = open(options.output, "w")
	for idx in xrange(0, len(args), 2):
		position = map(float, args[idx].split(','))
		if len(position) < 9 + 2:
			position = position[0:2]
			position += [1,0,0]
			position += [0,1,0]
			position += [0,0,1]
		filenames = fixUTF8(args[idx + 1]).split('|')

		profile.setTempOverride('object_center_x', position[0])
		profile.setTempOverride('object_center_y', position[1])
		if idx == 0:
			resultFile.write(';TYPE:CUSTOM\n')
			resultFile.write(profile.getAlterationFileContents('start.gcode', len(filenames)).replace('?filename?', ' '.join(filenames).encode('ascii', 'replace')))
		else:
			resultFile.write(';TYPE:CUSTOM\n')
			n = output[-1].rfind('Z')+1
			zString = output[-1][n:n+20]
			zString = zString[0:zString.find(' ')]
			clearZ = max(clearZ, float(zString) + 10)
			profile.setTempOverride('clear_z', clearZ)
			print position
			print profile.getAlterationFileContents('nextobject.gcode')
			resultFile.write(profile.getAlterationFileContents('nextobject.gcode').replace('?filename?', ' '.join(filenames).encode('ascii', 'replace')))

		output = []
		for filename in filenames:
			extruderNr = filenames.index(filename)
			profile.resetTempOverride()
			if extruderNr > 0:
				profile.setTempOverride('object_center_x', position[0] - profile.getPreferenceFloat('extruder_offset_x%d' % (extruderNr)))
				profile.setTempOverride('object_center_y', position[1] - profile.getPreferenceFloat('extruder_offset_y%d' % (extruderNr)))
				profile.setTempOverride('fan_enabled', 'False')
				profile.setTempOverride('skirt_line_count', '0')
				profile.setTempOverride('alternative_center', filenames[0])
			else:
				profile.setTempOverride('object_center_x', position[0])
				profile.setTempOverride('object_center_y', position[1])
			profile.setTempOverride('object_matrix', ','.join(map(str, position[2:11])))
			if extruderNr > 0:
				if profile.getProfileSettingFloat('filament_diameter%d' % (extruderNr + 1)) > 0:
					profile.setTempOverride('filament_diameter', profile.getProfileSetting('filament_diameter%d' % (extruderNr + 1)))
			print extruderNr, profile.getPreferenceFloat('extruder_offset_x%d' % (extruderNr)), profile.getPreferenceFloat('extruder_offset_y%d' % (extruderNr))
			output.append(export.getOutput(filename))
			profile.resetTempOverride()
		if len(output) == 1:
			resultFile.write(output[0])
		else:
			stitchMultiExtruder(output, resultFile)
	resultFile.write(';TYPE:CUSTOM\n')
	resultFile.write(profile.getAlterationFileContents('end.gcode'))
	resultFile.close()

	print "Running plugins"
	ret = profile.runPostProcessingPlugins(options.output)
	if ret is not None:
		print ret
	print "Finalizing %s" % (os.path.basename(options.output))
	if profile.getPreference('submit_slice_information') == 'True':
		filenames = fixUTF8(args[idx + 1]).split('|')
		for filename in filenames:
			m = hashlib.sha512()
			f = open(filename, "rb")
			while True:
				chunk = f.read(1024)
				if not chunk:
					break
				m.update(chunk)
			f.close()
			data = {
				'processor': platform.processor(),
				'machine': platform.machine(),
				'platform': platform.platform(),
				'profile': profile.getGlobalProfileString(),
				'preferences': profile.getGlobalPreferencesString(),
				'modelhash': m.hexdigest(),
				'version': version.getVersion(),
			}
			try:
				f = urllib2.urlopen("http://platform.ultimaker.com/curastats/", data = urllib.urlencode(data), timeout = 5);
				f.read()
				f.close()
			except:
				pass
예제 #12
0
파일: __main__.py 프로젝트: NastyUser/Cura
def stitchMultiExtruder(outputList, resultFile):
	print "Stitching %i files for multi-extrusion" % (len(outputList))
	currentExtruder = 0
	resultFile.write('T%d\n' % (currentExtruder))
	layerNr = 0
	hasLine = True
	outputList = map(lambda o: o.split('\n'), outputList)
	outputOrder = range(0, len(outputList))
	outputSlice = []
	for n in xrange(0, len(outputList)):
		outputSlice.append([0, 0])
	currentX = 0
	currentY = 0
	currentZ = 0
	currentF = 60
	while hasLine:
		hasLine = layerNr < 1000
		for n in xrange(0, len(outputList)):
			outputSlice[n][0] = outputSlice[n][1] + 1
			outputSlice[n][1] = outputSlice[n][0]
			while outputSlice[n][1] < len(outputList[n]) and not outputList[n][outputSlice[n][1]].startswith(';LAYER:'):
				outputSlice[n][1] += 1
		outputOrder = range(currentExtruder, len(outputList)) + range(0, currentExtruder)
		for n in outputOrder:
			if outputSlice[n][1] > outputSlice[n][0] + 1:
				nextExtruder = n
				resultFile.write(';LAYER:%d\n' % (layerNr))
				resultFile.write(';EXTRUDER:%d\n' % (nextExtruder))

				startSlice = outputSlice[n][0]
				endSlice = outputSlice[n][1]
				currentE = 0
				while not isPrintingLine(outputList[n][startSlice]):
					currentE = getCodeFloat(outputList[n][startSlice], 'E', currentE)
					currentX = getCodeFloat(outputList[n][startSlice], 'X', currentX)
					currentY = getCodeFloat(outputList[n][startSlice], 'Y', currentY)
					currentZ = getCodeFloat(outputList[n][startSlice], 'Z', currentZ)
					currentF = getCodeFloat(outputList[n][startSlice], 'F', currentF)
					startSlice += 1
				while not isPrintingLine(outputList[n][endSlice-1]):
					endSlice -= 1

				if nextExtruder != currentExtruder:
					profile.setTempOverride('extruder', nextExtruder)
					profile.setTempOverride('new_x', currentX)
					profile.setTempOverride('new_y', currentY)
					profile.setTempOverride('new_z', currentZ)
					resultFile.write(profile.getAlterationFileContents('switchExtruder.gcode') + '\n')
					profile.resetTempOverride()
					currentExtruder = nextExtruder

				for idx in xrange(outputSlice[n][0], startSlice):
					if not 'G1' in outputList[n][idx]:
						resultFile.write(outputList[n][idx])
						resultFile.write('\n')

				resultFile.write('G1 X%f Y%f Z%f F%f\n' % (currentX, currentY, currentZ, profile.getProfileSettingFloat('travel_speed') * 60))
				resultFile.write('G1 F%f\n' % (currentF))
				resultFile.write('G92 E%f\n' % (currentE))
				for idx in xrange(startSlice, endSlice):
					resultFile.write(outputList[n][idx])
					resultFile.write('\n')
					currentX = getCodeFloat(outputList[n][idx], 'X', currentX)
					currentY = getCodeFloat(outputList[n][idx], 'Y', currentY)
					currentZ = getCodeFloat(outputList[n][idx], 'Z', currentZ)
					hasLine = True
				resultFile.write('G92 E0\n')
		layerNr += 1
예제 #13
0
    def setupSlice(self):
        self.saveSettings()
        put = profile.setTempOverride
        get = profile.getProfileSetting
        for setting in profile.settingsList:
            if not setting.isProfile():
                continue
            profile.setTempOverride(setting.getName(), setting.getDefault())

        # LulzBot Mini slice settings for use with the simple slice selection.
        if profile.getMachineSetting("machine_type") == "lulzbot_mini":
            put("filament_diameter", "2.85")
            put("nozzle_size", "0.5")
            put("wall_thickness", "1")
            put("fill_density", "20")
            put("retraction_speed", "10")
            put("retraction_hop", "0.1")
            put("bottom_thickness", "0.425")
            put("layer0_width_factor", "125")
            put("travel_speed", "175")
            put("skirt_minimal_length", "250")
            put("brim_line_count", "10")
            put("raft_airgap", "0.5")
            put("bottom_layer_speed", "15")
            put("fan_full_height", "0.5")
            put("retraction_minimal_extrusion", "0.005")
            if self.printSupport.GetValue():
                put("support", _("Everywhere"))
                put("support_type", "Lines")
                put("support_angle", "45")
                put("support_fill_rate", "30")
                put("support_xy_distance", "0.7")
                put("support_z_distance", "0.05")
            if self.printBrim.GetValue():
                put("platform_adhesion", "Brim")
            if self.printMaterialHIPS.GetValue() or self.printMaterialABS.GetValue():
                put("print_temperature", "240")
                put("print_bed_temperature", "110")
                put("solid_layer_thickness", "0.8")
                put("retraction_amount", "1")
                put("fan_speed", "40")
                put(
                    "start.gcode",
                    """;This Gcode has been generated specifically for the LulzBot Mini
;Basic settings: Layer height: {layer_height} Walls: {wall_thickness} Fill: {fill_density}
;Filament Diameter: {filament_diameter}
;Nozzle Size: {nozzle_size}
G21                          ; metric values
G90                          ; absolute positioning
M82                          ; set extruder to absolute mode
M107                         ; start with the fan off
G92 E0                       ; set extruder position to 0
M140 S110                    ; get bed heating up
G28                          ; home all
M109 S150                    ; set to cleaning temp and wait
G1 Z150 E-30 F75             ; suck up XXmm of filament
M109 S170                    ; heat up rest of way
G1 X45 Y174 F11520           ; move behind scraper
G1 Z0  F1200                 ; CRITICAL: set Z to height of top of scraper
G1 X45 Y174 Z-.5 F4000       ; wiping ; plunge into wipe pad
G1 X55 Y172 Z-.5 F4000       ; wiping
G1 X45 Y174 Z0 F4000         ; wiping
G1 X55 Y172 F4000            ; wiping
G1 X45 Y174 F4000            ; wiping
G1 X55 Y172 F4000            ; wiping
G1 X45 Y174 F4000            ; wiping
G1 X55 Y172 F4000            ; wiping
G1 X60 Y174 F4000            ; wiping
G1 X80 Y172 F4000            ; wiping
G1 X60 Y174 F4000            ; wiping
G1 X80 Y172 F4000            ; wiping
G1 X60 Y174 F4000            ; wiping
G1 X90 Y172 F4000            ; wiping
G1 X80 Y174 F4000            ; wiping
G1 X100 Y172 F4000           ; wiping
G1 X80 Y174 F4000            ; wiping
G1 X100 Y172 F4000           ; wiping
G1 X80 Y174 F4000            ; wiping
G1 X100 Y172 F4000           ; wiping
G1 X110 Y174 F4000           ; wiping
G1 X100 Y172 F4000           ; wiping
G1 X110 Y174 F4000           ; wiping
G1 X100 Y172 F4000           ; wiping
G1 X110 Y174 F4000           ; wiping
G1 X115 Y172 Z-0.5 F1000     ; wipe slower and bury noz in cleanish area
G1 Z10                       ; raise z
G28 X0 Y0                    ; home x and y
M109 S170                    ; set to probing temp
M204 S300                    ; set accel for probing
G29                          ; Probe
M204 S2000                   ; set accel back to normal
G1 X5 Y15 Z10 F5000          ; get out the way
M400                         ; clear buffer
G4 S1                        ; pause
M109 S{print_temperature}    ; set extruder temp and wait
G4 S25                       ; wait for bed to temp up
G1 Z2 E0 F75                 ; extrude filament back into nozzle
M140 S{print_bed_temperature}; get bed temping up during first layer
""",
                )
                put(
                    "end.gcode",
                    """
M400
M104 S0                         ; Hotend off
M140 S0                         ; heated bed heater off (if you have it)
M107                            ; fans off
G92 E0                          ; set extruder to 0
G1 E-3 F300                     ; retract a bit to relieve pressure
G1 X5 Y5 Z156 F10000            ; move to cooling positioning
M190 R60                        ; wait for bed to cool
M140 S0                         ; Turn off bed temp
G1 X145 Y175 Z156 F1000         ; move to cooling positioning
M84                             ; steppers off
G90                             ; absolute positioning
;{profile_string}
""",
                )
                if self.printMaterialHIPS.GetValue():
                    put("fan_speed_max", "50")
                    if self.printTypeLow.GetValue():
                        put("layer_height", "0.38")
                        put("print_speed", "50")
                        put("infill_speed", "70")
                        put("inset0_speed", "40")
                        put("insetx_speed", "45")
                        put("cool_min_layer_time", "15")
                        put("cool_min_feedrate", "10")
                    if self.printTypeNormal.GetValue():
                        put("layer_height", "0.25")
                        put("print_speed", "50")
                        put("infill_speed", "60")
                        put("inset0_speed", "30")
                        put("insetx_speed", "35")
                        put("cool_min_layer_time", "15")
                        put("cool_min_feedrate", "10")
                    if self.printTypeHigh.GetValue():
                        put("layer_height", "0.18")
                        put("print_speed", "30")
                        put("infill_speed", "30")
                        put("inset0_speed", "20")
                        put("insetx_speed", "25")
                        put("cool_min_layer_time", "20")
                        put("cool_min_feedrate", "5")
                if self.printMaterialABS.GetValue():
                    put("fan_speed_max", "60")
                    if self.printTypeLow.GetValue():
                        put("layer_height", "0.38")
                        put("print_speed", "85")
                        put("infill_speed", "60")
                        put("inset0_speed", "50")
                        put("insetx_speed", "55")
                        put("cool_min_feedrate", "10")
                    if self.printTypeNormal.GetValue():
                        put("layer_height", "0.25")
                        put("print_speed", "50")
                        put("infill_speed", "55")
                        put("inset0_speed", "45")
                        put("insetx_speed", "50")
                        put("cool_min_feedrate", "10")
                    if self.printTypeHigh.GetValue():
                        put("layer_height", "0.18")
                        put("print_speed", "50")
                        put("infill_speed", "40")
                        put("inset0_speed", "30")
                        put("insetx_speed", "35")
                        put("cool_min_feedrate", "5")
            elif self.printMaterialPLA.GetValue():
                put("print_temperature", "205")
                put("print_bed_temperature", "60")
                put("solid_layer_thickness", "1")
                put("print_speed", "50")
                put("retraction_amount", "1.5")
                put("bottom_layer_speed", "15")
                put("cool_min_layer_time", "20")
                put("fan_speed", "75")
                put("fan_speed_max", "100")
                put(
                    "start.gcode",
                    """;This Gcode has been generated specifically for the LulzBot Mini
;Basic settings: Layer height: {layer_height} Walls: {wall_thickness} Fill: {fill_density}
;Filament Diameter: {filament_diameter}
;Nozzle Size: {nozzle_size}
G21                          ; metric values
G90                          ; absolute positioning
M82                          ; set extruder to absolute mode
M107                         ; start with the fan off
G92 E0                       ; set extruder position to 0
M140 S{print_bed_temperature}; get bed heating up
G28                          ; home all
M109 S140                    ; set to cleaning temp and wait
G1 Z150 E-30 F75             ; suck up XXmm of filament
M109 S140                    ; heat up rest of way
G1 X45 Y174 F11520           ; move behind scraper
G1 Z0  F1200                 ; CRITICAL: set Z to height of top of scraper
G1 X45 Y174 Z-.5 F4000       ; wiping ; plunge into wipe pad
G1 X55 Y172 Z-.5 F4000       ; wiping
G1 X45 Y174 Z0 F4000         ; wiping
G1 X55 Y172 F4000            ; wiping
G1 X45 Y174 F4000            ; wiping
G1 X55 Y172 F4000            ; wiping
G1 X45 Y174 F4000            ; wiping
G1 X55 Y172 F4000            ; wiping
G1 X60 Y174 F4000            ; wiping
G1 X80 Y172 F4000            ; wiping
G1 X60 Y174 F4000            ; wiping
G1 X80 Y172 F4000            ; wiping
G1 X60 Y174 F4000            ; wiping
G1 X90 Y172 F4000            ; wiping
G1 X80 Y174 F4000            ; wiping
G1 X100 Y172 F4000           ; wiping
G1 X80 Y174 F4000            ; wiping
G1 X100 Y172 F4000           ; wiping
G1 X80 Y174 F4000            ; wiping
G1 X100 Y172 F4000           ; wiping
G1 X110 Y174 F4000           ; wiping
G1 X100 Y172 F4000           ; wiping
G1 X110 Y174 F4000           ; wiping
G1 X100 Y172 F4000           ; wiping
G1 X110 Y174 F4000           ; wiping
G1 X115 Y172 Z-0.5 F1000     ; wipe slower and bury noz in cleanish area
G1 Z10                       ; raise z
G28 X0 Y0                    ; home x and y
M109 S140                    ; set to probing temp
M204 S300                    ; Set probing acceleration
G29                          ; Probe
M204 S2000                   ; Restore standard acceleration
G1 X5 Y15 Z10 F5000          ; get out the way
G4 S1                        ; pause
M400                         ; clear buffer
M109 S{print_temperature}    ; set extruder temp and wait
G4 S15                       ; wait for bed to temp up
G1 Z2 E0 F75                 ; extrude filament back into nozzle
M140 S{print_bed_temperature}; get bed temping up during first layer
""",
                )
                put(
                    "end.gcode",
                    """
M400
M104 S0                                      ; hotend off
M140 S0                                      ; heated bed heater off (if you have it)
M107                                         ; fans off
G92 E5                                       ; set extruder to 5mm for retract on print end
G1 X5 Y5 Z156 E0 F10000                      ; move to cooling positioning
M190 R50                                     ; wait for bed to cool
M104 S0                                      ;
G1 X145 Y175 Z156 F1000                      ; move to cooling positioning
M84                                          ; steppers off
G90                                          ; absolute positioning
;{profile_string}
""",
                )
                if self.printTypeLow.GetValue():
                    put("layer_height", "0.38")
                    put("cool_min_feedrate", "10")
                    put("infill_speed", "40")
                    put("inset0_speed", "30")
                    put("insetx_speed", "35")
                if self.printTypeNormal.GetValue():
                    put("layer_height", "0.25")
                    put("cool_min_feedrate", "10")
                    put("infill_speed", "40")
                    put("inset0_speed", "30")
                    put("insetx_speed", "35")
                if self.printTypeHigh.GetValue():
                    put("layer_height", "0.14")
                    put("cool_min_feedrate", "5")
                    put("infill_speed", "30")
                    put("inset0_speed", "25")
                    put("insetx_speed", "27")
        ### LulzBot TAZ 5 slice settings for use with the simple slice selection.
        if profile.getMachineSetting("machine_type") == "lulzbot_TAZ_5":
            put("nozzle_size", "0.35")
            put("wall_thickness", "1.05")
            put("retraction_speed", "10")
            put("retraction_hop", "0.1")
            put("layer0_width_factor", "125")
            put("travel_speed", "175")
            put("bottom_layer_speed", "15")
            put("skirt_minimal_length", "250")
            put("fan_full_height", "0.5")
            put("brim_line_count", "10")
            put("print_temperature", "0")
            put("print_bed_temperature", "0")
            put("retraction_minimal_extrusion", "0.005")
            if self.printSupport.GetValue():
                put("support", _("Everywhere"))
                put("support_type", "Lines")
                put("support_angle", "45")
                put("support_fill_rate", "30")
                put("support_xy_distance", "0.7")
                put("support_z_distance", "0.05")
            if self.printBrim.GetValue():
                put("platform_adhesion", "Brim")
            put(
                "start.gcode",
                """;Sliced at: {day} {date} {time} for use with the LulzBot TAZ 5
;Basic settings: Layer height: {layer_height} Walls: {wall_thickness} Fill: {fill_density}
G21                     ;metric values
G90                     ;absolute positioning
M82                     ;set extruder to absolute mode
M107                    ;start with the fan off
G28 X0 Y0               ;move X/Y to min endstops
G28 Z0                  ;move Z to min endstops
G1 Z15.0 F{travel_speed};move the platform down 15mm
G92 E0                  ; zero the extruded length
G1 F200 E0              ; extrude 3mm of feed stock
G92 E0                  ; zero the extruded length again
G1 F{travel_speed}      ; set travel speed
M203 X192 Y208 Z3       ; speed limits
M117 Printing...        ; send message to LCD""",
            )
            put(
                "end.gcode",
                """M400                           ; wait for buffer to clear
M104 S0                        ; hotend off
M140 S0                        ; heated bed heater off (if you have it)
M107                           ; fans off
G91                            ; relative positioning
G1 E-1 F300                    ; retract the filament a bit before lifting the nozzle, to release some of the pressure
G1 Z+0.5 E-5 X-20 Y-20 F3000   ; move Z up a bit and retract filament even more
G90                            ; absolute positioning
G1 X0 Y250                     ; move to cooling position
M84                            ; steppers off
G90                            ; absolute positioning
M117 TAZ Ready.
;{profile_string}""",
            )
            if self.printMaterialHIPS.GetValue() or self.printMaterialABS.GetValue():
                put("retraction_amount", "1")
                put("fan_speed", "40")
            if self.printMaterialHIPS.GetValue() or self.printMaterialPLA.GetValue():
                put("raft_airgap", "0.5")
            if self.printMaterialHIPS:
                put("fan_speed_max", "50")
                put("cool_min_layer_time", "20")
                if self.printTypeLow.GetValue():
                    put("layer_height", "0.28")
                    put("solid_layer_thickness", "0.84")
                    put("infill_speed", "70")
                    put("inset0_speed", "40")
                    put("insetx_speed", "45")
                if self.printTypeNormal.GetValue():
                    put("layer_height", "0.22")
                    put("solid_layer_thickness", "0.88")
                    put("infill_speed", "50")
                    put("inset0_speed", "30")
                    put("insetx_speed", "35")
                if self.printTypeHigh.GetValue():
                    put("layer_height", "0.14")
                    put("solid_layer_thickness", "0.7")
                    put("infill_speed", "30")
                    put("inset0_speed", "20")
                    put("insetx_speed", "25")
            if self.printMaterialABS.GetValue():
                put("fan_speed_max", "60")
                put("raft_airgap", "0.35")
                if self.printTypeLow.GetValue():
                    put("layer_height", "0.28")
                    put("solid_layer_thickness", "0.84")
                    put("infill_speed", "60")
                    put("inset0_speed", "50")
                    put("insetx_speed", "55")
                    put("cool_min_layer_time", "15")
                if self.printTypeNormal.GetValue():
                    put("layer_height", "0.22")
                    put("solid_layer_thickness", "0.88")
                    put("infill_speed", "55")
                    put("inset0_speed", "45")
                    put("insetx_speed", "50")
                    put("cool_min_layer_time", "15")
                if self.printTypeHigh.GetValue():
                    put("layer_height", "0.16")
                    put("solid_layer_thickness", "0.74")
                    put("infill_speed", "40")
                    put("inset0_speed", "30")
                    put("insetx_speed", "35")
                    put("cool_min_layer_time", "20")
            if self.printMaterialPLA.GetValue():
                put("retraction_amount", "1.5")
                put("fan_speed", "75")
                put("fan_speed_max", "100")
                if self.printTypeLow.GetValue():
                    put("layer_height", "0.28")
                    put("solid_layer_thickness", "0.84")
                    put("infill_speed", "80")
                    put("inset0_speed", "60")
                    put("insetx_speed", "70")
                    put("cool_min_layer_time", "15")
                    put("cool_min_feedrate", "15")
                if self.printTypeNormal.GetValue():
                    put("layer_height", "0.21")
                    put("solid_layer_thickness", "0.84")
                    put("infill_speed", "60")
                    put("inset0_speed", "50")
                    put("insetx_speed", "55")
                    put("cool_min_layer_time", "15")
                    put("cool_min_feedrate", "10")
                if self.printTypeHigh.GetValue():
                    put("layer_height", "0.14")
                    put("solid_layer_thickness", "0.7")
                    put("infill_speed", "50")
                    put("inset0_speed", "40")
                    put("insetx_speed", "45")
                    put("cool_min_layer_time", "20")
                    put("cool_min_feedrate", "5")

        ### LulzBot TAZ 4 slice settings for use with the simple slice selection.
        if profile.getMachineSetting("machine_type") == "lulzbot_TAZ_4":
            put("filament_diameter", "2.85")
            put("nozzle_size", "0.35")
            put("wall_thickness", "1.05")
            put("solid_layer_thickness", "0.84")
            put("retraction_amount", "1.5")
            put("layer0_width_factor", "125")
            put("print_temperature", "0")
            put("print_bed_temperature", "0")
            put("bottom_layer_speed", "30")
            put("travel_speed", "175")
            put("cool_min_layer_time", "15")
            put("retraction_speed", "25")
            put(
                "start.gcode",
                """;This Gcode has been generated specifically for the LulzBot TAZ 4
	;Sliced at: {day} {date} {time}
	;Basic settings: Layer height: {layer_height} Walls: {wall_thickness} Fill: {fill_density}
	;Filament Diameter: {filament_diameter}
	;Print time: {print_time}
	;M190 S{print_bed_temperature} ;Uncomment to add your own bed temperature line
	;M109 S{print_temperature} ;Uncomment to add your own temperature line
	G21        ;metric values
	G90        ;absolute positioning
	M82        ;set extruder to absolute mode
	M107       ;start with the fan off
	G28 X0 Y0  ;move X/Y to min endstops
	G28 Z0     ;move Z to min endstops
	G1 Z15.0 F{travel_speed} ;move the platform down 15mm
	G92 E0                  ;zero the extruded length
	G1 F200 E0              ;extrude 3mm of feed stock
	G92 E0                  ;zero the extruded length again
	G1 F{travel_speed}
	M203 X192 Y208 Z3 ;speed limits""",
            )
            put(
                "end.gcode",
                """= M400
	M104 S0                                        ; Hotend off
	M140 S0                                        ;heated bed heater off (if you have it)
	M107                                             ; fans off
	G91                                                ;relative positioning
	G1 E-1 F300                                  ;retract the filament a bit before lifting the nozzle, to release some of the pressure
	G1 Z+0.5 E-5 X-20 Y-20 F3000    ;move Z up a bit and retract filament even more
	M84                                                 ;steppers off
	G90                                                 ;absolute positioning
	;{profile_string}""",
            )
            if self.printSupport.GetValue():
                put("support", _("Everywhere"))
                put("support_type", "Lines")
                put("support_angle", "45")
                put("support_fill_rate", "30")
                put("support_xy_distance", "0.7")
                put("support_z_distance", "0.05")
            if self.printBrim.GetValue():
                put("platform_adhesion", "Brim")
            if self.printMaterialHIPS.GetValue() or self.printMaterialABS.GetValue():
                if self.printMaterialHIPS.GetValue():
                    if self.printTypeLow.GetValue():
                        put("layer_height", "0.28")
                        put("print_speed", "120")
                        put("retraction_hop", "0.1")
                        put("inset0_speed", "80")
                        put("insetx_speed", "100")
                        put("fan_full_height", "1")
                        put("fan_speed", "25")
                        put("fan_speed_max", "30")
                    if self.printTypeNormal.GetValue():
                        put("layer_height", "0.21")
                        put("print_speed", "100")
                        put("inset0_speed", "60")
                        put("insetx_speed", "80")
                        put("skirt_minimal_length", "250")
                        put("fan_full_height", "0.35")
                        put("fan_speed", "50")
                        put("fan_speed_max", "50")
                    if self.printTypeHigh.GetValue():
                        put("layer_height", "0.14")
                        put("print_speed", "60")
                        put("inset0_speed", "40")
                        put("insetx_speed", "50")
                        put("fan_full_height", "0.56")
                        put("fan_speed", "50")
                        put("fan_speed_max", "60")
                        put("cool_min_feedrate", "8")
                if self.printMaterialABS.GetValue():
                    if self.printTypeLow.GetValue():
                        put("layer_height", "0.28")
                        put("print_speed", "120")
                        put("retraction_hop", "0.1")
                        put("inset0_speed", "80")
                        put("insetx_speed", "100")
                        put("fan_full_height", "5")
                        put("fan_speed", "25")
                        put("fan_speed_max", "30")
                    if self.printTypeNormal.GetValue():
                        put("layer_height", "0.21")
                        put("print_speed", "100")
                        put("inset0_speed", "60")
                        put("insetx_speed", "80")
                        put("fan_speed", "25")
                        put("fan_speed_max", "25")
                        put("fill_overlap", "5")
                    if self.printTypeHigh.GetValue():
                        put("layer_height", "0.14")
                        put("print_speed", "60")
                        put("retraction_hop", "0.1")
                        put("inset0_speed", "40")
                        put("insetx_speed", "50")
                        put("fan_full_height", "5")
                        put("fan_speed", "40")
                        put("fan_speed_max", "75")
            elif self.printMaterialPLA.GetValue():
                if self.printTypeLow.GetValue():
                    put("layer_height", "0.28")
                    put("print_speed", "120")
                    put("retraction_hop", "0.1")
                    put("inset0_speed", "80")
                    put("insetx_speed", "100")
                    put("skirt_minimal_length", "250")
                    put("fan_full_height", "1")
                    put("fan_speed", "75")
                    put("cool_min_feedrate", "15")
                    put("fill_overlap", "0")
                if self.printTypeNormal.GetValue():
                    put("layer_height", "0.21")
                    put("print_speed", "100")
                    put("retraction_hop", "0.1")
                    put("inset0_speed", "60")
                    put("insetx_speed", "80")
                    put("skirt_minimal_length", "250")
                    put("fan_full_height", "1")
                    put("fan_speed", "75")
                    put("cool_min_feedrate", "15")
                if self.printTypeHigh.GetValue():
                    put("layer_height", "0.14")
                    put("print_speed", "60")
                    put("inset0_speed", "40")
                    put("insetx_speed", "50")
                    put("skirt_minimal_length", "0")
                    put("fan_full_height", "0.28")
                    put("fill_overlap", "10")
        elif (
            not profile.getMachineSetting("machine_type") == "lulzbot_mini"
            and not profile.getMachineSetting("machine_type") == "lulzbot_TAZ_5"
            and not profile.getMachineSetting("machine_type") == "lulzbot_TAZ_4"
        ):
            nozzle_size = float(get("nozzle_size"))
            if self.printBrim.GetValue():
                put("platform_adhesion", "Brim")
                put("brim_line_count", "10")
            if self.printTypeNormal.GetValue():
                put("wall_thickness", nozzle_size * 2.0)
                put("layer_height", "0.10")
                put("fill_density", "20")
            elif self.printTypeLow.GetValue():
                put("wall_thickness", nozzle_size * 2.5)
                put("layer_height", "0.20")
                put("fill_density", "10")
                put("print_speed", "60")
                put("cool_min_layer_time", "3")
                put("bottom_layer_speed", "30")
            elif self.printTypeHigh.GetValue():
                put("wall_thickness", nozzle_size * 2.0)
                put("layer_height", "0.06")
                put("fill_density", "20")
                put("bottom_layer_speed", "15")
            elif self.printTypeJoris.GetValue():
                put("wall_thickness", nozzle_size * 1.5)
            if self.printSupport.GetValue():
                put("support", _("Exterior Only"))
            put("filament_diameter", "2.85")
            if self.printMaterialPLA.GetValue():
                pass
            if self.printMaterialABS.GetValue():
                put("print_bed_temperature", "100")
                put("platform_adhesion", "Brim")
                put("filament_flow", "107")
                put("print_temperature", "245")
예제 #14
0
def overridePostProcessPluginConfig(config):
    profile.setTempOverride('plugin_config', pickle.dumps(config))
예제 #15
0
파일: __main__.py 프로젝트: sgclarke/Cura
def main():
    parser = OptionParser(usage="usage: %prog [options] <X,Y> <filename>[, <X,Y> <filename>][, ...]")
    parser.add_option(
        "-p", "--profile", action="store", type="string", dest="profile", help="Encoded profile to use for the print"
    )
    parser.add_option("-o", "--output", action="store", type="string", dest="output", help="Output filename")
    (options, args) = parser.parse_args()
    if options.output is None:
        print "Missing output filename"
        sys.exit(1)
    if options.profile is not None:
        profile.loadGlobalProfileFromString(options.profile)
    options.output = fixUTF8(options.output)

    clearZ = 0
    resultFile = open(options.output, "w")
    for idx in xrange(0, len(args), 2):
        position = map(float, args[idx].split(","))
        if len(position) < 9 + 2:
            position = position[0:2]
            position += [1, 0, 0]
            position += [0, 1, 0]
            position += [0, 0, 1]
        filenames = fixUTF8(args[idx + 1]).split("|")

        profile.setTempOverride("object_center_x", position[0])
        profile.setTempOverride("object_center_y", position[1])
        if idx == 0:
            resultFile.write(";TYPE:CUSTOM\n")
            resultFile.write(
                profile.getAlterationFileContents("start.gcode").replace(
                    "?filename?", " ".join(filenames).encode("ascii", "replace")
                )
            )
        else:
            resultFile.write(";TYPE:CUSTOM\n")
            n = output[-1].rfind("Z") + 1
            zString = output[-1][n : n + 20]
            zString = zString[0 : zString.find(" ")]
            clearZ = max(clearZ, float(zString) + 10)
            profile.setTempOverride("clear_z", clearZ)
            print position
            print profile.getAlterationFileContents("nextobject.gcode")
            resultFile.write(
                profile.getAlterationFileContents("nextobject.gcode").replace(
                    "?filename?", " ".join(filenames).encode("ascii", "replace")
                )
            )

        output = []
        for filename in filenames:
            extruderNr = filenames.index(filename)
            profile.resetTempOverride()
            if extruderNr > 0:
                profile.setTempOverride(
                    "object_center_x", position[0] - profile.getPreferenceFloat("extruder_offset_x%d" % (extruderNr))
                )
                profile.setTempOverride(
                    "object_center_y", position[1] - profile.getPreferenceFloat("extruder_offset_y%d" % (extruderNr))
                )
                profile.setTempOverride("fan_enabled", "False")
                profile.setTempOverride("skirt_line_count", "0")
                profile.setTempOverride("alternative_center", filenames[0])
            else:
                profile.setTempOverride("object_center_x", position[0])
                profile.setTempOverride("object_center_y", position[1])
            profile.setTempOverride("object_matrix", ",".join(map(str, position[2:11])))
            output.append(export.getOutput(filename))
            profile.resetTempOverride()
        if len(output) == 1:
            resultFile.write(output[0])
        else:
            stitchMultiExtruder(output, resultFile)
    resultFile.write(";TYPE:CUSTOM\n")
    resultFile.write(profile.getAlterationFileContents("end.gcode"))
    resultFile.close()

    print "Running plugins"
    ret = profile.runPostProcessingPlugins(options.output)
    if ret is not None:
        print ret
    print "Finalizing %s" % (os.path.basename(options.output))
    if profile.getPreference("submit_slice_information") == "True":
        filenames = fixUTF8(args[idx + 1]).split("|")
        for filename in filenames:
            m = hashlib.sha512()
            f = open(filename, "rb")
            while True:
                chunk = f.read(1024)
                if not chunk:
                    break
                m.update(chunk)
            f.close()
            data = {
                "processor": platform.processor(),
                "machine": platform.machine(),
                "platform": platform.platform(),
                "profile": profile.getGlobalProfileString(),
                "preferences": profile.getGlobalPreferencesString(),
                "modelhash": m.hexdigest(),
                "version": version.getVersion(),
            }
            try:
                f = urllib2.urlopen("http://platform.ultimaker.com/curastats/", data=urllib.urlencode(data), timeout=5)
                f.read()
                f.close()
            except:
                pass