• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python sliceRun.getExportFilename函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中util.sliceRun.getExportFilename函数的典型用法代码示例。如果您正苦于以下问题:Python getExportFilename函数的具体用法?Python getExportFilename怎么用?Python getExportFilename使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了getExportFilename函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: OnPrint

	def OnPrint(self, e):
		if len(self.filelist) < 1:
			wx.MessageBox('You need to load a file and slice it before you can print it.', 'Print error', wx.OK | wx.ICON_INFORMATION)
			return
		if not os.path.exists(sliceRun.getExportFilename(self.filelist[0])):
			wx.MessageBox('You need to slice the file to GCode before you can print it.', 'Print error', wx.OK | wx.ICON_INFORMATION)
			return
		printWindow.printFile(sliceRun.getExportFilename(self.filelist[0]))
开发者ID:felipesanches,项目名称:Cura,代码行数:8,代码来源:simpleMode.py


示例2: OnCopyToSD

	def OnCopyToSD(self, e):
		for f in self.filenameList:
			exportFilename = sliceRun.getExportFilename(f)
			filename = os.path.basename(exportFilename)
			if profile.getPreference('sdshortnames') == 'True':
				filename = sliceRun.getShortFilename(filename)
			shutil.copy(exportFilename, os.path.join(profile.getPreference('sdpath'), filename))
开发者ID:custodian,项目名称:Cura,代码行数:7,代码来源:batchRun.py


示例3: loadModelFiles

	def loadModelFiles(self, filelist, showWarning = False):
		while len(filelist) > len(self.objectList):
			self.objectList.append(previewObject())
		for idx in xrange(len(filelist), len(self.objectList)):
			self.objectList[idx].mesh = None
			self.objectList[idx].filename = None
		for idx in xrange(0, len(filelist)):
			obj = self.objectList[idx]
			if obj.filename != filelist[idx]:
				obj.fileTime = None
				self.gcodeFileTime = None
				self.logFileTime = None
			obj.filename = filelist[idx]
		
		self.gcodeFilename = sliceRun.getExportFilename(filelist[0])
		#Do the STL file loading in a background thread so we don't block the UI.
		if self.loadThread != None and self.loadThread.isAlive():
			self.loadThread.join()
		self.loadThread = threading.Thread(target=self.doFileLoadThread)
		self.loadThread.daemon = True
		self.loadThread.start()
		
		if showWarning:
			if profile.getProfileSettingFloat('model_scale') != 1.0 or profile.getProfileSettingFloat('model_rotate_base') != 0 or profile.getProfileSetting('flip_x') != 'False' or profile.getProfileSetting('flip_y') != 'False' or profile.getProfileSetting('flip_z') != 'False' or profile.getProfileSetting('swap_xz') != 'False' or profile.getProfileSetting('swap_yz') != 'False':
				self.warningPopup.Show(True)
				self.warningPopup.timer.Start(5000)
开发者ID:bwattendorf,项目名称:Cura,代码行数:26,代码来源:preview3d.py


示例4: run

	def run(self):
		p = sliceRun.startSliceCommandProcess(self.cmdList[0])
		line = p.stdout.readline()
		self.progressLog = []
		maxValue = 1

		while(len(line) > 0):
			line = line.rstrip()
			if line[0:9] == "Progress[" and line[-1:] == "]":
				progress = line[9:-1].split(":")
				if len(progress) > 2:
					maxValue = int(progress[2])
				wx.CallAfter(self.notifyWindow.SetProgress, progress[0], int(progress[1]), maxValue)

			else:
				self.progressLog.append(line)

			line = p.stdout.readline()

		self.returnCode = p.wait()

		gcodeFilename = sliceRun.getExportFilename(self.filename)
		gcodefile = open(gcodeFilename, "a")

		for logLine in self.progressLog:
			if logLine.startswith('Model error('):
				gcodefile.write(';%s\n' % (logLine))
		gcodefile.close()

		self.gcode = gcodeInterpreter.gcode()
		self.gcode.load(gcodeFilename)
		profile.replaceGCodeTags(gcodeFilename, self.gcode)

		wx.CallAfter(self.notifyWindow.OnSliceDone, self)
开发者ID:xtarn,项目名称:Cura-v2,代码行数:34,代码来源:PrintPanel.py


