- added some geometry parameters in Cutout Tool as a convenience, to be passed to the generated Geometry objects

This commit is contained in:
Marius Stanciu 2019-12-03 23:44:53 +02:00 committed by Marius
parent 8d45f77085
commit b1547bf6b9
4 changed files with 113 additions and 36 deletions

View File

@ -732,6 +732,9 @@ class App(QtCore.QObject):
"tools_cutouttooldia": 2.4,
"tools_cutoutkind": "single",
"tools_cutoutmargin": 0.1,
"tools_cutout_z": -1.8,
"tools_cutout_depthperpass": 0.6,
"tools_cutout_mdepth": True,
"tools_cutoutgapsize": 4,
"tools_gaps_ff": "4",
"tools_cutout_convexshape": False,
@ -1293,6 +1296,9 @@ class App(QtCore.QObject):
"tools_cutouttooldia": self.ui.tools_defaults_form.tools_cutout_group.cutout_tooldia_entry,
"tools_cutoutkind": self.ui.tools_defaults_form.tools_cutout_group.obj_kind_combo,
"tools_cutoutmargin": self.ui.tools_defaults_form.tools_cutout_group.cutout_margin_entry,
"tools_cutout_z": self.ui.tools_defaults_form.tools_cutout_group.cutz_entry,
"tools_cutout_depthperpass": self.ui.tools_defaults_form.tools_cutout_group.maxdepth_entry,
"tools_cutout_mdepth": self.ui.tools_defaults_form.tools_cutout_group.mpass_cb,
"tools_cutoutgapsize": self.ui.tools_defaults_form.tools_cutout_group.cutout_gap_entry,
"tools_gaps_ff": self.ui.tools_defaults_form.tools_cutout_group.gaps_combo,
"tools_cutout_convexshape": self.ui.tools_defaults_form.tools_cutout_group.convex_box,

View File

@ -17,6 +17,7 @@ CAD program, and create G-Code for Isolation routing.
- various small fixes
- fix for toggle grid lines updating canvas only after moving the mouse (hack, actually)
- some changes in the UI layout in Cutout Tool
- added some geometry parameters in Cutout Tool as a convenience, to be passed to the generated Geometry objects
2.12.2019

View File

