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)
Exemple #4
0
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)
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)
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]

for laserPower in laserPowers:
    x_move = 0
    y_move = 0

    for dwellTime in dwellTimes:
        gcode_move(x_move, y_move)

        totals = gcode_rectangle(dwellTime, laserPower, iterations)
        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

# Close file
writefile.closefile()
x_dist = -1*(length+spaceLarge)
y_dist = len(values2)*len(values3)*spaceSmall + len(values2)*(spaceLarge-spaceSmall)

for i in range(0,len(values1)):
	value1 = values1[i]
	
	for j in range(0,len(values2)):
		value2 = values2[j]
		
		for k in range(0,len(values3)):
			value3 = values3[k]
			
			kvargs = {orientation[0]:value1, orientation[1]:value2, orientation[2]:value3}
			gcode_line(kvargs)
		
		xy_move(0, spaceSmall - spaceLarge)
	
	xy_move(x_dist, y_dist) 

# Close file
writefile.closefile()