示例#1
0
def main():
	parser = OptionParser(usage="usage: %prog [options] <filename>.stl")
	parser.add_option("-i", "--ini", action="store", type="string", dest="profileini", help="Load settings from a profile ini file")
	parser.add_option("-P", "--project", action="store_true", dest="openprojectplanner", help="Open the project planner")
	parser.add_option("-F", "--flat", action="store_true", dest="openflatslicer", help="Open the 2D SVG slicer (unfinished)")
	parser.add_option("-r", "--print", action="store", type="string", dest="printfile", help="Open the printing interface, instead of the normal cura interface.")
	parser.add_option("-p", "--profile", action="store", type="string", dest="profile", help="Internal option, do not use!")
	parser.add_option("-s", "--slice", action="store_true", dest="slice", help="Slice the given files instead of opening them in Cura")
	(options, args) = parser.parse_args()
	if options.profile != None:
		profile.loadGlobalProfileFromString(options.profile)
	if options.profileini != None:
		profile.loadGlobalProfile(options.profileini)
	if options.openprojectplanner != None:
		from gui import projectPlanner
		projectPlanner.main()
		return
	if options.openflatslicer != None:
		from gui import flatSlicerWindow
		flatSlicerWindow.main()
		return
	if options.printfile != None:
		from gui import printWindow
		printWindow.startPrintInterface(options.printfile)
		return

	if options.slice != None:
		from util import sliceRun
		sliceRun.runSlice(args)
	else:
		if len(args) > 0:
			profile.putPreference('lastFile', ';'.join(args))
		from gui import splashScreen
		splashScreen.showSplash(mainWindowRunCallback)
示例#2
0
文件: cura.py 项目: danilke/Cura
def main():
	parser = OptionParser(usage="usage: %prog [options] <filename>.stl")
	parser.add_option("-i", "--ini", action="store", type="string", dest="profileini", help="Load settings from a profile ini file")
	parser.add_option("-P", "--project", action="store_true", dest="openprojectplanner", help="Open the project planner")
	parser.add_option("-F", "--flat", action="store_true", dest="openflatslicer", help="Open the 2D SVG slicer")
	parser.add_option("-r", "--print", action="store", type="string", dest="printfile", help="Open the printing interface, instead of the normal cura interface.")
	parser.add_option("-p", "--profile", action="store", type="string", dest="profile", help="Internal option, do not use!")
	(options, args) = parser.parse_args()
	if options.profile != None:
		profile.loadGlobalProfileFromString(options.profile)
	if options.profileini != None:
		profile.loadGlobalProfile(options.profileini)
	if options.openprojectplanner != None:
		from gui import projectPlanner
		projectPlanner.main()
		return
	if options.openflatslicer != None:
		from gui import flatSlicerWindow
		flatSlicerWindow.main()
		return
	if options.printfile != None:
		from gui import printWindow
		printWindow.startPrintInterface(options.printfile)
		return

	if len( args ) > 0:
		sliceRun.runSlice(args)
	else:
		from gui import mainWindow
		mainWindow.main()
示例#3
0
	def OnSlice(self, e):
		put = profile.setTempOverride
		oldProfile = profile.getGlobalProfileString()

		put('model_multiply_x', '1')
		put('model_multiply_y', '1')
		put('enable_raft', 'False')
		put('add_start_end_gcode', 'False')
		put('gcode_extension', 'project_tmp')
		
		clearZ = 0
		actionList = []
		for item in self.list:
			if item.profile != None and os.path.isfile(item.profile):
				profile.loadGlobalProfile(item.profile)
			put('machine_center_x', item.centerX - self.extruderOffset[item.extruder].x)
			put('machine_center_y', item.centerY - self.extruderOffset[item.extruder].y)
			put('model_scale', item.scale)
			put('flip_x', item.flipX)
			put('flip_y', item.flipY)
			put('flip_z', item.flipZ)
			put('model_rotate_base', item.rotate)
			put('swap_xz', item.swapXZ)
			put('swap_yz', item.swapYZ)
			
			action = Action()
			action.sliceCmd = sliceRun.getSliceCommand(item.filename)
			action.centerX = item.centerX
			action.centerY = item.centerY
			action.extruder = item.extruder
			action.filename = item.filename
			clearZ = max(clearZ, item.getMaximum().z * item.scale + 5.0)
			action.clearZ = clearZ
			action.leaveResultForNextSlice = False
			action.usePreviousSlice = False
			actionList.append(action)

			if self.list.index(item) > 0 and item.isSameExceptForPosition(self.list[self.list.index(item)-1]):
				actionList[-2].leaveResultForNextSlice = True
				actionList[-1].usePreviousSlice = True

			if item.profile != None:
				profile.loadGlobalProfileFromString(oldProfile)
		
		#Restore the old profile.
		profile.resetTempOverride()
		
		dlg=wx.FileDialog(self, "Save project gcode file", os.path.split(profile.getPreference('lastFile'))[0], style=wx.FD_SAVE)
		dlg.SetWildcard("GCode file (*.gcode)|*.gcode")
		if dlg.ShowModal() != wx.ID_OK:
			dlg.Destroy()
			return
		resultFilename = dlg.GetPath()
		dlg.Destroy()
		
		pspw = ProjectSliceProgressWindow(actionList, resultFilename)
		pspw.extruderOffset = self.extruderOffset
		pspw.Centre()
		pspw.Show(True)
