Просмотр исходного кода

- created a new tool: Isolation Routing Tool: work in progress
- some fixes in NCC Tool

Marius Stanciu 5 лет назад
Родитель
Сommit
43d8734a8a
6 измененных файлов с 406 добавлено и 464 удалено
  1. 8 5
      AppGUI/GUIElements.py
  2. 40 19
      AppGUI/ObjectUI.py
  3. 4 0
      AppObjects/FlatCAMGerber.py
  4. 319 401
      AppTools/ToolIsolation.py
  5. 33 39
      AppTools/ToolNCC.py
  6. 2 0
      CHANGELOG.md

+ 8 - 5
AppGUI/GUIElements.py

@@ -2224,11 +2224,14 @@ class OptionalHideInputSection:
         """
         """
         Associates the a checkbox with a set of inputs.
         Associates the a checkbox with a set of inputs.
 
 
-        :param cb: Checkbox that enables the optional inputs.
-        :param optinputs: List of widgets that are optional.
-        :param logic: When True the logic is normal, when False the logic is in reverse
-        It means that for logic=True, when the checkbox is checked the widgets are Enabled, and
-        for logic=False, when the checkbox is checked the widgets are Disabled
+        :param cb:          Checkbox that enables the optional inputs.
+        :type cb:           QtWidgets.QCheckBox
+        :param optinputs:   List of widgets that are optional.
+        :type optinputs:    list
+        :param logic:       When True the logic is normal, when False the logic is in reverse
+                            It means that for logic=True, when the checkbox is checked the widgets are Enabled, and
+                            for logic=False, when the checkbox is checked the widgets are Disabled
+        :type logic:        bool
         :return:
         :return:
         """
         """
         assert isinstance(cb, FCCheckBox), \
         assert isinstance(cb, FCCheckBox), \

+ 40 - 19
AppGUI/ObjectUI.py

@@ -428,15 +428,14 @@ class GerberObjectUI(ObjectUI):
         self.follow_cb.setToolTip(_("Generate a 'Follow' geometry.\n"
         self.follow_cb.setToolTip(_("Generate a 'Follow' geometry.\n"
                                     "This means that it will cut through\n"
                                     "This means that it will cut through\n"
                                     "the middle of the trace."))
                                     "the middle of the trace."))
-        grid1.addWidget(self.combine_passes_cb, 8, 0)
 
 
         # avoid an area from isolation
         # avoid an area from isolation
         self.except_cb = FCCheckBox(label=_('Except'))
         self.except_cb = FCCheckBox(label=_('Except'))
-        grid1.addWidget(self.follow_cb, 8, 1)
-
         self.except_cb.setToolTip(_("When the isolation geometry is generated,\n"
         self.except_cb.setToolTip(_("When the isolation geometry is generated,\n"
                                     "by checking this, the area of the object below\n"
                                     "by checking this, the area of the object below\n"
                                     "will be subtracted from the isolation geometry."))
                                     "will be subtracted from the isolation geometry."))
+        grid1.addWidget(self.combine_passes_cb, 8, 0)
+        grid1.addWidget(self.follow_cb, 8, 1)
         grid1.addWidget(self.except_cb, 8, 2)
         grid1.addWidget(self.except_cb, 8, 2)
 
 
         # ## Form Layout
         # ## Form Layout
@@ -563,6 +562,28 @@ class GerberObjectUI(ObjectUI):
         self.tool_lbl = QtWidgets.QLabel('<b>%s</b>' % _("TOOLS"))
         self.tool_lbl = QtWidgets.QLabel('<b>%s</b>' % _("TOOLS"))
         grid2.addWidget(self.tool_lbl, 0, 0, 1, 2)
         grid2.addWidget(self.tool_lbl, 0, 0, 1, 2)
 
 
