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

- fixed DblSided Tool issue when entering Tool diameter values with comma decimal separator instead of decimal dot separator
- fixed Cutout Tool Freeform to generate cutouts with options: LR, TB. 2LR, 2TB which didn't worked previously

Marius Stanciu 7 лет назад
Родитель
Сommit
b6d36bb86d
3 измененных файлов с 23 добавлено и 10 удалено
  1. 2 0
      README.md
  2. 9 9
      flatcamTools/ToolCutOut.py
  3. 12 1
      flatcamTools/ToolDblSided.py

+ 2 - 0
README.md

@@ -18,6 +18,8 @@ CAD program, and create G-Code for Isolation routing.
 - added some relevant status bar messages in DblSided Tool
 - added some relevant status bar messages in DblSided Tool
 - fixed DblSided Tool to correctly use the Box object (until now it used as reference only Gerber object in spite of Excellon or Geometry objects being available)
 - fixed DblSided Tool to correctly use the Box object (until now it used as reference only Gerber object in spite of Excellon or Geometry objects being available)
 - fixed DblSided Tool crash when trying to create Alignment Drills object without a Tool diameter specified
 - fixed DblSided Tool crash when trying to create Alignment Drills object without a Tool diameter specified
+- fixed DblSided Tool issue when entering Tool diameter values with comma decimal separator instead of decimal dot separator
+- fixed Cutout Tool Freeform to generate cutouts with options: LR, TB. 2LR, 2TB which didn't worked previously
 
 
 15.02.2019
 15.02.2019
 
 

+ 9 - 9
flatcamTools/ToolCutOut.py

@@ -153,8 +153,8 @@ class ToolCutOut(FlatCAMTool):
             "- one gap Left / one gap Right\n"
             "- one gap Left / one gap Right\n"
             "- one gap on each of the 4 sides."
             "- one gap on each of the 4 sides."
         )
         )
-        self.gaps_rect_radio = RadioSet([{'label': '2(T/B)', 'value': 'tb'},
-                                    {'label': '2(L/R)', 'value': 'lr'},
+        self.gaps_rect_radio = RadioSet([{'label': '2(T/B)', 'value': 'TB'},
+                                    {'label': '2(L/R)', 'value': 'LR'},
                                     {'label': '4', 'value': '4'}])
                                     {'label': '4', 'value': '4'}])
         form_layout_3.addRow(gapslabel_rect, self.gaps_rect_radio)
         form_layout_3.addRow(gapslabel_rect, self.gaps_rect_radio)
 
 
@@ -277,7 +277,7 @@ class ToolCutOut(FlatCAMTool):
             self.app.inform.emit("[WARNING_NOTCL]Tool Diameter is zero value. Change it to a positive integer.")
             self.app.inform.emit("[WARNING_NOTCL]Tool Diameter is zero value. Change it to a positive integer.")
             return "Tool Diameter is zero value. Change it to a positive integer."
             return "Tool Diameter is zero value. Change it to a positive integer."
 
 
-        if gaps not in ['lr', 'tb', '2lr', '2tb', '4', '8']:
+        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. "
             self.app.inform.emit("[WARNING_NOTCL] Gaps value can be only one of: 'lr', 'tb', '2lr', '2tb', 4 or 8. "
                                  "Fill in a correct value and retry. ")
                                  "Fill in a correct value and retry. ")
             return
             return
@@ -318,7 +318,7 @@ class ToolCutOut(FlatCAMTool):
 
 
             cutout_obj = self.app.collection.get_by_name(outname)
             cutout_obj = self.app.collection.get_by_name(outname)
 
 
-        if int(gaps) == 8 or gaps == '2lr':
+        if gaps == '8' or gaps == '2LR':
             subtract_rectangle(cutout_obj,
             subtract_rectangle(cutout_obj,
                                xmin - gapsize,  # botleft_x
                                xmin - gapsize,  # botleft_x
                                py - gapsize + lenghty / 4,  # botleft_y
                                py - gapsize + lenghty / 4,  # botleft_y
@@ -330,7 +330,7 @@ class ToolCutOut(FlatCAMTool):
                                xmax + gapsize,
                                xmax + gapsize,
                                py + gapsize - lenghty / 4)
                                py + gapsize - lenghty / 4)
 
 
