Ejemplo n.º 1
0
 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()
Ejemplo n.º 2
0
 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 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)
     if len(self.boundaryLayers) < 2:
         return
     for boundaryLayer in self.boundaryLayers:
         boundaryLayer.innerOutsetLoops = intercircle.getInsetSeparateLoopsFromLoops(
             -self.loopInnerOutset, boundaryLayer.loops)
         boundaryLayer.outerOutsetLoops = intercircle.getInsetSeparateLoopsFromLoops(
             -self.loopOuterOutset, boundaryLayer.loops)
         boundaryLayer.innerHorizontalTable = self.getHorizontalXIntersectionsTable(
             boundaryLayer.innerOutsetLoops)
         boundaryLayer.outerHorizontalTable = self.getHorizontalXIntersectionsTable(
             boundaryLayer.outerOutsetLoops)
         boundaryLayer.innerVerticalTable = self.getHorizontalXIntersectionsTable(
             euclidean.getDiagonalFlippedLoops(
                 boundaryLayer.innerOutsetLoops))
         boundaryLayer.outerVerticalTable = self.getHorizontalXIntersectionsTable(
             euclidean.getDiagonalFlippedLoops(
                 boundaryLayer.outerOutsetLoops))
     for boundaryLayerIndex in xrange(len(self.boundaryLayers) - 2, -1, -1):
         boundaryLayer = self.boundaryLayers[boundaryLayerIndex]
         boundaryLayerBelow = self.boundaryLayers[boundaryLayerIndex + 1]
         euclidean.joinXIntersectionsTables(
             boundaryLayerBelow.outerHorizontalTable,
             boundaryLayer.outerHorizontalTable)
         euclidean.joinXIntersectionsTables(
             boundaryLayerBelow.outerVerticalTable,
             boundaryLayer.outerVerticalTable)
     for boundaryLayerIndex in xrange(1, len(self.boundaryLayers)):
         boundaryLayer = self.boundaryLayers[boundaryLayerIndex]
         boundaryLayerAbove = self.boundaryLayers[boundaryLayerIndex - 1]
         euclidean.joinXIntersectionsTables(
             boundaryLayerAbove.innerHorizontalTable,
             boundaryLayer.innerHorizontalTable)
         euclidean.joinXIntersectionsTables(
             boundaryLayerAbove.innerVerticalTable,
             boundaryLayer.innerVerticalTable)
     for boundaryLayerIndex in xrange(len(self.boundaryLayers)):
         self.addSegmentTableLoops(boundaryLayerIndex)
Ejemplo n.º 3
0
	def setBoundaryLayers( self ):
		"Set the boundary layers."
		boundaryLoop = None
		boundaryLayer = None
		for line in self.lines[ self.lineIndex : ]:
			splitLine = line.split()
			firstWord = gcodec.getFirstWord( splitLine )
			if firstWord == '(<boundaryPoint>':
				location = gcodec.getLocationFromSplitLine( None, splitLine )
				if boundaryLoop == None:
					boundaryLoop = []
					boundaryLayer.loops.append( boundaryLoop )
				boundaryLoop.append( location.dropAxis( 2 ) )
			elif firstWord == '(<layer>':
				z = float( splitLine[ 1 ] )
				if self.operatingJump != None:
					z += self.operatingJump
				boundaryLayer = euclidean.LoopLayer( z )
				self.boundaryLayers.append( boundaryLayer )
			elif firstWord == '(</surroundingLoop>)':
				boundaryLoop = None
		if self.raftPreferences.supportChoiceNoSupportMaterial.value:
			return
		if len( self.interfaceStepsUntilEnd ) < 1:
			return
		if len( self.boundaryLayers ) < 2:
			return
		for boundaryLayer in self.boundaryLayers:
			supportLoops = intercircle.getInsetLoops( - self.supportOutset, boundaryLayer.loops )
			self.supportLoops.append( supportLoops )
		for layerIndex in xrange( len( self.supportLoops ) - 1 ):
			self.addSupportSegmentTable( layerIndex )
		self.truncateSupportSegmentTables()
		fillXIntersectionIndexTables = []
		for supportSegmentTableIndex in xrange( len( self.supportSegmentTables ) ):
			self.addToFillXIntersectionIndexTables( fillXIntersectionIndexTables, supportSegmentTableIndex )
		if self.raftPreferences.supportChoiceSupportMaterialOnExteriorOnly.value:
			for supportSegmentTableIndex in xrange( 1, len( self.supportSegmentTables ) ):
				self.subtractJoinedFill( fillXIntersectionIndexTables, supportSegmentTableIndex )
		for supportSegmentTableIndex in xrange( len( self.supportSegmentTables ) - 2, - 1, - 1 ):
			self.joinSegments( supportSegmentTableIndex )
		for supportSegmentTable in self.supportSegmentTables:
			self.extendSegments( supportSegmentTable )
		for supportSegmentTableIndex in xrange( len( self.supportSegmentTables ) ):
			subtractFill( fillXIntersectionIndexTables[ supportSegmentTableIndex ], self.supportSegmentTables[ supportSegmentTableIndex ] )
