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

Python profile.getProfileSettingFloat函数代码示例

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

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



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

示例1: 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


示例2: _doAutoPlace

	def _doAutoPlace(self, allowedSizeY):
		extraSizeMin = self.headSizeMin
		extraSizeMax = self.headSizeMax
		if profile.getProfileSettingFloat('skirt_line_count') > 0:
			skirtSize = profile.getProfileSettingFloat('skirt_line_count') * profile.calculateEdgeWidth() + profile.getProfileSettingFloat('skirt_gap')
			extraSizeMin = extraSizeMin + util3d.Vector3(skirtSize, skirtSize, 0)
			extraSizeMax = extraSizeMax + util3d.Vector3(skirtSize, skirtSize, 0)
		if profile.getProfileSetting('support') != 'None':
			extraSizeMin = extraSizeMin + util3d.Vector3(3.0, 0, 0)
			extraSizeMax = extraSizeMax + util3d.Vector3(3.0, 0, 0)
		
		if self.printMode == 1:
			extraSizeMin = util3d.Vector3(6.0, 6.0, 0)
			extraSizeMax = util3d.Vector3(6.0, 6.0, 0)

		if extraSizeMin.x > extraSizeMax.x:
			posX = self.machineSize.x
			dirX = -1
		else:
			posX = 0
			dirX = 1
		posY = 0
		dirY = 1
		
		minX = self.machineSize.x
		minY = self.machineSize.y
		maxX = 0
		maxY = 0
		for item in self.list:
			item.centerX = posX + item.getMaximum().x * item.scale * dirX
			item.centerY = posY + item.getMaximum().y * item.scale * dirY
			if item.centerY + item.getSize().y >= allowedSizeY:
				if dirX < 0:
					posX = minX - extraSizeMax.x - 1
				else:
					posX = maxX + extraSizeMin.x + 1
				posY = 0
				item.centerX = posX + item.getMaximum().x * item.scale * dirX
				item.centerY = posY + item.getMaximum().y * item.scale * dirY
			posY += item.getSize().y  * item.scale * dirY + extraSizeMin.y + 1
			minX = min(minX, item.centerX - item.getSize().x * item.scale / 2)
			minY = min(minY, item.centerY - item.getSize().y * item.scale / 2)
			maxX = max(maxX, item.centerX + item.getSize().x * item.scale / 2)
			maxY = max(maxY, item.centerY + item.getSize().y * item.scale / 2)
		
		for item in self.list:
			if dirX < 0:
				item.centerX -= minX / 2
			else:
				item.centerX += (self.machineSize.x - maxX) / 2
			item.centerY += (self.machineSize.y - maxY) / 2
		
		if minX < 0 or maxX > self.machineSize.x:
			return ((maxX - minX) + (maxY - minY)) * 100
		
		return (maxX - minX) + (maxY - minY)
开发者ID:danilke,项目名称:Cura,代码行数:56,代码来源:projectPlanner.py


示例3: OnPaint

	def OnPaint(self,e):
		dc = wx.PaintDC(self)
		if not hasOpenGLlibs:
			dc.Clear()
			dc.DrawText("No PyOpenGL installation found.\nNo preview window available.", 10, 10)
			return
		self.SetCurrent(self.context)
		opengl.InitGL(self, self.view3D, self.zoom)
		if self.view3D:
			glTranslate(0,0,-self.zoom)
			glRotate(-self.pitch, 1,0,0)
			glRotate(self.yaw, 0,0,1)
			if self.viewMode == "GCode" or self.viewMode == "Mixed":
				if self.parent.gcode != None and len(self.parent.gcode.layerList) > self.parent.layerSpin.GetValue() and len(self.parent.gcode.layerList[self.parent.layerSpin.GetValue()]) > 0:
					glTranslate(0,0,-self.parent.gcode.layerList[self.parent.layerSpin.GetValue()][0].list[-1].z)
			else:
				if self.parent.objectsMaxV != None:
					glTranslate(0,0,-(self.parent.objectsMaxV[2]-self.parent.objectsMinV[2]) * profile.getProfileSettingFloat('model_scale') / 2)
		else:
			glScale(1.0/self.zoom, 1.0/self.zoom, 1.0)
			glTranslate(self.offsetX, self.offsetY, 0.0)

		self.viewport = glGetIntegerv(GL_VIEWPORT);
		self.modelMatrix = glGetDoublev(GL_MODELVIEW_MATRIX);
		self.projMatrix = glGetDoublev(GL_PROJECTION_MATRIX);

		glTranslate(-self.parent.machineCenter.x, -self.parent.machineCenter.y, 0)

		self.OnDraw()
		self.SwapBuffers()