@ -4187,7 +4187,7 @@ class ToolsCutoutPrefGroupUI(OptionsGroupUI):
self.setTitle(str(_("Cutout Tool Options")))
self.decimals = 4
# ## Board cuttout
# ## Board cutout
self.board_cutout_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
self.board_cutout_label.setToolTip(
_("Create toolpaths to cut around\n"
@ -4199,33 +4199,77 @@ class ToolsCutoutPrefGroupUI(OptionsGroupUI):
grid0 = QtWidgets.QGridLayout()
self.layout.addLayout(grid0)
tdclabel = QtWidgets.QLabel('%s:' % _('Tool dia'))
tdclabel = QtWidgets.QLabel('%s:' % _('Tool Diameter'))
tdclabel.setToolTip(
_("Diameter of the tool used to cutout\n"
"the PCB shape out of the surrounding material.")
)
grid0.addWidget(tdclabel, 0, 0)
self.cutout_tooldia_entry = FCDoubleSpinner()
self.cutout_tooldia_entry.set_range(0.000001, 9999.9999)
self.cutout_tooldia_entry.set_precision(self.decimals)
self.cutout_tooldia_entry.setSingleStep(0.1)
grid0.addWidget(tdclabel, 0, 0)
grid0.addWidget(self.cutout_tooldia_entry, 0, 1)
# Cut Z
cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
cutzlabel.setToolTip(
_(
"Cutting depth (negative)\n"
"below the copper surface."
)
)
self.cutz_entry = FCDoubleSpinner()
self.cutz_entry.set_precision(self.decimals)
if machinist_setting == 0:
self.cutz_entry.setRange(-9999.9999, -0.00001)
else:
self.cutz_entry.setRange(-9999.9999, 9999.9999)
self.cutz_entry.setSingleStep(0.1)
grid0.addWidget(cutzlabel, 1, 0)
grid0.addWidget(self.cutz_entry, 1, 1)
# Multi-pass
self.mpass_cb = FCCheckBox('%s:' % _("Multi-Depth"))
self.mpass_cb.setToolTip(
_(
"Use multiple passes to limit\n"
"the cut depth in each pass. Will\n"
"cut multiple times until Cut Z is\n"
"reached."
)
)
self.maxdepth_entry = FCDoubleSpinner()
self.maxdepth_entry.set_precision(self.decimals)
self.maxdepth_entry.setRange(0, 9999.9999)
self.maxdepth_entry.setSingleStep(0.1)
self.maxdepth_entry.setToolTip(_("Depth of each pass (positive)."))
grid0.addWidget(self.mpass_cb, 2, 0)
grid0.addWidget(self.maxdepth_entry, 2, 1)
# Object kind
kindlabel = QtWidgets.QLabel('%s:' % _('Obj kind'))
kindlabel = QtWidgets.QLabel('%s:' % _('Object kind'))
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.")
)
grid0.addWidget(kindlabel, 1, 0)
self.obj_kind_combo = RadioSet([
{"label": _("Single"), "value": "single"},
{"label": _("Panel"), "value": "panel"},
])
grid0.addWidget(self.obj_kind_combo, 1, 1)
grid0.addWidget(kindlabel, 3, 0)
grid0.addWidget(self.obj_kind_combo, 3, 1)
marginlabel = QtWidgets.QLabel('%s:' % _('Margin'))
marginlabel.setToolTip(
@ -4233,13 +4277,14 @@ class ToolsCutoutPrefGroupUI(OptionsGroupUI):
"will make the cutout of the PCB further from\n"
"the actual PCB border")
)
grid0.addWidget(marginlabel, 2, 0)
self.cutout_margin_entry = FCDoubleSpinner()
self.cutout_margin_entry.set_range(-9999.9999, 9999.9999)
self.cutout_margin_entry.set_precision(self.decimals)
self.cutout_margin_entry.setSingleStep(0.1)
grid0.addWidget(self.cutout_margin_entry, 2, 1)
grid0.addWidget(marginlabel, 4, 0)
grid0.addWidget(self.cutout_margin_entry, 4, 1)
gaplabel = QtWidgets.QLabel('%s:' % _('Gap size'))
gaplabel.setToolTip(
@ -4248,13 +4293,14 @@ class ToolsCutoutPrefGroupUI(OptionsGroupUI):
"the surrounding material (the one \n"
"from which the PCB is cutout).")
)
grid0.addWidget(gaplabel, 3, 0)
self.cutout_gap_entry = FCDoubleSpinner()
self.cutout_gap_entry.set_range(0.000001, 9999.9999)
self.cutout_gap_entry.set_precision(self.decimals)
self.cutout_gap_entry.setSingleStep(0.1)
grid0.addWidget(self.cutout_gap_entry, 3, 1)
grid0.addWidget(gaplabel, 5, 0)
grid0.addWidget(self.cutout_gap_entry, 5, 1)
gaps_label = QtWidgets.QLabel('%s:' % _('Gaps'))
gaps_label.setToolTip(
@ -4269,9 +4315,10 @@ class ToolsCutoutPrefGroupUI(OptionsGroupUI):
"- 2tb - 2*top + 2*bottom\n"
"- 8 - 2*left + 2*right +2*top + 2*bottom")
)
grid0.addWidget(gaps_label, 4, 0)
self.gaps_combo = FCComboBox()
grid0.addWidget(self.gaps_combo, 4, 1)
grid0.addWidget(gaps_label, 6, 0)
grid0.addWidget(self.gaps_combo, 6, 1)
gaps_items = ['None', 'LR', 'TB', '4', '2LR', '2TB', '8']
for it in gaps_items:
@ -4285,8 +4332,8 @@ class ToolsCutoutPrefGroupUI(OptionsGroupUI):
_("Create a convex shape surrounding the entire PCB.\n"
"Used only if the source object type is Gerber.")
)
grid0.addWidget(self.convex_box_label, 5, 0)
grid0.addWidget(self.convex_box, 5, 1)
grid0.addWidget(self.convex_box_label, 7, 0)
grid0.addWidget(self.convex_box, 7, 1)
self.layout.addStretch()