示例5: OnPrint

 def OnPrint(self, e):
     if len(self.filelist) < 1:
         wx.MessageBox(
             "You need to load a file and prepare it before you can print.",
             "Print error",
             wx.OK | wx.ICON_INFORMATION,
         )
         return
     if not os.path.exists(sliceRun.getExportFilename(self.filelist[0])):
         wx.MessageBox(
             "You need to prepare a print before you can run the actual print.",
             "Print error",
             wx.OK | wx.ICON_INFORMATION,
         )
         return
     printWindow.printFile(sliceRun.getExportFilename(self.filelist[0]))
开发者ID:Lunavast,项目名称:Cura,代码行数:16,代码来源:mainWindow.py


示例6: _stitchMultiExtruder

	def _stitchMultiExtruder(self):
		files = []
		resultFile = open(sliceRun.getExportFilename(self.filelist[0]), "w")
		resultFile.write(';TYPE:CUSTOM\n')
		resultFile.write(profile.getAlterationFileContents('start.gcode'))
		for filename in self.filelist:
			if os.path.isfile(sliceRun.getExportFilename(filename, 'multi_extrude_tmp')):
				files.append(open(sliceRun.getExportFilename(filename, 'multi_extrude_tmp'), "r"))
			else:
				return
		
		currentExtruder = 0
		resultFile.write('T%d\n' % (currentExtruder))
		layerNr = -1
		hasLine = True
		while hasLine:
			hasLine = False
			for f in files:
				layerHasLine = False
				for line in f:
					hasLine = True
					if line.startswith(';LAYER:'):
						break
					if 'Z' in line:
						lastZ = float(re.search('Z([^\s]+)', line).group(1))
					if not layerHasLine:
						nextExtruder = files.index(f)
						resultFile.write(';LAYER:%d\n' % (layerNr))
						resultFile.write(';EXTRUDER:%d\n' % (nextExtruder))
						if nextExtruder != currentExtruder:
							resultFile.write(';TYPE:CUSTOM\n')
							profile.setTempOverride('extruder', nextExtruder)
							resultFile.write(profile.getAlterationFileContents('switchExtruder.gcode'))
							profile.resetTempOverride()
							currentExtruder = nextExtruder
						layerHasLine = True
					resultFile.write(line)
			layerNr += 1
		for f in files:
			f.close()
		for filename in self.filelist:
			os.remove(sliceRun.getExportFilename(filename, 'multi_extrude_tmp'))
		resultFile.write(';TYPE:CUSTOM\n')
		resultFile.write(profile.getAlterationFileContents('end.gcode'))
		resultFile.close()
开发者ID:festlv,项目名称:Cura,代码行数:45,代码来源:sliceProgessPanel.py


示例7: loadModelFiles

	def loadModelFiles(self, filelist):
		while len(filelist) > len(self.objectList):
			self.objectList.append(previewObject())
		for idx in xrange(len(filelist), len(self.objectList)):
			self.objectList[idx].mesh = None
			self.objectList[idx].filename = None
		for idx in xrange(0, len(filelist)):
			obj = self.objectList[idx]
			if obj.filename != filelist[idx]:
				obj.fileTime = None
				self.gcodeFileTime = None
				self.logFileTime = None
			obj.filename = filelist[idx]
		
		self.gcodeFilename = sliceRun.getExportFilename(filelist[0])
		self.logFilename = sliceRun.getExportFilename(filelist[0], "log")
		#Do the STL file loading in a background thread so we don't block the UI.
		if self.loadThread != None and self.loadThread.isAlive():
			self.loadThread.join()
		self.loadThread = threading.Thread(target=self.doFileLoadThread)
		self.loadThread.daemon = True
		self.loadThread.start()
开发者ID:danilke,项目名称:Cura,代码行数:22,代码来源:preview3d.py