-        if int(gaps) == 8 or gaps == '2tb':
+        if gaps == '8' or gaps == '2TB':
             subtract_rectangle(cutout_obj,
             subtract_rectangle(cutout_obj,
                                px - gapsize + lenghtx / 4,
                                px - gapsize + lenghtx / 4,
                                ymin - gapsize,
                                ymin - gapsize,
@@ -342,14 +342,14 @@ class ToolCutOut(FlatCAMTool):
                                px + gapsize - lenghtx / 4,
                                px + gapsize - lenghtx / 4,
                                ymax + gapsize)
                                ymax + gapsize)
 
 
-        if int(gaps) == 4 or gaps == 'lr':
+        if gaps == '4' or gaps == 'LR':
             subtract_rectangle(cutout_obj,
             subtract_rectangle(cutout_obj,
                                xmin - gapsize,
                                xmin - gapsize,
                                py - gapsize,
                                py - gapsize,
                                xmax + gapsize,
                                xmax + gapsize,
                                py + gapsize)
                                py + gapsize)
 
 
-        if int(gaps) == 4 or gaps == 'tb':
+        if gaps == '4' or gaps == 'TB':
             subtract_rectangle(cutout_obj,
             subtract_rectangle(cutout_obj,
                                px - gapsize,
                                px - gapsize,
                                ymin - gapsize,
                                ymin - gapsize,
@@ -447,9 +447,9 @@ class ToolCutOut(FlatCAMTool):
                    [maxx, midy + hgap],
                    [maxx, midy + hgap],
                    [maxx, maxy],
                    [maxx, maxy],
                    [midx + hgap, maxy]]
                    [midx + hgap, maxy]]
-            cases = {"tb": [[pts[0], pts[1], pts[4], pts[5]],
+            cases = {"TB": [[pts[0], pts[1], pts[4], pts[5]],
                             [pts[6], pts[7], pts[10], pts[11]]],
                             [pts[6], pts[7], pts[10], pts[11]]],
-                     "lr": [[pts[9], pts[10], pts[1], pts[2]],
+                     "LR": [[pts[9], pts[10], pts[1], pts[2]],
                             [pts[3], pts[4], pts[7], pts[8]]],
                             [pts[3], pts[4], pts[7], pts[8]]],
                      "4": [[pts[0], pts[1], pts[2]],
                      "4": [[pts[0], pts[1], pts[2]],
                            [pts[3], pts[4], pts[5]],
                            [pts[3], pts[4], pts[5]],

+ 12 - 1
flatcamTools/ToolDblSided.py

@@ -317,7 +317,18 @@ class DblSidedTool(FlatCAMTool):
 
 
         xscale, yscale = {"X": (1.0, -1.0), "Y": (-1.0, 1.0)}[axis]
         xscale, yscale = {"X": (1.0, -1.0), "Y": (-1.0, 1.0)}[axis]
 
 
-        dia = self.drill_dia.get_value()
+        try:
+            dia = float(self.drill_dia.get_value())
+        except ValueError:
+            # try to convert comma to decimal point. if it's still not working error message and return
+            try:
+                dia = float(self.drill_dia.get_value().replace(',', '.'))
+                self.drill_dia.set_value(dia)
+            except ValueError:
+                self.app.inform.emit("[WARNING_NOTCL] Tool diameter value is missing or wrong format. "
+                                     "Add it and retry.")
+                return
+
         if dia is '':
         if dia is '':
             self.app.inform.emit("[WARNING_NOTCL]No value or wrong format in Drill Dia entry. Add it and retry.")
             self.app.inform.emit("[WARNING_NOTCL]No value or wrong format in Drill Dia entry. Add it and retry.")
             return
             return