示例#4
0
文件: mainWindow.py 项目: festlv/Cura
	def OnLoadProfile(self, e):
		dlg=wx.FileDialog(self, "Select profile file to load", os.path.split(profile.getPreference('lastFile'))[0], style=wx.FD_OPEN|wx.FD_FILE_MUST_EXIST)
		dlg.SetWildcard("ini files (*.ini)|*.ini")
		if dlg.ShowModal() == wx.ID_OK:
			profileFile = dlg.GetPath()
			profile.loadGlobalProfile(profileFile)
			self.updateProfileToControls()
		dlg.Destroy()
示例#5
0
 def OnLoadProfile(self, e):
     dlg = wx.FileDialog(self,
                         "Select profile file to load",
                         os.path.split(
                             profile.getPreference('lastFile'))[0],
                         style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)
     dlg.SetWildcard("ini files (*.ini)|*.ini")
     if dlg.ShowModal() == wx.ID_OK:
         profileFile = dlg.GetPath()
         profile.loadGlobalProfile(profileFile)
         self.updateProfileToControls()
     dlg.Destroy()
示例#6
0
	def OnSlice(self, e):
		dlg=wx.FileDialog(self, "Save project gcode file", os.path.split(profile.getPreference('lastFile'))[0], style=wx.FD_SAVE)
		dlg.SetWildcard("GCode file (*.gcode)|*.gcode")
		if dlg.ShowModal() != wx.ID_OK:
			dlg.Destroy()
			return
		resultFilename = dlg.GetPath()
		dlg.Destroy()

		put = profile.setTempOverride
		oldProfile = profile.getGlobalProfileString()
		
		put('add_start_end_gcode', 'False')
		put('gcode_extension', 'project_tmp')
		if self.printMode == 0:
			clearZ = 0
			actionList = []
			for item in self.list:
				if item.profile != None and os.path.isfile(item.profile):
					profile.loadGlobalProfile(item.profile)
				put('machine_center_x', item.centerX - self.extruderOffset[item.extruder][0])
				put('machine_center_y', item.centerY - self.extruderOffset[item.extruder][1])
				put('model_scale', item.scale)
				put('flip_x', item.flipX)
				put('flip_y', item.flipY)
				put('flip_z', item.flipZ)
				put('model_rotate_base', item.rotate)
				put('swap_xz', item.swapXZ)
				put('swap_yz', item.swapYZ)
				
				action = Action()
				action.sliceCmd = sliceRun.getSliceCommand(item.filename)
				action.centerX = item.centerX
				action.centerY = item.centerY
				action.temperature = profile.getProfileSettingFloat('print_temperature')
				action.extruder = item.extruder
				action.filename = item.filename
				clearZ = max(clearZ, item.getSize()[2] * item.scale + 5.0)
				action.clearZ = clearZ
				action.leaveResultForNextSlice = False
				action.usePreviousSlice = False
				actionList.append(action)

				if self.list.index(item) > 0 and item.isSameExceptForPosition(self.list[self.list.index(item)-1]):
					actionList[-2].leaveResultForNextSlice = True
					actionList[-1].usePreviousSlice = True

				if item.profile != None:
					profile.loadGlobalProfileFromString(oldProfile)
			
		else:
			self._saveCombinedSTL(resultFilename + "_temp_.stl")
			put('model_scale', 1.0)
			put('flip_x', False)
			put('flip_y', False)
			put('flip_z', False)
			put('model_rotate_base', 0)
			put('swap_xz', False)
			put('swap_yz', False)
			actionList = []
			
			action = Action()
			action.sliceCmd = sliceRun.getSliceCommand(resultFilename + "_temp_.stl")
			action.centerX = profile.getProfileSettingFloat('machine_center_x')
			action.centerY = profile.getProfileSettingFloat('machine_center_y')
			action.temperature = profile.getProfileSettingFloat('print_temperature')
			action.extruder = 0
			action.filename = resultFilename + "_temp_.stl"
			action.clearZ = 0
			action.leaveResultForNextSlice = False
			action.usePreviousSlice = False

			actionList.append(action)
		
		#Restore the old profile.
		profile.resetTempOverride()
		
		pspw = ProjectSliceProgressWindow(actionList, resultFilename)
		pspw.extruderOffset = self.extruderOffset
		pspw.Centre()
		pspw.Show(True)