|
@@ -1,10 +1,10 @@
|
|
|
-# ########################################################## ##
|
|
|
|
|
|
|
+# ##########################################################
|
|
|
# FlatCAM: 2D Post-processing for Manufacturing #
|
|
# FlatCAM: 2D Post-processing for Manufacturing #
|
|
|
# http://flatcam.org #
|
|
# http://flatcam.org #
|
|
|
# File Author: Marius Adrian Stanciu (c) #
|
|
# File Author: Marius Adrian Stanciu (c) #
|
|
|
# Date: 3/10/2019 #
|
|
# Date: 3/10/2019 #
|
|
|
# MIT Licence #
|
|
# MIT Licence #
|
|
|
-# ########################################################## ##
|
|
|
|
|
|
|
+# ##########################################################
|
|
|
|
|
|
|
|
from FlatCAMPostProc import *
|
|
from FlatCAMPostProc import *
|
|
|
|
|
|
|
@@ -90,11 +90,12 @@ class Toolchange_Probe_MACH3(FlatCAMPostProc):
|
|
|
toolchangexy = p.xy_toolchange
|
|
toolchangexy = p.xy_toolchange
|
|
|
f_plunge = p.f_plunge
|
|
f_plunge = p.f_plunge
|
|
|
|
|
|
|
|
- gcode = ''
|
|
|
|
|
-
|
|
|
|
|
if toolchangexy is not None:
|
|
if toolchangexy is not None:
|
|
|
x_toolchange = toolchangexy[0]
|
|
x_toolchange = toolchangexy[0]
|
|
|
y_toolchange = toolchangexy[1]
|
|
y_toolchange = toolchangexy[1]
|
|
|
|
|
+ else:
|
|
|
|
|
+ x_toolchange = 0.0
|
|
|
|
|
+ y_toolchange = 0.0
|
|
|
|
|
|
|
|
no_drills = 1
|
|
no_drills = 1
|
|
|
|
|
|
|
@@ -132,7 +133,7 @@ M0
|
|
|
z_toolchange=self.coordinate_format % (p.coords_decimals, z_toolchange),
|
|
z_toolchange=self.coordinate_format % (p.coords_decimals, z_toolchange),
|
|
|
z_move=self.coordinate_format % (p.coords_decimals, p.z_move),
|
|
z_move=self.coordinate_format % (p.coords_decimals, p.z_move),
|
|
|
z_in_between=self.coordinate_format % (p.coords_decimals, p.z_move / 2),
|
|
z_in_between=self.coordinate_format % (p.coords_decimals, p.z_move / 2),
|
|
|
- feedrate_probe=str(self.feedrate_format %(p.fr_decimals, p.feedrate_probe)),
|
|
|
|
|
|
|
+ feedrate_probe=str(self.feedrate_format % (p.fr_decimals, p.feedrate_probe)),
|
|
|
feedrate_probe_slow=str(self.feedrate_format % (p.fr_decimals, (p.feedrate_probe / 2))),
|
|
feedrate_probe_slow=str(self.feedrate_format % (p.fr_decimals, (p.feedrate_probe / 2))),
|
|
|
z_pdepth=self.coordinate_format % (p.coords_decimals, p.z_pdepth),
|
|
z_pdepth=self.coordinate_format % (p.coords_decimals, p.z_pdepth),
|
|
|
tool=int(p.tool),
|
|
tool=int(p.tool),
|
|
@@ -159,7 +160,7 @@ M0
|
|
|
""".format(z_toolchange=self.coordinate_format % (p.coords_decimals, z_toolchange),
|
|
""".format(z_toolchange=self.coordinate_format % (p.coords_decimals, z_toolchange),
|
|
|
z_move=self.coordinate_format % (p.coords_decimals, p.z_move),
|
|
z_move=self.coordinate_format % (p.coords_decimals, p.z_move),
|
|
|
z_in_between=self.coordinate_format % (p.coords_decimals, p.z_move / 2),
|
|
z_in_between=self.coordinate_format % (p.coords_decimals, p.z_move / 2),
|
|
|
- feedrate_probe=str(self.feedrate_format %(p.fr_decimals, p.feedrate_probe)),
|
|
|
|
|
|
|
+ feedrate_probe=str(self.feedrate_format % (p.fr_decimals, p.feedrate_probe)),
|
|
|
feedrate_probe_slow=str(self.feedrate_format % (p.fr_decimals, (p.feedrate_probe / 2))),
|
|
feedrate_probe_slow=str(self.feedrate_format % (p.fr_decimals, (p.feedrate_probe / 2))),
|
|
|
z_pdepth=self.coordinate_format % (p.coords_decimals, p.z_pdepth),
|
|
z_pdepth=self.coordinate_format % (p.coords_decimals, p.z_pdepth),
|
|
|
tool=int(p.tool),
|
|
tool=int(p.tool),
|
|
@@ -195,7 +196,7 @@ M0
|
|
|
z_toolchange=self.coordinate_format % (p.coords_decimals, z_toolchange),
|
|
z_toolchange=self.coordinate_format % (p.coords_decimals, z_toolchange),
|
|
|
z_move=self.coordinate_format % (p.coords_decimals, p.z_move),
|
|
z_move=self.coordinate_format % (p.coords_decimals, p.z_move),
|
|
|
z_in_between=self.coordinate_format % (p.coords_decimals, p.z_move / 2),
|
|
z_in_between=self.coordinate_format % (p.coords_decimals, p.z_move / 2),
|
|
|
- feedrate_probe=str(self.feedrate_format %(p.fr_decimals, p.feedrate_probe)),
|
|
|
|
|
|
|
+ feedrate_probe=str(self.feedrate_format % (p.fr_decimals, p.feedrate_probe)),
|
|
|
feedrate_probe_slow=str(self.feedrate_format % (p.fr_decimals, (p.feedrate_probe / 2))),
|
|
feedrate_probe_slow=str(self.feedrate_format % (p.fr_decimals, (p.feedrate_probe / 2))),
|
|
|
z_pdepth=self.coordinate_format % (p.coords_decimals, p.z_pdepth),
|
|
z_pdepth=self.coordinate_format % (p.coords_decimals, p.z_pdepth),
|
|
|
tool=int(p.tool),
|
|
tool=int(p.tool),
|
|
@@ -221,7 +222,7 @@ M0
|
|
|
""".format(z_toolchange=self.coordinate_format % (p.coords_decimals, z_toolchange),
|
|
""".format(z_toolchange=self.coordinate_format % (p.coords_decimals, z_toolchange),
|
|
|
z_move=self.coordinate_format % (p.coords_decimals, p.z_move),
|
|
z_move=self.coordinate_format % (p.coords_decimals, p.z_move),
|
|
|
z_in_between=self.coordinate_format % (p.coords_decimals, p.z_move / 2),
|
|
z_in_between=self.coordinate_format % (p.coords_decimals, p.z_move / 2),
|
|
|
- feedrate_probe=str(self.feedrate_format %(p.fr_decimals, p.feedrate_probe)),
|
|
|
|
|
|
|
+ feedrate_probe=str(self.feedrate_format % (p.fr_decimals, p.feedrate_probe)),
|
|
|
feedrate_probe_slow=str(self.feedrate_format % (p.fr_decimals, (p.feedrate_probe / 2))),
|
|
feedrate_probe_slow=str(self.feedrate_format % (p.fr_decimals, (p.feedrate_probe / 2))),
|
|
|
z_pdepth=self.coordinate_format % (p.coords_decimals, p.z_pdepth),
|
|
z_pdepth=self.coordinate_format % (p.coords_decimals, p.z_pdepth),
|
|
|
tool=int(p.tool),
|
|
tool=int(p.tool),
|
|
@@ -246,17 +247,17 @@ M0
|
|
|
|
|
|
|
|
def end_code(self, p):
|
|
def end_code(self, p):
|
|
|
coords_xy = p['xy_toolchange']
|
|
coords_xy = p['xy_toolchange']
|
|
|
- gcode = ('G00 Z' + self.feedrate_format %(p.fr_decimals, p.z_end) + "\n")
|
|
|
|
|
|
|
+ gcode = ('G00 Z' + self.feedrate_format % (p.fr_decimals, p.z_end) + "\n")
|
|
|
|
|
|
|
|
if coords_xy is not None:
|
|
if coords_xy is not None:
|
|
|
gcode += 'G00 X{x} Y{y}'.format(x=coords_xy[0], y=coords_xy[1]) + "\n"
|
|
gcode += 'G00 X{x} Y{y}'.format(x=coords_xy[0], y=coords_xy[1]) + "\n"
|
|
|
return gcode
|
|
return gcode
|
|
|
|
|
|
|
|
def feedrate_code(self, p):
|
|
def feedrate_code(self, p):
|
|
|
- return 'G01 F' + str(self.feedrate_format %(p.fr_decimals, p.feedrate))
|
|
|
|
|
|
|
+ return 'G01 F' + str(self.feedrate_format % (p.fr_decimals, p.feedrate))
|
|
|
|
|
|
|
|
def z_feedrate_code(self, p):
|
|
def z_feedrate_code(self, p):
|
|
|
- return 'G01 F' + str(self.feedrate_format %(p.fr_decimals, p.z_feedrate))
|
|
|
|
|
|
|
+ return 'G01 F' + str(self.feedrate_format % (p.fr_decimals, p.z_feedrate))
|
|
|
|
|
|
|
|
def spindle_code(self, p):
|
|
def spindle_code(self, p):
|
|
|
sdir = {'CW': 'M03', 'CCW': 'M04'}[p.spindledir]
|
|
sdir = {'CW': 'M03', 'CCW': 'M04'}[p.spindledir]
|
|
@@ -269,5 +270,5 @@ M0
|
|
|
if p.dwelltime:
|
|
if p.dwelltime:
|
|
|
return 'G4 P' + str(p.dwelltime)
|
|
return 'G4 P' + str(p.dwelltime)
|
|
|
|
|
|
|
|
- def spindle_stop_code(self,p):
|
|
|
|
|
|
|
+ def spindle_stop_code(self, p):
|
|
|
return 'M05'
|
|
return 'M05'
|