diff --git a/README.md b/README.md index 5d777a83..90ac98be 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ CAD program, and create G-Code for Isolation routing. 23.08.2019 - in Tool Cutout for the manual gaps, right mouse button click will exit from the action of adding gaps +- in Tool Cutout tool I've added the possibility to create a cutout without bridge gaps; added the 'None' option in the Gaps combobox 22.08.2019 diff --git a/flatcamGUI/FlatCAMGUI.py b/flatcamGUI/FlatCAMGUI.py index 054fa6dd..32563bf7 100644 --- a/flatcamGUI/FlatCAMGUI.py +++ b/flatcamGUI/FlatCAMGUI.py @@ -6567,9 +6567,10 @@ class ToolsCutoutPrefGroupUI(OptionsGroupUI): gaps_label = QtWidgets.QLabel('%s:' % _('Gaps')) gaps_label.setToolTip( - _("Number of bridge gaps used for the cutout.\n" + _("Number of gaps used for the cutout.\n" "There can be maximum 8 bridges/gaps.\n" "The choices are:\n" + "- None - no gaps\n" "- lr - left + right\n" "- tb - top + bottom\n" "- 4 - left + right +top + bottom\n" @@ -6581,7 +6582,7 @@ class ToolsCutoutPrefGroupUI(OptionsGroupUI): self.gaps_combo = FCComboBox() grid0.addWidget(self.gaps_combo, 4, 1) - gaps_items = ['LR', 'TB', '4', '2LR', '2TB', '8'] + gaps_items = ['None', 'LR', 'TB', '4', '2LR', '2TB', '8'] for it in gaps_items: self.gaps_combo.addItem(it) self.gaps_combo.setStyleSheet('background-color: rgb(255,255,255)') diff --git a/flatcamTools/ToolCutOut.py b/flatcamTools/ToolCutOut.py index 9674b36f..552614a3 100644 --- a/flatcamTools/ToolCutOut.py +++ b/flatcamTools/ToolCutOut.py @@ -151,6 +151,7 @@ class CutOut(FlatCAMTool): _("Number of gaps used for the Automatic cutout.\n" "There can be maximum 8 bridges/gaps.\n" "The choices are:\n" + "- None - no gaps\n" "- lr - left + right\n" "- tb - top + bottom\n" "- 4 - left + right +top + bottom\n" @@ -161,7 +162,7 @@ class CutOut(FlatCAMTool): gaps_label.setMinimumWidth(60) self.gaps = FCComboBox() - gaps_items = ['LR', 'TB', '4', '2LR', '2TB', '8'] + gaps_items = ['None', 'LR', 'TB', '4', '2LR', '2TB', '8'] for it in gaps_items: self.gaps.addItem(it) self.gaps.setStyleSheet('background-color: rgb(255,255,255)') @@ -413,8 +414,9 @@ class CutOut(FlatCAMTool): self.app.inform.emit(_("[WARNING_NOTCL] Number of gaps value is missing. Add it and retry.")) return - if gaps not in ['LR', 'TB', '2LR', '2TB', '4', '8']: - self.app.inform.emit(_("[WARNING_NOTCL] Gaps value can be only one of: 'lr', 'tb', '2lr', '2tb', 4 or 8. " + if gaps not in ['None', 'LR', 'TB', '2LR', '2TB', '4', '8']: + self.app.inform.emit(_("[WARNING_NOTCL] Gaps value can be only one of: " + "'None', 'lr', 'tb', '2lr', '2tb', 4 or 8. " "Fill in a correct value and retry. ")) return @@ -449,44 +451,46 @@ class CutOut(FlatCAMTool): leny = (ymax - ymin) + (margin * 2) proc_geometry = [] + if gaps == 'None': + pass + else: + if gaps == '8' or gaps == '2LR': + geom = self.subtract_poly_from_geo(geom, + xmin - gapsize, # botleft_x + py - gapsize + leny / 4, # botleft_y + xmax + gapsize, # topright_x + py + gapsize + leny / 4) # topright_y + geom = self.subtract_poly_from_geo(geom, + xmin - gapsize, + py - gapsize - leny / 4, + xmax + gapsize, + py + gapsize - leny / 4) - if gaps == '8' or gaps == '2LR': - geom = self.subtract_poly_from_geo(geom, - xmin - gapsize, # botleft_x - py - gapsize + leny / 4, # botleft_y - xmax + gapsize, # topright_x - py + gapsize + leny / 4) # topright_y - geom = self.subtract_poly_from_geo(geom, - xmin - gapsize, - py - gapsize - leny / 4, - xmax + gapsize, - py + gapsize - leny / 4) + if gaps == '8' or gaps == '2TB': + geom = self.subtract_poly_from_geo(geom, + px - gapsize + lenx / 4, + ymin - gapsize, + px + gapsize + lenx / 4, + ymax + gapsize) + geom = self.subtract_poly_from_geo(geom, + px - gapsize - lenx / 4, + ymin - gapsize, + px + gapsize - lenx / 4, + ymax + gapsize) - if gaps == '8' or gaps == '2TB': - geom = self.subtract_poly_from_geo(geom, - px - gapsize + lenx / 4, - ymin - gapsize, - px + gapsize + lenx / 4, - ymax + gapsize) - geom = self.subtract_poly_from_geo(geom, - px - gapsize - lenx / 4, - ymin - gapsize, - px + gapsize - lenx / 4, - ymax + gapsize) + if gaps == '4' or gaps == 'LR': + geom = self.subtract_poly_from_geo(geom, + xmin - gapsize, + py - gapsize, + xmax + gapsize, + py + gapsize) - if gaps == '4' or gaps == 'LR': - geom = self.subtract_poly_from_geo(geom, - xmin - gapsize, - py - gapsize, - xmax + gapsize, - py + gapsize) - - if gaps == '4' or gaps == 'TB': - geom = self.subtract_poly_from_geo(geom, - px - gapsize, - ymin - gapsize, - px + gapsize, - ymax + gapsize) + if gaps == '4' or gaps == 'TB': + geom = self.subtract_poly_from_geo(geom, + px - gapsize, + ymin - gapsize, + px + gapsize, + ymax + gapsize) try: for g in geom: @@ -606,8 +610,9 @@ class CutOut(FlatCAMTool): self.app.inform.emit(_("[WARNING_NOTCL] Number of gaps value is missing. Add it and retry.")) return - if gaps not in ['LR', 'TB', '2LR', '2TB', '4', '8']: - self.app.inform.emit(_("[WARNING_NOTCL] Gaps value can be only one of: 'lr', 'tb', '2lr', '2tb', 4 or 8. " + if gaps not in ['None', 'LR', 'TB', '2LR', '2TB', '4', '8']: + self.app.inform.emit(_("[WARNING_NOTCL] Gaps value can be only one of: " + "'None', 'lr', 'tb', '2lr', '2tb', 4 or 8. " "Fill in a correct value and retry. ")) return @@ -633,43 +638,46 @@ class CutOut(FlatCAMTool): lenx = (xmax - xmin) + (margin * 2) leny = (ymax - ymin) + (margin * 2) - if gaps == '8' or gaps == '2LR': - geom = self.subtract_poly_from_geo(geom, - xmin - gapsize, # botleft_x - py - gapsize + leny / 4, # botleft_y - xmax + gapsize, # topright_x - py + gapsize + leny / 4) # topright_y - geom = self.subtract_poly_from_geo(geom, - xmin - gapsize, - py - gapsize - leny / 4, - xmax + gapsize, - py + gapsize - leny / 4) + if gaps == 'None': + pass + else: + if gaps == '8' or gaps == '2LR': + geom = self.subtract_poly_from_geo(geom, + xmin - gapsize, # botleft_x + py - gapsize + leny / 4, # botleft_y + xmax + gapsize, # topright_x + py + gapsize + leny / 4) # topright_y + geom = self.subtract_poly_from_geo(geom, + xmin - gapsize, + py - gapsize - leny / 4, + xmax + gapsize, + py + gapsize - leny / 4) - if gaps == '8' or gaps == '2TB': - geom = self.subtract_poly_from_geo(geom, - px - gapsize + lenx / 4, - ymin - gapsize, - px + gapsize + lenx / 4, - ymax + gapsize) - geom = self.subtract_poly_from_geo(geom, - px - gapsize - lenx / 4, - ymin - gapsize, - px + gapsize - lenx / 4, - ymax + gapsize) + if gaps == '8' or gaps == '2TB': + geom = self.subtract_poly_from_geo(geom, + px - gapsize + lenx / 4, + ymin - gapsize, + px + gapsize + lenx / 4, + ymax + gapsize) + geom = self.subtract_poly_from_geo(geom, + px - gapsize - lenx / 4, + ymin - gapsize, + px + gapsize - lenx / 4, + ymax + gapsize) - if gaps == '4' or gaps == 'LR': - geom = self.subtract_poly_from_geo(geom, - xmin - gapsize, - py - gapsize, - xmax + gapsize, - py + gapsize) + if gaps == '4' or gaps == 'LR': + geom = self.subtract_poly_from_geo(geom, + xmin - gapsize, + py - gapsize, + xmax + gapsize, + py + gapsize) - if gaps == '4' or gaps == 'TB': - geom = self.subtract_poly_from_geo(geom, - px - gapsize, - ymin - gapsize, - px + gapsize, - ymax + gapsize) + if gaps == '4' or gaps == 'TB': + geom = self.subtract_poly_from_geo(geom, + px - gapsize, + ymin - gapsize, + px + gapsize, + ymax + gapsize) try: for g in geom: proc_geometry.append(g)