Ejemplo n.º 4
0
	def parseLine( self, line ):
		"Parse a gcode line and add it to the cool skein."
		splitLine = gcodec.getSplitLineBeforeBracketSemicolon( line )
		if len( splitLine ) < 1:
			return
		firstWord = splitLine[ 0 ]
		if firstWord == 'G1':
			location = gcodec.getLocationFromSplitLine( self.oldLocation, splitLine )
			line = self.getCoolMove( line, location, splitLine )
			self.oldLocation = location
		elif firstWord == '(<boundaryPoint>':
			self.boundaryLoop.append( gcodec.getLocationFromSplitLine( None, splitLine ).dropAxis( 2 ) )
		elif firstWord == '(<layer>':
			self.distanceFeedRate.addLine( line )
			self.distanceFeedRate.addLinesSetAbsoluteDistanceMode( self.coolStartLines )
			layerTime = self.getLayerTime()
			remainingOrbitTime = max( self.coolRepository.minimumLayerTime.value - layerTime, 0.0 )
			self.addCoolTemperature( remainingOrbitTime )
			if self.coolRepository.orbit.value:
				self.addOrbitsIfNecessary( remainingOrbitTime )
			else:
				self.setMultiplier( layerTime )
			z = float( splitLine[ 1 ] )
			self.boundaryLayer = euclidean.LoopLayer( z )
			self.highestZ = max( z, self.highestZ )
			self.distanceFeedRate.addLinesSetAbsoluteDistanceMode( self.coolEndLines )
			return
		elif firstWord == '(</layer>)':
			self.multiplier = None
			if self.coolTemperature != None:
				self.addTemperature( self.oldTemperature )
				self.coolTemperature = None
			self.addFlowRateLineIfNecessary( self.oldFlowRateString )
		elif firstWord == 'M104':
			self.oldTemperature = gcodec.getDoubleAfterFirstLetter( splitLine[ 1 ] )
		elif firstWord == 'M108':
			self.setOperatingFlowString( splitLine )
			if self.multiplier != None:
				self.addFlowRateLineIfNecessary( str( self.multiplier * self.oldFlowRate ) )
				return
		elif firstWord == '(<surroundingLoop>)':
			self.boundaryLoop = []
			self.boundaryLayer.loops.append( self.boundaryLoop )
		self.distanceFeedRate.addLine( line )
Ejemplo n.º 5
0
	def parseLine( self, coolPreferences, line ):
		"Parse a gcode line and add it to the cool skein."
		splitLine = line.split()
		if len( splitLine ) < 1:
			return
		firstWord = splitLine[ 0 ]
		if firstWord == 'G1':
			self.linearMove( splitLine )
		elif firstWord == '(<boundaryPoint>':
			self.boundaryLoop.append( gcodec.getLocationFromSplitLine( None, splitLine ).dropAxis( 2 ) )
		elif firstWord == '(<layer>':
			remainingOrbitTime = coolPreferences.minimumLayerTime.value - self.layerTime
			if remainingOrbitTime > 0.0 and self.boundaryLayer != None:
				intercircle.addOperatingOrbits( self.boundaryLayer.loops, euclidean.getXYComplexFromVector3( self.oldLocation ), self, remainingOrbitTime, self.highestZ )
			z = float( splitLine[ 1 ] )
			self.boundaryLayer = euclidean.LoopLayer( z )
			self.highestZ = z
			self.layerTime = 0.0
		elif firstWord == '(<surroundingLoop>)':
			self.boundaryLoop = []
			self.boundaryLayer.loops.append( self.boundaryLoop )
		self.addLine( line )