+        # ## Isolation Routing
+        self.iso_label = QtWidgets.QLabel("%s" % _("Isolation"))
+        self.iso_label.setToolTip(
+            _("Create a Geometry object with\n"
+              "toolpaths to cut around polygons.")
+        )
+        self.iso_label.setMinimumWidth(90)
+
+        self.iso_button = QtWidgets.QPushButton(_('Isolation Routing'))
+        self.iso_button.setToolTip(
+            _("Create a Geometry object with\n"
+              "toolpaths to cut around polygons.")
+        )
+        self.iso_button.setStyleSheet("""
+                                      QPushButton
+                                      {
+                                          font-weight: bold;
+                                      }
+                                      """)
+        grid2.addWidget(self.iso_label, 1, 0)
+        grid2.addWidget(self.iso_button, 1, 1)
+
         # ## Clear non-copper regions
         # ## Clear non-copper regions
         self.clearcopper_label = QtWidgets.QLabel("%s" % _("Clear N-copper"))
         self.clearcopper_label = QtWidgets.QLabel("%s" % _("Clear N-copper"))
         self.clearcopper_label.setToolTip(
         self.clearcopper_label.setToolTip(
@@ -582,8 +603,8 @@ class GerberObjectUI(ObjectUI):
                             font-weight: bold;
                             font-weight: bold;
                         }
                         }
                         """)
                         """)
-        grid2.addWidget(self.clearcopper_label, 1, 0)
-        grid2.addWidget(self.generate_ncc_button, 1, 1)
+        grid2.addWidget(self.clearcopper_label, 2, 0)
+        grid2.addWidget(self.generate_ncc_button, 2, 1)
 
 
         # ## Board cutout
         # ## Board cutout
         self.board_cutout_label = QtWidgets.QLabel("%s" % _("Board cutout"))
         self.board_cutout_label = QtWidgets.QLabel("%s" % _("Board cutout"))
@@ -604,13 +625,13 @@ class GerberObjectUI(ObjectUI):
                             font-weight: bold;
                             font-weight: bold;
                         }
                         }
                         """)
                         """)
-        grid2.addWidget(self.board_cutout_label, 2, 0)
-        grid2.addWidget(self.generate_cutout_button, 2, 1)
+        grid2.addWidget(self.board_cutout_label, 3, 0)
+        grid2.addWidget(self.generate_cutout_button, 3, 1)
 
 
         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)
-        grid2.addWidget(separator_line, 3, 0, 1, 2)
+        grid2.addWidget(separator_line, 4, 0, 1, 2)
 
 
         # ## Non-copper regions
         # ## Non-copper regions
         self.noncopper_label = QtWidgets.QLabel("<b>%s</b>" % _("Non-copper regions"))
         self.noncopper_label = QtWidgets.QLabel("<b>%s</b>" % _("Non-copper regions"))
@@ -622,7 +643,7 @@ class GerberObjectUI(ObjectUI):
               "copper from a specified region.")
               "copper from a specified region.")
         )
         )
 
 
-        grid2.addWidget(self.noncopper_label, 4, 0, 1, 2)
+        grid2.addWidget(self.noncopper_label, 5, 0, 1, 2)
 
 
         # Margin
         # Margin
         bmlabel = QtWidgets.QLabel('%s:' % _('Boundary Margin'))
         bmlabel = QtWidgets.QLabel('%s:' % _('Boundary Margin'))
@@ -638,8 +659,8 @@ class GerberObjectUI(ObjectUI):
         self.noncopper_margin_entry.set_precision(self.decimals)
         self.noncopper_margin_entry.set_precision(self.decimals)
         self.noncopper_margin_entry.setSingleStep(0.1)
         self.noncopper_margin_entry.setSingleStep(0.1)
 
 
-        grid2.addWidget(bmlabel, 5, 0)
-        grid2.addWidget(self.noncopper_margin_entry, 5, 1)
+        grid2.addWidget(bmlabel, 6, 0)
+        grid2.addWidget(self.noncopper_margin_entry, 6, 1)
 
 
         # Rounded corners
         # Rounded corners
         self.noncopper_rounded_cb = FCCheckBox(label=_("Rounded Geo"))
         self.noncopper_rounded_cb = FCCheckBox(label=_("Rounded Geo"))
@@ -649,13 +670,13 @@ class GerberObjectUI(ObjectUI):
         self.noncopper_rounded_cb.setMinimumWidth(90)
         self.noncopper_rounded_cb.setMinimumWidth(90)
 
 
         self.generate_noncopper_button = QtWidgets.QPushButton(_('Generate Geo'))
         self.generate_noncopper_button = QtWidgets.QPushButton(_('Generate Geo'))
