- added protection against entering float numbers with comma separator instead of decimal dot separator in key points of FlatCAM (not everywhere)

- added a choice of plotting the kind of geometry for the CNC plot (all, travel and cut kind of geometries) in CNCJob Selected Tab
This commit is contained in:
Marius Stanciu
2019-02-02 23:56:08 +02:00
committed by Marius S
parent 0b96cbbac1
commit 7607aad8d8
15 changed files with 571 additions and 129 deletions

View File

@@ -255,10 +255,37 @@ class ToolCalculator(FlatCAMTool):
try:
tip_diameter = float(self.tipDia_entry.get_value())
half_tip_angle = float(self.tipAngle_entry.get_value()) / 2
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
tip_diameter = float(self.tipDia_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
"use a number.")
return
try:
half_tip_angle = float(self.tipAngle_entry.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
half_tip_angle = float(self.tipAngle_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
"use a number.")
return
half_tip_angle /= 2
try:
cut_depth = float(self.cutDepth_entry.get_value())
except:
return
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
cut_depth = float(self.cutDepth_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
"use a number.")
return
tool_diameter = tip_diameter + (2 * cut_depth * math.tan(math.radians(half_tip_angle)))
self.effectiveToolDia_entry.set_value("%.4f" % tool_diameter)
@@ -270,10 +297,50 @@ class ToolCalculator(FlatCAMTool):
self.mm_entry.set_value('%.6f' % (float(self.inch_entry.get_value()) * 25.4))
def on_calculate_eplate(self):
length = float(self.pcblength_entry.get_value())
width = float(self.pcbwidth_entry.get_value())
density = float(self.cdensity_entry.get_value())
copper = float(self.growth_entry.get_value())
try:
length = float(self.pcblength_entry.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
length = float(self.pcblength_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
"use a number.")
return
try:
width = float(self.pcbwidth_entry.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
width = float(self.pcbwidth_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
"use a number.")
return
try:
density = float(self.cdensity_entry.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
density = float(self.cdensity_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
"use a number.")
return
try:
copper = float(self.growth_entry.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
copper = float(self.growth_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
"use a number.")
return
calculated_current = (length * width * density) * 0.0021527820833419
calculated_time = copper * 2.142857142857143 * float(20 / density)

View File

@@ -8,7 +8,7 @@ from GUIElements import IntEntry, RadioSet, LengthEntry
from FlatCAMObj import FlatCAMGeometry, FlatCAMExcellon, FlatCAMGerber
class ToolCutout(FlatCAMTool):
class ToolCutOut(FlatCAMTool):
toolName = "Cutout PCB"
@@ -228,19 +228,37 @@ class ToolCutout(FlatCAMTool):
try:
dia = float(self.dia.get_value())
except TypeError:
self.app.inform.emit("[warning_notcl] Tool diameter value is missing. Add it and retry.")
return
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
dia = float(self.dia.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[warning_notcl] Tool diameter value is missing or wrong format. "
"Add it and retry.")
return
try:
margin = float(self.margin.get_value())
except TypeError:
self.app.inform.emit("[warning_notcl] Margin value is missing. Add it and retry.")
return
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
margin = float(self.margin.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[warning_notcl] Margin value is missing or wrong format. "
"Add it and retry.")
return
try:
gapsize = float(self.gapsize.get_value())
except TypeError:
self.app.inform.emit("[warning_notcl] Gap size value is missing. Add it and retry.")
return
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
gapsize = float(self.gapsize.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[warning_notcl] Gap size value is missing or wrong format. "
"Add it and retry.")
return
try:
gaps = self.gaps.get_value()
except TypeError:
@@ -349,19 +367,37 @@ class ToolCutout(FlatCAMTool):
try:
dia = float(self.dia.get_value())
except TypeError:
self.app.inform.emit("[warning_notcl] Tool diameter value is missing. Add it and retry.")
return
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
dia = float(self.dia.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[warning_notcl] Tool diameter value is missing or wrong format. "
"Add it and retry.")
return
try:
margin = float(self.margin.get_value())
except TypeError:
self.app.inform.emit("[warning_notcl] Margin value is missing. Add it and retry.")
return
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
margin = float(self.margin.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[warning_notcl] Margin value is missing or wrong format. "
"Add it and retry.")
return
try:
gapsize = float(self.gapsize.get_value())
except TypeError:
self.app.inform.emit("[warning_notcl] Gap size value is missing. Add it and retry.")
return
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
gapsize = float(self.gapsize.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[warning_notcl] Gap size value is missing or wrong format. "
"Add it and retry.")
return
try:
gaps = self.gaps_rect_radio.get_value()
except TypeError:

View File

@@ -6,6 +6,7 @@ from shapely.geometry import Point
from shapely import affinity
from PyQt5 import QtCore
class DblSidedTool(FlatCAMTool):
toolName = "2-Sided PCB"
@@ -113,8 +114,8 @@ class DblSidedTool(FlatCAMTool):
self.axloc_label = QtWidgets.QLabel("Axis Ref:")
self.axloc_label.setToolTip(
"The axis should pass through a <b>point</b> or cut\n "
"a specified <b>box</b> (in a Geometry object) in \n"
"the middle."
"a specified <b>box</b> (in a FlatCAM object) through \n"
"the center."
)
# grid_lay.addRow("Axis Location:", self.axis_location)
grid_lay.addWidget(self.axloc_label, 8, 0)
@@ -127,19 +128,18 @@ class DblSidedTool(FlatCAMTool):
self.point_box_container = QtWidgets.QVBoxLayout()
self.pb_label = QtWidgets.QLabel("<b>Point/Box:</b>")
self.pb_label.setToolTip(
"Specify the point (x, y) through which the mirror axis \n "
"passes or the Geometry object containing a rectangle \n"
"that the mirror axis cuts in half."
"If 'Point' is selected above it store the coordinates (x, y) through which\n"
"the mirroring axis passes.\n"
"If 'Box' is selected above, select here a FlatCAM object (Gerber, Exc or Geo).\n"
"Through the center of this object pass the mirroring axis selected above."
)
# grid_lay.addRow("Point/Box:", self.point_box_container)
self.add_point_button = QtWidgets.QPushButton("Add")
self.add_point_button.setToolTip(
"Add the <b>point (x, y)</b> through which the mirror axis \n "
"passes or the Object containing a rectangle \n"
"that the mirror axis cuts in half.\n"
"The point is captured by pressing SHIFT key\n"
"and left mouse clicking on canvas or you can enter them manually."
"Add the coordinates in format <b>(x, y)</b> through which the mirroring axis \n "
"selected in 'MIRROR AXIS' pass.\n"
"The (x, y) coordinates are captured by pressing SHIFT key\n"
"and left mouse button click on canvas or you can enter the coords manually."
)
self.add_point_button.setFixedWidth(40)
@@ -171,9 +171,9 @@ class DblSidedTool(FlatCAMTool):
self.ah_label.setToolTip(
"Alignment holes (x1, y1), (x2, y2), ... "
"on one side of the mirror axis. For each set of (x, y) coordinates\n"
"entered here, a pair of drills will be created: one on the\n"
"coordinates entered and one in mirror position over the axis\n"
"selected above in the 'Mirror Axis'."
"entered here, a pair of drills will be created:\n\n"
"- one drill at the coordinates from the field\n"
"- one drill in mirror position over the axis selected above in the 'Mirror Axis'."
)
self.layout.addWidget(self.ah_label)
@@ -184,10 +184,13 @@ class DblSidedTool(FlatCAMTool):
self.add_drill_point_button = QtWidgets.QPushButton("Add")
self.add_drill_point_button.setToolTip(
"Add alignment drill holes coords (x1, y1), (x2, y2), ... \n"
"on one side of the mirror axis.\n"
"The point(s) can be captured by pressing SHIFT key\n"
"and left mouse clicking on canvas. Or you can enter them manually."
"Add alignment drill holes coords in the format: (x1, y1), (x2, y2), ... \n"
"on one side of the mirror axis.\n\n"
"The coordinates set can be obtained:\n"
"- press SHIFT key and left mouse clicking on canvas. Then click Add.\n"
"- press SHIFT key and left mouse clicking on canvas. Then CTRL+V in the field.\n"
"- press SHIFT key and left mouse clicking on canvas. Then RMB click in the field and click Paste.\n"
"- by entering the coords manually in the format: (x1, y1), (x2, y2), ..."
)
self.add_drill_point_button.setFixedWidth(40)
@@ -195,11 +198,10 @@ class DblSidedTool(FlatCAMTool):
grid_lay1.addWidget(self.add_drill_point_button, 0, 3)
## Drill diameter for alignment holes
self.dt_label = QtWidgets.QLabel("<b>Alignment Drill Creation</b>:")
self.dt_label = QtWidgets.QLabel("<b>Alignment Drill Diameter</b>:")
self.dt_label.setToolTip(
"Create a set of alignment drill holes\n"
"with the specified diameter,\n"
"at the specified coordinates."
"Diameter of the drill for the "
"alignment holes."
)
self.layout.addWidget(self.dt_label)
@@ -295,6 +297,9 @@ class DblSidedTool(FlatCAMTool):
xscale, yscale = {"X": (1.0, -1.0), "Y": (-1.0, 1.0)}[axis]
dia = self.drill_dia.get_value()
if dia is None:
self.app.inform.emit("[warning_notcl]No value or wrong format in Drill Dia entry. Add it and retry.")
return
tools = {"1": {"C": dia}}
# holes = self.alignment_holes.get_value()

View File

@@ -1,6 +1,6 @@
from FlatCAMTool import FlatCAMTool
from GUIElements import RadioSet, FloatEntry
from GUIElements import RadioSet, FCEntry
from PyQt5 import QtGui, QtCore, QtWidgets
@@ -99,7 +99,7 @@ class Film(FlatCAMTool):
# Boundary for negative film generation
self.boundary_entry = FloatEntry()
self.boundary_entry = FCEntry()
self.boundary_label = QtWidgets.QLabel("Border:")
self.boundary_label.setToolTip(
"Specify a border around the object.\n"
@@ -172,7 +172,17 @@ class Film(FlatCAMTool):
self.app.inform.emit("[error_notcl] No Box object selected. Load a Box object and retry.")
return
border = float(self.boundary_entry.get_value())
try:
border = float(self.boundary_entry.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
border = float(self.boundary_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
"use a number.")
return
if border is None:
border = 0

View File

@@ -96,7 +96,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
self.addtool_entry_lbl.setToolTip(
"Diameter for the new tool to add in the Tool Table"
)
self.addtool_entry = FloatEntry()
self.addtool_entry = FCEntry()
# hlay.addWidget(self.addtool_label)
# hlay.addStretch()
@@ -150,7 +150,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
"due of too many paths."
)
grid3.addWidget(nccoverlabel, 1, 0)
self.ncc_overlap_entry = FloatEntry()
self.ncc_overlap_entry = FCEntry()
grid3.addWidget(self.ncc_overlap_entry, 1, 1)
nccmarginlabel = QtWidgets.QLabel('Margin:')
@@ -158,7 +158,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
"Bounding box margin."
)
grid3.addWidget(nccmarginlabel, 2, 0)
self.ncc_margin_entry = FloatEntry()
self.ncc_margin_entry = FCEntry()
grid3.addWidget(self.ncc_margin_entry, 2, 1)
# Method
@@ -430,7 +430,16 @@ class NonCopperClear(FlatCAMTool, Gerber):
if dia:
tool_dia = dia
else:
tool_dia = self.addtool_entry.get_value()
try:
tool_dia = float(self.addtool_entry.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
tool_dia = float(self.addtool_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
"use a number.")
return
if tool_dia is None:
self.build_ui()
self.app.inform.emit("[warning_notcl] Please enter a tool diameter to add, in Float format.")
@@ -487,7 +496,18 @@ class NonCopperClear(FlatCAMTool, Gerber):
tool_dias.append(float('%.4f' % v[tool_v]))
for row in range(self.tools_table.rowCount()):
new_tool_dia = float(self.tools_table.item(row, 1).text())
try:
new_tool_dia = float(self.tools_table.item(row, 1).text())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
new_tool_dia = float(self.tools_table.item(row, 1).text().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
"use a number.")
return
tooluid = int(self.tools_table.item(row, 3).text())
# identify the tool that was edited and get it's tooluid
@@ -553,10 +573,28 @@ class NonCopperClear(FlatCAMTool, Gerber):
def on_ncc(self):
over = self.ncc_overlap_entry.get_value()
try:
over = float(self.ncc_overlap_entry.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
over = float(self.ncc_overlap_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
"use a number.")
return
over = over if over else self.app.defaults["tools_nccoverlap"]
margin = self.ncc_margin_entry.get_value()
try:
margin = float(self.ncc_margin_entry.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
margin = float(self.ncc_margin_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
"use a number.")
return
margin = margin if margin else self.app.defaults["tools_nccmargin"]
connect = self.ncc_connect_cb.get_value()

View File

@@ -93,7 +93,7 @@ class ToolPaint(FlatCAMTool, Gerber):
self.addtool_entry_lbl.setToolTip(
"Diameter for the new tool."
)
self.addtool_entry = FloatEntry()
self.addtool_entry = FCEntry()
# hlay.addWidget(self.addtool_label)
# hlay.addStretch()
@@ -145,7 +145,7 @@ class ToolPaint(FlatCAMTool, Gerber):
"due of too many paths."
)
grid3.addWidget(ovlabel, 1, 0)
self.paintoverlap_entry = LengthEntry()
self.paintoverlap_entry = FCEntry()
grid3.addWidget(self.paintoverlap_entry, 1, 1)
# Margin
@@ -156,7 +156,7 @@ class ToolPaint(FlatCAMTool, Gerber):
"be painted."
)
grid3.addWidget(marginlabel, 2, 0)
self.paintmargin_entry = LengthEntry()
self.paintmargin_entry = FCEntry()
grid3.addWidget(self.paintmargin_entry, 2, 1)
# Method
@@ -486,7 +486,17 @@ class ToolPaint(FlatCAMTool, Gerber):
if dia:
tool_dia = dia
else:
tool_dia = self.addtool_entry.get_value()
try:
tool_dia = float(self.addtool_entry.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
tool_dia = float(self.addtool_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
"use a number.")
return
if tool_dia is None:
self.build_ui()
self.app.inform.emit("[warning_notcl] Please enter a tool diameter to add, in Float format.")
@@ -546,7 +556,16 @@ class ToolPaint(FlatCAMTool, Gerber):
tool_dias.append(float('%.4f' % v[tool_v]))
for row in range(self.tools_table.rowCount()):
new_tool_dia = float(self.tools_table.item(row, 1).text())
try:
new_tool_dia = float(self.tools_table.item(row, 1).text())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
new_tool_dia = float(self.tools_table.item(row, 1).text().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
"use a number.")
return
tooluid = int(self.tools_table.item(row, 3).text())
# identify the tool that was edited and get it's tooluid
@@ -672,8 +691,17 @@ class ToolPaint(FlatCAMTool, Gerber):
self.app.report_usage("geometry_on_paint_button")
self.app.inform.emit("[warning_notcl]Click inside the desired polygon.")
try:
overlap = float(self.paintoverlap_entry.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
overlap = float(self.paintoverlap_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
"use a number.")
return
overlap = self.paintoverlap_entry.get_value()
connect = self.pathconnect_cb.get_value()
contour = self.paintcontour_cb.get_value()
select_method = self.selectmethod_combo.get_value()
@@ -744,7 +772,17 @@ class ToolPaint(FlatCAMTool, Gerber):
# poly = find_polygon(self.solid_geometry, inside_pt)
poly = obj.find_polygon(inside_pt)
paint_method = self.paintmethod_combo.get_value()
paint_margin = self.paintmargin_entry.get_value()
try:
paint_margin = float(self.paintmargin_entry.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
paint_margin = float(self.paintmargin_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
"use a number.")
return
# No polygon?
if poly is None:
@@ -878,10 +916,19 @@ class ToolPaint(FlatCAMTool, Gerber):
:return:
"""
paint_method = self.paintmethod_combo.get_value()
paint_margin = self.paintmargin_entry.get_value()
try:
paint_margin = float(self.paintmargin_entry.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
paint_margin = float(self.paintmargin_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
"use a number.")
return
proc = self.app.proc_container.new("Painting polygon.")
name = outname if outname else self.obj_name + "_paint"
over = overlap
conn = connect

View File

@@ -82,7 +82,7 @@ class Panelize(FlatCAMTool):
form_layout.addRow(self.box_combo_label, self.box_combo)
## Spacing Columns
self.spacing_columns = FloatEntry()
self.spacing_columns = FCEntry()
self.spacing_columns_label = QtWidgets.QLabel("Spacing cols:")
self.spacing_columns_label.setToolTip(
"Spacing between columns of the desired panel.\n"
@@ -91,7 +91,7 @@ class Panelize(FlatCAMTool):
form_layout.addRow(self.spacing_columns_label, self.spacing_columns)
## Spacing Rows
self.spacing_rows = FloatEntry()
self.spacing_rows = FCEntry()
self.spacing_rows_label = QtWidgets.QLabel("Spacing rows:")
self.spacing_rows_label.setToolTip(
"Spacing between rows of the desired panel.\n"
@@ -100,7 +100,7 @@ class Panelize(FlatCAMTool):
form_layout.addRow(self.spacing_rows_label, self.spacing_rows)
## Columns
self.columns = IntEntry()
self.columns = FCEntry()
self.columns_label = QtWidgets.QLabel("Columns:")
self.columns_label.setToolTip(
"Number of columns of the desired panel"
@@ -108,7 +108,7 @@ class Panelize(FlatCAMTool):
form_layout.addRow(self.columns_label, self.columns)
## Rows
self.rows = IntEntry()
self.rows = FCEntry()
self.rows_label = QtWidgets.QLabel("Rows:")
self.rows_label.setToolTip(
"Number of rows of the desired panel"
@@ -126,7 +126,7 @@ class Panelize(FlatCAMTool):
)
form_layout.addRow(self.constrain_cb)
self.x_width_entry = FloatEntry()
self.x_width_entry = FCEntry()
self.x_width_lbl = QtWidgets.QLabel("Width (DX):")
self.x_width_lbl.setToolTip(
"The width (DX) within which the panel must fit.\n"
@@ -134,7 +134,7 @@ class Panelize(FlatCAMTool):
)
form_layout.addRow(self.x_width_lbl, self.x_width_entry)
self.y_height_entry = FloatEntry()
self.y_height_entry = FCEntry()
self.y_height_lbl = QtWidgets.QLabel("Height (DY):")
self.y_height_lbl.setToolTip(
"The height (DY)within which the panel must fit.\n"
@@ -237,20 +237,77 @@ class Panelize(FlatCAMTool):
self.outname = name + '_panelized'
spacing_columns = self.spacing_columns.get_value()
try:
spacing_columns = float(self.spacing_columns.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
spacing_columns = float(self.spacing_columns.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
"use a number.")
return
spacing_columns = spacing_columns if spacing_columns is not None else 0
spacing_rows = self.spacing_rows.get_value()
try:
spacing_rows = float(self.spacing_rows.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
spacing_rows = float(self.spacing_rows.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
"use a number.")
return
spacing_rows = spacing_rows if spacing_rows is not None else 0
rows = self.rows.get_value()
try:
rows = int(self.rows.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
rows = float(self.rows.get_value().replace(',', '.'))
rows = int(rows)
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
"use a number.")
return
rows = rows if rows is not None else 1
columns = self.columns.get_value()
try:
columns = int(self.columns.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
columns = float(self.columns.get_value().replace(',', '.'))
columns = int(columns)
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
"use a number.")
return
columns = columns if columns is not None else 1
constrain_dx = self.x_width_entry.get_value()
constrain_dy = self.y_height_entry.get_value()
try:
constrain_dx = float(self.x_width_entry.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
constrain_dx = float(self.x_width_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
"use a number.")
return
try:
constrain_dy = float(self.y_height_entry.get_value())
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
constrain_dy = float(self.y_height_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered, "
"use a number.")
return
if 0 in {columns, rows}:
self.app.inform.emit("[error_notcl]Columns or Rows are zero value. Change them to a positive integer.")

View File

@@ -377,9 +377,14 @@ class ToolTransform(FlatCAMTool):
def on_rotate(self):
try:
value = float(self.rotate_entry.get_value())
except Exception as e:
self.app.inform.emit("[error] Failed to rotate due of: %s" % str(e))
return
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
value = float(self.rotate_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered for Rotate, "
"use a number.")
return
self.app.worker_task.emit({'fcn': self.on_rotate_action,
'params': [value]})
# self.on_rotate_action(value)
@@ -406,9 +411,15 @@ class ToolTransform(FlatCAMTool):
def on_skewx(self):
try:
value = float(self.skewx_entry.get_value())
except:
self.app.inform.emit("[warning_notcl] No value for Skew!")
return
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
value = float(self.skewx_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered for Skew X, "
"use a number.")
return
# self.on_skew("X", value)
axis = 'X'
self.app.worker_task.emit({'fcn': self.on_skew,
@@ -418,9 +429,15 @@ class ToolTransform(FlatCAMTool):
def on_skewy(self):
try:
value = float(self.skewy_entry.get_value())
except:
self.app.inform.emit("[warning_notcl] No value for Skew!")
return
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
value = float(self.skewy_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered for Skew Y, "
"use a number.")
return
# self.on_skew("Y", value)
axis = 'Y'
self.app.worker_task.emit({'fcn': self.on_skew,
@@ -430,9 +447,15 @@ class ToolTransform(FlatCAMTool):
def on_scalex(self):
try:
xvalue = float(self.scalex_entry.get_value())
except:
self.app.inform.emit("[warning_notcl] No value for Scale!")
return
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
xvalue = float(self.scalex_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered for Scale X, "
"use a number.")
return
# scaling to zero has no sense so we remove it, because scaling with 1 does nothing
if xvalue == 0:
xvalue = 1
@@ -458,9 +481,15 @@ class ToolTransform(FlatCAMTool):
xvalue = 1
try:
yvalue = float(self.scaley_entry.get_value())
except:
self.app.inform.emit("[warning_notcl] No value for Scale!")
return
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
yvalue = float(self.scaley_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered for Scale Y, "
"use a number.")
return
# scaling to zero has no sense so we remove it, because scaling with 1 does nothing
if yvalue == 0:
yvalue = 1
@@ -481,9 +510,15 @@ class ToolTransform(FlatCAMTool):
def on_offx(self):
try:
value = float(self.offx_entry.get_value())
except:
self.app.inform.emit("[warning_notcl] No value for Offset!")
return
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
value = float(self.offx_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered for Offset X, "
"use a number.")
return
# self.on_offset("X", value)
axis = 'X'
self.app.worker_task.emit({'fcn': self.on_offset,
@@ -493,9 +528,15 @@ class ToolTransform(FlatCAMTool):
def on_offy(self):
try:
value = float(self.offy_entry.get_value())
except:
self.app.inform.emit("[warning_notcl] No value for Offset!")
return
except ValueError:
# try to convert comma to decimal point. if it's still not working error message and return
try:
value = float(self.offy_entry.get_value().replace(',', '.'))
except ValueError:
self.app.inform.emit("[error_notcl]Wrong value format entered for Offset Y, "
"use a number.")
return
# self.on_offset("Y", value)
axis = 'Y'
self.app.worker_task.emit({'fcn': self.on_offset,

View File

@@ -5,7 +5,8 @@ from flatcamTools.ToolPanelize import Panelize
from flatcamTools.ToolFilm import Film
from flatcamTools.ToolMove import ToolMove
from flatcamTools.ToolDblSided import DblSidedTool
from flatcamTools.ToolCutout import ToolCutout
from flatcamTools.ToolCutOut import ToolCutOut
from flatcamTools.ToolCalculators import ToolCalculator
from flatcamTools.ToolProperties import Properties
from flatcamTools.ToolImage import ToolImage