View File

@ -77,7 +77,7 @@ class CutOut(FlatCAMTool):
# self.type_obj_combo.setItemIcon(1, QtGui.QIcon("share/drill16.png"))
self.type_obj_combo.setItemIcon(2, QtGui.QIcon("share/geometry16.png"))
self.type_obj_combo_label = QtWidgets.QLabel('%s:' % _("Obj Type"))
self.type_obj_combo_label = QtWidgets.QLabel('%s:' % _("Object Type"))
self.type_obj_combo_label.setToolTip(
_("Specify the type of object to be cutout.\n"
"It can be of type: Gerber or Geometry.\n"
@ -88,21 +88,20 @@ class CutOut(FlatCAMTool):
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"))
# Object to be cutout
self.obj_combo = QtWidgets.QComboBox()
self.obj_combo.setModel(self.app.collection)
self.obj_combo.setRootModelIndex(self.app.collection.index(0, 0, QtCore.QModelIndex()))
self.obj_combo.setCurrentIndex(1)
self.object_label = QtWidgets.QLabel('%s:' % _("Object"))
self.object_label.setToolTip(
_("Object to be cutout. ")
)
grid0.addWidget(self.object_label, 1, 0)
grid0.addWidget(self.obj_combo, 1, 1)
grid0.addWidget(self.object_label, 1, 0, 1, 2)
grid0.addWidget(self.obj_combo, 2, 0, 1, 2)
# Object kind
self.kindlabel = QtWidgets.QLabel('%s:' % _('Obj 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>"
@ -113,20 +112,21 @@ class CutOut(FlatCAMTool):
{"label": _("Single"), "value": "single"},
{"label": _("Panel"), "value": "panel"},
])
grid0.addWidget(self.kindlabel, 2, 0)
grid0.addWidget(self.obj_kind_combo, 2, 1)
grid0.addWidget(self.kindlabel, 3, 0)
grid0.addWidget(self.obj_kind_combo, 3, 1)
# Tool Diameter
self.dia = FCDoubleSpinner()
self.dia.set_precision(self.decimals)
self.dia.set_range(0.0000, 9999.9999)
self.dia_label = QtWidgets.QLabel('%s:' % _("Tool dia"))
self.dia_label = QtWidgets.QLabel('%s:' % _("Tool Diameter"))
self.dia_label.setToolTip(
_("Diameter of the tool used to cutout\n"
"the PCB shape out of the surrounding material.")
)
grid0.addWidget(self.dia_label, 3, 0)
grid0.addWidget(self.dia, 3, 1)
grid0.addWidget(self.dia_label, 4, 0)
grid0.addWidget(self.dia, 4, 1)
# Cut Z
cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
@ -146,8 +146,8 @@ class CutOut(FlatCAMTool):
self.cutz_entry.setSingleStep(0.1)
grid0.addWidget(cutzlabel, 4, 0)
grid0.addWidget(self.cutz_entry, 4, 1)
grid0.addWidget(cutzlabel, 5, 0)
grid0.addWidget(self.cutz_entry, 5, 1)
# Multi-pass
self.mpass_cb = FCCheckBox('%s:' % _("Multi-Depth"))
@ -172,8 +172,8 @@ class CutOut(FlatCAMTool):
)
self.ois_mpass_geo = OptionalInputSection(self.mpass_cb, [self.maxdepth_entry])
grid0.addWidget(self.mpass_cb, 5, 0)
grid0.addWidget(self.maxdepth_entry, 5, 1)
grid0.addWidget(self.mpass_cb, 6, 0)
grid0.addWidget(self.maxdepth_entry, 6, 1)
# Margin
self.margin = FCDoubleSpinner()
@ -185,8 +185,8 @@ class CutOut(FlatCAMTool):
"will make the cutout of the PCB further from\n"
"the actual PCB border")
)
grid0.addWidget(self.margin_label, 6, 0)
grid0.addWidget(self.margin, 6, 1)
grid0.addWidget(self.margin_label, 7, 0)
grid0.addWidget(self.margin, 7, 1)
# Gapsize
self.gapsize = FCDoubleSpinner()
@ -199,8 +199,8 @@ class CutOut(FlatCAMTool):
"the surrounding material (the one \n"
"from which the PCB is cutout).")
)
grid0.addWidget(self.gapsize_label, 7, 0)
grid0.addWidget(self.gapsize, 7, 1)
grid0.addWidget(self.gapsize_label, 8, 0)
grid0.addWidget(self.gapsize, 8, 1)
# How gaps wil be rendered:
# lr - left + right
@ -217,7 +217,12 @@ class CutOut(FlatCAMTool):
_("Create a convex shape surrounding the entire PCB.\n"
"Used only if the source object type is Gerber.")
)
grid0.addWidget(self.convex_box, 8, 0, 1, 2)
grid0.addWidget(self.convex_box, 9, 0, 1, 2)
separator_line = QtWidgets.QFrame()
separator_line.setFrameShape(QtWidgets.QFrame.HLine)
separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
grid0.addWidget(separator_line, 10, 0, 1, 2)
# Title2
title_param_label = QtWidgets.QLabel("<font size=4><b>%s</b></font>" % _('A. Automatic Bridge Gaps'))
@ -283,6 +288,11 @@ class CutOut(FlatCAMTool):
""")
self.layout.addWidget(self.rect_cutout_object_btn)
separator_line = QtWidgets.QFrame()
separator_line.setFrameShape(QtWidgets.QFrame.HLine)
separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
self.layout.addWidget(separator_line)
# Title5
title_manual_label = QtWidgets.QLabel("<font size=4><b>%s</b></font>" % _('B. Manual Bridge Gaps'))
title_manual_label.setToolTip(
@ -418,6 +428,10 @@ class CutOut(FlatCAMTool):
self.dia.set_value(float(self.app.defaults["tools_cutouttooldia"]))
self.obj_kind_combo.set_value(self.app.defaults["tools_cutoutkind"])
self.margin.set_value(float(self.app.defaults["tools_cutoutmargin"]))
self.cutz_entry.set_value(float(self.app.defaults["tools_cutout_z"]))
self.mpass_cb.set_value(float(self.app.defaults["tools_cutout_mdepth"]))
self.maxdepth_entry.set_value(float(self.app.defaults["tools_cutout_depthperpass"]))
self.gapsize.set_value(float(self.app.defaults["tools_cutoutgapsize"]))
self.gaps.set_value(self.app.defaults["tools_gaps_ff"])
self.convex_box.set_value(self.app.defaults['tools_cutout_convexshape'])
@ -584,6 +598,9 @@ class CutOut(FlatCAMTool):
geo_obj.options['xmax'] = xmax
geo_obj.options['ymax'] = ymax
geo_obj.options['cnctooldia'] = str(dia)
geo_obj.options['cutz'] = self.cutz_entry.get_value()
geo_obj.options['multidepth'] = self.mpass_cb.get_value()
geo_obj.options['depthperpass'] = self.maxdepth_entry.get_value()
outname = cutout_obj.options["name"] + "_cutout"
self.app.new_object('geometry', outname, geo_init)
@ -739,6 +756,9 @@ class CutOut(FlatCAMTool):
geo_obj.solid_geometry = deepcopy(solid_geo)
geo_obj.options['cnctooldia'] = str(dia)
geo_obj.options['cutz'] = self.cutz_entry.get_value()
geo_obj.options['multidepth'] = self.mpass_cb.get_value()
geo_obj.options['depthperpass'] = self.maxdepth_entry.get_value()
outname = cutout_obj.options["name"] + "_cutout"
self.app.new_object('geometry', outname, geo_init)
@ -879,6 +899,9 @@ class CutOut(FlatCAMTool):
solid_geo.append(poly.exterior)
geo_obj.solid_geometry = deepcopy(solid_geo)
geo_obj.options['cnctooldia'] = str(dia)
geo_obj.options['cutz'] = self.cutz_entry.get_value()
geo_obj.options['multidepth'] = self.mpass_cb.get_value()
geo_obj.options['depthperpass'] = self.maxdepth_entry.get_value()
outname = cutout_obj.options["name"] + "_cutout"
self.app.new_object('geometry', outname, geo_init)