- 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
This commit is contained in:
Marius Stanciu
2019-02-16 12:40:44 +02:00
committed by Marius S
parent ffb7931adb
commit b6d36bb86d
3 changed files with 23 additions and 10 deletions

View File

@@ -18,6 +18,8 @@ CAD program, and create G-Code for Isolation routing.
- 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 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

View File

@@ -153,8 +153,8 @@ class ToolCutOut(FlatCAMTool):
"- one gap Left / one gap Right\n"
"- 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'}])
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.")
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. "
"Fill in a correct value and retry. ")
return
@@ -318,7 +318,7 @@ class ToolCutOut(FlatCAMTool):
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,
xmin - gapsize, # botleft_x
py - gapsize + lenghty / 4, # botleft_y
@@ -330,7 +330,7 @@ class ToolCutOut(FlatCAMTool):
xmax + gapsize,
py + gapsize - lenghty / 4)
if int(gaps) == 8 or gaps == '2tb':
if gaps == '8' or gaps == '2TB':
subtract_rectangle(cutout_obj,
px - gapsize + lenghtx / 4,
ymin - gapsize,
@@ -342,14 +342,14 @@ class ToolCutOut(FlatCAMTool):
px + gapsize - lenghtx / 4,
ymax + gapsize)
if int(gaps) == 4 or gaps == 'lr':
if gaps == '4' or gaps == 'LR':
subtract_rectangle(cutout_obj,
xmin - gapsize,
py - gapsize,
xmax + gapsize,
py + gapsize)
if int(gaps) == 4 or gaps == 'tb':
if gaps == '4' or gaps == 'TB':
subtract_rectangle(cutout_obj,
px - gapsize,
ymin - gapsize,
@@ -447,9 +447,9 @@ class ToolCutOut(FlatCAMTool):
[maxx, midy + hgap],
[maxx, 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]]],
"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]]],
"4": [[pts[0], pts[1], pts[2]],
[pts[3], pts[4], pts[5]],

View File

@@ -317,7 +317,18 @@ class DblSidedTool(FlatCAMTool):
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 '':
self.app.inform.emit("[WARNING_NOTCL]No value or wrong format in Drill Dia entry. Add it and retry.")
return