def getCraftedGcode(self, gcodeText, coolRepository): "Parse gcode text and store the cool gcode." self.coolRepository = coolRepository self.coolEndText = settings.getFileInAlterationsOrGivenDirectory( os.path.dirname(__file__), 'Cool_End.gcode') self.coolEndLines = gcodec.getTextLines(self.coolEndText) self.coolStartText = settings.getFileInAlterationsOrGivenDirectory( os.path.dirname(__file__), 'Cool_Start.gcode') self.coolStartLines = gcodec.getTextLines(self.coolStartText) self.halfCorner = complex(coolRepository.minimumOrbitalRadius.value, coolRepository.minimumOrbitalRadius.value) self.lines = gcodec.getTextLines(gcodeText) self.minimumArea = 4.0 * coolRepository.minimumOrbitalRadius.value * coolRepository.minimumOrbitalRadius.value self.parseInitialization() self.boundingRectangle = gcodec.BoundingRectangle().getFromGcodeLines( self.lines[self.lineIndex:], 0.5 * self.perimeterWidth) margin = 0.2 * self.perimeterWidth halfCornerMargin = self.halfCorner + complex(margin, margin) self.boundingRectangle.cornerMaximum -= halfCornerMargin self.boundingRectangle.cornerMinimum += halfCornerMargin for self.lineIndex in xrange(self.lineIndex, len(self.lines)): line = self.lines[self.lineIndex] self.parseLine(line) if coolRepository.turnFanOffAtEnding.value: self.distanceFeedRate.addLine('M107') return self.distanceFeedRate.output.getvalue()
def getCraftedGcode( self, gcodeText, homeRepository ): "Parse gcode text and store the home gcode." self.homingText = settings.getFileInAlterationsOrGivenDirectory( os.path.dirname( __file__ ), homeRepository.nameOfHomingFile.value ) if len( self.homingText ) < 1: return gcodeText self.lines = gcodec.getTextLines( gcodeText ) self.homeRepository = homeRepository self.parseInitialization( homeRepository ) self.homingLines = gcodec.getTextLines( self.homingText ) for self.lineIndex in xrange( self.lineIndex, len( self.lines ) ): line = self.lines[ self.lineIndex ] self.parseLine( line ) return self.distanceFeedRate.output.getvalue()
def getCraftedGcode( self, gcodeText, homeRepository ): "Parse gcode text and store the home gcode." self.homingText = settings.getFileInAlterationsOrGivenDirectory( os.path.dirname( __file__ ), homeRepository.nameOfHomingFile.value ) if len( self.homingText ) < 1: return gcodeText self.lines = gcodec.getTextLines(gcodeText) self.homeRepository = homeRepository self.parseInitialization( homeRepository ) self.homingLines = gcodec.getTextLines( self.homingText ) for self.lineIndex in xrange( self.lineIndex, len( self.lines ) ): line = self.lines[ self.lineIndex ] self.parseLine(line) return self.distanceFeedRate.output.getvalue()
def __init__( self, xmlText ): "Add empty lists." self.isInFabmetheus = False self.lines = gcodec.getTextLines( xmlText ) self.output = cStringIO.StringIO() for line in self.lines: self.parseLine( line )
def getNavigationHypertext(fileText, transferredFileNameIndex, transferredFileNames): "Get the hypertext help with navigation lines." helpTextEnd = fileText.find('</p>') helpTextStart = fileText.find('<p>') helpText = fileText[helpTextStart:helpTextEnd] lines = gcodec.getTextLines(helpText) headings = [] headingLineTable = {} for line in lines: addToHeadings(headingLineTable, headings, line) headingsToBeenAdded = True output = cStringIO.StringIO() for line in lines: if line[:2] == '==': if headingsToBeenAdded: output.write('<br />\n') for heading in headings: heading.addToOutput(output) output.write('<br />\n') headingsToBeenAdded = False if line in headingLineTable: line = headingLineTable[line] output.write(line + '\n') helpText = output.getvalue() previousFileName = 'contents.html' previousIndex = transferredFileNameIndex - 1 if previousIndex >= 0: previousFileName = transferredFileNames[previousIndex] previousLinkText = '<a href="%s">Previous</a>' % previousFileName navigationLine = getNavigationLine( '<a href="contents.html">Contents</a>', previousLinkText, getNextLinkText(transferredFileNames, transferredFileNameIndex + 1)) helpText = navigationLine + helpText + '<br />\n<br />\n' + navigationLine + '<hr>\n' return fileText[:helpTextStart] + helpText + fileText[helpTextEnd:]
def parseGcode( self, fileName, gcodeText, repository ): "Parse gcode text and store the vector output." self.repository = repository self.fileName = fileName self.gcodeText = gcodeText self.initializeActiveLocation() self.cornerHigh = Vector3(-999999999.0, -999999999.0, -999999999.0) self.cornerLow = Vector3(999999999.0, 999999999.0, 999999999.0) self.goAroundExtruderOffTravel = repository.goAroundExtruderOffTravel.value self.lines = gcodec.getTextLines(gcodeText) self.isThereALayerStartWord = gcodec.isThereAFirstWord('(<layer>', self.lines, 1 ) self.parseInitialization() for line in self.lines[self.lineIndex :]: self.parseCorner(line) if len( self.layerTops ) > 0: self.layerTops[-1] += 912345678.9 if len( self.layerTops ) > 1: self.oneMinusBrightnessOverTopLayerIndex = ( 1.0 - repository.bottomLayerBrightness.value ) / float( len( self.layerTops ) - 1 ) self.firstTopLayer = len( self.layerTops ) - self.repository.numberOfFillTopLayers.value self.centerComplex = 0.5 * ( self.cornerHigh.dropAxis(2) + self.cornerLow.dropAxis(2) ) self.centerBottom = Vector3( self.centerComplex.real, self.centerComplex.imag, self.cornerLow.z ) self.scale = repository.scale.value self.scaleCenterBottom = self.scale * self.centerBottom self.scaleCornerHigh = self.scale * self.cornerHigh.dropAxis(2) self.scaleCornerLow = self.scale * self.cornerLow.dropAxis(2) print( "The lower left corner of the behold window is at %s, %s" % ( self.cornerLow.x, self.cornerLow.y ) ) print( "The upper right corner of the behold window is at %s, %s" % ( self.cornerHigh.x, self.cornerHigh.y ) ) self.cornerImaginaryTotal = self.cornerHigh.y + self.cornerLow.y margin = complex( 5.0, 5.0 ) self.marginCornerLow = self.scaleCornerLow - margin self.screenSize = margin + 2.0 * ( self.scaleCornerHigh - self.marginCornerLow ) self.initializeActiveLocation() for self.lineIndex in xrange( self.lineIndex, len( self.lines ) ): line = self.lines[ self.lineIndex ] self.parseLine(line)
def getCraftedGcode(self, gcodeText, splodgeRepository): "Parse gcode text and store the splodge gcode." self.lines = gcodec.getTextLines(gcodeText) self.setRotations() self.splodgeRepository = splodgeRepository self.parseInitialization(splodgeRepository) self.boundingRectangle = gcodec.BoundingRectangle().getFromGcodeLines( self.lines[self.lineIndex :], 0.5 * self.perimeterWidth ) self.initialSplodgeFeedRateMinute = 60.0 * splodgeRepository.initialSplodgeFeedRate.value self.initialStartupDistance = ( splodgeRepository.initialSplodgeQuantityLength.value * splodgeRepository.initialSplodgeFeedRate.value / self.operatingFeedRatePerSecond ) self.operatingSplodgeFeedRateMinute = 60.0 * splodgeRepository.operatingSplodgeFeedRate.value self.operatingStartupDistance = ( splodgeRepository.operatingSplodgeQuantityLength.value * splodgeRepository.operatingSplodgeFeedRate.value / self.operatingFeedRatePerSecond ) for self.lineIndex in xrange(self.lineIndex, len(self.lines)): line = self.lines[self.lineIndex] self.parseLine(line) return self.distanceFeedRate.output.getvalue()
def getCraftedGcode(self, gcodeText, binary16ByteRepository): "Parse gcode text and store the gcode." self.binary16ByteRepository = binary16ByteRepository lines = gcodec.getTextLines(gcodeText) for line in lines: self.parseLine(line) return self.output.getvalue()
def getCraftedGcode( self, gcodeText, binary16ByteRepository ): "Parse gcode text and store the gcode." self.binary16ByteRepository = binary16ByteRepository lines = gcodec.getTextLines(gcodeText) for line in lines: self.parseLine(line) return self.output.getvalue()
def getCraftedGcode(self, gcodeStepRepository, gcodeText): "Parse gcode text and store the gcode." self.gcodeStepRepository = gcodeStepRepository lines = gcodec.getTextLines(gcodeText) for line in lines: self.parseLine(line) return self.output.getvalue()
def parseGcode( self, fileName, gcodeText, repository ): "Parse gcode text and store the vector output." self.fileName = fileName self.gcodeText = gcodeText self.repository = repository self.initializeActiveLocation() self.cornerHigh = Vector3(-999999999.0, -999999999.0, -999999999.0) self.cornerLow = Vector3(999999999.0, 999999999.0, 999999999.0) self.lines = gcodec.getTextLines(gcodeText) self.isThereALayerStartWord = gcodec.isThereAFirstWord('(<layer>', self.lines, 1 ) self.parseInitialization() for line in self.lines[self.lineIndex :]: self.parseCorner(line) self.cornerHighComplex = self.cornerHigh.dropAxis(2) self.cornerLowComplex = self.cornerLow.dropAxis(2) self.scale = repository.scale.value self.scaleCornerHigh = self.scale * self.cornerHighComplex self.scaleCornerLow = self.scale * self.cornerLowComplex self.cornerImaginaryTotal = self.cornerHigh.y + self.cornerLow.y self.margin = complex( 10.0, 10.0 ) self.marginCornerHigh = self.scaleCornerHigh + self.margin self.marginCornerLow = self.scaleCornerLow - self.margin self.screenSize = self.marginCornerHigh - self.marginCornerLow self.initializeActiveLocation() self.colorNames = ['brown', 'red', 'orange', 'yellow', 'green', 'blue', 'purple'] for self.lineIndex in xrange( self.lineIndex, len( self.lines ) ): line = self.lines[ self.lineIndex ] self.parseLine(line)
def getNavigationHypertext( fileText, transferredFileNameIndex, transferredFileNames ): "Get the hypertext help with navigation lines." helpTextEnd = fileText.find('</p>') helpTextStart = fileText.find('<p>') helpText = fileText[ helpTextStart : helpTextEnd ] lines = gcodec.getTextLines( helpText ) headings = [] headingLineTable = {} for line in lines: addToHeadings( headingLineTable, headings, line ) headingsToBeenAdded = True output = cStringIO.StringIO() for line in lines: if line[ : 2 ] == '==': if headingsToBeenAdded: output.write('<br />\n') for heading in headings: heading.addToOutput(output) output.write('<br />\n') headingsToBeenAdded = False if line in headingLineTable: line = headingLineTable[ line ] output.write( line + '\n') helpText = output.getvalue() previousFileName = 'contents.html' previousIndex = transferredFileNameIndex - 1 if previousIndex >= 0: previousFileName = transferredFileNames[ previousIndex ] previousLinkText = '<a href="%s">Previous</a>' % previousFileName navigationLine = getNavigationLine('<a href="contents.html">Contents</a>', previousLinkText, getNextLinkText( transferredFileNames, transferredFileNameIndex + 1 ) ) helpText = navigationLine + helpText + '<br />\n<br />\n' + navigationLine + '<hr>\n' return fileText[ : helpTextStart ] + helpText + fileText[ helpTextEnd : ]
def getCraftedGcode( self, gcodeStepRepository, gcodeText ): "Parse gcode text and store the gcode." self.gcodeStepRepository = gcodeStepRepository lines = gcodec.getTextLines( gcodeText ) for line in lines: self.parseLine( line ) return self.output.getvalue()
def __init__(self, xmlText): "Add empty lists." self.isInFabmetheus = False self.lines = gcodec.getTextLines(xmlText) self.output = cStringIO.StringIO() for line in self.lines: self.parseLine(line)
def parseGcode(self, fileName, gcodeText, repository): "Parse gcode text and store the vector output." self.fileName = fileName self.gcodeText = gcodeText self.repository = repository self.initializeActiveLocation() self.cornerHigh = Vector3(-999999999.0, -999999999.0, -999999999.0) self.cornerLow = Vector3(999999999.0, 999999999.0, 999999999.0) self.lines = gcodec.getTextLines(gcodeText) self.isThereALayerStartWord = gcodec.isThereAFirstWord( '(<layer>', self.lines, 1) self.parseInitialization() for line in self.lines[self.lineIndex:]: self.parseCorner(line) self.cornerHighComplex = self.cornerHigh.dropAxis(2) self.cornerLowComplex = self.cornerLow.dropAxis(2) self.scale = repository.scale.value self.scaleCornerHigh = self.scale * self.cornerHighComplex self.scaleCornerLow = self.scale * self.cornerLowComplex self.cornerImaginaryTotal = self.cornerHigh.y + self.cornerLow.y self.margin = complex(10.0, 10.0) self.marginCornerHigh = self.scaleCornerHigh + self.margin self.marginCornerLow = self.scaleCornerLow - self.margin self.screenSize = self.marginCornerHigh - self.marginCornerLow self.initializeActiveLocation() self.colorNames = [ 'brown', 'red', 'orange', 'yellow', 'green', 'blue', 'purple' ] for self.lineIndex in xrange(self.lineIndex, len(self.lines)): line = self.lines[self.lineIndex] self.parseLine(line)
def __init__(self, xmlText): "Add empty lists." self.isInComment = False self.parents = [] self.rootElement = None self.lines = gcodec.getTextLines(xmlText) for line in self.lines: self.parseLine(line)
def getCraftedGcode(self, gcodeText, repository): "Parse gcode text and store the widen gcode." self.repository = repository self.lines = gcodec.getTextLines(gcodeText) self.parseInitialization() for line in self.lines[self.lineIndex:]: self.parseLine(line) return self.distanceFeedRate.output.getvalue()
def getCraftedGcode(self, gcodeText, repository): "Parse gcode text and store the bevel gcode." self.repository = repository self.lines = gcodec.getTextLines(gcodeText) self.parseInitialization() for lineIndex in xrange(self.lineIndex, len(self.lines)): self.parseLine(lineIndex) return self.distanceFeedRate.output.getvalue()
def getCraftedGcode( self, gcodeText, repository ): "Parse gcode text and store the limit gcode." self.repository = repository self.lines = gcodec.getTextLines( gcodeText ) self.parseInitialization() for lineIndex in xrange( self.lineIndex, len( self.lines ) ): self.parseLine( lineIndex ) return self.distanceFeedRate.output.getvalue()
def __init__( self, xmlText ): "Add empty lists." self.isInComment = False self.parents = [] self.rootElement = None self.lines = gcodec.getTextLines( xmlText ) for line in self.lines: self.parseLine( line )
def getCraftedGcode( self, jitterRepository, gcodeText ): "Parse gcode text and store the jitter gcode." self.lines = gcodec.getTextLines( gcodeText ) self.parseInitialization( jitterRepository ) for self.lineIndex in xrange( self.lineIndex, len( self.lines ) ): line = self.lines[ self.lineIndex ] self.parseAddJitter( line ) return self.distanceFeedRate.output.getvalue()
def addFacesGivenText( stlText, triangleMesh, vertexIndexTable ): "Add faces given stl text." lines = gcodec.getTextLines( stlText ) vertices = [] for line in lines: if line.find( 'vertex' ) != - 1: vertices.append( getVertexGivenLine( line ) ) addFacesGivenVertices( triangleMesh, vertexIndexTable, vertices )
def getCraftedGcode( self, gcodeText, repository ): "Parse gcode text and store the widen gcode." self.repository = repository self.lines = gcodec.getTextLines( gcodeText ) self.parseInitialization() for line in self.lines[ self.lineIndex : ]: self.parseLine( line ) return self.distanceFeedRate.output.getvalue()
def getCraftedGcode(self, jitterRepository, gcodeText): "Parse gcode text and store the jitter gcode." self.lines = gcodec.getTextLines(gcodeText) self.parseInitialization(jitterRepository) for self.lineIndex in xrange(self.lineIndex, len(self.lines)): line = self.lines[self.lineIndex] self.parseAddJitter(line) return self.distanceFeedRate.output.getvalue()
def addFacesGivenText(stlText, triangleMesh, vertexIndexTable): "Add faces given stl text." lines = gcodec.getTextLines(stlText) vertices = [] for line in lines: if line.find('vertex') != -1: vertices.append(getVertexGivenLine(line)) addFacesGivenVertices(triangleMesh, vertexIndexTable, vertices)
def getCraftedGcode( self, gcodeText, hopRepository ): "Parse gcode text and store the hop gcode." self.lines = gcodec.getTextLines(gcodeText) self.minimumSlope = math.tan( math.radians( hopRepository.minimumHopAngle.value ) ) self.parseInitialization( hopRepository ) for self.lineIndex in xrange( self.lineIndex, len( self.lines ) ): line = self.lines[ self.lineIndex ] self.parseLine(line) return self.distanceFeedRate.output.getvalue()
def getCraftedGcode( self, gcodeText, stretchRepository ): "Parse gcode text and store the stretch gcode." self.lines = gcodec.getTextLines(gcodeText) self.stretchRepository = stretchRepository self.parseInitialization() for self.lineIndex in xrange( self.lineIndex, len( self.lines ) ): line = self.lines[ self.lineIndex ] self.parseStretch(line) return self.distanceFeedRate.output.getvalue()
def __init__(self, parent, csvText): "Add empty lists." self.continueFunction = None self.extraLeadingTabCount = None self.lines = gcodec.getTextLines(csvText) self.oldCSVElement = None self.root = None for line in self.lines: self.parseLine(line)
def getCraftedGcode(self, gcodeText, oozebaneRepository): "Parse gcode text and store the oozebane gcode." self.lines = gcodec.getTextLines(gcodeText) self.oozebaneRepository = oozebaneRepository self.parseInitialization(oozebaneRepository) for self.lineIndex in xrange(self.lineIndex, len(self.lines)): line = self.lines[self.lineIndex] self.parseLine(line) return self.distanceFeedRate.output.getvalue()
def getCraftedGcode( self, gcodeText, hopRepository ): "Parse gcode text and store the hop gcode." self.lines = gcodec.getTextLines( gcodeText ) self.minimumSlope = math.tan( math.radians( hopRepository.minimumHopAngle.value ) ) self.parseInitialization( hopRepository ) for self.lineIndex in xrange( self.lineIndex, len( self.lines ) ): line = self.lines[ self.lineIndex ] self.parseLine( line ) return self.distanceFeedRate.output.getvalue()
def __init__( self, parent, csvText ): "Add empty lists." self.continueFunction = None self.extraLeadingTabCount = None self.lines = gcodec.getTextLines( csvText ) self.oldCSVElement = None self.root = None for line in self.lines: self.parseLine(line)
def getCraftedGcode(self, gcodeText, stretchRepository): "Parse gcode text and store the stretch gcode." self.lines = gcodec.getTextLines(gcodeText) self.stretchRepository = stretchRepository self.parseInitialization() for self.lineIndex in xrange(self.lineIndex, len(self.lines)): line = self.lines[self.lineIndex] self.parseStretch(line) return self.distanceFeedRate.output.getvalue()
def getCraftedGcode( self, gcodeText, raftlessRepository ): "Parse gcode text and store the raftless gcode." self.raftlessRepository = raftlessRepository self.wantsExtrusionIntro=self.raftlessRepository.addExtrusionIntro.value self.lines = gcodec.getTextLines( gcodeText ) self.parseInitialization() for line in self.lines[ self.lineIndex : ]: self.parseLine( line ) return self.distanceFeedRate.output.getvalue()
def getCraftedGcode( self, filletRepository, gcodeText ): "Parse gcode text and store the bevel gcode." self.cornerFeedRateOverOperatingFeedRate = filletRepository.cornerFeedRateOverOperatingFeedRate.value self.lines = gcodec.getTextLines(gcodeText) self.filletRepository = filletRepository self.parseInitialization( filletRepository ) for self.lineIndex in xrange( self.lineIndex, len( self.lines ) ): line = self.lines[ self.lineIndex ] self.parseLine(line) return self.distanceFeedRate.output.getvalue()
def getCraftedGcode(self, filletRepository, gcodeText): "Parse gcode text and store the bevel gcode." self.cornerFeedRateOverOperatingFeedRate = filletRepository.cornerFeedRateOverOperatingFeedRate.value self.lines = gcodec.getTextLines(gcodeText) self.filletRepository = filletRepository self.parseInitialization(filletRepository) for self.lineIndex in xrange(self.lineIndex, len(self.lines)): line = self.lines[self.lineIndex] self.parseLine(line) return self.distanceFeedRate.output.getvalue()
def getCraftedGcode(self, gcodeText, repository): "Parse gcode text and store the coil gcode." self.repository = repository self.lines = gcodec.getTextLines(gcodeText) self.parseInitialization() self.parseBoundaries() self.parseUntilLayer() self.addCoilLayers() self.distanceFeedRate.addLines(self.shutdownLines) return self.distanceFeedRate.output.getvalue()
def getCraftedGcode( self, gcodeText, repository ): "Parse gcode text and store the coil gcode." self.repository = repository self.lines = gcodec.getTextLines(gcodeText) self.parseInitialization() self.parseBoundaries() self.parseUntilLayer() self.addCoilLayers() self.distanceFeedRate.addLines( self.shutdownLines ) return self.distanceFeedRate.output.getvalue()
def addFacesGivenText( objText, triangleMesh ): "Add faces given obj text." lines = gcodec.getTextLines( objText ) for line in lines: splitLine = line.split() firstWord = gcodec.getFirstWord( splitLine ) if firstWord == 'v': triangleMesh.vertices.append( getVertexGivenLine(line) ) elif firstWord == 'f': triangleMesh.faces.append( getFaceGivenLine( line, triangleMesh ) )
def addFacesGivenText(objText, triangleMesh): "Add faces given obj text." lines = gcodec.getTextLines(objText) for line in lines: splitLine = line.split() firstWord = gcodec.getFirstWord(splitLine) if firstWord == 'v': triangleMesh.vertexes.append(getVertexGivenLine(line)) elif firstWord == 'f': triangleMesh.faces.append(getFaceGivenLine(line, triangleMesh))
def __init__( self, fileName, parent, xmlText ): "Add empty lists." self.commentString = None self.fileName = fileName self.isInComment = False self.parent = parent self.root = None self.xmlText = xmlText self.lines = gcodec.getTextLines( xmlText ) for line in self.lines: self.parseLine( line )
def getReplaced( exportText ): "Get text with strings replaced according to replace.csv file." replaceText = settings.getFileInAlterationsOrGivenDirectory( os.path.dirname( __file__ ), 'Replace.csv') if replaceText == '': return exportText lines = gcodec.getTextLines( replaceText ) for line in lines: splitLine = line.split('\t') if len(splitLine) > 1: exportText = exportText.replace( splitLine[0], splitLine[1] ) return exportText
def getCraftedGcode( self, gcodeText, lashRepository ): "Parse gcode text and store the lash gcode." self.lines = gcodec.getTextLines( gcodeText ) self.lashRepository = lashRepository self.xBacklash = lashRepository.xBacklash.value self.yBacklash = lashRepository.yBacklash.value self.parseInitialization() for self.lineIndex in xrange( self.lineIndex, len( self.lines ) ): line = self.lines[ self.lineIndex ] self.parseLash( line ) return self.distanceFeedRate.output.getvalue()
def getCraftedGcode(self, gcodeText, lashRepository): "Parse gcode text and store the lash gcode." self.lines = gcodec.getTextLines(gcodeText) self.lashRepository = lashRepository self.xBacklash = lashRepository.xBacklash.value self.yBacklash = lashRepository.yBacklash.value self.parseInitialization() for self.lineIndex in xrange(self.lineIndex, len(self.lines)): line = self.lines[self.lineIndex] self.parseLash(line) return self.distanceFeedRate.output.getvalue()
def getCraftedGcode(self, combRepository, gcodeText): "Parse gcode text and store the comb gcode." self.combRepository = combRepository self.lines = gcodec.getTextLines(gcodeText) self.parseInitialization(combRepository) for lineIndex in xrange(self.lineIndex, len(self.lines)): line = self.lines[lineIndex] self.parseBoundariesLayers(combRepository, line) for lineIndex in xrange(self.lineIndex, len(self.lines)): line = self.lines[lineIndex] self.parseLine(line) return self.distanceFeedRate.output.getvalue()
def getCraftedGcode( self, gcodeText, wipeRepository ): "Parse gcode text and store the wipe gcode." self.lines = gcodec.getTextLines(gcodeText) self.wipePeriod = wipeRepository.wipePeriod.value self.parseInitialization( wipeRepository ) self.locationArrival = Vector3( wipeRepository.locationArrivalX.value, wipeRepository.locationArrivalY.value, wipeRepository.locationArrivalZ.value ) self.locationDeparture = Vector3( wipeRepository.locationDepartureX.value, wipeRepository.locationDepartureY.value, wipeRepository.locationDepartureZ.value ) self.locationWipe = Vector3( wipeRepository.locationWipeX.value, wipeRepository.locationWipeY.value, wipeRepository.locationWipeZ.value ) for self.lineIndex in xrange( self.lineIndex, len( self.lines ) ): line = self.lines[ self.lineIndex ] self.parseLine(line) return self.distanceFeedRate.output.getvalue()
def getCraftedGcode(self, gcodeText, feedRepository): "Parse gcode text and store the feed gcode." self.distanceFeedRate.maximumZDrillFeedRatePerSecond = feedRepository.maximumZDrillFeedRatePerSecond.value self.distanceFeedRate.maximumZTravelFeedRatePerSecond = feedRepository.maximumZTravelFeedRatePerSecond.value self.feedRepository = feedRepository self.feedRatePerSecond = feedRepository.feedRatePerSecond.value self.travelFeedRatePerMinute = 60.0 * self.feedRepository.travelFeedRatePerSecond.value self.lines = gcodec.getTextLines(gcodeText) self.parseInitialization() for line in self.lines[self.lineIndex:]: self.parseLine(line) return self.distanceFeedRate.output.getvalue()
def getReplaced(exportText): "Get text with strings replaced according to replace.csv file." replaceText = settings.getFileInAlterationsOrGivenDirectory( os.path.dirname(__file__), 'Replace.csv') if replaceText == '': return exportText lines = gcodec.getTextLines(replaceText) for line in lines: splitLine = line.split('\t') if len(splitLine) > 1: exportText = exportText.replace(splitLine[0], splitLine[1]) return exportText
def getCraftedGcode( self, gcodeText, wipeRepository ): "Parse gcode text and store the wipe gcode." self.lines = gcodec.getTextLines( gcodeText ) self.wipePeriod = wipeRepository.wipePeriod.value self.parseInitialization( wipeRepository ) self.locationArrival = Vector3( wipeRepository.locationArrivalX.value, wipeRepository.locationArrivalY.value, wipeRepository.locationArrivalZ.value ) self.locationDeparture = Vector3( wipeRepository.locationDepartureX.value, wipeRepository.locationDepartureY.value, wipeRepository.locationDepartureZ.value ) self.locationWipe = Vector3( wipeRepository.locationWipeX.value, wipeRepository.locationWipeY.value, wipeRepository.locationWipeZ.value ) for self.lineIndex in xrange( self.lineIndex, len( self.lines ) ): line = self.lines[ self.lineIndex ] self.parseLine( line ) return self.distanceFeedRate.output.getvalue()
def getCraftedGcode( self, combRepository, gcodeText ): "Parse gcode text and store the comb gcode." self.combRepository = combRepository self.lines = gcodec.getTextLines(gcodeText) self.parseInitialization( combRepository ) for lineIndex in xrange( self.lineIndex, len( self.lines ) ): line = self.lines[ lineIndex ] self.parseBoundariesLayers( combRepository, line ) for lineIndex in xrange( self.lineIndex, len( self.lines ) ): line = self.lines[ lineIndex ] self.parseLine(line) return self.distanceFeedRate.output.getvalue()
def getCraftedGcode( self, gcodeText, repository ): "Parse gcode text and store the unpause gcode." self.delaySecond = repository.delay.value * 0.001 self.maximumSpeed = repository.maximumSpeed.value self.minimumSpeedUpReciprocal = 1.0 / self.maximumSpeed self.repository = repository self.lines = gcodec.getTextLines(gcodeText) self.parseInitialization() for self.lineIndex in xrange( self.lineIndex, len( self.lines ) ): line = self.lines[ self.lineIndex ] self.parseLine(line) return self.distanceFeedRate.output.getvalue()
def getCraftedGcode( self, gcodeText, multiplyRepository ): "Parse gcode text and store the multiply gcode." self.centerOffset = complex( multiplyRepository.centerX.value, multiplyRepository.centerY.value ) self.multiplyRepository = multiplyRepository self.numberOfColumns = multiplyRepository.numberOfColumns.value self.numberOfRows = multiplyRepository.numberOfRows.value self.lines = gcodec.getTextLines(gcodeText) self.parseInitialization() self.setCorners() for line in self.lines[self.lineIndex :]: self.parseLine(line) return self.distanceFeedRate.output.getvalue()
def getCraftedGcode( self, gcodeText, feedRepository ): "Parse gcode text and store the feed gcode." self.distanceFeedRate.maximumZDrillFeedRatePerSecond = feedRepository.maximumZDrillFeedRatePerSecond.value self.distanceFeedRate.maximumZTravelFeedRatePerSecond = feedRepository.maximumZTravelFeedRatePerSecond.value self.feedRepository = feedRepository self.feedRatePerSecond = feedRepository.feedRatePerSecond.value self.travelFeedRatePerMinute = 60.0 * self.feedRepository.travelFeedRatePerSecond.value self.lines = gcodec.getTextLines(gcodeText) self.parseInitialization() for line in self.lines[self.lineIndex :]: self.parseLine(line) return self.distanceFeedRate.output.getvalue()
def getCraftedGcode(self, gcodeText, repository): "Parse gcode text and store the unpause gcode." self.delaySecond = repository.delay.value * 0.001 self.maximumSpeed = repository.maximumSpeed.value self.minimumSpeedUpReciprocal = 1.0 / self.maximumSpeed self.repository = repository self.lines = gcodec.getTextLines(gcodeText) self.parseInitialization() for self.lineIndex in xrange(self.lineIndex, len(self.lines)): line = self.lines[self.lineIndex] self.parseLine(line) return self.distanceFeedRate.output.getvalue()
def getCraftedGcode( self, gcodeText, repository ): "Parse gcode text and store the temperature gcode." self.repository = repository self.lines = gcodec.getTextLines(gcodeText) if self.repository.coolingRate.value < 0.1: print('The cooling rate should be more than 0.1, any cooling rate less than 0.1 will be treated as 0.1.') self.repository.coolingRate.value = 0.1 if self.repository.heatingRate.value < 0.1: print('The heating rate should be more than 0.1, any heating rate less than 0.1 will be treated as 0.1.') self.repository.heatingRate.value = 0.1 self.parseInitialization() self.distanceFeedRate.addLines( self.lines[self.lineIndex :] ) return self.distanceFeedRate.output.getvalue()
def getCraftedGcode( self, gcodeText, repository ): "Parse gcode text and store the dimension gcode." self.repository = repository self.lines = gcodec.getTextLines(gcodeText) self.parseInitialization() if self.operatingFlowRate == None: print('There is no operatingFlowRate so dimension will do nothing.') return gcodeText self.restartDistance = self.repository.retractionDistance.value + self.repository.restartExtraDistance.value self.extruderRetractionSpeedMinuteString = self.distanceFeedRate.getRounded( 60.0 * self.repository.extruderRetractionSpeed.value ) for lineIndex in xrange( self.lineIndex, len( self.lines ) ): self.parseLine( lineIndex ) return self.distanceFeedRate.output.getvalue()
def getCraftedGcode( self, gcodeText, repository ): "Parse gcode text and store the speed gcode." self.distanceFeedRate.maximumZDrillFeedRatePerSecond = repository.maximumZFeedRatePerSecond.value self.distanceFeedRate.maximumZTravelFeedRatePerSecond = repository.maximumZFeedRatePerSecond.value self.repository = repository self.feedRatePerSecond = repository.feedRatePerSecond.value self.travelFeedRatePerMinute = 60.0 * self.repository.travelFeedRatePerSecond.value self.lines = gcodec.getTextLines( gcodeText ) self.parseInitialization() for line in self.lines[ self.lineIndex : ]: self.parseLine( line ) self.addParameterString( 'M113', self.repository.dutyCycleAtEnding.value ) # Set duty cycle . return self.distanceFeedRate.output.getvalue()
def getCraftedGcode(self, gcodeText, multiplyRepository): "Parse gcode text and store the multiply gcode." self.centerOffset = complex(multiplyRepository.centerX.value, multiplyRepository.centerY.value) self.multiplyRepository = multiplyRepository self.numberOfColumns = multiplyRepository.numberOfColumns.value self.numberOfRows = multiplyRepository.numberOfRows.value self.lines = gcodec.getTextLines(gcodeText) self.parseInitialization() self.setCorners() for line in self.lines[self.lineIndex:]: self.parseLine(line) return self.distanceFeedRate.output.getvalue()
def getCraftedGcode( self, gcodeText, coolRepository ): "Parse gcode text and store the cool gcode." self.coolRepository = coolRepository self.coolEndText = settings.getFileInAlterationsOrGivenDirectory( os.path.dirname( __file__ ), 'Cool_End.gcode') self.coolEndLines = gcodec.getTextLines( self.coolEndText ) self.coolStartText = settings.getFileInAlterationsOrGivenDirectory( os.path.dirname( __file__ ), 'Cool_Start.gcode') self.coolStartLines = gcodec.getTextLines( self.coolStartText ) self.halfCorner = complex( coolRepository.minimumOrbitalRadius.value, coolRepository.minimumOrbitalRadius.value ) self.lines = gcodec.getTextLines(gcodeText) self.minimumArea = 4.0 * coolRepository.minimumOrbitalRadius.value * coolRepository.minimumOrbitalRadius.value self.parseInitialization() self.boundingRectangle = gcodec.BoundingRectangle().getFromGcodeLines( self.lines[self.lineIndex :], 0.5 * self.perimeterWidth ) margin = 0.2 * self.perimeterWidth halfCornerMargin = self.halfCorner + complex( margin, margin ) self.boundingRectangle.cornerMaximum -= halfCornerMargin self.boundingRectangle.cornerMinimum += halfCornerMargin for self.lineIndex in xrange( self.lineIndex, len( self.lines ) ): line = self.lines[ self.lineIndex ] self.parseLine(line) if coolRepository.turnFanOffAtEnding.value: self.distanceFeedRate.addLine('M107') return self.distanceFeedRate.output.getvalue()