- when saving HPGL code it will be saved as a file with extension .plt
- the units mentioned in HPGL format are only METRIC therefore if FlatCAM units are in INCH they will be transform to METRIC - the minimum unit in HPGL is 0.025mm therefore the coordinates are rounded to a multiple of 0.025mm
This commit is contained in:
parent
7ea6ee4a85
commit
b9a062a84e
|
@ -3798,21 +3798,24 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
|
||||||
if 'Roland' in self.pp_excellon_name or 'Roland' in self.pp_geometry_name:
|
if 'Roland' in self.pp_excellon_name or 'Roland' in self.pp_geometry_name:
|
||||||
_filter_ = "RML1 Files (*.rol);;" \
|
_filter_ = "RML1 Files (*.rol);;" \
|
||||||
"All Files (*.*)"
|
"All Files (*.*)"
|
||||||
|
elif 'hpgl' in self.pp_geometry_name:
|
||||||
|
_filter_ = "HPGL Files (*.plt);;" \
|
||||||
|
"All Files (*.*)"
|
||||||
else:
|
else:
|
||||||
_filter_ = "G-Code Files (*.nc);;G-Code Files (*.txt);;G-Code Files (*.tap);;G-Code Files (*.cnc);;" \
|
_filter_ = "G-Code Files (*.nc);;G-Code Files (*.txt);;G-Code Files (*.tap);;G-Code Files (*.cnc);;" \
|
||||||
"G-Code Files (*.g-code);;All Files (*.*)"
|
"G-Code Files (*.g-code);;All Files (*.*)"
|
||||||
try:
|
try:
|
||||||
filename = str(QtWidgets.QFileDialog.getSaveFileName(
|
filename = str(QtWidgets.QFileDialog.getSaveFileName(
|
||||||
caption="Export G-Code ...", directory=self.app.get_last_save_folder(), filter=_filter_)[0])
|
caption="Export Machine Code ...", directory=self.app.get_last_save_folder(), filter=_filter_)[0])
|
||||||
except TypeError:
|
except TypeError:
|
||||||
filename = str(QtWidgets.QFileDialog.getSaveFileName(caption="Export G-Code ...", filter=_filter_)[0])
|
filename = str(QtWidgets.QFileDialog.getSaveFileName(caption="Export Machine Code ...", filter=_filter_)[0])
|
||||||
|
|
||||||
preamble = str(self.ui.prepend_text.get_value())
|
preamble = str(self.ui.prepend_text.get_value())
|
||||||
postamble = str(self.ui.append_text.get_value())
|
postamble = str(self.ui.append_text.get_value())
|
||||||
|
|
||||||
self.export_gcode(filename, preamble=preamble, postamble=postamble)
|
self.export_gcode(filename, preamble=preamble, postamble=postamble)
|
||||||
self.app.file_saved.emit("gcode", filename)
|
self.app.file_saved.emit("gcode", filename)
|
||||||
self.app.inform.emit("[success] G-Code file saved to: %s" % filename)
|
self.app.inform.emit("[success] Machine Code file saved to: %s" % filename)
|
||||||
|
|
||||||
def on_modifygcode_button_click(self, *args):
|
def on_modifygcode_button_click(self, *args):
|
||||||
# add the tab if it was closed
|
# add the tab if it was closed
|
||||||
|
@ -3883,7 +3886,7 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
|
||||||
(str(self.app.version), str(self.app.version_date)) + '";\n'
|
(str(self.app.version), str(self.app.version_date)) + '";\n'
|
||||||
|
|
||||||
gcode += 'CO "Name: ' + str(self.options['name']) + '";\n'
|
gcode += 'CO "Name: ' + str(self.options['name']) + '";\n'
|
||||||
gcode += 'CO "Type: ' + "G-code from " + str(self.options['type']) + '";\n'
|
gcode += 'CO "Type: ' + "HPGL code from " + str(self.options['type']) + '";\n'
|
||||||
|
|
||||||
# if str(p['options']['type']) == 'Excellon' or str(p['options']['type']) == 'Excellon Geometry':
|
# if str(p['options']['type']) == 'Excellon' or str(p['options']['type']) == 'Excellon Geometry':
|
||||||
# gcode += '(Tools in use: ' + str(p['options']['Tools_in_use']) + ')\n'
|
# gcode += '(Tools in use: ' + str(p['options']['Tools_in_use']) + ')\n'
|
||||||
|
|
|
@ -15,6 +15,9 @@ CAD program, and create G-Code for Isolation routing.
|
||||||
- fixed the message box layout when asking to save the current work
|
- fixed the message box layout when asking to save the current work
|
||||||
- made sure that whenever the HPGL postprocessor is selected the Toolchange is always ON and the MultiDepth is OFF
|
- made sure that whenever the HPGL postprocessor is selected the Toolchange is always ON and the MultiDepth is OFF
|
||||||
- the HPGL postprocessor entry is not allowed in Excellon Object postprocessor selection combobox as it is only applicable for Geometry
|
- the HPGL postprocessor entry is not allowed in Excellon Object postprocessor selection combobox as it is only applicable for Geometry
|
||||||
|
- when saving HPGL code it will be saved as a file with extension .plt
|
||||||
|
- the units mentioned in HPGL format are only METRIC therefore if FlatCAM units are in INCH they will be transform to METRIC
|
||||||
|
- the minimum unit in HPGL is 0.025mm therefore the coordinates are rounded to a multiple of 0.025mm
|
||||||
|
|
||||||
19.01.2019
|
19.01.2019
|
||||||
|
|
||||||
|
|
|
@ -6,8 +6,6 @@ from FlatCAMPostProc import *
|
||||||
class hpgl(FlatCAMPostProc):
|
class hpgl(FlatCAMPostProc):
|
||||||
|
|
||||||
coordinate_format = "%.*f"
|
coordinate_format = "%.*f"
|
||||||
feedrate_format = '%.1f'
|
|
||||||
feedrate_rapid_format = '%.1f'
|
|
||||||
|
|
||||||
def start_code(self, p):
|
def start_code(self, p):
|
||||||
gcode = 'IN;'
|
gcode = 'IN;'
|
||||||
|
@ -31,8 +29,23 @@ class hpgl(FlatCAMPostProc):
|
||||||
return ''
|
return ''
|
||||||
|
|
||||||
def position_code(self, p):
|
def position_code(self, p):
|
||||||
|
units = str(p['units']).lower()
|
||||||
|
|
||||||
|
# we work only with METRIC units because HPGL mention only metric units so if FlatCAM units are INCH we
|
||||||
|
# transform them in METRIC
|
||||||
|
if units == 'in':
|
||||||
|
x = p.x * 25.4
|
||||||
|
y = p.y * 25.4
|
||||||
|
else:
|
||||||
|
x = p.x
|
||||||
|
y = p.y
|
||||||
|
|
||||||
|
# we need to have the coordinates as multiples of 0.025mm
|
||||||
|
x = round(x / 0.025) * 25 / 1000
|
||||||
|
y = round(y / 0.025) * 25 / 1000
|
||||||
|
|
||||||
return ('PA' + self.coordinate_format + ',' + self.coordinate_format + ';') % \
|
return ('PA' + self.coordinate_format + ',' + self.coordinate_format + ';') % \
|
||||||
(p.coords_decimals, p.x, p.coords_decimals, p.y)
|
(p.coords_decimals, x, p.coords_decimals, y)
|
||||||
|
|
||||||
def rapid_code(self, p):
|
def rapid_code(self, p):
|
||||||
return self.position_code(p).format(**p)
|
return self.position_code(p).format(**p)
|
||||||
|
|
Loading…
Reference in New Issue