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 tableau.getIsLayerStart(firstWord, self, splitLine): self.extrusionNumber = 0 self.layerCount.printProgressIncrement('skeinlayer') 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
def parseCorner(self, line): "Parse a gcode line and use the location to update the bounding corners." splitLine = gcodec.getSplitLineBeforeBracketSemicolon(line) if len(splitLine) < 1: return firstWord = splitLine[0] if tableau.getIsLayerStart(firstWord, self, splitLine): if firstWord == "(<layer>": self.layerTopZ = float(splitLine[1]) + self.thirdLayerThickness else: self.layerTopZ = ( gcodec.getLocationFromSplitLine(self.oldLocation, splitLine).z + self.thirdLayerThickness ) self.layerTops.append(self.layerTopZ) if firstWord == "G1": self.linearCorner(splitLine) elif firstWord == "M101": self.extruderActive = True elif firstWord == "M103": self.extruderActive = False elif firstWord == "(<layerThickness>": self.thirdLayerThickness = 0.33333333333 * float(splitLine[1]) if firstWord == "(<nestedRing>)": if self.layerTopZ > self.getLayerTop(): self.layerTops.append(self.layerTopZ)
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 tableau.getIsLayerStart(firstWord, self, splitLine): self.layerCount.printProgressIncrement('skeiniso') self.skeinPane = SkeinPane( len( self.skeinPanes ) ) 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.moveColoredThreadToSkeinPane() self.extruderActive = True elif firstWord == 'M103': self.moveColoredThreadToSkeinPane() self.extruderActive = False self.isLoop = False self.isPerimeter = False elif firstWord == '(<loop>': self.isLoop = True elif firstWord == '(</loop>)': self.moveColoredThreadToSkeinPane() self.isLoop = False elif firstWord == '(<perimeter>': self.isPerimeter = True self.isOuter = ( splitLine[1] == 'outer') elif firstWord == '(</perimeter>)': self.moveColoredThreadToSkeinPane() self.isPerimeter = False elif firstWord == '(<surroundingLoop>)': self.hasASurroundingLoopBeenReached = True 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
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 tableau.getIsLayerStart(firstWord, self, splitLine): self.layerCount.printProgressIncrement("skeiniso") self.skeinPane = SkeinPane(len(self.skeinPanes)) 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.moveColoredThreadToSkeinPane() self.extruderActive = True elif firstWord == "M103": self.moveColoredThreadToSkeinPane() self.extruderActive = False self.isLoop = False self.isPerimeter = False elif firstWord == "(<loop>": self.isLoop = True elif firstWord == "(</loop>)": self.moveColoredThreadToSkeinPane() self.isLoop = False elif firstWord == "(<nestedRing>)": self.hasANestedRingBeenReached = True elif firstWord == "(<perimeter>": self.isPerimeter = True self.isOuter = splitLine[1] == "outer" elif firstWord == "(</perimeter>)": self.moveColoredThreadToSkeinPane() self.isPerimeter = 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
def parseCorner(self, line): "Parse a gcode line and use the location to update the bounding corners." splitLine = gcodec.getSplitLineBeforeBracketSemicolon(line) if len(splitLine) < 1: return firstWord = splitLine[0] if tableau.getIsLayerStart(firstWord, self, splitLine): if firstWord == '(<layer>': self.layerTopZ = float(splitLine[1]) + self.thirdLayerThickness else: self.layerTopZ = gcodec.getLocationFromSplitLine(self.oldLocation, splitLine).z + self.thirdLayerThickness self.layerTops.append( self.layerTopZ ) if firstWord == 'G1': self.linearCorner(splitLine) elif firstWord == 'M101': self.extruderActive = True elif firstWord == 'M103': self.extruderActive = False elif firstWord == '(<layerThickness>': self.thirdLayerThickness = 0.33333333333 * float(splitLine[1]) if firstWord == '(<surroundingLoop>)': if self.layerTopZ > self.getLayerTop(): self.layerTops.append( self.layerTopZ )