瀏覽代碼

- added the exclusion parameters for Drilling Tool to the Preferences area

Marius Stanciu 5 年之前
父節點
當前提交
265028de76

+ 1 - 0
CHANGELOG.md

@@ -17,6 +17,7 @@ CHANGELOG for FlatCAM beta
 - some strings changed
 - some strings changed
 - fixed crash on using shortcut for creating a new Document Object
 - fixed crash on using shortcut for creating a new Document Object
 - fixed Cutout Tool to work with the endxy parameter
 - fixed Cutout Tool to work with the endxy parameter
+- added the exclusion parameters for Drilling Tool to the Preferences area
 
 
 20.10.2020
 20.10.2020
 
 

+ 6 - 0
appGUI/preferences/PreferencesUIManager.py

@@ -382,6 +382,12 @@ class PreferencesUIManager:
             "tools_drill_f_plunge":         self.ui.tools_defaults_form.tools_drill_group.fplunge_cb,
             "tools_drill_f_plunge":         self.ui.tools_defaults_form.tools_drill_group.fplunge_cb,
             "tools_drill_f_retract":        self.ui.tools_defaults_form.tools_drill_group.fretract_cb,
             "tools_drill_f_retract":        self.ui.tools_defaults_form.tools_drill_group.fretract_cb,
 
 
+            # Area Exclusion
+            "tools_drill_area_exclusion":   self.ui.tools_defaults_form.tools_drill_group.exclusion_cb,
+            "tools_drill_area_shape":       self.ui.tools_defaults_form.tools_drill_group.area_shape_radio,
+            "tools_drill_area_strategy":    self.ui.tools_defaults_form.tools_drill_group.strategy_radio,
+            "tools_drill_area_overz":       self.ui.tools_defaults_form.tools_drill_group.over_z_entry,
+
             # NCC Tool
             # NCC Tool
             "tools_ncctools":           self.ui.tools_defaults_form.tools_ncc_group.ncc_tool_dia_entry,
             "tools_ncctools":           self.ui.tools_defaults_form.tools_ncc_group.ncc_tool_dia_entry,
             "tools_nccorder":           self.ui.tools_defaults_form.tools_ncc_group.ncc_order_radio,
             "tools_nccorder":           self.ui.tools_defaults_form.tools_ncc_group.ncc_order_radio,

+ 4 - 6
appGUI/preferences/geometry/GeometryAdvOptPrefGroupUI.py

@@ -197,13 +197,11 @@ class GeometryAdvOptPrefGroupUI(OptionsGroupUI):
         # -----------------------------
         # -----------------------------
         # --- Area Exclusion ----------
         # --- Area Exclusion ----------
         # -----------------------------
         # -----------------------------
-        self.adv_label = QtWidgets.QLabel('<b>%s:</b>' % _('Area Exclusion'))
-        self.adv_label.setToolTip(
-            _("Area exclusion parameters.\n"
-              "Those parameters are available only for\n"
-              "Advanced App. Level.")
+        self.area_exc_label = QtWidgets.QLabel('<b>%s:</b>' % _('Area Exclusion'))
+        self.area_exc_label.setToolTip(
+            _("Area exclusion parameters.")
         )
         )
-        grid1.addWidget(self.adv_label, 13, 0, 1, 2)
+        grid1.addWidget(self.area_exc_label, 13, 0, 1, 2)
 
 
         # Exclusion Area CB
         # Exclusion Area CB
         self.exclusion_cb = FCCheckBox('%s' % _("Exclusion areas"))
         self.exclusion_cb = FCCheckBox('%s' % _("Exclusion areas"))

+ 82 - 22
appGUI/preferences/tools/ToolsDrillPrefGroupUI.py