-        grid2.addWidget(self.noncopper_rounded_cb, 6, 0)
-        grid2.addWidget(self.generate_noncopper_button, 6, 1)
+        grid2.addWidget(self.noncopper_rounded_cb, 7, 0)
+        grid2.addWidget(self.generate_noncopper_button, 7, 1)
 
 
         separator_line1 = QtWidgets.QFrame()
         separator_line1 = QtWidgets.QFrame()
         separator_line1.setFrameShape(QtWidgets.QFrame.HLine)
         separator_line1.setFrameShape(QtWidgets.QFrame.HLine)
         separator_line1.setFrameShadow(QtWidgets.QFrame.Sunken)
         separator_line1.setFrameShadow(QtWidgets.QFrame.Sunken)
-        grid2.addWidget(separator_line1, 7, 0, 1, 2)
+        grid2.addWidget(separator_line1, 8, 0, 1, 2)
 
 
         # ## Bounding box
         # ## Bounding box
         self.boundingbox_label = QtWidgets.QLabel('<b>%s</b>' % _('Bounding Box'))
         self.boundingbox_label = QtWidgets.QLabel('<b>%s</b>' % _('Bounding Box'))
@@ -664,7 +685,7 @@ class GerberObjectUI(ObjectUI):
               "Square shape.")
               "Square shape.")
         )
         )
 
 
