Exemple #1
0
	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 )
Exemple #2
0
	def importModule( self ):
		"Import the python script and store the layers."
		path = os.path.abspath( self.untilDotName )
		pluginModule = gcodec.getModuleWithPath( path )
		loopLayers = pluginModule.getLoopLayers( self.layerThickness )
		for loopLayer in loopLayers:
			rotatedBoundaryLayer = euclidean.RotatedLoopLayer( loopLayer.z )
			rotatedBoundaryLayer.loops = loopLayer.loops
			self.rotatedBoundaryLayers.append( rotatedBoundaryLayer )
Exemple #3
0
	def processContourLayers( self, file ):
		"Process a contour layer at a time until the top of the part."
		while True:
			minLayer = getLittleEndianFloatGivenFile( file )
			numContours = getLittleEndianUnsignedLongGivenFile( file )
			if numContours == 0xFFFFFFFF:
				return
			rotatedBoundaryLayer = euclidean.RotatedLoopLayer( minLayer )
			self.rotatedBoundaryLayers.append( rotatedBoundaryLayer )
			for contourIndex in xrange( numContours ):
				numPoints = getLittleEndianUnsignedLongGivenFile( file )
				numGaps = getLittleEndianUnsignedLongGivenFile( file )
				if numPoints > 2:
					rotatedBoundaryLayer.loops.append( getPointsFromFile( numPoints, file ) )
Exemple #4
0
def addTextData(line, rotatedBoundaryLayers):
    "Add the data from the text line."
    if line.find('layerThickness') != -1:
        return
    line = line.replace('>', ' ')
    line = line.replace('<', ' ')
    line = line.replace(',', ' ')
    splitLine = line.split()
    if 'Layer' not in splitLine:
        return
    splitLine = splitLine[splitLine.index('Layer') + 1:]
    if 'z' not in splitLine:
        return
    zIndex = splitLine.index('z')
    rotatedBoundaryLayer = euclidean.RotatedLoopLayer(
        float(splitLine[zIndex + 1]))
    rotatedBoundaryLayers.append(rotatedBoundaryLayer)
Exemple #5
0
 def parseLine(self, line):
     "Parse a gcode line and add it to the widen 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 == '(<layer>':
         self.rotatedBoundaryLayer = euclidean.RotatedLoopLayer(
             float(splitLine[1]))
         self.distanceFeedRate.addLine(line)
     elif firstWord == '(</layer>)':
         self.addWiden(self.rotatedBoundaryLayer)
         self.rotatedBoundaryLayer = None
     elif firstWord == '(<surroundingLoop>)':
         self.boundary = []
         self.rotatedBoundaryLayer.loops.append(self.boundary)
     if self.rotatedBoundaryLayer == None:
         self.distanceFeedRate.addLine(line)
	def getZAddExtruderPaths( self, z ):
		"Get next z and add extruder loops."
		zoneArray = []
		for point in self.vertices:
			addToZoneArray( point, z, zoneArray, self.zZoneInterval )
		lowestZoneIndex = getLowestZoneIndex( zoneArray, z )
		halfAround = int( math.ceil( float( lowestZoneIndex ) / 2.0 ) )
		zAround = float( halfAround ) * self.zZoneInterval
		if lowestZoneIndex % 2 == 1:
			zAround = - zAround
		zPlusAround = z + zAround
		rotatedBoundaryLayer = euclidean.RotatedLoopLayer( zPlusAround )
		self.rotatedBoundaryLayers.append( rotatedBoundaryLayer )
		rotatedBoundaryLayer.loops = self.getLoopsFromMesh( zPlusAround )
		if self.bridgeLayerThickness == None:
			return z + self.layerThickness
		allExtrudateLoops = []
		for loop in rotatedBoundaryLayer.loops:
			allExtrudateLoops += getBridgeLoops( self.layerThickness, loop )
		rotatedBoundaryLayer.rotation = getBridgeDirection( self.belowLoops, allExtrudateLoops, self.layerThickness )
		self.belowLoops = allExtrudateLoops
		if rotatedBoundaryLayer.rotation == None:
			return z + self.layerThickness
		return z + self.bridgeLayerThickness
Exemple #7
0
	def getExtruderPaths( self, z ):
		"Get extruder loops."
		rotatedBoundaryLayer = euclidean.RotatedLoopLayer( z )
		for carvableObjectInfo in self.carvableObjectInfos:
			rotatedBoundaryLayer.loops += carvableObjectInfo.getLoops( self.importRadius, z )
		return rotatedBoundaryLayer
Exemple #8
0
 def addRotatedLoopLayer(self, z):
     "Add rotated loop layer."
     self.rotatedBoundaryLayer = euclidean.RotatedLoopLayer(z)
     self.rotatedBoundaryLayers.append(self.rotatedBoundaryLayer)