@@ -2,7 +2,7 @@ from PyQt5 import QtWidgets
 from PyQt5.QtCore import QSettings, Qt
 from PyQt5.QtCore import QSettings, Qt
 
 
 from appGUI.GUIElements import RadioSet, FCDoubleSpinner, FCComboBox, FCCheckBox, FCSpinner, NumericalEvalTupleEntry, \
 from appGUI.GUIElements import RadioSet, FCDoubleSpinner, FCComboBox, FCCheckBox, FCSpinner, NumericalEvalTupleEntry, \
-    OptionalInputSection, NumericalEvalEntry
+    OptionalInputSection, NumericalEvalEntry, FCLabel
 from appGUI.preferences.OptionsGroupUI import OptionsGroupUI
 from appGUI.preferences.OptionsGroupUI import OptionsGroupUI
 
 
 import gettext
 import gettext
@@ -28,7 +28,7 @@ class ToolsDrillPrefGroupUI(OptionsGroupUI):
         self.decimals = decimals
         self.decimals = decimals
 
 
         # ## Clear non-copper regions
         # ## Clear non-copper regions
-        self.drill_label = QtWidgets.QLabel("<b>%s:</b>" % _("Parameters"))
+        self.drill_label = FCLabel("<b>%s:</b>" % _("Parameters"))
         self.drill_label.setToolTip(
         self.drill_label.setToolTip(
             _("Create CNCJob with toolpaths for drilling or milling holes.")
             _("Create CNCJob with toolpaths for drilling or milling holes.")
         )
         )
@@ -38,7 +38,7 @@ class ToolsDrillPrefGroupUI(OptionsGroupUI):
         self.layout.addLayout(grid0)
         self.layout.addLayout(grid0)
 
 
         # Tool order Radio Button
         # Tool order Radio Button
