Beispiel #1
0
    def exportGCode(self,sheet):
        print "Converting " + str(sheet.name)+" into G-code"
        gcodeFilePath = "output-gcode/"+str(sheet.name)+".txt"
        
        gcode = ""
        
        # Load pre-made starting gcode
        gcode += readWrite.readStringFromFile("input-gcode/gcode-start.txt")
        
        # Loop through holes to generate gcode
        
        #print "DRILLDIAM: ",sheet.drillDiam
        for hole in sheet.holeList:
            holeSize = round(hole[2],3)
            #print "HOLESIZE: "+str(holeSize)
            x = round(hole[0],3)
            y = round(hole[1],3)
            #gcode += "x:"+str(x)+" y: "+str(y)+"\r"
            gcode += str(self.drillHole(x,y,self.holeDepth,holeSize,sheet.drillDiam))
            
        # Load pre-made ending gcode
        gcode += readWrite.readStringFromFile("input-gcode/gcode-end.txt")

        readWrite.writeStringToFile(gcode,gcodeFilePath)
cnc = cncmachine.Cnc(feedSpeed,plungeSpeed)

#print cnc.listToCode(locationList,-5,0)


# Figure out depth ranges using stepdown and cutDepth
currentDepth = 0
depthList = []
while currentDepth < cutDepth:
    depthList.append(currentDepth)
    currentDepth += stepdown
else:
    depthList.append(cutDepth)

depthRangeList = []
for index,val in enumerate(depthList[:-1]):
    depthRangeList.append([val,depthList[index+1]])
    


outputCode = ""
for depths in depthRangeList:
    outputCode += cnc.listToCode(finalLocationList,-depths[0],-depths[1])





rw.writeStringToFile(outputCode,"output/output.gcode")
# for line in locationList:
#     print line
Beispiel #3
0
 def writeGcode(self,whatToWrite,fileName):
     filePath = "output-gcode/"+str(fileName)
     readWrite.writeStringToFile(whatToWrite,filePath)