Prepend to gcode. Impements issue #115.
This commit is contained in:
parent
9dec4ff32f
commit
b89a04d1e2
|
@ -797,7 +797,8 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
|
||||||
self.options.update({
|
self.options.update({
|
||||||
"plot": True,
|
"plot": True,
|
||||||
"tooldia": 0.4 / 25.4, # 0.4mm in inches
|
"tooldia": 0.4 / 25.4, # 0.4mm in inches
|
||||||
"append": ""
|
"append": "",
|
||||||
|
"prepend": ""
|
||||||
})
|
})
|
||||||
|
|
||||||
# Attributes to be included in serialization
|
# Attributes to be included in serialization
|
||||||
|
@ -815,7 +816,8 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
|
||||||
self.form_fields.update({
|
self.form_fields.update({
|
||||||
"plot": self.ui.plot_cb,
|
"plot": self.ui.plot_cb,
|
||||||
"tooldia": self.ui.tooldia_entry,
|
"tooldia": self.ui.tooldia_entry,
|
||||||
"append": self.ui.append_text
|
"append": self.ui.append_text,
|
||||||
|
"prepend": self.ui.prepend_text
|
||||||
})
|
})
|
||||||
|
|
||||||
self.ui.plot_cb.stateChanged.connect(self.on_plot_cb_click)
|
self.ui.plot_cb.stateChanged.connect(self.on_plot_cb_click)
|
||||||
|
@ -839,9 +841,10 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
|
||||||
except TypeError:
|
except TypeError:
|
||||||
filename = QtGui.QFileDialog.getSaveFileName(caption="Export G-Code ...")
|
filename = QtGui.QFileDialog.getSaveFileName(caption="Export G-Code ...")
|
||||||
|
|
||||||
|
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='', postamble=postamble)
|
self.export_gcode(filename, preamble=preamble, postamble=postamble)
|
||||||
|
|
||||||
def export_gcode(self, filename, preamble='', postamble=''):
|
def export_gcode(self, filename, preamble='', postamble=''):
|
||||||
f = open(filename, 'w')
|
f = open(filename, 'w')
|
||||||
|
|
11
ObjectUI.py
11
ObjectUI.py
|
@ -169,6 +169,17 @@ class CNCObjectUI(ObjectUI):
|
||||||
)
|
)
|
||||||
self.custom_box.addWidget(self.export_gcode_label)
|
self.custom_box.addWidget(self.export_gcode_label)
|
||||||
|
|
||||||
|
# Prepend text to Gerber
|
||||||
|
prependlabel = QtGui.QLabel('Prepend to G-Code:')
|
||||||
|
prependlabel.setToolTip(
|
||||||
|
"Type here any G-Code commands you would\n"
|
||||||
|
"like to add to the beginning of the generated file."
|
||||||
|
)
|
||||||
|
self.custom_box.addWidget(prependlabel)
|
||||||
|
|
||||||
|
self.prepend_text = FCTextArea()
|
||||||
|
self.custom_box.addWidget(self.prepend_text)
|
||||||
|
|
||||||
# Append text to Gerber
|
# Append text to Gerber
|
||||||
appendlabel = QtGui.QLabel('Append to G-Code:')
|
appendlabel = QtGui.QLabel('Append to G-Code:')
|
||||||
appendlabel.setToolTip(
|
appendlabel.setToolTip(
|
||||||
|
|
Loading…
Reference in New Issue