-        self.order_label = QtWidgets.QLabel('%s:' % _('Tool order'))
+        self.order_label = FCLabel('%s:' % _('Tool order'))
         self.order_label.setToolTip(_("This set the way that the tools in the tools table are used.\n"
         self.order_label.setToolTip(_("This set the way that the tools in the tools table are used.\n"
                                       "'No' --> means that the used order is the one in the tool table\n"
                                       "'No' --> means that the used order is the one in the tool table\n"
                                       "'Forward' --> means that the tools will be ordered from small to big\n"
                                       "'Forward' --> means that the tools will be ordered from small to big\n"
@@ -54,7 +54,7 @@ class ToolsDrillPrefGroupUI(OptionsGroupUI):
         grid0.addWidget(self.order_radio, 1, 1, 1, 2)
         grid0.addWidget(self.order_radio, 1, 1, 1, 2)
 
 
         # Cut Z
         # Cut Z
-        cutzlabel = QtWidgets.QLabel('%s:' % _('Cut Z'))
+        cutzlabel = FCLabel('%s:' % _('Cut Z'))
         cutzlabel.setToolTip(
         cutzlabel.setToolTip(
             _("Drill depth (negative)\n"
             _("Drill depth (negative)\n"
               "below the copper surface.")
               "below the copper surface.")
@@ -95,7 +95,7 @@ class ToolsDrillPrefGroupUI(OptionsGroupUI):
         grid0.addWidget(self.maxdepth_entry, 4, 1, 1, 2)
         grid0.addWidget(self.maxdepth_entry, 4, 1, 1, 2)
 
 
         # Travel Z
         # Travel Z
-        travelzlabel = QtWidgets.QLabel('%s:' % _('Travel Z'))
+        travelzlabel = FCLabel('%s:' % _('Travel Z'))
         travelzlabel.setToolTip(
         travelzlabel.setToolTip(
             _("Tool height when travelling\n"
             _("Tool height when travelling\n"
               "across the XY plane.")
               "across the XY plane.")
@@ -121,7 +121,7 @@ class ToolsDrillPrefGroupUI(OptionsGroupUI):
         grid0.addWidget(self.toolchange_cb, 6, 0, 1, 3)
         grid0.addWidget(self.toolchange_cb, 6, 0, 1, 3)
 
 
         # Tool Change Z
         # Tool Change Z
-        toolchangezlabel = QtWidgets.QLabel('%s:' % _('Toolchange Z'))
+        toolchangezlabel = FCLabel('%s:' % _('Toolchange Z'))
         toolchangezlabel.setToolTip(
         toolchangezlabel.setToolTip(
             _("Z-axis position (height) for\n"
             _("Z-axis position (height) for\n"
               "tool change.")
               "tool change.")
@@ -139,7 +139,7 @@ class ToolsDrillPrefGroupUI(OptionsGroupUI):
         grid0.addWidget(self.toolchangez_entry, 7, 1, 1, 2)
         grid0.addWidget(self.toolchangez_entry, 7, 1, 1, 2)
 
 
         # End Move Z
         # End Move Z
-        endz_label = QtWidgets.QLabel('%s:' % _('End move Z'))
+        endz_label = FCLabel('%s:' % _('End move Z'))
         endz_label.setToolTip(
         endz_label.setToolTip(
             _("Height of the tool after\n"
             _("Height of the tool after\n"
               "the last move at the end of the job.")
               "the last move at the end of the job.")
@@ -156,7 +156,7 @@ class ToolsDrillPrefGroupUI(OptionsGroupUI):
         grid0.addWidget(self.endz_entry, 8, 1, 1, 2)
         grid0.addWidget(self.endz_entry, 8, 1, 1, 2)
 
 
         # End Move X,Y
         # End Move X,Y
-        endmove_xy_label = QtWidgets.QLabel('%s:' % _('End move X,Y'))
+        endmove_xy_label = FCLabel('%s:' % _('End move X,Y'))
         endmove_xy_label.setToolTip(
         endmove_xy_label.setToolTip(
             _("End move X,Y position. In format (x,y).\n"
             _("End move X,Y position. In format (x,y).\n"
               "If no value is entered then there is no move\n"
               "If no value is entered then there is no move\n"
@@ -168,7 +168,7 @@ class ToolsDrillPrefGroupUI(OptionsGroupUI):
         grid0.addWidget(self.endxy_entry, 9, 1, 1, 2)
         grid0.addWidget(self.endxy_entry, 9, 1, 1, 2)
 
 
         # Feedrate Z
         # Feedrate Z
-        frlabel = QtWidgets.QLabel('%s:' % _('Feedrate Z'))
+        frlabel = FCLabel('%s:' % _('Feedrate Z'))
         frlabel.setToolTip(
         frlabel.setToolTip(
             _("Tool speed while drilling\n"
             _("Tool speed while drilling\n"
               "(in units per minute).\n"
               "(in units per minute).\n"
@@ -183,7 +183,7 @@ class ToolsDrillPrefGroupUI(OptionsGroupUI):
         grid0.addWidget(self.feedrate_z_entry, 10, 1, 1, 2)
         grid0.addWidget(self.feedrate_z_entry, 10, 1, 1, 2)
 
 
         # Spindle speed
         # Spindle speed
-        spdlabel = QtWidgets.QLabel('%s:' % _('Spindle Speed'))
+        spdlabel = FCLabel('%s:' % _('Spindle Speed'))
         spdlabel.setToolTip(
         spdlabel.setToolTip(
             _("Speed of the spindle\n"
             _("Speed of the spindle\n"
               "in RPM (optional)")
               "in RPM (optional)")
@@ -206,7 +206,7 @@ class ToolsDrillPrefGroupUI(OptionsGroupUI):
         grid0.addWidget(self.dwell_cb, 12, 0, 1, 3)
         grid0.addWidget(self.dwell_cb, 12, 0, 1, 3)
 
 
         # Dwell Time
         # Dwell Time
-        dwelltime = QtWidgets.QLabel('%s:' % _('Duration'))
+        dwelltime = FCLabel('%s:' % _('Duration'))
         dwelltime.setToolTip(_("Number of time units for spindle to dwell."))
         dwelltime.setToolTip(_("Number of time units for spindle to dwell."))
         self.dwelltime_entry = FCDoubleSpinner()
         self.dwelltime_entry = FCDoubleSpinner()
         self.dwelltime_entry.set_precision(self.decimals)
         self.dwelltime_entry.set_precision(self.decimals)
@@ -218,7 +218,7 @@ class ToolsDrillPrefGroupUI(OptionsGroupUI):
         self.ois_dwell_exc = OptionalInputSection(self.dwell_cb, [self.dwelltime_entry])
         self.ois_dwell_exc = OptionalInputSection(self.dwell_cb, [self.dwelltime_entry])
 
 
         # preprocessor selection
         # preprocessor selection
-        pp_excellon_label = QtWidgets.QLabel('%s:' % _("Preprocessor"))
+        pp_excellon_label = FCLabel('%s:' % _("Preprocessor"))
         pp_excellon_label.setToolTip(
         pp_excellon_label.setToolTip(
             _("The preprocessor JSON file that dictates\n"
             _("The preprocessor JSON file that dictates\n"
               "Gcode output.")
               "Gcode output.")
@@ -236,7 +236,7 @@ class ToolsDrillPrefGroupUI(OptionsGroupUI):
         grid0.addWidget(separator_line, 16, 0, 1, 3)
         grid0.addWidget(separator_line, 16, 0, 1, 3)
 
 
         # DRILL SLOTS LABEL
         # DRILL SLOTS LABEL
-        self.dslots_label = QtWidgets.QLabel('<b>%s:</b>' % _('Drilling Slots'))
+        self.dslots_label = FCLabel('<b>%s:</b>' % _('Drilling Slots'))
         grid0.addWidget(self.dslots_label, 18, 0, 1, 3)
         grid0.addWidget(self.dslots_label, 18, 0, 1, 3)
 
 
         # Drill slots
         # Drill slots
@@ -247,7 +247,7 @@ class ToolsDrillPrefGroupUI(OptionsGroupUI):
         grid0.addWidget(self.drill_slots_cb, 20, 0, 1, 3)
         grid0.addWidget(self.drill_slots_cb, 20, 0, 1, 3)
 
 
         # Drill Overlap
         # Drill Overlap
-        self.drill_overlap_label = QtWidgets.QLabel('%s:' % _('Overlap'))
+        self.drill_overlap_label = FCLabel('%s:' % _('Overlap'))
         self.drill_overlap_label.setToolTip(
         self.drill_overlap_label.setToolTip(
             _("How much (percentage) of the tool diameter to overlap previous drill hole.")
             _("How much (percentage) of the tool diameter to overlap previous drill hole.")
         )
         )
@@ -273,14 +273,14 @@ class ToolsDrillPrefGroupUI(OptionsGroupUI):
         separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
         separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
         grid0.addWidget(separator_line, 26, 0, 1, 3)
         grid0.addWidget(separator_line, 26, 0, 1, 3)
 
 
-        self.exc_label = QtWidgets.QLabel('<b>%s:</b>' % _('Advanced Options'))
+        self.exc_label = FCLabel('<b>%s:</b>' % _('Advanced Options'))
         self.exc_label.setToolTip(
         self.exc_label.setToolTip(
             _("A list of advanced parameters.")
             _("A list of advanced parameters.")
         )
         )
         grid0.addWidget(self.exc_label, 28, 0, 1, 3)
         grid0.addWidget(self.exc_label, 28, 0, 1, 3)
 
 
         # Offset Z
         # Offset Z
-        offsetlabel = QtWidgets.QLabel('%s:' % _('Offset Z'))
+        offsetlabel = FCLabel('%s:' % _('Offset Z'))
         offsetlabel.setToolTip(
         offsetlabel.setToolTip(
             _("Some drill bits (the larger ones) need to drill deeper\n"
             _("Some drill bits (the larger ones) need to drill deeper\n"
               "to create the desired exit hole diameter due of the tip shape.\n"
               "to create the desired exit hole diameter due of the tip shape.\n"
@@ -293,7 +293,7 @@ class ToolsDrillPrefGroupUI(OptionsGroupUI):
         grid0.addWidget(self.offset_entry, 29, 1, 1, 2)
         grid0.addWidget(self.offset_entry, 29, 1, 1, 2)
 
 
         # ToolChange X,Y
         # ToolChange X,Y
-        toolchange_xy_label = QtWidgets.QLabel('%s:' % _('Toolchange X,Y'))
+        toolchange_xy_label = FCLabel('%s:' % _('Toolchange X,Y'))
         toolchange_xy_label.setToolTip(
         toolchange_xy_label.setToolTip(
             _("Toolchange X,Y position.")
             _("Toolchange X,Y position.")
         )
         )
@@ -303,7 +303,7 @@ class ToolsDrillPrefGroupUI(OptionsGroupUI):
         grid0.addWidget(self.toolchangexy_entry, 31, 1, 1, 2)
         grid0.addWidget(self.toolchangexy_entry, 31, 1, 1, 2)
 
 
         # Start Z
         # Start Z
-        startzlabel = QtWidgets.QLabel('%s:' % _('Start Z'))
+        startzlabel = FCLabel('%s:' % _('Start Z'))
         startzlabel.setToolTip(
         startzlabel.setToolTip(
             _("Height of the tool just after start.\n"
             _("Height of the tool just after start.\n"
               "Delete the value if you don't need this feature.")
               "Delete the value if you don't need this feature.")
@@ -314,7 +314,7 @@ class ToolsDrillPrefGroupUI(OptionsGroupUI):
         grid0.addWidget(self.estartz_entry, 33, 1, 1, 2)
         grid0.addWidget(self.estartz_entry, 33, 1, 1, 2)
 
 
         # Feedrate Rapids
         # Feedrate Rapids
-        fr_rapid_label = QtWidgets.QLabel('%s:' % _('Feedrate Rapids'))
+        fr_rapid_label = FCLabel('%s:' % _('Feedrate Rapids'))
         fr_rapid_label.setToolTip(
         fr_rapid_label.setToolTip(
             _("Tool speed while drilling\n"
             _("Tool speed while drilling\n"
               "(in units per minute).\n"
               "(in units per minute).\n"
@@ -330,7 +330,7 @@ class ToolsDrillPrefGroupUI(OptionsGroupUI):
         grid0.addWidget(self.feedrate_rapid_entry, 35, 1, 1, 2)
         grid0.addWidget(self.feedrate_rapid_entry, 35, 1, 1, 2)
 
 
         # Probe depth
         # Probe depth
-        self.pdepth_label = QtWidgets.QLabel('%s:' % _("Probe Z depth"))
+        self.pdepth_label = FCLabel('%s:' % _("Probe Z depth"))
         self.pdepth_label.setToolTip(
         self.pdepth_label.setToolTip(
             _("The maximum depth that the probe is allowed\n"
             _("The maximum depth that the probe is allowed\n"
               "to probe. Negative value, in current units.")
               "to probe. Negative value, in current units.")
@@ -343,7 +343,7 @@ class ToolsDrillPrefGroupUI(OptionsGroupUI):
         grid0.addWidget(self.pdepth_entry, 37, 1, 1, 2)
         grid0.addWidget(self.pdepth_entry, 37, 1, 1, 2)
 
 
         # Probe feedrate
         # Probe feedrate
-        self.feedrate_probe_label = QtWidgets.QLabel('%s:' % _("Feedrate Probe"))
+        self.feedrate_probe_label = FCLabel('%s:' % _("Feedrate Probe"))
         self.feedrate_probe_label.setToolTip(
         self.feedrate_probe_label.setToolTip(
            _("The feedrate used while the probe is probing.")
            _("The feedrate used while the probe is probing.")
         )
         )
@@ -355,7 +355,7 @@ class ToolsDrillPrefGroupUI(OptionsGroupUI):
         grid0.addWidget(self.feedrate_probe_entry, 38, 1, 1, 2)
         grid0.addWidget(self.feedrate_probe_entry, 38, 1, 1, 2)
 
 
         # Spindle direction
         # Spindle direction
-        spindle_dir_label = QtWidgets.QLabel('%s:' % _('Spindle direction'))
+        spindle_dir_label = FCLabel('%s:' % _('Spindle direction'))
         spindle_dir_label.setToolTip(
         spindle_dir_label.setToolTip(
             _("This sets the direction that the spindle is rotating.\n"
             _("This sets the direction that the spindle is rotating.\n"
               "It can be either:\n"
               "It can be either:\n"
@@ -389,4 +389,64 @@ class ToolsDrillPrefGroupUI(OptionsGroupUI):
 
 
         grid0.addWidget(self.fretract_cb, 45, 0, 1, 3)
         grid0.addWidget(self.fretract_cb, 45, 0, 1, 3)
 
 
+        separator_line = QtWidgets.QFrame()
+        separator_line.setFrameShape(QtWidgets.QFrame.HLine)
+        separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
+        grid0.addWidget(separator_line, 46, 0, 1, 3)
+
+        # -----------------------------
+        # --- Area Exclusion ----------
+        # -----------------------------
+        self.area_exc_label = FCLabel('<b>%s:</b>' % _('Area Exclusion'))
+        self.area_exc_label.setToolTip(
+            _("Area exclusion parameters.")
+        )
+        grid0.addWidget(self.area_exc_label, 47, 0, 1, 2)
+
+        # Exclusion Area CB
+        self.exclusion_cb = FCCheckBox('%s' % _("Exclusion areas"))
+        self.exclusion_cb.setToolTip(
+            _(
+                "Include exclusion areas.\n"
+                "In those areas the travel of the tools\n"
+                "is forbidden."
+            )
+        )
+        grid0.addWidget(self.exclusion_cb, 49, 0, 1, 2)
+
+        # Area Selection shape
+        self.area_shape_label = FCLabel('%s:' % _("Shape"))
+        self.area_shape_label.setToolTip(
+            _("The kind of selection shape used for area selection.")
+        )
+
+        self.area_shape_radio = RadioSet([{'label': _("Square"), 'value': 'square'},
+                                          {'label': _("Polygon"), 'value': 'polygon'}])
+
+        grid0.addWidget(self.area_shape_label, 51, 0)
+        grid0.addWidget(self.area_shape_radio, 51, 1)
+
+        # Chose Strategy
+        self.strategy_label = FCLabel('%s:' % _("Strategy"))
+        self.strategy_label.setToolTip(_("The strategy followed when encountering an exclusion area.\n"
+                                         "Can be:\n"
+                                         "- Over -> when encountering the area, the tool will go to a set height\n"
+                                         "- Around -> will avoid the exclusion area by going around the area"))
+        self.strategy_radio = RadioSet([{'label': _('Over'), 'value': 'over'},
+                                        {'label': _('Around'), 'value': 'around'}])
+
+        grid0.addWidget(self.strategy_label, 53, 0)
+        grid0.addWidget(self.strategy_radio, 53, 1)
+
+        # Over Z
+        self.over_z_label = FCLabel('%s:' % _("Over Z"))
+        self.over_z_label.setToolTip(_("The height Z to which the tool will rise in order to avoid\n"
+                                       "an interdiction area."))
+        self.over_z_entry = FCDoubleSpinner()
+        self.over_z_entry.set_range(0.000, 9999.9999)
+        self.over_z_entry.set_precision(self.decimals)
+
+        grid0.addWidget(self.over_z_label, 55, 0)
+        grid0.addWidget(self.over_z_entry, 55, 1)
+
         self.layout.addStretch()
         self.layout.addStretch()