Merged jpcgt/flatcam/master into tcl-commands
This commit is contained in:
commit
1bc3a0230c
12
FlatCAM.py
12
FlatCAM.py
|
@ -1,10 +1,13 @@
|
||||||
import sys
|
import sys
|
||||||
from PyQt4 import QtGui
|
from PyQt4 import QtGui
|
||||||
from PyQt4 import QtCore
|
|
||||||
from FlatCAMApp import App
|
from FlatCAMApp import App
|
||||||
|
|
||||||
|
|
||||||
def debug_trace():
|
def debug_trace():
|
||||||
'''Set a tracepoint in the Python debugger that works with Qt'''
|
"""
|
||||||
|
Set a tracepoint in the Python debugger that works with Qt
|
||||||
|
:return: None
|
||||||
|
"""
|
||||||
from PyQt4.QtCore import pyqtRemoveInputHook
|
from PyQt4.QtCore import pyqtRemoveInputHook
|
||||||
#from pdb import set_trace
|
#from pdb import set_trace
|
||||||
pyqtRemoveInputHook()
|
pyqtRemoveInputHook()
|
||||||
|
@ -12,8 +15,9 @@ def debug_trace():
|
||||||
|
|
||||||
debug_trace()
|
debug_trace()
|
||||||
|
|
||||||
# all X11 calling should be thread safe otherwise we have strange issues
|
# All X11 calling should be thread safe otherwise we have strange issues
|
||||||
QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_X11InitThreads)
|
# QtCore.QCoreApplication.setAttribute(QtCore.Qt.AA_X11InitThreads)
|
||||||
|
# NOTE: Never talk to the GUI from threads! This is why I commented the above.
|
||||||
|
|
||||||
app = QtGui.QApplication(sys.argv)
|
app = QtGui.QApplication(sys.argv)
|
||||||
fc = App()
|
fc = App()
|
||||||
|
|
|
@ -231,6 +231,7 @@ class App(QtCore.QObject):
|
||||||
"excellon_feedrate": self.defaults_form.excellon_group.feedrate_entry,
|
"excellon_feedrate": self.defaults_form.excellon_group.feedrate_entry,
|
||||||
"excellon_spindlespeed": self.defaults_form.excellon_group.spindlespeed_entry,
|
"excellon_spindlespeed": self.defaults_form.excellon_group.spindlespeed_entry,
|
||||||
"excellon_toolchangez": self.defaults_form.excellon_group.toolchangez_entry,
|
"excellon_toolchangez": self.defaults_form.excellon_group.toolchangez_entry,
|
||||||
|
"excellon_tooldia": self.defaults_form.excellon_group.tooldia_entry,
|
||||||
"geometry_plot": self.defaults_form.geometry_group.plot_cb,
|
"geometry_plot": self.defaults_form.geometry_group.plot_cb,
|
||||||
"geometry_cutz": self.defaults_form.geometry_group.cutz_entry,
|
"geometry_cutz": self.defaults_form.geometry_group.cutz_entry,
|
||||||
"geometry_travelz": self.defaults_form.geometry_group.travelz_entry,
|
"geometry_travelz": self.defaults_form.geometry_group.travelz_entry,
|
||||||
|
@ -360,6 +361,7 @@ class App(QtCore.QObject):
|
||||||
"excellon_feedrate": self.options_form.excellon_group.feedrate_entry,
|
"excellon_feedrate": self.options_form.excellon_group.feedrate_entry,
|
||||||
"excellon_spindlespeed": self.options_form.excellon_group.spindlespeed_entry,
|
"excellon_spindlespeed": self.options_form.excellon_group.spindlespeed_entry,
|
||||||
"excellon_toolchangez": self.options_form.excellon_group.toolchangez_entry,
|
"excellon_toolchangez": self.options_form.excellon_group.toolchangez_entry,
|
||||||
|
"excellon_tooldia": self.options_form.excellon_group.tooldia_entry,
|
||||||
"geometry_plot": self.options_form.geometry_group.plot_cb,
|
"geometry_plot": self.options_form.geometry_group.plot_cb,
|
||||||
"geometry_cutz": self.options_form.geometry_group.cutz_entry,
|
"geometry_cutz": self.options_form.geometry_group.cutz_entry,
|
||||||
"geometry_travelz": self.options_form.geometry_group.travelz_entry,
|
"geometry_travelz": self.options_form.geometry_group.travelz_entry,
|
||||||
|
|
|
@ -607,6 +607,23 @@ class ExcellonOptionsGroupUI(OptionsGroupUI):
|
||||||
self.spindlespeed_entry = IntEntry(allow_empty=True)
|
self.spindlespeed_entry = IntEntry(allow_empty=True)
|
||||||
grid1.addWidget(self.spindlespeed_entry, 4, 1)
|
grid1.addWidget(self.spindlespeed_entry, 4, 1)
|
||||||
|
|
||||||
|
#### Milling Holes ####
|
||||||
|
self.mill_hole_label = QtGui.QLabel('<b>Mill Holes</b>')
|
||||||
|
self.mill_hole_label.setToolTip(
|
||||||
|
"Create Geometry for milling holes."
|
||||||
|
)
|
||||||
|
self.layout.addWidget(self.mill_hole_label)
|
||||||
|
|
||||||
|
grid1 = QtGui.QGridLayout()
|
||||||
|
self.layout.addLayout(grid1)
|
||||||
|
tdlabel = QtGui.QLabel('Tool dia:')
|
||||||
|
tdlabel.setToolTip(
|
||||||
|
"Diameter of the cutting tool."
|
||||||
|
)
|
||||||
|
grid1.addWidget(tdlabel, 0, 0)
|
||||||
|
self.tooldia_entry = LengthEntry()
|
||||||
|
grid1.addWidget(self.tooldia_entry, 0, 1)
|
||||||
|
|
||||||
|
|
||||||
class GeometryOptionsGroupUI(OptionsGroupUI):
|
class GeometryOptionsGroupUI(OptionsGroupUI):
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
|
|
17
camlib.py
17
camlib.py
|
@ -2782,7 +2782,9 @@ class CNCjob(Geometry):
|
||||||
else:
|
else:
|
||||||
selected_tools = [x.strip() for x in tools.split(",")] # we strip spaces and also separate the tools by ','
|
selected_tools = [x.strip() for x in tools.split(",")] # we strip spaces and also separate the tools by ','
|
||||||
selected_tools = filter(lambda i: i in selected_tools, selected_tools)
|
selected_tools = filter(lambda i: i in selected_tools, selected_tools)
|
||||||
tools = [i for i,j in sorted_tools for k in selected_tools if i == k] # create a sorted list of selected tools from the sorted_tools list
|
|
||||||
|
# Create a sorted list of selected tools from the sorted_tools list
|
||||||
|
tools = [i for i, j in sorted_tools for k in selected_tools if i == k]
|
||||||
log.debug("Tools selected and sorted are: %s" % str(tools))
|
log.debug("Tools selected and sorted are: %s" % str(tools))
|
||||||
|
|
||||||
# Points (Group by tool)
|
# Points (Group by tool)
|
||||||
|
@ -2800,7 +2802,8 @@ class CNCjob(Geometry):
|
||||||
# Basic G-Code macros
|
# Basic G-Code macros
|
||||||
t = "G00 " + CNCjob.defaults["coordinate_format"] + "\n"
|
t = "G00 " + CNCjob.defaults["coordinate_format"] + "\n"
|
||||||
down = "G01 Z%.4f\n" % self.z_cut
|
down = "G01 Z%.4f\n" % self.z_cut
|
||||||
up = "G01 Z%.4f\n" % self.z_move
|
up = "G00 Z%.4f\n" % self.z_move
|
||||||
|
up_to_zero = "G01 Z0\n"
|
||||||
|
|
||||||
# Initialization
|
# Initialization
|
||||||
gcode = self.unitcode[self.units.upper()] + "\n"
|
gcode = self.unitcode[self.units.upper()] + "\n"
|
||||||
|
@ -2810,7 +2813,8 @@ class CNCjob(Geometry):
|
||||||
gcode += "G00 Z%.4f\n" % self.z_move # Move to travel height
|
gcode += "G00 Z%.4f\n" % self.z_move # Move to travel height
|
||||||
|
|
||||||
if self.spindlespeed is not None:
|
if self.spindlespeed is not None:
|
||||||
gcode += "M03 S%d\n" % int(self.spindlespeed) # Spindle start with configured speed
|
# Spindle start with configured speed
|
||||||
|
gcode += "M03 S%d\n" % int(self.spindlespeed)
|
||||||
else:
|
else:
|
||||||
gcode += "M03\n" # Spindle start
|
gcode += "M03\n" # Spindle start
|
||||||
|
|
||||||
|
@ -2818,7 +2822,7 @@ class CNCjob(Geometry):
|
||||||
|
|
||||||
for tool in tools:
|
for tool in tools:
|
||||||
|
|
||||||
# only if tool have some points, otherwise thre may be error and this part is useless
|
# Only if tool has points.
|
||||||
if tool in points:
|
if tool in points:
|
||||||
# Tool change sequence (optional)
|
# Tool change sequence (optional)
|
||||||
if toolchange:
|
if toolchange:
|
||||||
|
@ -2829,7 +2833,8 @@ class CNCjob(Geometry):
|
||||||
gcode += "(MSG, Change to tool dia=%.4f)\n" % exobj.tools[tool]["C"]
|
gcode += "(MSG, Change to tool dia=%.4f)\n" % exobj.tools[tool]["C"]
|
||||||
gcode += "M0\n" # Temporary machine stop
|
gcode += "M0\n" # Temporary machine stop
|
||||||
if self.spindlespeed is not None:
|
if self.spindlespeed is not None:
|
||||||
gcode += "M03 S%d\n" % int(self.spindlespeed) # Spindle start with configured speed
|
# Spindle start with configured speed
|
||||||
|
gcode += "M03 S%d\n" % int(self.spindlespeed)
|
||||||
else:
|
else:
|
||||||
gcode += "M03\n" # Spindle start
|
gcode += "M03\n" # Spindle start
|
||||||
|
|
||||||
|
@ -2837,7 +2842,7 @@ class CNCjob(Geometry):
|
||||||
for point in points[tool]:
|
for point in points[tool]:
|
||||||
x, y = point.coords.xy
|
x, y = point.coords.xy
|
||||||
gcode += t % (x[0], y[0])
|
gcode += t % (x[0], y[0])
|
||||||
gcode += down + up
|
gcode += down + up_to_zero + up
|
||||||
|
|
||||||
gcode += t % (0, 0)
|
gcode += t % (0, 0)
|
||||||
gcode += "M05\n" # Spindle stop
|
gcode += "M05\n" # Spindle stop
|
||||||
|
|
Loading…
Reference in New Issue