开发者ID:bwattendorf,项目名称:Cura,代码行数:30,代码来源:preview3d.py


示例4: updateProfileToControls

	def updateProfileToControls(self):
		self.scale.SetValue(profile.getProfileSetting('model_scale'))
		self.rotate.SetValue(profile.getProfileSettingFloat('model_rotate_base'))
		self.mirrorX.SetValue(profile.getProfileSetting('flip_x') == 'True')
		self.mirrorY.SetValue(profile.getProfileSetting('flip_y') == 'True')
		self.mirrorZ.SetValue(profile.getProfileSetting('flip_z') == 'True')
		self.swapXZ.SetValue(profile.getProfileSetting('swap_xz') == 'True')
		self.swapYZ.SetValue(profile.getProfileSetting('swap_yz') == 'True')
		self.updateModelTransform()
开发者ID:danilke,项目名称:Cura,代码行数:9,代码来源:preview3d.py


示例5: StoreData

	def StoreData(self):
		profile.putPreference('machine_width', self.machineWidth.GetValue())
		profile.putPreference('machine_depth', self.machineDepth.GetValue())
		profile.putPreference('machine_height', self.machineHeight.GetValue())
		profile.putProfileSetting('nozzle_size', self.nozzleSize.GetValue())
		profile.putProfileSetting('machine_center_x', profile.getPreferenceFloat('machine_width') / 2)
		profile.putProfileSetting('machine_center_y', profile.getPreferenceFloat('machine_depth') / 2)
		profile.putProfileSetting('wall_thickness', float(profile.getProfileSettingFloat('nozzle_size')) * 2)
		profile.putPreference('has_heated_bed', str(self.heatedBed.GetValue()))
开发者ID:PKartaviy,项目名称:Cura,代码行数:9,代码来源:configWizard.py


示例6: OnMouseMotion

	def OnMouseMotion(self,e):
		if self.parent.objectsMaxV != None:
			size = (self.parent.objectsMaxV - self.parent.objectsMinV)
			sizeXY = math.sqrt((size[0] * size[0]) + (size[1] * size[1]))
			
			p0 = numpy.array(gluUnProject(e.GetX(), self.viewport[1] + self.viewport[3] - e.GetY(), 0, self.modelMatrix, self.projMatrix, self.viewport))
			p1 = numpy.array(gluUnProject(e.GetX(), self.viewport[1] + self.viewport[3] - e.GetY(), 1, self.modelMatrix, self.projMatrix, self.viewport))
			cursorZ0 = p0 - (p1 - p0) * (p0[2] / (p1[2] - p0[2]))
			cursorXY = math.sqrt((cursorZ0[0] * cursorZ0[0]) + (cursorZ0[1] * cursorZ0[1]))
			if cursorXY >= sizeXY * 0.7 and cursorXY <= sizeXY * 0.7 + 3:
				self.SetCursor(wx.StockCursor(wx.CURSOR_SIZING))
			else:
				self.SetCursor(wx.StockCursor(wx.CURSOR_DEFAULT))

		if e.Dragging() and e.LeftIsDown():
			if self.dragType == '':
				#Define the drag type depending on the cursor position.
				if cursorXY >= sizeXY * 0.7 and cursorXY <= sizeXY * 0.7 + 3:
					self.dragType = 'modelRotate'
					self.dragStart = math.atan2(cursorZ0[0], cursorZ0[1])
				else:
					self.dragType = 'viewRotate'
				
			if self.dragType == 'viewRotate':
				if self.view3D:
					self.yaw += e.GetX() - self.oldX
					self.pitch -= e.GetY() - self.oldY
					if self.pitch > 170:
						self.pitch = 170
					if self.pitch < 10:
						self.pitch = 10
				else:
					self.offsetX += float(e.GetX() - self.oldX) * self.zoom / self.GetSize().GetHeight() * 2
					self.offsetY -= float(e.GetY() - self.oldY) * self.zoom / self.GetSize().GetHeight() * 2
			elif self.dragType == 'modelRotate':
				angle = math.atan2(cursorZ0[0], cursorZ0[1])
				diff = self.dragStart - angle
				self.tempRotate = diff * 180 / math.pi
			#Workaround for buggy ATI cards.
			size = self.GetSizeTuple()
			self.SetSize((size[0]+1, size[1]))
			self.SetSize((size[0], size[1]))
			self.Refresh()
		else:
			if self.tempRotate != 0:
				profile.putProfileSetting('model_rotate_base', profile.getProfileSettingFloat('model_rotate_base') + self.tempRotate)
				self.parent.updateModelTransform()
				self.tempRotate = 0
				
			self.dragType = ''
		if e.Dragging() and e.RightIsDown():
			self.zoom += e.GetY() - self.oldY
			if self.zoom < 1:
				self.zoom = 1
			self.Refresh()
		self.oldX = e.GetX()
		self.oldY = e.GetY()