-        grid2.addWidget(self.boundingbox_label, 8, 0, 1, 2)
+        grid2.addWidget(self.boundingbox_label, 9, 0, 1, 2)
 
 
         bbmargin = QtWidgets.QLabel('%s:' % _('Boundary Margin'))
         bbmargin = QtWidgets.QLabel('%s:' % _('Boundary Margin'))
         bbmargin.setToolTip(
         bbmargin.setToolTip(
@@ -677,8 +698,8 @@ class GerberObjectUI(ObjectUI):
         self.bbmargin_entry.set_precision(self.decimals)
         self.bbmargin_entry.set_precision(self.decimals)
         self.bbmargin_entry.setSingleStep(0.1)
         self.bbmargin_entry.setSingleStep(0.1)
 
 
-        grid2.addWidget(bbmargin, 9, 0)
-        grid2.addWidget(self.bbmargin_entry, 9, 1)
+        grid2.addWidget(bbmargin, 10, 0)
+        grid2.addWidget(self.bbmargin_entry, 10, 1)
 
 
         self.bbrounded_cb = FCCheckBox(label=_("Rounded Geo"))
         self.bbrounded_cb = FCCheckBox(label=_("Rounded Geo"))
         self.bbrounded_cb.setToolTip(
         self.bbrounded_cb.setToolTip(
@@ -693,8 +714,8 @@ class GerberObjectUI(ObjectUI):
         self.generate_bb_button.setToolTip(
         self.generate_bb_button.setToolTip(
             _("Generate the Geometry object.")
             _("Generate the Geometry object.")
         )
         )
-        grid2.addWidget(self.bbrounded_cb, 10, 0)
-        grid2.addWidget(self.generate_bb_button, 10, 1)
+        grid2.addWidget(self.bbrounded_cb, 11, 0)
+        grid2.addWidget(self.generate_bb_button, 11, 1)
 
 
 
 
 class ExcellonObjectUI(ObjectUI):
 class ExcellonObjectUI(ObjectUI):

+ 4 - 0
AppObjects/FlatCAMGerber.py

@@ -224,8 +224,12 @@ class GerberObject(FlatCAMObj, Gerber):
         self.ui.solid_cb.stateChanged.connect(self.on_solid_cb_click)
         self.ui.solid_cb.stateChanged.connect(self.on_solid_cb_click)
         self.ui.multicolored_cb.stateChanged.connect(self.on_multicolored_cb_click)
         self.ui.multicolored_cb.stateChanged.connect(self.on_multicolored_cb_click)
         self.ui.generate_iso_button.clicked.connect(self.on_iso_button_click)
         self.ui.generate_iso_button.clicked.connect(self.on_iso_button_click)
+
+        # Tools
+        self.ui.iso_button.clicked.connect(self.app.isolation_tool.run)
         self.ui.generate_ncc_button.clicked.connect(self.app.ncclear_tool.run)
         self.ui.generate_ncc_button.clicked.connect(self.app.ncclear_tool.run)
         self.ui.generate_cutout_button.clicked.connect(self.app.cutout_tool.run)
         self.ui.generate_cutout_button.clicked.connect(self.app.cutout_tool.run)
+
         self.ui.generate_bb_button.clicked.connect(self.on_generatebb_button_click)
         self.ui.generate_bb_button.clicked.connect(self.on_generatebb_button_click)
         self.ui.generate_noncopper_button.clicked.connect(self.on_generatenoncopper_button_click)
         self.ui.generate_noncopper_button.clicked.connect(self.on_generatenoncopper_button_click)
         self.ui.aperture_table_visibility_cb.stateChanged.connect(self.on_aperture_table_visibility_change)
         self.ui.aperture_table_visibility_cb.stateChanged.connect(self.on_aperture_table_visibility_change)

Разница между файлами не показана из-за своего большого размера
+ 319 - 401
AppTools/ToolIsolation.py


+ 33 - 39
AppTools/ToolNCC.py

@@ -2340,6 +2340,9 @@ class NonCopperClear(AppTool, Gerber):
                 if self.ncc_tools[tooluid]['data']['tools_nccoperation'] == 'clear':
                 if self.ncc_tools[tooluid]['data']['tools_nccoperation'] == 'clear':
                     sorted_clear_tools.append(self.ncc_tools[tooluid]['tooldia'])
                     sorted_clear_tools.append(self.ncc_tools[tooluid]['tooldia'])
 
 
+        if not sorted_clear_tools:
+            return 'fail'
+
         # ########################################################################################################
         # ########################################################################################################
         # set the name for the future Geometry object
         # set the name for the future Geometry object
         # I do it here because it is also stored inside the gen_clear_area() and gen_clear_area_rest() methods
         # I do it here because it is also stored inside the gen_clear_area() and gen_clear_area_rest() methods
@@ -2361,6 +2364,8 @@ class NonCopperClear(AppTool, Gerber):
             # will store the number of tools for which the isolation is broken
             # will store the number of tools for which the isolation is broken
             warning_flag = 0
             warning_flag = 0
 
 
+            tool = None
+
             if order == 'fwd':
             if order == 'fwd':
                 sorted_clear_tools.sort(reverse=False)
                 sorted_clear_tools.sort(reverse=False)
             elif order == 'rev':
             elif order == 'rev':
@@ -2900,7 +2905,7 @@ class NonCopperClear(AppTool, Gerber):
             if run_threaded:
             if run_threaded:
                 proc.done()
                 proc.done()
             else:
             else:
-                app_obj.proc_container.view.set_idle()
+                a_obj.proc_container.view.set_idle()
 
 
             # focus on Selected Tab
             # focus on Selected Tab
             self.app.ui.notebook.setCurrentWidget(self.app.ui.selected_tab)
             self.app.ui.notebook.setCurrentWidget(self.app.ui.selected_tab)
@@ -2914,48 +2919,34 @@ class NonCopperClear(AppTool, Gerber):
         else:
         else:
             job_thread(app_obj=self.app)
             job_thread(app_obj=self.app)
 
 
-    def clear_copper_tcl(self, ncc_obj,
-                         sel_obj=None,
-                         ncctooldia=None,
-                         isotooldia=None,
-                         margin=None,
-                         has_offset=None,
-                         offset=None,
-                         select_method=None,
-                         outname=None,
-                         overlap=None,
-                         connect=None,
-                         contour=None,
-                         order=None,
-                         method=None,
-                         rest=None,
-                         tools_storage=None,
-                         plot=True,
-                         run_threaded=False):
+    def clear_copper_tcl(self, ncc_obj, sel_obj=None, ncctooldia=None, isotooldia=None, margin=None, has_offset=None,
+                         offset=None, select_method=None, outname=None, overlap=None, connect=None, contour=None,
+                         order=None, method=None, rest=None, tools_storage=None, plot=True, run_threaded=False):
         """
         """
         Clear the excess copper from the entire object. To be used only in a TCL command.
         Clear the excess copper from the entire object. To be used only in a TCL command.
 
 
-        :param ncc_obj: ncc cleared object
+        :param ncc_obj:         ncc cleared object
         :param sel_obj:
         :param sel_obj:
-        :param ncctooldia: a tuple or single element made out of diameters of the tools to be used to ncc clear
-        :param isotooldia: a tuple or single element made out of diameters of the tools to be used for isolation
-        :param overlap: value by which the paths will overlap
-        :param order: if the tools are ordered and how
-        :param select_method: if to do ncc on the whole object, on an defined area or on an area defined by
-        another object
-        :param has_offset: True if an offset is needed
-        :param offset: distance from the copper features where the copper clearing is stopping
-        :param margin: a border around cleared area
-        :param outname: name of the resulting object
-        :param connect: Connect lines to avoid tool lifts.
-        :param contour: Paint around the edges.
-        :param method: choice out of 'seed', 'normal', 'lines'
-        :param rest: True if to use rest-machining
-        :param tools_storage: whether to use the current tools_storage self.ncc_tools or a different one.
-        Usage of the different one is related to when this function is called from a TcL command.
-        :param plot: if True after the job is finished the result will be plotted, else it will not.
-        :param run_threaded: If True the method will be run in a threaded way suitable for GUI usage; if False it will
-        run non-threaded for TclShell usage
+        :param ncctooldia:      a tuple or single element made out of diameters of the tools to be used to ncc clear
+        :param isotooldia:      a tuple or single element made out of diameters of the tools to be used for isolation
+        :param overlap:         value by which the paths will overlap
+        :param order:           if the tools are ordered and how
+        :param select_method:   if to do ncc on the whole object, on an defined area or on an area defined by
+                                another object
+        :param has_offset:      True if an offset is needed
+        :param offset:          distance from the copper features where the copper clearing is stopping
+        :param margin:          a border around cleared area
+        :param outname:         name of the resulting object
+        :param connect:         Connect lines to avoid tool lifts.
+        :param contour:         Clear around the edges.
+        :param method:          choice out of 'seed', 'normal', 'lines'
+        :param rest:            True if to use rest-machining
+        :param tools_storage:   whether to use the current tools_storage self.ncc_tools or a different one.
+                                Usage of the different one is related to when this function is called from a
+                                TcL command.
+        :param plot:            if True after the job is finished the result will be plotted, else it will not.
+        :param run_threaded:    If True the method will be run in a threaded way suitable for GUI usage;
+                                if False it will run non-threaded for TclShell usage
         :return:
         :return:
         """
         """
         if run_threaded:
         if run_threaded:
@@ -3003,6 +2994,9 @@ class NonCopperClear(AppTool, Gerber):
             else:
             else:
                 sorted_tools = ncctooldia
                 sorted_tools = ncctooldia
 
 
+        if not sorted_tools:
+            return 'fail'
+
         # ##############################################################################################################
         # ##############################################################################################################
         # Prepare non-copper polygons. Create the bounding box area from which the copper features will be subtracted ##
         # Prepare non-copper polygons. Create the bounding box area from which the copper features will be subtracted ##
         # ##############################################################################################################
         # ##############################################################################################################

+ 2 - 0
CHANGELOG.md

@@ -16,6 +16,8 @@ CHANGELOG for FlatCAM beta
 - changed and added some icons
 - changed and added some icons
 - fixed the Shortcuts Tab to reflect the actual current shortcut keys
 - fixed the Shortcuts Tab to reflect the actual current shortcut keys
 - started to work on moving the Isolation Routing from the Gerber Object UI to it's own tool
 - started to work on moving the Isolation Routing from the Gerber Object UI to it's own tool
+- created a new tool: Isolation Routing Tool: work in progress
+- some fixes in NCC Tool
 
 
 24.05.2020
 24.05.2020
 
 

Некоторые файлы не были показаны из-за большого количества измененных файлов