|
@@ -7,7 +7,7 @@
|
|
|
|
|
|
|
|
from PyQt5 import QtWidgets, QtGui, QtCore
|
|
from PyQt5 import QtWidgets, QtGui, QtCore
|
|
|
from FlatCAMTool import FlatCAMTool
|
|
from FlatCAMTool import FlatCAMTool
|
|
|
-from flatcamGUI.GUIElements import FCDoubleSpinner, FCCheckBox, RadioSet, FCComboBox, OptionalInputSection
|
|
|
|
|
|
|
+from flatcamGUI.GUIElements import FCDoubleSpinner, FCCheckBox, RadioSet, FCComboBox, OptionalInputSection, FCButton
|
|
|
from FlatCAMObj import FlatCAMGerber
|
|
from FlatCAMObj import FlatCAMGerber
|
|
|
|
|
|
|
|
from shapely.geometry import box, MultiPolygon, Polygon, LineString, LinearRing
|
|
from shapely.geometry import box, MultiPolygon, Polygon, LineString, LinearRing
|
|
@@ -59,23 +59,39 @@ class CutOut(FlatCAMTool):
|
|
|
""")
|
|
""")
|
|
|
self.layout.addWidget(title_label)
|
|
self.layout.addWidget(title_label)
|
|
|
|
|
|
|
|
|
|
+ self.layout.addWidget(QtWidgets.QLabel(''))
|
|
|
|
|
+
|
|
|
# Form Layout
|
|
# Form Layout
|
|
|
grid0 = QtWidgets.QGridLayout()
|
|
grid0 = QtWidgets.QGridLayout()
|
|
|
grid0.setColumnStretch(0, 0)
|
|
grid0.setColumnStretch(0, 0)
|
|
|
grid0.setColumnStretch(1, 1)
|
|
grid0.setColumnStretch(1, 1)
|
|
|
self.layout.addLayout(grid0)
|
|
self.layout.addLayout(grid0)
|
|
|
|
|
|
|
|
- # Type of object to be cutout
|
|
|
|
|
- self.type_obj_combo = QtWidgets.QComboBox()
|
|
|
|
|
- self.type_obj_combo.addItem("Gerber")
|
|
|
|
|
- self.type_obj_combo.addItem("Excellon")
|
|
|
|
|
- self.type_obj_combo.addItem("Geometry")
|
|
|
|
|
|
|
+ self.object_label = QtWidgets.QLabel('<b>%s:</b>' % _("Source Object"))
|
|
|
|
|
+ self.object_label.setToolTip('%s.' % _("Object to be cutout"))
|
|
|
|
|
|
|
|
- # we get rid of item1 ("Excellon") as it is not suitable for creating film
|
|
|
|
|
- self.type_obj_combo.view().setRowHidden(1, True)
|
|
|
|
|
- self.type_obj_combo.setItemIcon(0, QtGui.QIcon(self.app.resource_location + "/flatcam_icon16.png"))
|
|
|
|
|
- # self.type_obj_combo.setItemIcon(1, QtGui.QIcon(self.app.resource_location + "/drill16.png"))
|
|
|
|
|
- self.type_obj_combo.setItemIcon(2, QtGui.QIcon(self.app.resource_location + "/geometry16.png"))
|
|
|
|
|
|
|
+ grid0.addWidget(self.object_label, 0, 0, 1, 2)
|
|
|
|
|
+
|
|
|
|
|
+ # Object kind
|
|
|
|
|
+ self.kindlabel = QtWidgets.QLabel('%s:' % _('Object kind'))
|
|
|
|
|
+ self.kindlabel.setToolTip(
|
|
|
|
|
+ _("Choice of what kind the object we want to cutout is.<BR>"
|
|
|
|
|
+ "- <B>Single</B>: contain a single PCB Gerber outline object.<BR>"
|
|
|
|
|
+ "- <B>Panel</B>: a panel PCB Gerber object, which is made\n"
|
|
|
|
|
+ "out of many individual PCB outlines.")
|
|
|
|
|
+ )
|
|
|
|
|
+ self.obj_kind_combo = RadioSet([
|
|
|
|
|
+ {"label": _("Single"), "value": "single"},
|
|
|
|
|
+ {"label": _("Panel"), "value": "panel"},
|
|
|
|
|
+ ])
|
|
|
|
|
+ grid0.addWidget(self.kindlabel, 1, 0)
|
|
|
|
|
+ grid0.addWidget(self.obj_kind_combo, 1, 1)
|
|
|
|
|
+
|
|
|
|
|
+ # Type of object to be cutout
|
|
|
|
|
+ self.type_obj_radio = RadioSet([
|
|
|
|
|
+ {"label": _("Gerber"), "value": "grb"},
|
|
|
|
|
+ {"label": _("Geometry"), "value": "geo"},
|
|
|
|
|
+ ])
|
|
|
|
|
|
|
|
self.type_obj_combo_label = QtWidgets.QLabel('%s:' % _("Object Type"))
|
|
self.type_obj_combo_label = QtWidgets.QLabel('%s:' % _("Object Type"))
|
|
|
self.type_obj_combo_label.setToolTip(
|
|
self.type_obj_combo_label.setToolTip(
|
|
@@ -84,12 +100,9 @@ class CutOut(FlatCAMTool):
|
|
|
"What is selected here will dictate the kind\n"
|
|
"What is selected here will dictate the kind\n"
|
|
|
"of objects that will populate the 'Object' combobox.")
|
|
"of objects that will populate the 'Object' combobox.")
|
|
|
)
|
|
)
|
|
|
- self.type_obj_combo_label.setMinimumWidth(60)
|
|
|
|
|
- grid0.addWidget(self.type_obj_combo_label, 0, 0)
|
|
|
|
|
- grid0.addWidget(self.type_obj_combo, 0, 1)
|
|
|
|
|
|
|
|
|
|
- self.object_label = QtWidgets.QLabel('<b>%s:</b>' % _("Object to be cutout"))
|
|
|
|
|
- self.object_label.setToolTip('%s.' % _("Object to be cutout"))
|
|
|
|
|
|
|
+ grid0.addWidget(self.type_obj_combo_label, 2, 0)
|
|
|
|
|
+ grid0.addWidget(self.type_obj_radio, 2, 1)
|
|
|
|
|
|
|
|
# Object to be cutout
|
|
# Object to be cutout
|
|
|
self.obj_combo = QtWidgets.QComboBox()
|
|
self.obj_combo = QtWidgets.QComboBox()
|
|
@@ -97,23 +110,17 @@ class CutOut(FlatCAMTool):
|
|
|
self.obj_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
|
|
self.obj_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
|
|
|
self.obj_combo.setCurrentIndex(1)
|
|
self.obj_combo.setCurrentIndex(1)
|
|
|
|
|
|
|
|
- grid0.addWidget(self.object_label, 1, 0, 1, 2)
|
|
|
|
|
- grid0.addWidget(self.obj_combo, 2, 0, 1, 2)
|
|
|
|
|
|
|
+ grid0.addWidget(self.obj_combo, 3, 0, 1, 2)
|
|
|
|
|
|
|
|
- # Object kind
|
|
|
|
|
- self.kindlabel = QtWidgets.QLabel('%s:' % _('Object kind'))
|
|
|
|
|
- self.kindlabel.setToolTip(
|
|
|
|
|
- _("Choice of what kind the object we want to cutout is.<BR>"
|
|
|
|
|
- "- <B>Single</B>: contain a single PCB Gerber outline object.<BR>"
|
|
|
|
|
- "- <B>Panel</B>: a panel PCB Gerber object, which is made\n"
|
|
|
|
|
- "out of many individual PCB outlines.")
|
|
|
|
|
- )
|
|
|
|
|
- self.obj_kind_combo = RadioSet([
|
|
|
|
|
- {"label": _("Single"), "value": "single"},
|
|
|
|
|
- {"label": _("Panel"), "value": "panel"},
|
|
|
|
|
- ])
|
|
|
|
|
- grid0.addWidget(self.kindlabel, 3, 0)
|
|
|
|
|
- grid0.addWidget(self.obj_kind_combo, 3, 1)
|
|
|
|
|
|
|
+ separator_line = QtWidgets.QFrame()
|
|
|
|
|
+ separator_line.setFrameShape(QtWidgets.QFrame.HLine)
|
|
|
|
|
+ separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
|
|
|
|
|
+ grid0.addWidget(separator_line, 4, 0, 1, 2)
|
|
|
|
|
+
|
|
|
|
|
+ grid0.addWidget(QtWidgets.QLabel(''), 5, 0, 1, 2)
|
|
|
|
|
+
|
|
|
|
|
+ self.param_label = QtWidgets.QLabel('<b>%s:</b>' % _("Tool Parameters"))
|
|
|
|
|
+ grid0.addWidget(self.param_label, 6, 0, 1, 2)
|
|
|
|
|
|
|
|
# Tool Diameter
|
|
# Tool Diameter
|
|
|
self.dia = FCDoubleSpinner()
|
|
self.dia = FCDoubleSpinner()
|
|
@@ -125,8 +132,8 @@ class CutOut(FlatCAMTool):
|
|
|
_("Diameter of the tool used to cutout\n"
|
|
_("Diameter of the tool used to cutout\n"
|
|
|
"the PCB shape out of the surrounding material.")
|
|
"the PCB shape out of the surrounding material.")
|
|
|
)
|
|
)
|
|
|
- grid0.addWidget(self.dia_label, 4, 0)
|
|
|
|
|
- grid0.addWidget(self.dia, 4, 1)
|
|
|
|
|
|
|
+ grid0.addWidget(self.dia_label, 8, 0)
|
|
|
|
|
+ grid0.addWidget(self.dia, 8, 1)
|
|
|
|
|
|
|
|
# Cut Z
|
|
# Cut Z
|
|
|
cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
|
|
cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
|
|
@@ -146,8 +153,8 @@ class CutOut(FlatCAMTool):
|
|
|
|
|
|
|
|
self.cutz_entry.setSingleStep(0.1)
|
|
self.cutz_entry.setSingleStep(0.1)
|
|
|
|
|
|
|
|
- grid0.addWidget(cutzlabel, 5, 0)
|
|
|
|
|
- grid0.addWidget(self.cutz_entry, 5, 1)
|
|
|
|
|
|
|
+ grid0.addWidget(cutzlabel, 9, 0)
|
|
|
|
|
+ grid0.addWidget(self.cutz_entry, 9, 1)
|
|
|
|
|
|
|
|
# Multi-pass
|
|
# Multi-pass
|
|
|
self.mpass_cb = FCCheckBox('%s:' % _("Multi-Depth"))
|
|
self.mpass_cb = FCCheckBox('%s:' % _("Multi-Depth"))
|
|
@@ -172,8 +179,8 @@ class CutOut(FlatCAMTool):
|
|
|
)
|
|
)
|
|
|
self.ois_mpass_geo = OptionalInputSection(self.mpass_cb, [self.maxdepth_entry])
|
|
self.ois_mpass_geo = OptionalInputSection(self.mpass_cb, [self.maxdepth_entry])
|
|
|
|
|
|
|
|
- grid0.addWidget(self.mpass_cb, 6, 0)
|
|
|
|
|
- grid0.addWidget(self.maxdepth_entry, 6, 1)
|
|
|
|
|
|
|
+ grid0.addWidget(self.mpass_cb, 10, 0)
|
|
|
|
|
+ grid0.addWidget(self.maxdepth_entry, 10, 1)
|
|
|
|
|
|
|
|
# Margin
|
|
# Margin
|
|
|
self.margin = FCDoubleSpinner()
|
|
self.margin = FCDoubleSpinner()
|
|
@@ -187,8 +194,8 @@ class CutOut(FlatCAMTool):
|
|
|
"will make the cutout of the PCB further from\n"
|
|
"will make the cutout of the PCB further from\n"
|
|
|
"the actual PCB border")
|
|
"the actual PCB border")
|
|
|
)
|
|
)
|
|
|
- grid0.addWidget(self.margin_label, 7, 0)
|
|
|
|
|
- grid0.addWidget(self.margin, 7, 1)
|
|
|
|
|
|
|
+ grid0.addWidget(self.margin_label, 11, 0)
|
|
|
|
|
+ grid0.addWidget(self.margin, 11, 1)
|
|
|
|
|
|
|
|
# Gapsize
|
|
# Gapsize
|
|
|
self.gapsize = FCDoubleSpinner()
|
|
self.gapsize = FCDoubleSpinner()
|
|
@@ -201,8 +208,8 @@ class CutOut(FlatCAMTool):
|
|
|
"the surrounding material (the one \n"
|
|
"the surrounding material (the one \n"
|
|
|
"from which the PCB is cutout).")
|
|
"from which the PCB is cutout).")
|
|
|
)
|
|
)
|
|
|
- grid0.addWidget(self.gapsize_label, 8, 0)
|
|
|
|
|
- grid0.addWidget(self.gapsize, 8, 1)
|
|
|
|
|
|
|
+ grid0.addWidget(self.gapsize_label, 13, 0)
|
|
|
|
|
+ grid0.addWidget(self.gapsize, 13, 1)
|
|
|
|
|
|
|
|
# How gaps wil be rendered:
|
|
# How gaps wil be rendered:
|
|
|
# lr - left + right
|
|
# lr - left + right
|
|
@@ -219,12 +226,14 @@ class CutOut(FlatCAMTool):
|
|
|
_("Create a convex shape surrounding the entire PCB.\n"
|
|
_("Create a convex shape surrounding the entire PCB.\n"
|
|
|
"Used only if the source object type is Gerber.")
|
|
"Used only if the source object type is Gerber.")
|
|
|
)
|
|
)
|
|
|
- grid0.addWidget(self.convex_box, 9, 0, 1, 2)
|
|
|
|
|
|
|
+ grid0.addWidget(self.convex_box, 15, 0, 1, 2)
|
|
|
|
|
|
|
|
separator_line = QtWidgets.QFrame()
|
|
separator_line = QtWidgets.QFrame()
|
|
|
separator_line.setFrameShape(QtWidgets.QFrame.HLine)
|
|
separator_line.setFrameShape(QtWidgets.QFrame.HLine)
|
|
|
separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
|
|
separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
|
|
|
- grid0.addWidget(separator_line, 10, 0, 1, 2)
|
|
|
|
|
|
|
+ grid0.addWidget(separator_line, 16, 0, 1, 2)
|
|
|
|
|
+
|
|
|
|
|
+ grid0.addWidget(QtWidgets.QLabel(''), 17, 0, 1, 2)
|
|
|
|
|
|
|
|
# Title2
|
|
# Title2
|
|
|
title_param_label = QtWidgets.QLabel("<font size=4><b>%s</b></font>" % _('A. Automatic Bridge Gaps'))
|
|
title_param_label = QtWidgets.QLabel("<font size=4><b>%s</b></font>" % _('A. Automatic Bridge Gaps'))
|
|
@@ -398,13 +407,13 @@ class CutOut(FlatCAMTool):
|
|
|
self.ff_cutout_object_btn.clicked.connect(self.on_freeform_cutout)
|
|
self.ff_cutout_object_btn.clicked.connect(self.on_freeform_cutout)
|
|
|
self.rect_cutout_object_btn.clicked.connect(self.on_rectangular_cutout)
|
|
self.rect_cutout_object_btn.clicked.connect(self.on_rectangular_cutout)
|
|
|
|
|
|
|
|
- self.type_obj_combo.currentIndexChanged.connect(self.on_type_obj_index_changed)
|
|
|
|
|
|
|
+ self.type_obj_radio.activated_custom.connect(self.on_type_obj_changed)
|
|
|
self.man_geo_creation_btn.clicked.connect(self.on_manual_geo)
|
|
self.man_geo_creation_btn.clicked.connect(self.on_manual_geo)
|
|
|
self.man_gaps_creation_btn.clicked.connect(self.on_manual_gap_click)
|
|
self.man_gaps_creation_btn.clicked.connect(self.on_manual_gap_click)
|
|
|
self.reset_button.clicked.connect(self.set_tool_ui)
|
|
self.reset_button.clicked.connect(self.set_tool_ui)
|
|
|
|
|
|
|
|
- def on_type_obj_index_changed(self, index):
|
|
|
|
|
- obj_type = self.type_obj_combo.currentIndex()
|
|
|
|
|
|
|
+ def on_type_obj_changed(self, val):
|
|
|
|
|
+ obj_type = {'grb': 0, 'geo': 2}[val]
|
|
|
self.obj_combo.setRootModelIndex(self.app.collection.index(obj_type, 0, QtCore.QModelIndex()))
|
|
self.obj_combo.setRootModelIndex(self.app.collection.index(obj_type, 0, QtCore.QModelIndex()))
|
|
|
self.obj_combo.setCurrentIndex(0)
|
|
self.obj_combo.setCurrentIndex(0)
|
|
|
|
|
|
|
@@ -451,6 +460,7 @@ class CutOut(FlatCAMTool):
|
|
|
self.gapsize.set_value(float(self.app.defaults["tools_cutoutgapsize"]))
|
|
self.gapsize.set_value(float(self.app.defaults["tools_cutoutgapsize"]))
|
|
|
self.gaps.set_value(self.app.defaults["tools_gaps_ff"])
|
|
self.gaps.set_value(self.app.defaults["tools_gaps_ff"])
|
|
|
self.convex_box.set_value(self.app.defaults['tools_cutout_convexshape'])
|
|
self.convex_box.set_value(self.app.defaults['tools_cutout_convexshape'])
|
|
|
|
|
+ self.type_obj_radio.set_value('grb')
|
|
|
|
|
|
|
|
def on_freeform_cutout(self):
|
|
def on_freeform_cutout(self):
|
|
|
|
|
|