开发者ID:CNCBASHER,项目名称:Cura,代码行数:57,代码来源:preview3d.py


示例7: validate

	def validate(self):
		try:
			nozzleSize = profile.getProfileSettingFloat('nozzle_size')
			layerHeight = profile.getProfileSettingFloat('layer_height')
			printSpeed = profile.getProfileSettingFloat('print_speed')
			
			printVolumePerMM = layerHeight * nozzleSize
			printVolumePerSecond = printVolumePerMM * printSpeed
			#Using 10mm3 per second with a 0.4mm nozzle (normal max according to Joergen Geerds)
			maxPrintVolumePerSecond = 10 / (math.pi*(0.2*0.2)) * (math.pi*(nozzleSize/2*nozzleSize/2))
			
			if printVolumePerSecond > maxPrintVolumePerSecond:
				return WARNING, 'You are trying to print more then %.1fmm^3 of filament per second. This might cause filament slipping. (You are printing at %0.1fmm^3 per second)' % (maxPrintVolumePerSecond, printVolumePerSecond)
			
			return SUCCESS, ''
		except ValueError:
			#We already have an error by the int/float validator in this case.
			return SUCCESS, ''
开发者ID:danilke,项目名称:Cura,代码行数:18,代码来源:validators.py


示例8: __init__

	def __init__(self, mainWindow, parent, filelist):
		wx.Panel.__init__(self, parent, -1)
		self.mainWindow = mainWindow
		self.filelist = filelist
		self.abort = False
		
		box = wx.StaticBox(self, -1, filelist[0])
		self.sizer = wx.StaticBoxSizer(box, wx.HORIZONTAL)

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

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

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

		self.SetSizer(mainSizer)
		self.prevStep = 'start'
		self.totalDoneFactor = 0.0
		self.startTime = time.time()
		if profile.getPreference('save_profile') == 'True':
			profile.saveGlobalProfile(self.filelist[0][: self.filelist[0].rfind('.')] + "_profile.ini")
		cmdList = []
		for filename in self.filelist:
			idx = self.filelist.index(filename)
			#print filename, idx
			if idx > 0:
				profile.setTempOverride('fan_enabled', 'False')
				profile.setTempOverride('skirt_line_count', '0')
				profile.setTempOverride('machine_center_x', profile.getProfileSettingFloat('machine_center_x') - profile.getPreferenceFloat('extruder_offset_x%d' % (idx)))
				profile.setTempOverride('machine_center_y', profile.getProfileSettingFloat('machine_center_y') - profile.getPreferenceFloat('extruder_offset_y%d' % (idx)))
				profile.setTempOverride('alternative_center', self.filelist[0])
			if len(self.filelist) > 1:
				profile.setTempOverride('add_start_end_gcode', 'False')
				profile.setTempOverride('gcode_extension', 'multi_extrude_tmp')
			cmdList.append(sliceRun.getSliceCommand(filename))
		profile.resetTempOverride()
		self.thread = WorkerThread(self, filelist, cmdList)
开发者ID:festlv,项目名称:Cura,代码行数:44,代码来源:sliceProgessPanel.py


