def writeGCODE(kvarg): if (kvarg): guiGlobVars(kvarg) ## Write GCODE file writefile.header(f) f.writelines("M3 S0\n") ## Laser Off if relative == 0: f.writelines("G28\n") ## Home axes. else: f.writelines("G90\n") f.writelines("M3 S0\n") ## Laser Off f.writelines("G0 X" + str(x_start) + " Y" + str(y_start) + " F2000\n") # Move to x and y-axis start f.writelines("G0 Z" + str(z_start) + " F300\n") ##Move to z-axis position if relative == 1: f.writelines("G91\n") x_current = currentX(0) y_current = currentY(0) currentX(-1*x_current+x_start) currentY(-1*y_current+y_start) ## Print Square gcode_rectangle(dwellTime, laserPower) cleanLaserHead() writefile.closefile(f)
def writeGCODE(): conditions = check_Conditions(laserPower, dwellTime, zValue) if conditions == 0: quit() #Hexagonal packing distances hex_pattern(hex_pack) ## Write GCODE file writefile.header(f) f.writelines("M3 S0\n") ## Laser Off f.writelines("G28\n") ## Home axes for i in range(0,conditions): f.writelines("G90\n") f.writelines("M3 S0\n") ## Laser Off f.writelines("G0 X" + str(x_start-x_dist*i) + " Y" + str(y_start) + " F2000\n") # Move to x and y-axis start f.writelines("G0 Z" + str(zValue[i]) + " F300\n") ##Move to z-axis position f.writelines("G91\n") ## Print Squares x_grid = 0 y_grid = 0 x_move = 0 y_move = 0 gcode_move(x_move, y_move) totals = gcode_rectangle(dwellTime[i], laserPower[i], conditions) x_move = totals[0] - rectLength - spaceSmall y_move = totals[1] x_grid += rectLength + spaceSmall gcode_move(x_move + x_grid, y_move - rectWidth - spaceSmall) x_grid = 0 y_grid += rectWidth + spaceSmall cleanLaserHead() writefile.closefile(f)
def writeGCODE(): conditions = check_Conditions(laserPower, dwellTime, zValue) if conditions == 0: quit() #Hexagonal packing distances hex_pattern(hex_pack) ## Write GCODE file writefile.header(f) f.writelines("M3 S0\n") ## Laser Off f.writelines("G28\n") ## Home axes for i in range(0,conditions): f.writelines("G90\n") f.writelines("M3 S0\n") ## Laser Off f.writelines("G0 X" + str(x_start-x_dist*i) + " Y" + str(y_start) + " F2000\n") # Move to x and y-axis start f.writelines("G0 Z" + str(zValue[i]) + " F300\n") ##Move to z-axis position f.writelines("G91\n") ## Print Squares x_grid = 0 y_grid = 0 x_move = 0 y_move = 0 gcode_move(x_move, y_move) totals = gcode_rectangle(dwellTime[i], laserPower[i], conditions) x_move = totals[0] - rectLength - spaceSmall y_move = totals[1] x_grid += rectLength + spaceSmall gcode_move(x_move + x_grid, y_move - rectWidth - spaceSmall) x_grid = 0 y_grid += rectWidth + spaceSmall writefile.closefile(f)
def writeGCODE(kvarg): if (kvarg): guiGlobVars(kvarg) ## Write GCODE file writefile.header(f) f.writelines("M3 S0\n") ## Laser Off if relative == 0: f.writelines("G28\n") ## Home axes. else: f.writelines("G90\n") f.writelines("M3 S0\n") ## Laser Off f.writelines("G0 X" + str(x_start) + " Y" + str(y_start) + " F2000\n") # Move to x and y-axis start f.writelines("G0 Z" + str(z_start) + " F300\n") ##Move to z-axis position if relative == 1: f.writelines("G91\n") ## Print Squares x_grid = 0 y_grid = 0 x_move = 0 y_move = 0 gcode_move(x_move, y_move) totals = gcode_rectangle(dwellTime, laserPower) x_move = totals[0] - rectLength - spaceSmall y_move = totals[1] x_grid += rectLength + spaceSmall gcode_move(x_move + x_grid, y_move - rectWidth - spaceSmall) x_grid = 0 y_grid += rectWidth + spaceSmall writefile.closefile(f)
x_overhang = flag * x_dist / 2 gcode_move(rectLength + x_overhang, -1 * y_dist) x_total += rectLength + x_overhang y_total += y_dist flag *= -1 print(x_total) totals = [x_total, y_total] return totals ## Write GCODE file writefile.header() f.writelines("M3 S0\n") ## Laser Off f.writelines("G28\n") ## Home axes. if relative == 0: f.writelines("G0 X" + str(x_start) + " Y" + str(y_start) + " F2000\n") # Move to x and y-axis start f.writelines("G0 Z" + str(z_start) + " F300\n") ##Move to z-axis position ## Print Squares x_grid = 0 y_grid = 0 totals = [0, 0]
z = str(kvargs['3']) x = str(-1*length) ppm = str(1.0/hexLength) speed = str(feedRate) z_move(z) line = "G1 B1 X{0} F{1} S{2} L{3} P{4}\n".format(x, speed, laserPower, dwellTime, ppm) f.writelines(line) xy_move(length, -1*spaceSmall) ## Write GCODE file writefile.header() f.writelines("M3 S0\n") ## Laser Off if relative == 1: f.writelines("G28\n") ## Home axes. else: f.writelines("G90\n") f.writelines("G0 X" + str(x_start) + " Y" + str(y_start) + " F2000\n") # Move to x and y-axis start f.writelines("G91\n") ## Print Parameter Scan values1 = params[orientation[0]] values2 = params[orientation[1]] values3 = params[orientation[2]]