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()) elif firstWord == '(<bridgeRotation>': self.loopLayer.rotation = gcodec.getRotationBySplitLine(splitLine) elif firstWord == '(</crafting>)': self.distanceFeedRate.addLine(line) if self.repository.turnExtruderHeaterOffAtShutDown.value: self.distanceFeedRate.addLine('M104 S0') # Turn extruder heater off. return elif firstWord == '(<layer>': self.layerCount.printProgressIncrement('inset') self.loopLayer = euclidean.LoopLayer(float(splitLine[1])) self.distanceFeedRate.addLine(line) elif firstWord == '(</layer>)': self.addInset(self.loopLayer) self.loopLayer = None elif firstWord == '(<nestedRing>)': self.boundary = [] self.loopLayer.loops.append(self.boundary) if self.loopLayer == None: self.distanceFeedRate.addLine(line)
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()) elif firstWord == '(<bridgeRotation>': self.rotatedLoopLayer.rotation = gcodec.getRotationBySplitLine(splitLine) elif firstWord == '(</crafting>)': self.distanceFeedRate.addLine(line) if self.repository.turnExtruderHeaterOffAtShutDown.value: self.distanceFeedRate.addLine('M104 S0') # Turn extruder heater off. return elif firstWord == '(<layer>': self.layerCount.printProgressIncrement('inset') self.rotatedLoopLayer = euclidean.RotatedLoopLayer(float(splitLine[1])) self.distanceFeedRate.addLine(line) elif firstWord == '(</layer>)': self.addInset( self.rotatedLoopLayer ) self.rotatedLoopLayer = None elif firstWord == '(<nestedRing>)': self.boundary = [] self.rotatedLoopLayer.loops.append( self.boundary ) if self.rotatedLoopLayer == None: self.distanceFeedRate.addLine(line)
def parseLine(self, line): 'Parse a gcode line and add it to the skin skein.' splitLine = gcodec.getSplitLineBeforeBracketSemicolon(line) if len(splitLine) < 1: return firstWord = splitLine[0] if firstWord == 'G1': self.feedRateMinute = gcodec.getFeedRateMinute( self.feedRateMinute, splitLine) location = gcodec.getLocationFromSplitLine(self.oldLocation, splitLine) self.oldLocation = location if self.infillBoundaries != None: return if self.perimeter != None: self.perimeter.append(location.dropAxis()) return elif firstWord == '(<infill>)': if self.layerIndex >= self.layersFromBottom and self.layerIndex == self.layerIndexTop: self.infillBoundaries = [] elif firstWord == '(</infill>)': self.addSkinnedInfill() elif firstWord == '(<infillBoundary>)': if self.infillBoundaries != None: self.infillBoundary = [] self.infillBoundaries.append(self.infillBoundary) elif firstWord == '(<infillPoint>': if self.infillBoundaries != None: location = gcodec.getLocationFromSplitLine(None, splitLine) self.infillBoundary.append(location.dropAxis()) elif firstWord == '(<layer>': self.layerCount.printProgressIncrement('skin') self.layerIndex += 1 elif firstWord == 'M101' or firstWord == 'M103': if self.infillBoundaries != None or self.perimeter != None: return elif firstWord == 'M108': self.oldFlowRate = gcodec.getDoubleAfterFirstLetter(splitLine[1]) elif firstWord == '(<perimeter>': if self.layerIndex >= self.layersFromBottom: self.perimeter = [] elif firstWord == '(<rotation>': self.rotation = gcodec.getRotationBySplitLine(splitLine) self.reverseRotation = complex(self.rotation.real, -self.rotation.imag) elif firstWord == '(</perimeter>)': self.addSkinnedPerimeter() self.distanceFeedRate.addLine(line)
def parseLine(self, line): 'Parse a gcode line and add it to the skin skein.' splitLine = gcodec.getSplitLineBeforeBracketSemicolon(line) if len(splitLine) < 1: return firstWord = splitLine[0] if firstWord == 'G1': self.feedRateMinute = gcodec.getFeedRateMinute(self.feedRateMinute, splitLine) location = gcodec.getLocationFromSplitLine(self.oldLocation, splitLine) self.oldLocation = location if self.infillBoundaries != None: return if self.perimeter != None: self.perimeter.append(location.dropAxis()) return elif firstWord == '(<infill>)': if self.layerIndex >= self.layersFromBottom and self.layerIndex == self.layerIndexTop: self.infillBoundaries = [] elif firstWord == '(</infill>)': self.addSkinnedInfill() elif firstWord == '(<infillBoundary>)': if self.infillBoundaries != None: self.infillBoundary = [] self.infillBoundaries.append(self.infillBoundary) elif firstWord == '(<infillPoint>': if self.infillBoundaries != None: location = gcodec.getLocationFromSplitLine(None, splitLine) self.infillBoundary.append(location.dropAxis()) elif firstWord == '(<layer>': self.layerIndex += 1 settings.printProgress(self.layerIndex, 'skin') elif firstWord == 'M101' or firstWord == 'M103': if self.infillBoundaries != None or self.perimeter != None: return elif firstWord == 'M108': self.oldFlowRate = gcodec.getDoubleAfterFirstLetter(splitLine[1]) elif firstWord == '(<perimeter>': if self.layerIndex >= self.layersFromBottom: self.perimeter = [] elif firstWord == '(<rotation>': self.rotation = gcodec.getRotationBySplitLine(splitLine) self.reverseRotation = complex(self.rotation.real, -self.rotation.imag) elif firstWord == '(</perimeter>)': self.addSkinnedPerimeter() self.distanceFeedRate.addLine(line)
def parseLine(self, line): 'Parse a gcode line and add it to the smooth skein.' splitLine = gcodec.getSplitLineBeforeBracketSemicolon(line) if len(splitLine) < 1: return firstWord = splitLine[0] if firstWord == '(<boundaryPerimeter>)': if self.boundaryLayerIndex < 0: self.boundaryLayerIndex = 0 elif firstWord == 'G1': self.feedRateMinute = gcodec.getFeedRateMinute( self.feedRateMinute, splitLine) location = gcodec.getLocationFromSplitLine(self.oldLocation, splitLine) self.oldLocation = location if self.infill != None: self.infill.append(location.dropAxis()) return elif firstWord == '(<infill>)': if self.boundaryLayerIndex >= self.layersFromBottom: self.infill = [] elif firstWord == '(</infill>)': self.infill = None elif firstWord == '(<layer>': self.layerCount.printProgressIncrement('smooth') if self.boundaryLayerIndex >= 0: self.boundaryLayerIndex += 1 elif firstWord == 'M101': if self.infill != None: if len(self.infill) > 1: self.infill = [self.infill[0]] return elif firstWord == 'M103': if self.infill != None: self.addSmoothedInfill() self.infill = [] return elif firstWord == '(<rotation>': self.rotation = gcodec.getRotationBySplitLine(splitLine) self.distanceFeedRate.addLine(line)
def parseLine(self, line): "Parse a gcode line and add it to the smooth skein." splitLine = gcodec.getSplitLineBeforeBracketSemicolon(line) if len(splitLine) < 1: return firstWord = splitLine[0] if firstWord == "(<boundaryPerimeter>)": if self.boundaryLayerIndex < 0: self.boundaryLayerIndex = 0 elif firstWord == "G1": self.feedRateMinute = gcodec.getFeedRateMinute(self.feedRateMinute, splitLine) location = gcodec.getLocationFromSplitLine(self.oldLocation, splitLine) self.oldLocation = location if self.infill is not None: self.infill.append(location.dropAxis()) return elif firstWord == "(<infill>)": if self.boundaryLayerIndex >= self.layersFromBottom: self.infill = [] elif firstWord == "(</infill>)": self.infill = None elif firstWord == "(<layer>": self.layerCount.printProgressIncrement("smooth") if self.boundaryLayerIndex >= 0: self.boundaryLayerIndex += 1 elif firstWord == "M101": if self.infill is not None: if len(self.infill) > 1: self.infill = [self.infill[0]] return elif firstWord == "M103": if self.infill is not None: self.addSmoothedInfill() self.infill = [] return elif firstWord == "(<rotation>": self.rotation = gcodec.getRotationBySplitLine(splitLine) self.distanceFeedRate.addLine(line)