示例9: OnOpenSVG

 def OnOpenSVG(self, e):
     dlg = wx.FileDialog(
         self,
         "Open SVG file",
         os.path.split(profile.getPreference("lastFile"))[0],
         style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST,
     )
     dlg.SetWildcard("SVG files (*.svg)|*.svg;*.SVG")
     if dlg.ShowModal() == wx.ID_OK:
         self.filename = dlg.GetPath()
         self.svg = svg.SVG(self.filename)
         self.svg.center(
             complex(
                 profile.getProfileSettingFloat("machine_center_x"),
                 profile.getProfileSettingFloat("machine_center_y"),
             )
         )
         self.preview.Refresh()
     dlg.Destroy()
开发者ID:CNCBASHER,项目名称:Cura,代码行数:19,代码来源:flatSlicerWindow.py


示例10: getExtraHeadSize

	def getExtraHeadSize(self):
		extraSizeMin = self.headSizeMin
		extraSizeMax = self.headSizeMax
		if profile.getProfileSettingFloat('skirt_line_count') > 0:
			skirtSize = profile.getProfileSettingFloat('skirt_line_count') * profile.calculateEdgeWidth() + profile.getProfileSettingFloat('skirt_gap')
			extraSizeMin = extraSizeMin + numpy.array([skirtSize, skirtSize, 0])
			extraSizeMax = extraSizeMax + numpy.array([skirtSize, skirtSize, 0])
		if profile.getProfileSetting('enable_raft') != 'False':
			raftSize = profile.getProfileSettingFloat('raft_margin') * 2
			extraSizeMin = extraSizeMin + numpy.array([raftSize, raftSize, 0])
			extraSizeMax = extraSizeMax + numpy.array([raftSize, raftSize, 0])
		if profile.getProfileSetting('support') != 'None':
			extraSizeMin = extraSizeMin + numpy.array([3.0, 0, 0])
			extraSizeMax = extraSizeMax + numpy.array([3.0, 0, 0])

		if self.printMode == 1:
			extraSizeMin = numpy.array([6.0, 6.0, 0])
			extraSizeMax = numpy.array([6.0, 6.0, 0])
		
		return extraSizeMin, extraSizeMax
开发者ID:custodian,项目名称:Cura,代码行数:20,代码来源:projectPlanner.py


示例11: drawModel

	def drawModel(self, obj):
		multiX = 1 #int(profile.getProfileSetting('model_multiply_x'))
		multiY = 1 #int(profile.getProfileSetting('model_multiply_y'))
		modelScale = profile.getProfileSettingFloat('model_scale')
		modelSize = (obj.mesh.getMaximum() - obj.mesh.getMinimum()) * modelScale
		glPushMatrix()
		glTranslate(-(modelSize.x+10)*(multiX-1)/2,-(modelSize.y+10)*(multiY-1)/2, 0)
		for mx in xrange(0, multiX):
			for my in xrange(0, multiY):
				glPushMatrix()
				glTranslate((modelSize.x+10)*mx,(modelSize.y+10)*my, 0)
				glScalef(modelScale, modelScale, modelScale)
				glCallList(obj.displayList)
				glPopMatrix()
		glPopMatrix()
开发者ID:danilke,项目名称:Cura,代码行数:15,代码来源:preview3d.py


示例12: updateModelTransform

	def updateModelTransform(self, f=0):
		if len(self.objectList) < 1 or self.objectList[0].mesh == None:
			return
		
		rotate = profile.getProfileSettingFloat('model_rotate_base')
		mirrorX = profile.getProfileSetting('flip_x') == 'True'
		mirrorY = profile.getProfileSetting('flip_y') == 'True'
		mirrorZ = profile.getProfileSetting('flip_z') == 'True'
		swapXZ = profile.getProfileSetting('swap_xz') == 'True'
		swapYZ = profile.getProfileSetting('swap_yz') == 'True'

		for obj in self.objectList:
			if obj.mesh == None:
				continue
			obj.mesh.setRotateMirror(rotate, mirrorX, mirrorY, mirrorZ, swapXZ, swapYZ)
		
		minV = self.objectList[0].mesh.getMinimum()
		maxV = self.objectList[0].mesh.getMaximum()
		for obj in self.objectList:
			if obj.mesh == None:
				continue

			obj.mesh.getMinimumZ()
			minV = numpy.minimum(minV, obj.mesh.getMinimum())
			maxV = numpy.maximum(maxV, obj.mesh.getMaximum())

		self.objectsMaxV = maxV
		self.objectsMinV = minV
		for obj in self.objectList:
			if obj.mesh == None:
				continue

			obj.mesh.vertexes -= numpy.array([minV[0] + (maxV[0] - minV[0]) / 2, minV[1] + (maxV[1] - minV[1]) / 2, minV[2]])
			#for v in obj.mesh.vertexes:
			#	v[2] -= minV[2]
			#	v[0] -= minV[0] + (maxV[0] - minV[0]) / 2
			#	v[1] -= minV[1] + (maxV[1] - minV[1]) / 2
			obj.mesh.getMinimumZ()
			obj.dirty = True
		self.glCanvas.Refresh()
开发者ID:bwattendorf,项目名称:Cura,代码行数:40,代码来源:preview3d.py


示例13: updateModelTransform

	def updateModelTransform(self, f=0):
		if len(self.objectList) < 1 or self.objectList[0].mesh == None:
			return
		
		rotate = profile.getProfileSettingFloat('model_rotate_base')
		mirrorX = profile.getProfileSetting('flip_x') == 'True'
		mirrorY = profile.getProfileSetting('flip_y') == 'True'
		mirrorZ = profile.getProfileSetting('flip_z') == 'True'
		swapXZ = profile.getProfileSetting('swap_xz') == 'True'
		swapYZ = profile.getProfileSetting('swap_yz') == 'True'

		for obj in self.objectList:
			if obj.mesh == None:
				continue
			obj.mesh.setRotateMirror(rotate, mirrorX, mirrorY, mirrorZ, swapXZ, swapYZ)
		
		minV = self.objectList[0].mesh.getMinimum()
		maxV = self.objectList[0].mesh.getMaximum()
		for obj in self.objectList:
			if obj.mesh == None:
				continue

			obj.mesh.getMinimumZ()
			minV = minV.min(obj.mesh.getMinimum())
			maxV = maxV.max(obj.mesh.getMaximum())

		self.objectsMaxV = maxV
		self.objectsMinV = minV
		for obj in self.objectList:
			if obj.mesh == None:
				continue

			for v in obj.mesh.vertexes:
				v.z -= minV.z
				v.x -= minV.x + (maxV.x - minV.x) / 2
				v.y -= minV.y + (maxV.y - minV.y) / 2
			obj.mesh.getMinimumZ()
			obj.dirty = True
		self.glCanvas.Refresh()
开发者ID:danilke,项目名称:Cura,代码行数:39,代码来源:preview3d.py


示例14: doFileLoadThread

	def doFileLoadThread(self):
		for obj in self.objectList:
			if obj.filename != None and os.path.isfile(obj.filename) and obj.fileTime != os.stat(obj.filename).st_mtime:
				obj.ileTime = os.stat(obj.filename).st_mtime
				mesh = meshLoader.loadMesh(obj.filename)
				obj.dirty = False
				obj.mesh = mesh
				self.updateModelTransform()
				scale = profile.getProfileSettingFloat('model_scale')
				size = (self.objectsMaxV - self.objectsMinV) * scale
				if size[0] > self.machineSize.x or size[1] > self.machineSize.y or size[2] > self.machineSize.z:
					self.OnScaleMax(None)
				self.glCanvas.zoom = numpy.max(size) * 2.5
				self.errorList = []
				wx.CallAfter(self.updateToolbar)
				wx.CallAfter(self.glCanvas.Refresh)
		
		if os.path.isfile(self.gcodeFilename) and self.gcodeFileTime != os.stat(self.gcodeFilename).st_mtime:
			self.gcodeFileTime = os.stat(self.gcodeFilename).st_mtime
			gcode = gcodeInterpreter.gcode()
			gcode.progressCallback = self.loadProgress
			gcode.load(self.gcodeFilename)
			self.gcodeDirty = False
			self.gcode = gcode
			self.gcodeDirty = True

			errorList = []
			for line in open(self.gcodeFilename, "rt"):
				res = re.search(';Model error\(([a-z ]*)\): \(([0-9\.\-e]*), ([0-9\.\-e]*), ([0-9\.\-e]*)\) \(([0-9\.\-e]*), ([0-9\.\-e]*), ([0-9\.\-e]*)\)', line)
				if res != None:
					v1 = util3d.Vector3(float(res.group(2)), float(res.group(3)), float(res.group(4)))
					v2 = util3d.Vector3(float(res.group(5)), float(res.group(6)), float(res.group(7)))
					errorList.append([v1, v2])
			self.errorList = errorList

			wx.CallAfter(self.updateToolbar)
			wx.CallAfter(self.glCanvas.Refresh)
		elif not os.path.isfile(self.gcodeFilename):
			self.gcode = None
开发者ID:bwattendorf,项目名称:Cura,代码行数:39,代码来源:preview3d.py


示例15: OnDraw


#.........这里部分代码省略.........
				glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE)
				glDisable(GL_LIGHTING)
				glDisable(GL_DEPTH_TEST)
				glEnable(GL_STENCIL_TEST)
				glStencilFunc(GL_ALWAYS, 1, 1)
				glStencilOp(GL_INCR, GL_INCR, GL_INCR)
				self.drawModel(obj)
				glStencilOp (GL_KEEP, GL_KEEP, GL_KEEP);
				
				glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE)
				glStencilFunc(GL_EQUAL, 0, 1)
				glColor(1, 1, 1)
				self.drawModel(obj)
				glStencilFunc(GL_EQUAL, 1, 1)
				glColor(1, 0, 0)
				self.drawModel(obj)

				glPushMatrix()
				glLoadIdentity()
				for i in xrange(2, 15, 2):
					glStencilFunc(GL_EQUAL, i, 0xFF);
					glColor(float(i)/10, float(i)/10, float(i)/5)
					glBegin(GL_QUADS)
					glVertex3f(-1000,-1000,-1)
					glVertex3f( 1000,-1000,-1)
					glVertex3f( 1000, 1000,-1)
					glVertex3f(-1000, 1000,-1)
					glEnd()
				for i in xrange(1, 15, 2):
					glStencilFunc(GL_EQUAL, i, 0xFF);
					glColor(float(i)/10, 0, 0)
					glBegin(GL_QUADS)
					glVertex3f(-1000,-1000,-1)
					glVertex3f( 1000,-1000,-1)
					glVertex3f( 1000, 1000,-1)
					glVertex3f(-1000, 1000,-1)
					glEnd()
				glPopMatrix()

				glDisable(GL_STENCIL_TEST)
				glEnable(GL_DEPTH_TEST)
				
				#Fix the depth buffer
				glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE)
				self.drawModel(obj)
				glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE)
			elif self.viewMode == "Normal":
				glLightfv(GL_LIGHT0, GL_DIFFUSE, self.objColor[self.parent.objectList.index(obj)])
				glLightfv(GL_LIGHT0, GL_AMBIENT, map(lambda x: x / 5, self.objColor[self.parent.objectList.index(obj)]))
				glEnable(GL_LIGHTING)
				self.drawModel(obj)

			if self.drawBorders and (self.viewMode == "Normal" or self.viewMode == "Transparent" or self.viewMode == "X-Ray"):
				glEnable(GL_DEPTH_TEST)
				glDisable(GL_LIGHTING)
				glColor3f(1,1,1)
				glPushMatrix()
				modelScale = profile.getProfileSettingFloat('model_scale')
				glScalef(modelScale, modelScale, modelScale)
				opengl.DrawMeshOutline(obj.mesh)
				glPopMatrix()
		
		glPopMatrix()	
		if self.viewMode == "Normal" or self.viewMode == "Transparent" or self.viewMode == "X-Ray":
			glDisable(GL_LIGHTING)
			glDisable(GL_DEPTH_TEST)
			glDisable(GL_BLEND)
			glColor3f(1,0,0)
			glBegin(GL_LINES)
			for err in self.parent.errorList:
				glVertex3f(err[0].x, err[0].y, err[0].z)
				glVertex3f(err[1].x, err[1].y, err[1].z)
			glEnd()
			glEnable(GL_DEPTH_TEST)

		opengl.DrawMachine(machineSize)

		glPushMatrix()
		glTranslate(self.parent.machineCenter.x, self.parent.machineCenter.y, 0)
		
		#Draw the rotate circle
		if self.parent.objectsMaxV != None and False:
			glDisable(GL_LIGHTING)
			glDisable(GL_CULL_FACE)
			glEnable(GL_BLEND)
			glBegin(GL_TRIANGLE_STRIP)
			size = (self.parent.objectsMaxV - self.parent.objectsMinV)
			sizeXY = math.sqrt((size[0] * size[0]) + (size[1] * size[1]))
			for i in xrange(0, 64+1):
				f = i if i < 64/2 else 64 - i
				glColor4ub(255,int(f*255/(64/2)),0,128)
				glVertex3f(sizeXY * 0.7 * math.cos(i/32.0*math.pi), sizeXY * 0.7 * math.sin(i/32.0*math.pi),0.1)
				glColor4ub(  0,128,0,128)
				glVertex3f((sizeXY * 0.7 + 3) * math.cos(i/32.0*math.pi), (sizeXY * 0.7 + 3) * math.sin(i/32.0*math.pi),0.1)
			glEnd()
			glEnable(GL_CULL_FACE)
		
		glPopMatrix()
		
		glFlush()
开发者ID:bwattendorf,项目名称:Cura,代码行数:101,代码来源:preview3d.py


示例16: getProfileInformation


#.........这里部分代码省略.........
			'Activate_Hop': "False",
			'Hop_Over_Layer_Thickness_ratio': DEFSET,
			'Minimum_Hop_Angle_degrees': DEFSET,
		},'wipe': {
			'Activate_Wipe': "False",
			'Arrival_X_mm': DEFSET,
			'Arrival_Y_mm': DEFSET,
			'Arrival_Z_mm': DEFSET,
			'Departure_X_mm': DEFSET,
			'Departure_Y_mm': DEFSET,
			'Departure_Z_mm': DEFSET,
			'Wipe_X_mm': DEFSET,
			'Wipe_Y_mm': DEFSET,
			'Wipe_Z_mm': DEFSET,
			'Wipe_Period_layers': DEFSET,
		},'oozebane': {
			'Activate_Oozebane': "False",
			'After_Startup_Distance_millimeters': DEFSET,
			'Early_Shutdown_Distance_millimeters': DEFSET,
			'Early_Startup_Distance_Constant_millimeters': DEFSET,
			'Early_Startup_Maximum_Distance_millimeters': DEFSET,
			'First_Early_Startup_Distance_millimeters': DEFSET,
			'Minimum_Distance_for_Early_Startup_millimeters': DEFSET,
			'Minimum_Distance_for_Early_Shutdown_millimeters': DEFSET,
			'Slowdown_Startup_Steps_positive_integer': DEFSET,
		},'dwindle': {
			'Activate_Dwindle': "False",
			'End_Rate_Multiplier_ratio': '0.5',
			'Pent_Up_Volume_cubic_millimeters': "0.4",
			'Slowdown_Steps_positive_integer': '5',
			'Slowdown_Volume_cubic_millimeters': "5.0",
		},'splodge': {
			'Activate_Splodge': "False",
			'Initial_Lift_over_Extra_Thickness_ratio': DEFSET,
			'Initial_Splodge_Feed_Rate_mm/s': DEFSET,
			'Operating_Splodge_Feed_Rate_mm/s': DEFSET,
			'Operating_Splodge_Quantity_Length_millimeters': DEFSET,
			'Initial_Splodge_Quantity_Length_millimeters': DEFSET,
			'Operating_Lift_over_Extra_Thickness_ratio': DEFSET,
		},'home': {
			'Activate_Home': "False",
			'Name_of_Home_File': DEFSET,
		},'lash': {
			'Activate_Lash': "False",
			'X_Backlash_mm': DEFSET,
			'Y_Backlash_mm': DEFSET,
		},'fillet': {
			'Activate_Fillet': "False",
			'Arc_Point': DEFSET,
			'Arc_Radius': DEFSET,
			'Arc_Segment': DEFSET,
			'Bevel': DEFSET,
			'Corner_Feed_Rate_Multiplier_ratio': DEFSET,
			'Fillet_Radius_over_Perimeter_Width_ratio': DEFSET,
			'Reversal_Slowdown_Distance_over_Perimeter_Width_ratio': DEFSET,
			'Use_Intermediate_Feed_Rate_in_Corners': DEFSET,
		},'limit': {
			'Activate_Limit': "False",
			'Maximum_Initial_Feed_Rate_mm/s': DEFSET,
		},'unpause': {
			'Activate_Unpause': "False",
			'Delay_milliseconds': DEFSET,
			'Maximum_Speed_ratio': DEFSET,
		},'dimension': {
			'Activate_Dimension': "True",
			'Absolute_Extrusion_Distance': "True",
			'Relative_Extrusion_Distance': "False",
			'Extruder_Retraction_Speed_mm/s': storedSettingFloat('retraction_speed'),
			'Filament_Diameter_mm': storedSettingFloat("filament_diameter"),
			'Filament_Packing_Density_ratio': storedSettingFloat("filament_density"),
			'Maximum_E_Value_before_Reset_float': DEFSET,
			'Minimum_Travel_for_Retraction_millimeters': storedSettingFloat("retraction_min_travel"),
			'Retract_Within_Island': storedSettingInvertBoolean("retract_on_jumps_only"),
			'Retraction_Distance_millimeters': lambda setting: profile.getProfileSettingFloat('retraction_amount') if profile.getProfileSetting('retraction_enable') == 'True' else 0,
			'Restart_Extra_Distance_millimeters': storedSettingFloat('retraction_extra'),
		},'alteration': {
			'Activate_Alteration': storedSetting('add_start_end_gcode'),
			'Name_of_End_File': "end.gcode",
			'Name_of_Start_File': "start.gcode",
			'Remove_Redundant_Mcode': "True",
			'Replace_Variable_with_Setting': DEFSET,
		},'export': {
			'Activate_Export': "True",
			'Add_Descriptive_Extension': DEFSET,
			'Add_Export_Suffix': DEFSET,
			'Add_Profile_Extension': DEFSET,
			'Add_Timestamp_Extension': DEFSET,
			'Also_Send_Output_To': DEFSET,
			'Analyze_Gcode': DEFSET,
			'Comment_Choice': DEFSET,
			'Do_Not_Change_Output': DEFSET,
			'binary_16_byte': DEFSET,
			'gcode_step': DEFSET,
			'gcode_time_segment': DEFSET,
			'gcode_small': DEFSET,
			'File_Extension': storedSetting('gcode_extension'),
			'Name_of_Replace_File': DEFSET,
			'Save_Penultimate_Gcode': "False",
		}
	}
开发者ID:darkomen,项目名称:Cura,代码行数:101,代码来源:settings.py


示例17: calcLayerSkip

def calcLayerSkip(setting):
	bottomThickness = profile.getProfileSettingFloat('bottom_thickness')
	layerThickness = profile.getProfileSettingFloat('layer_height')
	if bottomThickness < layerThickness:
		return 0
	return int(math.ceil((bottomThickness - layerThickness) / layerThickness + 0.0001) - 1)
开发者ID:darkomen,项目名称:Cura,代码行数:6,代码来源:settings.py


示例18: calcExtraBottomThickness

def calcExtraBottomThickness(setting):
	bottomThickness = profile.getProfileSettingFloat('bottom_thickness')
	layerThickness = profile.getProfileSettingFloat('layer_height')
	if bottomThickness < layerThickness:
		return 0.0
	return bottomThickness - layerThickness
开发者ID:darkomen,项目名称:Cura,代码行数:6,代码来源:settings.py


示例19: calcBottomLayerFlowRateRatio

def calcBottomLayerFlowRateRatio(setting):
	bottomThickness = profile.getProfileSettingFloat('bottom_thickness')
	layerThickness = profile.getProfileSettingFloat('layer_height')
	if bottomThickness < layerThickness:
		return 1.0
	return bottomThickness / layerThickness
开发者ID:darkomen,项目名称:Cura,代码行数:6,代码来源:settings.py


示例20: calcSupportDistanceRatio

def calcSupportDistanceRatio(setting):
	edgeWidth = calculateEdgeWidth(setting)
	distance = profile.getProfileSettingFloat('support_distance')
	return distance / edgeWidth
开发者ID:darkomen,项目名称:Cura,代码行数:4,代码来源:settings.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python profile.putPreference函数代码示例发布时间:2022-05-26
下一篇:
Python profile.getProfileSetting函数代码示例发布时间: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