示例8: run

	def run(self):
		p = subprocess.Popen(self.cmdList[self.fileIdx], stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
		line = p.stdout.readline()
		self.progressLog = []
		maxValue = 1
		while(len(line) > 0):
			line = line.rstrip()
			if line[0:9] == "Progress[" and line[-1:] == "]":
				progress = line[9:-1].split(":")
				if len(progress) > 2:
					maxValue = int(progress[2])
				wx.CallAfter(self.notifyWindow.SetProgress, progress[0], int(progress[1]), maxValue)
			else:
				#print line
				self.progressLog.append(line)
				wx.CallAfter(self.notifyWindow.statusText.SetLabel, line)
			if self.notifyWindow.abort:
				p.terminate()
				wx.CallAfter(self.notifyWindow.statusText.SetLabel, "Aborted by user.")
				return
			line = p.stdout.readline()
		self.returnCode = p.wait()
		logfile = open(sliceRun.getExportFilename(self.filelist[self.fileIdx], "log"), "w")
		for logLine in self.progressLog:
			logfile.write(logLine)
			logfile.write('\n')
		logfile.close()
		self.fileIdx += 1
		if self.fileIdx == len(self.cmdList):
			if len(self.filelist) > 1:
				self._stitchMultiExtruder()
			self.gcode = gcodeInterpreter.gcode()
			self.gcode.load(sliceRun.getExportFilename(self.filelist[0]))
			wx.CallAfter(self.notifyWindow.OnSliceDone, self)
		else:
			self.run()
开发者ID:lespacedunmatin,项目名称:Cura,代码行数:36,代码来源:sliceProgessPanel.py


示例9: OnCopyToSD

	def OnCopyToSD(self, e):
		if profile.getPreference('sdpath') == '':
			wx.MessageBox("You need to configure your SD card drive first before you can copy files to it.\nOpening the preferences now.", 'No SD card drive.', wx.OK | wx.ICON_INFORMATION)
			prefDialog = preferencesDialog.preferencesDialog(self.GetParent())
			prefDialog.Centre()
			prefDialog.Show(True)
			if profile.getPreference('sdpath') == '':
				print "No path set"
				return
		exportFilename = sliceRun.getExportFilename(self.filelist[0])
		filename = os.path.basename(exportFilename)
		if profile.getPreference('sdshortnames') == 'True':
			filename = sliceRun.getShortFilename(filename)
		try:
			shutil.copy(exportFilename, os.path.join(profile.getPreference('sdpath'), filename))
		except:
			self.GetParent().preview3d.ShowWarningPopup("Failed to copy file to SD card.")
			return
		self.GetParent().preview3d.ShowWarningPopup("Copy finished, safely remove SD card?", self.OnSafeRemove)
开发者ID:PKartaviy,项目名称:Cura,代码行数:19,代码来源:sliceProgessPanel.py


示例10: run

	def run(self):
		p = sliceRun.startSliceCommandProcess(self.cmdList[self.fileIdx])
		line = p.stdout.readline()
		self.progressLog = []
		maxValue = 1
		while(len(line) > 0):
			line = line.rstrip()
			if line[0:9] == "Progress[" and line[-1:] == "]":
				progress = line[9:-1].split(":")
				if len(progress) > 2:
					maxValue = int(progress[2])
				wx.CallAfter(self.notifyWindow.SetProgress, progress[0], int(progress[1]), maxValue)
			else:
				self.progressLog.append(line)
				wx.CallAfter(self.notifyWindow.statusText.SetLabel, line)
			if self.notifyWindow.abort:
				p.terminate()
				wx.CallAfter(self.notifyWindow.statusText.SetLabel, "Aborted by user.")
				return
			line = p.stdout.readline()
		self.returnCode = p.wait()
		self.fileIdx += 1
		if self.fileIdx == len(self.cmdList):
			if len(self.filelist) > 1:
				self._stitchMultiExtruder()
			gcodeFilename = sliceRun.getExportFilename(self.filelist[0])
			gcodefile = open(gcodeFilename, "a")
			for logLine in self.progressLog:
				if logLine.startswith('Model error('):
					gcodefile.write(';%s\n' % (logLine))
			gcodefile.close()
			wx.CallAfter(self.notifyWindow.statusText.SetLabel, "Running plugins")
			ret = profile.runPostProcessingPlugins(gcodeFilename)
			if ret != None:
				self.progressLog.append(ret)
			self.gcode = gcodeInterpreter.gcode()
			self.gcode.load(gcodeFilename)
			profile.replaceGCodeTags(gcodeFilename, self.gcode)
			wx.CallAfter(self.notifyWindow.OnSliceDone, self)
		else:
			self.run()
开发者ID:bwattendorf,项目名称:Cura,代码行数:41,代码来源:sliceProgessPanel.py


示例11: OnOpenFileLocation

	def OnOpenFileLocation(self, e):
		exporer.openExporer(sliceRun.getExportFilename(self.filelist[0]))
开发者ID:festlv,项目名称:Cura,代码行数:2,代码来源:sliceProgessPanel.py


示例12: OnRun

	def OnRun(self):
		resultFile = open(self.resultFilename, "w")
		put = profile.setTempOverride
		self.progressLog = []
		for action in self.actionList:
			wx.CallAfter(self.SetTitle, "Building: [%d/%d]"  % (self.actionList.index(action) + 1, len(self.actionList)))
			if not action.usePreviousSlice:
				p = subprocess.Popen(action.sliceCmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
				line = p.stdout.readline()
		
				maxValue = 1
				while(len(line) > 0):
					line = line.rstrip()
					if line[0:9] == "Progress[" and line[-1:] == "]":
						progress = line[9:-1].split(":")
						if len(progress) > 2:
							maxValue = int(progress[2])
						wx.CallAfter(self.SetProgress, progress[0], int(progress[1]), maxValue)
					else:
						print line
						self.progressLog.append(line)
						wx.CallAfter(self.statusText.SetLabel, line)
					if self.abort:
						p.terminate()
						wx.CallAfter(self.statusText.SetLabel, "Aborted by user.")
						resultFile.close()
						return
					line = p.stdout.readline()
				self.returnCode = p.wait()
			
			put('machine_center_x', action.centerX - self.extruderOffset[action.extruder][0])
			put('machine_center_y', action.centerY - self.extruderOffset[action.extruder][1])
			put('clear_z', action.clearZ)
			put('extruder', action.extruder)
			put('print_temperature', action.temperature)
			
			if action == self.actionList[0]:
				resultFile.write(';TYPE:CUSTOM\n')
				resultFile.write('T%d\n' % (action.extruder))
				currentExtruder = action.extruder
				prevTemp = action.temperature
				resultFile.write(profile.getAlterationFileContents('start.gcode'))
			else:
				#reset the extrusion length, and move to the next object center.
				resultFile.write(';TYPE:CUSTOM\n')
				if prevTemp != action.temperature:
					resultFile.write('M104 S%d\n' % (int(action.temperature)))
					prevTemp = action.temperature
				resultFile.write(profile.getAlterationFileContents('nextobject.gcode'))
			resultFile.write(';PRINTNR:%d\n' % self.actionList.index(action))
			profile.resetTempOverride()
			
			if not action.usePreviousSlice:
				f = open(sliceRun.getExportFilename(action.filename, "project_tmp"), "r")
				data = f.read(4096)
				while data != '':
					resultFile.write(data)
					data = f.read(4096)
				f.close()
				savedCenterX = action.centerX
				savedCenterY = action.centerY
			else:
				f = open(sliceRun.getExportFilename(action.filename, "project_tmp"), "r")
				for line in f:
					if line[0] != ';':
						if 'X' in line:
							line = self._adjustNumberInLine(line, 'X', action.centerX - savedCenterX)
						if 'Y' in line:
							line = self._adjustNumberInLine(line, 'Y', action.centerY - savedCenterY)
					resultFile.write(line)
				f.close()

			if not action.leaveResultForNextSlice:
				os.remove(sliceRun.getExportFilename(action.filename, "project_tmp"))
			
			wx.CallAfter(self.progressGauge.SetValue, 10000)
			self.totalDoneFactor = 0.0
			wx.CallAfter(self.progressGauge2.SetValue, self.actionList.index(action) + 1)
		
		resultFile.write(';TYPE:CUSTOM\n')
		resultFile.write('G1 Z%f F%f\n' % (self.actionList[-1].clearZ, profile.getProfileSettingFloat('max_z_speed') * 60))
		resultFile.write(profile.getAlterationFileContents('end.gcode'))
		resultFile.close()
		
		gcode = gcodeInterpreter.gcode()
		gcode.load(self.resultFilename)
		
		self.abort = True
		sliceTime = time.time() - self.sliceStartTime
		status = "Build: %s" % (self.resultFilename)
		status += "\nSlicing took: %02d:%02d" % (sliceTime / 60, sliceTime % 60)
		status += "\nFilament: %.2fm %.2fg" % (gcode.extrusionAmount / 1000, gcode.calculateWeight() * 1000)
		status += "\nPrint time: %02d:%02d" % (int(gcode.totalMoveTimeMinute / 60), int(gcode.totalMoveTimeMinute % 60))
		cost = gcode.calculateCost()
		if cost != False:
			status += "\nCost: %s" % (cost)
		profile.replaceGCodeTags(self.resultFilename, gcode)
		wx.CallAfter(self.statusText.SetLabel, status)
		wx.CallAfter(self.OnSliceDone)
开发者ID:custodian,项目名称:Cura,代码行数:99,代码来源:projectPlanner.py



注:本文中的util.sliceRun.getExportFilename函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python timesince.timesince函数代码示例发布时间:2022-05-26
下一篇:
Python sessions.Session类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap