当前位置: 首页>>代码示例>>Python>>正文


Python gcodec.getLocationFromSplitLine函数代码示例

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


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

示例1: parseLine

	def parseLine( self, line ):
		"Parse a gcode line and add it to the vector output."
		splitLine = gcodec.getSplitLineBeforeBracketSemicolon( line )
		if len( splitLine ) < 1:
			return
		firstWord = splitLine[ 0 ]
		if self.isLayerStart( firstWord, splitLine ):
			self.extrusionNumber = 0
			self.skeinPane = []
			self.skeinPanes.append( self.skeinPane )
		if firstWord == 'G1':
			location = gcodec.getLocationFromSplitLine( self.oldLocation, splitLine )
			self.linearMove( line, location )
			self.oldLocation = location
		elif firstWord == 'M101':
			self.extruderActive = True
			self.extrusionNumber += 1
		elif firstWord == 'M103':
			self.extruderActive = False
		if firstWord == 'G2' or firstWord == 'G3':
			relativeLocation = gcodec.getLocationFromSplitLine( self.oldLocation, splitLine )
			relativeLocation.z = 0.0
			location = self.oldLocation + relativeLocation
			self.linearMove( line, location )
			self.oldLocation = location
开发者ID:CNCBASHER,项目名称:skeinforge,代码行数:25,代码来源:skeinview.py

示例2: getDistanceToThreadBeginningAfterThreadEnd

	def getDistanceToThreadBeginningAfterThreadEnd( self, remainingDistance ):
		"Get the distance to the thread beginning after the end of this thread."
		extruderOnReached = False
		line = self.lines[ self.lineIndex ]
		splitLine = gcodec.getSplitLineBeforeBracketSemicolon( line )
		lastThreadLocation = gcodec.getLocationFromSplitLine( self.oldLocation, splitLine )
		threadEndReached = False
		totalDistance = 0.0
		for afterIndex in xrange( self.lineIndex + 1, len( self.lines ) ):
			line = self.lines[ afterIndex ]
			splitLine = gcodec.getSplitLineBeforeBracketSemicolon( line )
			firstWord = gcodec.getFirstWord( splitLine )
			if firstWord == 'G1':
				location = gcodec.getLocationFromSplitLine( lastThreadLocation, splitLine )
				if threadEndReached:
					totalDistance += location.distance( lastThreadLocation )
					if totalDistance >= remainingDistance:
						return None
					if extruderOnReached:
						return totalDistance
				lastThreadLocation = location
			elif firstWord == 'M101':
				extruderOnReached = True
			elif firstWord == 'M103':
				threadEndReached = True
		return None
开发者ID:CNCBASHER,项目名称:skeinforge,代码行数:26,代码来源:oozebane.py

示例3: setLayerPixelTable

	def setLayerPixelTable( self ):
		"Parse a gcode line and add it to the clip skein."
		boundaryLoop = None
		extruderActive = False
		maskPixelTable = {}
		self.boundaryLoops = []
		self.maskPixelTableTable = {}
		self.layerPixelTable = {}
		oldLocation = self.oldLocation
		for afterIndex in xrange( self.lineIndex + 1, len( self.lines ) ):
			line = self.lines[ afterIndex ]
			splitLine = gcodec.getSplitLineBeforeBracketSemicolon( line )
			firstWord = gcodec.getFirstWord( splitLine )
			if firstWord == 'G1':
				location = gcodec.getLocationFromSplitLine( oldLocation, splitLine )
				if extruderActive and oldLocation != None:
					self.addSegmentToPixelTables( location, maskPixelTable, oldLocation )
				oldLocation = location
			elif firstWord == 'M101':
				extruderActive = True
			elif firstWord == 'M103':
				extruderActive = False
				maskPixelTable = {}
			elif firstWord == '(</boundaryPerimeter>)':
				boundaryLoop = None
			elif firstWord == '(<boundaryPoint>':
				if boundaryLoop == None:
					boundaryLoop = []
					self.boundaryLoops.append( boundaryLoop )
				location = gcodec.getLocationFromSplitLine( None, splitLine )
				boundaryLoop.append( location.dropAxis( 2 ) )
			elif firstWord == '(</layer>)':
				return
开发者ID:FarMcKon,项目名称:skeinforge,代码行数:33,代码来源:clip.py

示例4: parseLine

	def parseLine( self, line ):
		"Parse a gcode line and add it to the inset skein."
		splitLine = gcodec.getSplitLineBeforeBracketSemicolon( line )
		if len( splitLine ) < 1:
			return
		firstWord = splitLine[ 0 ]
		if firstWord == '(<boundaryPoint>':
			location = gcodec.getLocationFromSplitLine( None, splitLine )
			self.boundary.append( location.dropAxis( 2 ) )
		elif ( firstWord == '(<bridgeRotation>' or firstWord == '<!--bridgeRotation-->' ):
			secondWordWithoutBrackets = splitLine[ 1 ].replace( '(', '' ).replace( ')', '' )
			self.rotatedBoundaryLayer.rotation = complex( secondWordWithoutBrackets )
		elif firstWord == '(</extrusion>)':
				self.distanceFeedRate.addLine( line )
				if self.repository.turnExtruderHeaterOffAtShutDown.value:
					self.distanceFeedRate.addLine( 'M104 S0' ) # Turn extruder heater off.
				return
		elif firstWord == '(<layer>':
			self.rotatedBoundaryLayer = euclidean.RotatedLoopLayer( float( splitLine[ 1 ] ) )
			self.distanceFeedRate.addLine( line )
		elif firstWord == '(</layer>)':
			self.addInset( self.rotatedBoundaryLayer )
			self.rotatedBoundaryLayer = None
		elif firstWord == '(<surroundingLoop>)':
			self.boundary = []
			self.rotatedBoundaryLayer.loops.append( self.boundary )
		if self.rotatedBoundaryLayer == None:
			self.distanceFeedRate.addLine( line )
开发者ID:CNCBASHER,项目名称:skeinforge,代码行数:28,代码来源:inset.py

示例5: getHopLine

	def getHopLine( self, line ):
		"Get hopped gcode line."
		splitLine = gcodec.getSplitLineBeforeBracketSemicolon( line )
		self.feedRateMinute = gcodec.getFeedRateMinute( self.feedRateMinute, splitLine )
		if self.extruderActive:
			return line
		location = gcodec.getLocationFromSplitLine( self.oldLocation, splitLine )
		highestZ = location.z
		if self.oldLocation != None:
			highestZ = max( highestZ, self.oldLocation.z )
		highestZHop = highestZ + self.hopHeight
		locationComplex = location.dropAxis( 2 )
		if self.justDeactivated:
			oldLocationComplex = self.oldLocation.dropAxis( 2 )
			distance = abs( locationComplex - oldLocationComplex )
			if distance < self.minimumDistance:
				if self.isNextTravel():
					return self.distanceFeedRate.getLineWithZ( line, splitLine, highestZHop )
			alongRatio = min( 0.41666666, self.hopDistance / distance )
			oneMinusAlong = 1.0 - alongRatio
			closeLocation = oldLocationComplex * oneMinusAlong + locationComplex * alongRatio
			self.distanceFeedRate.addLine( self.distanceFeedRate.getLineWithZ( line, splitLine, highestZHop ) )
			if self.isNextTravel():
				return self.distanceFeedRate.getLineWithZ( line, splitLine, highestZHop )
			farLocation = oldLocationComplex * alongRatio + locationComplex * oneMinusAlong
			self.distanceFeedRate.addGcodeMovementZWithFeedRate( self.feedRateMinute, farLocation, highestZHop )
			return line
		if self.isNextTravel():
			return self.distanceFeedRate.getLineWithZ( line, splitLine, highestZHop )
		return line
开发者ID:CNCBASHER,项目名称:skeinforge,代码行数:30,代码来源:hop.py

示例6: parseBoundaries

	def parseBoundaries( self ):
		"Parse the boundaries and add them to the boundary layers."
		boundaryLoop = None
		boundaryLayer = None
		for line in self.lines[ self.lineIndex : ]:
			splitLine = gcodec.getSplitLineBeforeBracketSemicolon( line )
			firstWord = gcodec.getFirstWord( splitLine )
			if len( self.shutdownLines ) > 0:
				self.shutdownLines.append( line )
			if firstWord == '(</boundaryPerimeter>)':
				boundaryLoop = None
			elif firstWord == '(<boundaryPoint>':
				location = gcodec.getLocationFromSplitLine( None, splitLine )
				if boundaryLoop == None:
					boundaryLoop = []
					boundaryLayer.loops.append( boundaryLoop )
				boundaryLoop.append( location.dropAxis( 2 ) )
			elif firstWord == '(<layer>':
				boundaryLayer = euclidean.LoopLayer( float( splitLine[ 1 ] ) )
				self.boundaryLayers.append( boundaryLayer )
			elif firstWord == '(</extrusion>)':
				self.shutdownLines = [ line ]
		for boundaryLayer in self.boundaryLayers:
			if not euclidean.isWiddershins( boundaryLayer.loops[ 0 ] ):
				boundaryLayer.loops[ 0 ].reverse()
		self.boundaryReverseLayers = self.boundaryLayers[ : ]
		self.boundaryReverseLayers.reverse()
开发者ID:CNCBASHER,项目名称:skeinforge,代码行数:27,代码来源:coil.py

示例7: getLinearMove

	def getLinearMove( self, line, splitLine ):
		"Get the linear move."
		location = gcodec.getLocationFromSplitLine( self.oldLocation, splitLine )
		self.movementLines.append( line )
		z = location.z + self.layerDeltas[ 0 ]
		self.oldLocation = location
		return self.distanceFeedRate.getLineWithZ( line, splitLine, z )
开发者ID:TeamTeamUSA,项目名称:SkeinFox,代码行数:7,代码来源:whittle.py

示例8: parseLine

	def parseLine( self, line ):
		"Parse a gcode line and add it to the mill skein."
		splitLine = gcodec.getSplitLineBeforeBracketSemicolon( line )
		if len( splitLine ) < 1:
			return
		firstWord = splitLine[ 0 ]
		if firstWord == 'G1':
			location = gcodec.getLocationFromSplitLine( self.oldLocation, splitLine )
			if self.isExtruderActive:
				self.average.addValue( location.z )
				if self.oldLocation != None:
					euclidean.addValueSegmentToPixelTable( self.oldLocation.dropAxis( 2 ), location.dropAxis( 2 ), self.aroundPixelTable, None, self.aroundWidth )
			self.oldLocation = location
		elif firstWord == 'M101':
			self.isExtruderActive = True
		elif firstWord == 'M103':
			self.isExtruderActive = False
		elif firstWord == '(<layer>':
			self.aroundPixelTable = {}
			self.average.reset()
		elif firstWord == '(</layer>)':
			if len( self.boundaryLayers ) > self.layerIndex:
				self.addMillThreads()
			self.layerIndex += 1
		self.distanceFeedRate.addLine( line )
开发者ID:CNCBASHER,项目名称:skeinforge,代码行数:25,代码来源:mill.py

示例9: parseSurroundingLoop

	def parseSurroundingLoop( self, line ):
		"Parse a surrounding loop."
		splitLine = gcodec.getSplitLineBeforeBracketSemicolon( line )
		if len( splitLine ) < 1:
			return
		firstWord = splitLine[ 0 ]
		if firstWord == 'G1':
			self.linearMove( splitLine )
		if firstWord == 'M101':
			self.extruderActive = True
		elif firstWord == 'M103':
			self.extruderActive = False
		elif firstWord == '(<boundaryPoint>':
			location = gcodec.getLocationFromSplitLine( None, splitLine )
			if self.boundary == None:
				self.boundary = []
			self.boundary.append( location.dropAxis( 2 ) )
		elif firstWord == '(<layer>':
			self.layerZ = float( splitLine[ 1 ] )
			self.threadLayer = None
		elif firstWord == '(<boundaryPerimeter>)':
			self.addThreadLayerIfNone()
		elif firstWord == '(</boundaryPerimeter>)':
			if self.boundary != None:
				self.threadLayer.points.append( getPolygonCenter( self.boundary ) )
				self.boundary = None
开发者ID:CNCBASHER,项目名称:skeinforge,代码行数:26,代码来源:drill.py

示例10: linearMove

	def linearMove( self, splitLine ):
		"Add a linear move to the loop."
		self.addThreadLayerIfNone()
		location = gcodec.getLocationFromSplitLine( self.oldLocation, splitLine )
		if self.extruderActive:
			self.boundary = None
		self.oldLocation = location
开发者ID:CNCBASHER,项目名称:skeinforge,代码行数:7,代码来源:drill.py

示例11: getUnpausedArcMovement

	def getUnpausedArcMovement( self, line, splitLine ):
		"Get an unpaused arc movement."
		if self.oldLocation == None:
			return line
		self.feedRateMinute = gcodec.getFeedRateMinute( self.feedRateMinute, splitLine )
		relativeLocation = gcodec.getLocationFromSplitLine( self.oldLocation, splitLine )
		location = self.oldLocation + relativeLocation
		self.oldLocation = location
		halfPlaneLineDistance = 0.5 * abs( relativeLocation.dropAxis( 2 ) )
		radius = gcodec.getDoubleFromCharacterSplitLine( 'R', splitLine )
		if radius == None:
			relativeCenter = complex( gcodec.getDoubleFromCharacterSplitLine( 'I', splitLine ), gcodec.getDoubleFromCharacterSplitLine( 'J', splitLine ) )
			radius = abs( relativeCenter )
		angle = 0.0
		if radius > 0.0:
			angle = math.pi
			if halfPlaneLineDistance < radius:
				angle = 2.0 * math.asin( halfPlaneLineDistance / radius )
			else:
				angle *= halfPlaneLineDistance / radius
		deltaZ = abs( relativeLocation.z )
		arcDistanceZ = complex( abs( angle ) * radius, relativeLocation.z )
		distance = abs( arcDistanceZ )
		if distance <= 0.0:
			return ''
		unpausedFeedRateMinute = self.distanceFeedRate.getZLimitedFeedRate( deltaZ, distance, self.feedRateMinute )
		return self.distanceFeedRate.getLineWithFeedRate( unpausedFeedRateMinute, line, splitLine )
开发者ID:CNCBASHER,项目名称:skeinforge,代码行数:27,代码来源:unpause.py

示例12: getTransferClosestSurroundingLoopLines

	def getTransferClosestSurroundingLoopLines( self, oldOrderedLocation, remainingSurroundingLoops ):
		"Get and transfer the closest remaining surrounding loop."
		if len( remainingSurroundingLoops ) > 0:
			oldOrderedLocation.z = remainingSurroundingLoops[ 0 ].z
		closestDistance = 999999999999999999.0
		closestSurroundingLoop = None
		for remainingSurroundingLoop in remainingSurroundingLoops:
			distance = euclidean.getNearestDistanceIndex( oldOrderedLocation.dropAxis( 2 ), remainingSurroundingLoop.boundary ).distance
			if distance < closestDistance:
				closestDistance = distance
				closestSurroundingLoop = remainingSurroundingLoop
		remainingSurroundingLoops.remove( closestSurroundingLoop )
		hasTravelledHighRoad = False
		for line in closestSurroundingLoop.lines:
			splitLine = gcodec.getSplitLineBeforeBracketSemicolon( line )
			firstWord = gcodec.getFirstWord( splitLine )
			if firstWord == 'G1':
				location = gcodec.getLocationFromSplitLine( self.oldLocation, splitLine )
				if not hasTravelledHighRoad:
					hasTravelledHighRoad = True
					self.addHighThread( location )
				if location.z > self.highestZ:
					self.highestZ = location.z
				self.oldLocation = location
			self.distanceFeedRate.addLine( line )
		return closestSurroundingLoop
开发者ID:CNCBASHER,项目名称:skeinforge,代码行数:26,代码来源:tower.py

示例13: getUnpausedArcMovement

	def getUnpausedArcMovement( self, line, splitLine ):
		"Get an unpaused arc movement."
		if self.oldLocation == None:
			return line
		self.feedRateMinute = gcodec.getFeedRateMinute( self.feedRateMinute, splitLine )
		relativeLocation = gcodec.getLocationFromSplitLine( self.oldLocation, splitLine )
		location = self.oldLocation + relativeLocation
		self.oldLocation = location
		halfPlaneLineDistance = 0.5 * abs( relativeLocation.dropAxis( 2 ) )
		radius = gcodec.getDoubleFromCharacterSplitLine( 'R', splitLine )
		if radius == None:
			relativeCenter = complex( gcodec.getDoubleFromCharacterSplitLine( 'I', splitLine ), gcodec.getDoubleFromCharacterSplitLine( 'J', splitLine ) )
			radius = abs( relativeCenter )
		angle = 0.0
		if radius > 0.0:
			angle = math.pi
			if halfPlaneLineDistance < radius:
				angle = 2.0 * math.asin( halfPlaneLineDistance / radius )
			else:
				angle *= halfPlaneLineDistance / radius
		deltaZ = abs( relativeLocation.z )
		arcDistanceZ = complex( abs( angle ) * radius, relativeLocation.z )
		distance = abs( arcDistanceZ )
		if distance <= 0.0:
			return ''
		feedRateMinute = self.distanceFeedRate.getZLimitedFeedRate( deltaZ, distance, self.feedRateMinute )
		indexOfF = gcodec.indexOfStartingWithSecond( "F", splitLine )
		if indexOfF > 0 and feedRateMinute != self.feedRateMinute:
			feedRateStringOriginal = splitLine[ indexOfF ]
			feedRateStringReplacement = 'F' + self.distanceFeedRate.getRounded( feedRateMinute )
			return line.replace( feedRateStringOriginal, feedRateStringReplacement )
		return line
开发者ID:TeamTeamUSA,项目名称:SkeinFox,代码行数:32,代码来源:unpause.py

示例14: linearMove

	def linearMove( self, splitLine ):
		"Get statistics for a linear move."
		location = gcodec.getLocationFromSplitLine( self.oldLocation, splitLine )
		self.cornerMaximum = euclidean.getPointMaximum( self.cornerMaximum, location )
		self.cornerMinimum = euclidean.getPointMinimum( self.cornerMinimum, location )
		self.thread.append( location.dropAxis( 2 ) )
		self.oldLocation = location
开发者ID:TeamTeamUSA,项目名称:ReplicatorG,代码行数:7,代码来源:vectorwrite.py

示例15: getRelativeStretch

	def getRelativeStretch( self, locationComplex, lineIterator ):
		"Get relative stretch for a location."
		lastLocationComplex = locationComplex
		oldTotalLength = 0.0
		pointComplex = locationComplex
		totalLength = 0.0
		while 1:
			try:
				line = lineIterator.getNext()
			except StopIteration:
				locationMinusPoint = locationComplex - pointComplex
				locationMinusPointLength = abs( locationMinusPoint )
				if locationMinusPointLength > 0.0:
					return locationMinusPoint / locationMinusPointLength
				return complex()
			splitLine = gcodec.getSplitLineBeforeBracketSemicolon( line )
			firstWord = splitLine[ 0 ]
			pointComplex = gcodec.getLocationFromSplitLine( self.oldLocation, splitLine ).dropAxis( 2 )
			locationMinusPoint = lastLocationComplex - pointComplex
			locationMinusPointLength = abs( locationMinusPoint )
			totalLength += locationMinusPointLength
			if totalLength >= self.stretchFromDistance:
				distanceFromRatio = ( self.stretchFromDistance - oldTotalLength ) / locationMinusPointLength
				totalPoint = distanceFromRatio * pointComplex + ( 1.0 - distanceFromRatio ) * lastLocationComplex
				locationMinusTotalPoint = locationComplex - totalPoint
				return locationMinusTotalPoint / self.stretchFromDistance
			lastLocationComplex = pointComplex
			oldTotalLength = totalLength
开发者ID:FarMcKon,项目名称:skeinforge,代码行数:28,代码来源:stretch.py


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