diff --git a/FlatCAMApp.py b/FlatCAMApp.py
index 2503dffa..5ae8b993 100644
--- a/FlatCAMApp.py
+++ b/FlatCAMApp.py
@@ -396,6 +396,8 @@ class App(QtCore.QObject):
self.defaults = LoudDict()
self.defaults.update({
# Global APP Preferences
+ "decimals_inch": 4,
+ "decimals_metric": 4,
"version": self.version,
"first_run": True,
"units": "MM",
@@ -937,6 +939,11 @@ class App(QtCore.QObject):
if user_defaults:
self.load_defaults(filename='current_defaults')
+ if self.defaults['units'] == 'MM':
+ self.decimals = int(self.defaults['decimals_metric'])
+ else:
+ self.decimals = int(self.defaults['decimals_inch'])
+
# #############################################################################
# ##################### CREATE MULTIPROCESSING POOL ###########################
# #############################################################################
@@ -987,7 +994,7 @@ class App(QtCore.QObject):
QtCore.QObject.__init__(self)
- self.ui = FlatCAMGUI(self.version, self.beta, self)
+ self.ui = FlatCAMGUI(self)
theme_settings = QtCore.QSettings("Open Source", "FlatCAM")
if theme_settings.contains("theme"):
@@ -1020,6 +1027,8 @@ class App(QtCore.QObject):
# def new_object(self, kind, name, initialize, active=True, fit=True, plot=True)
self.defaults_form_fields = {
# General App
+ "decimals_inch": self.ui.general_defaults_form.general_app_group.precision_inch_entry,
+ "decimals_metric": self.ui.general_defaults_form.general_app_group.precision_metric_entry,
"units": self.ui.general_defaults_form.general_app_group.units_radio,
"global_graphic_engine": self.ui.general_defaults_form.general_app_group.ge_radio,
"global_app_level": self.ui.general_defaults_form.general_app_group.app_level_radio,
@@ -3354,7 +3363,7 @@ class App(QtCore.QObject):
self.inform.emit('[WARNING_NOTCL] %s' %
_("Select a Gerber, Geometry or Excellon Object to update."))
return
- edited_obj.set_ui(edited_obj.ui_type())
+ edited_obj.set_ui(edited_obj.ui_type(decimals=self.decimals))
self.ui.notebook.setCurrentWidget(self.ui.selected_tab)
elif response == bt_cancel:
return
@@ -5670,13 +5679,15 @@ class App(QtCore.QObject):
coords_xy = [float(eval(a)) for a in coordinates if a != '']
coords_xy[0] *= sfactor
coords_xy[1] *= sfactor
- self.defaults['excellon_toolchangexy'] = "%.4f, %.4f" % (coords_xy[0], coords_xy[1])
+ self.defaults['excellon_toolchangexy'] = "%.*f, %.*f" % (self.decimals, coords_xy[0],
+ self.decimals, coords_xy[1])
elif dim == 'geometry_toolchangexy':
coordinates = self.defaults["geometry_toolchangexy"].split(",")
coords_xy = [float(eval(a)) for a in coordinates if a != '']
coords_xy[0] *= sfactor
coords_xy[1] *= sfactor
- self.defaults['geometry_toolchangexy'] = "%.4f, %.4f" % (coords_xy[0], coords_xy[1])
+ self.defaults['geometry_toolchangexy'] = "%.*f, %.*f" % (self.decimals, coords_xy[0],
+ self.decimals, coords_xy[1])
elif dim == 'geometry_cnctooldia':
tools_diameters = []
try:
@@ -5688,7 +5699,7 @@ class App(QtCore.QObject):
self.defaults['geometry_cnctooldia'] = ''
for t in range(len(tools_diameters)):
tools_diameters[t] *= sfactor
- self.defaults['geometry_cnctooldia'] += "%.4f," % tools_diameters[t]
+ self.defaults['geometry_cnctooldia'] += "%.*f," % (self.decimals, tools_diameters[t])
elif dim == 'tools_ncctools':
ncctools = []
try:
@@ -5700,7 +5711,7 @@ class App(QtCore.QObject):
self.defaults['tools_ncctools'] = ''
for t in range(len(ncctools)):
ncctools[t] *= sfactor
- self.defaults['tools_ncctools'] += "%.4f," % ncctools[t]
+ self.defaults['tools_ncctools'] += "%.*f," % (self.decimals, ncctools[t])
elif dim == 'tools_solderpaste_tools':
sptools = []
try:
@@ -5712,13 +5723,14 @@ class App(QtCore.QObject):
self.defaults['tools_solderpaste_tools'] = ""
for t in range(len(sptools)):
sptools[t] *= sfactor
- self.defaults['tools_solderpaste_tools'] += "%.4f," % sptools[t]
+ self.defaults['tools_solderpaste_tools'] += "%.*f," % (self.decimals, sptools[t])
elif dim == 'tools_solderpaste_xy_toolchange':
coordinates = self.defaults["tools_solderpaste_xy_toolchange"].split(",")
sp_coords = [float(eval(a)) for a in coordinates if a != '']
sp_coords[0] *= sfactor
sp_coords[1] *= sfactor
- self.defaults['tools_solderpaste_xy_toolchange'] = "%.4f, %.4f" % (sp_coords[0], sp_coords[1])
+ self.defaults['tools_solderpaste_xy_toolchange'] = "%.*f, %.*f" % (self.decimals, sp_coords[0],
+ self.decimals, sp_coords[1])
elif dim == 'global_gridx' or dim == 'global_gridy':
if new_units == 'IN':
val = 0.1
@@ -5727,7 +5739,7 @@ class App(QtCore.QObject):
except Exception as e:
log.debug('App.on_toggle_units().scale_defaults() --> %s' % str(e))
- self.defaults[dim] = float('%.6f' % val)
+ self.defaults[dim] = float('%.*f' % (self.decimals, val))
else:
val = 0.1
try:
@@ -5735,7 +5747,7 @@ class App(QtCore.QObject):
except Exception as e:
log.debug('App.on_toggle_units().scale_defaults() --> %s' % str(e))
- self.defaults[dim] = float('%.4f' % val)
+ self.defaults[dim] = float('%.*f' % (self.decimals, val))
else:
val = 0.1
if self.defaults[dim]:
diff --git a/FlatCAMObj.py b/FlatCAMObj.py
index c09fe9b5..5cf2d2e0 100644
--- a/FlatCAMObj.py
+++ b/FlatCAMObj.py
@@ -83,6 +83,7 @@ class FlatCAMObj(QtCore.QObject):
:param name: Name of the object given by the user.
:return: FlatCAMObj
"""
+
QtCore.QObject.__init__(self)
# View
@@ -572,6 +573,8 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
grb_final.follow_geometry = MultiPolygon(grb_final.follow_geometry)
def __init__(self, name):
+ self.decimals = self.app.decimals
+
Gerber.__init__(self, steps_per_circle=int(self.app.defaults["gerber_circle_steps"]))
FlatCAMObj.__init__(self, name)
@@ -617,9 +620,6 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
# list of rows with apertures plotted
self.marked_rows = []
- # Number of decimals to be used by tools in this class
- self.decimals = 4
-
# Mouse events
self.mr = None
@@ -648,11 +648,6 @@ class FlatCAMGerber(FlatCAMObj, Gerber):
self.units = self.app.defaults['units'].upper()
- if self.units == 'MM':
- self.decimals = 2
- else:
- self.decimals = 4
-
self.replotApertures.connect(self.on_mark_cb_click_table)
self.form_fields.update({
@@ -2095,6 +2090,8 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
optionChanged = QtCore.pyqtSignal(str)
def __init__(self, name):
+ self.decimals = self.app.decimals
+
Excellon.__init__(self, geo_steps_per_circle=int(self.app.defaults["geometry_circle_steps"]))
FlatCAMObj.__init__(self, name)
@@ -2146,9 +2143,6 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
self.multigeo = False
- # Number fo decimals to be used for tools in this class
- self.decimals = 4
-
# Attributes to be included in serialization
# Always append to it because it carries contents
# from predecessors.
@@ -2559,11 +2553,6 @@ class FlatCAMExcellon(FlatCAMObj, Excellon):
self.units = self.app.defaults['units'].upper()
- if self.units == 'MM':
- self.decimals = 2
- else:
- self.decimals = 4
-
self.form_fields.update({
"plot": self.ui.plot_cb,
"solid": self.ui.solid_cb,
@@ -3430,6 +3419,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
ui_type = GeometryObjectUI
def __init__(self, name):
+ self.decimals = self.app.decimals
FlatCAMObj.__init__(self, name)
Geometry.__init__(self, geo_steps_per_circle=int(self.app.defaults["geometry_circle_steps"]))
@@ -3507,9 +3497,6 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
self.old_pp_state = self.app.defaults["geometry_multidepth"]
self.old_toolchangeg_state = self.app.defaults["geometry_toolchange"]
- # Number of decimals to be used for tools in this class
- self.decimals = 4
-
# Attributes to be included in serialization
# Always append to it because it carries contents
# from predecessors.
@@ -3668,11 +3655,6 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
self.units = self.app.defaults['units'].upper()
- if self.units == 'MM':
- self.decimals = 2
- else:
- self.decimals = 4
-
# populate postprocessor names in the combobox
for name in list(self.app.postprocessors.keys()):
self.ui.pp_geometry_name_cb.addItem(name)
@@ -5588,10 +5570,7 @@ class FlatCAMGeometry(FlatCAMObj, Geometry):
if tooldia:
tooldia *= factor
# limit the decimals to 2 for METRIC and 3 for INCH
- if units.lower() == 'in':
- tooldia = float('%.4f' % tooldia)
- else:
- tooldia = float('%.2f' % tooldia)
+ tooldia = float('%.*f' % (self.decimals, tooldia))
self.ui.addtool_entry.set_value(tooldia)
@@ -5810,7 +5789,7 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
FlatCAMApp.App.log.debug("Creating CNCJob object...")
- self.decimals = 4
+ self.decimals = self.app.decimals
CNCjob.__init__(self, units=units, kind=kind, z_move=z_move,
feedrate=feedrate, feedrate_rapid=feedrate_rapid, z_cut=z_cut, tooldia=tooldia,
@@ -6033,11 +6012,6 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
self.units = self.app.defaults['units'].upper()
- if self.units == "IN":
- self.decimals = 4
- else:
- self.decimals = 2
-
# this signal has to be connected to it's slot before the defaults are populated
# the decision done in the slot has to override the default value set bellow
self.ui.toolchange_cb.toggled.connect(self.on_toolchange_custom_clicked)
@@ -6709,6 +6683,8 @@ class FlatCAMScript(FlatCAMObj):
ui_type = ScriptObjectUI
def __init__(self, name):
+ self.decimals = self.app.decimals
+
FlatCAMApp.App.log.debug("Creating a FlatCAMScript object...")
FlatCAMObj.__init__(self, name)
@@ -6721,7 +6697,6 @@ class FlatCAMScript(FlatCAMObj):
})
self.units = ''
- self.decimals = 4
self.ser_attrs = ['options', 'kind', 'source_file']
self.source_file = ''
@@ -6738,7 +6713,6 @@ class FlatCAMScript(FlatCAMObj):
"Expected a ScriptObjectUI, got %s" % type(self.ui)
self.units = self.app.defaults['units'].upper()
- self.decimals = 4 if self.units == "IN" else 2
# Fill form fields only on object create
self.to_form()
@@ -6905,13 +6879,13 @@ class FlatCAMDocument(FlatCAMObj):
ui_type = DocumentObjectUI
def __init__(self, name):
+ self.decimals = self.app.decimals
+
FlatCAMApp.App.log.debug("Creating a Document object...")
FlatCAMObj.__init__(self, name)
self.kind = "document"
-
self.units = ''
- self.decimals = 4
self.ser_attrs = ['options', 'kind', 'source_file']
self.source_file = ''
@@ -6934,11 +6908,6 @@ class FlatCAMDocument(FlatCAMObj):
self.units = self.app.defaults['units'].upper()
- if self.units == "IN":
- self.decimals = 4
- else:
- self.decimals = 2
-
# Fill form fields only on object create
self.to_form()
diff --git a/FlatCAMTool.py b/FlatCAMTool.py
index 56e17a70..6c51ecb9 100644
--- a/FlatCAMTool.py
+++ b/FlatCAMTool.py
@@ -24,15 +24,15 @@ class FlatCAMTool(QtWidgets.QWidget):
:param parent: Qt Parent
:return: FlatCAMTool
"""
- QtWidgets.QWidget.__init__(self, parent)
+ self.app = app
+ self.decimals = app.decimals
+ QtWidgets.QWidget.__init__(self, parent)
# self.setSizePolicy(QtWidgets.QSizePolicy.Maximum, QtWidgets.QSizePolicy.Maximum)
self.layout = QtWidgets.QVBoxLayout()
self.setLayout(self.layout)
- self.app = app
-
self.menuAction = None
def install(self, icon=None, separator=None, shortcut=None, **kwargs):
diff --git a/ObjectCollection.py b/ObjectCollection.py
index b917ea47..e9cbb6d5 100644
--- a/ObjectCollection.py
+++ b/ObjectCollection.py
@@ -498,7 +498,7 @@ class ObjectCollection(QtCore.QAbstractItemModel):
name += "_1"
obj.options["name"] = name
- obj.set_ui(obj.ui_type())
+ obj.set_ui(obj.ui_type(decimals=self.app.decimals))
# Required before appending (Qt MVC)
group = self.group_items[obj.kind]
diff --git a/README.md b/README.md
index 9d7bad5d..ee85cfad 100644
--- a/README.md
+++ b/README.md
@@ -15,6 +15,7 @@ CAD program, and create G-Code for Isolation routing.
- Copper Thieving Tool - added units label for the pattern plated area
- Properties Tool - added a new parameter, the copper area which show the area of the copper features for the Gerber objects
- Copper Thieving Tool - added a default value for the mask clearance when generating pattern plating mask
+- application wide change: introduced the precision parameters in Edit -> Preferences who will control how many decimals to use in the app parameters
4.12.2019
diff --git a/camlib.py b/camlib.py
index aede3e53..d181711f 100644
--- a/camlib.py
+++ b/camlib.py
@@ -465,7 +465,8 @@ class Geometry(object):
def __init__(self, geo_steps_per_circle=None):
# Units (in or mm)
self.units = self.app.defaults["units"]
-
+ self.decimals = self.app.decimals
+
# Final geometry: MultiPolygon or list (of geometry constructs)
self.solid_geometry = None
@@ -2144,6 +2145,8 @@ class CNCjob(Geometry):
segy=None,
steps_per_circle=None):
+ self.decimals = self.app.decimals
+
# Used when parsing G-code arcs
self.steps_per_circle = int(self.app.defaults['cncjob_steps_per_circle'])
@@ -2592,10 +2595,7 @@ class CNCjob(Geometry):
if self.dwell is True:
gcode += self.doformat(p.dwell_code) # Dwell time
- if self.units == 'MM':
- current_tooldia = float('%.2f' % float(exobj.tools[tool]["C"]))
- else:
- current_tooldia = float('%.4f' % float(exobj.tools[tool]["C"]))
+ current_tooldia = float('%.*f' % (self.decimals, float(exobj.tools[tool]["C"])))
self.app.inform.emit(
'%s: %s%s.' % (_("Starting G-Code for tool with diameter"),
@@ -2738,10 +2738,7 @@ class CNCjob(Geometry):
if self.dwell is True:
gcode += self.doformat(p.dwell_code) # Dwell time
- if self.units == 'MM':
- current_tooldia = float('%.2f' % float(exobj.tools[tool]["C"]))
- else:
- current_tooldia = float('%.4f' % float(exobj.tools[tool]["C"]))
+ current_tooldia = float('%.*f' % (self.decimals, float(exobj.tools[tool]["C"])))
self.app.inform.emit(
'%s: %s%s.' % (_("Starting G-Code for tool with diameter"),
@@ -2842,10 +2839,7 @@ class CNCjob(Geometry):
if self.dwell is True:
gcode += self.doformat(p.dwell_code) # Dwell time
- if self.units == 'MM':
- current_tooldia = float('%.2f' % float(exobj.tools[tool]["C"]))
- else:
- current_tooldia = float('%.4f' % float(exobj.tools[tool]["C"]))
+ current_tooldia = float('%.*f' % (self.decimals, float(exobj.tools[tool]["C"])))
self.app.inform.emit(
'%s: %s%s.' % (_("Starting G-Code for tool with diameter"),
@@ -3164,10 +3158,7 @@ class CNCjob(Geometry):
old_disp_number = 0
log.warning("Number of paths for which to generate GCode: %s" % str(geo_len))
- if self.units == 'MM':
- current_tooldia = float('%.2f' % float(self.tooldia))
- else:
- current_tooldia = float('%.4f' % float(self.tooldia))
+ current_tooldia = float('%.*f' % (self.decimals, float(self.tooldia)))
self.app.inform.emit( '%s: %s%s.' % (_("Starting G-Code for tool with diameter"),
str(current_tooldia),
@@ -3511,10 +3502,7 @@ class CNCjob(Geometry):
old_disp_number = 0
log.warning("Number of paths for which to generate GCode: %s" % str(geo_len))
- if self.units == 'MM':
- current_tooldia = float('%.2f' % float(self.tooldia))
- else:
- current_tooldia = float('%.4f' % float(self.tooldia))
+ current_tooldia = float('%.*f' % (self.decimals, float(self.tooldia)))
self.app.inform.emit(
'%s: %s%s.' % (_("Starting G-Code for tool with diameter"),
@@ -3997,18 +3985,27 @@ class CNCjob(Geometry):
# create the geometry for the holes created when drilling Excellon drills
if self.origin_kind == 'excellon':
if current['Z'] < 0:
- current_drill_point_coords = (float('%.4f' % current['X']), float('%.4f' % current['Y']))
+ current_drill_point_coords = (
+ float('%.*f' % (self.decimals, current['X'])),
+ float('%.*f' % (self.decimals, current['Y']))
+ )
+
# find the drill diameter knowing the drill coordinates
for pt_dict in self.exc_drills:
- point_in_dict_coords = (float('%.4f' % pt_dict['point'].x),
- float('%.4f' % pt_dict['point'].y))
+ point_in_dict_coords = (
+ float('%.*f' % (self.decimals, pt_dict['point'].x)),
+ float('%.*f' % (self.decimals, pt_dict['point'].y))
+ )
if point_in_dict_coords == current_drill_point_coords:
tool = pt_dict['tool']
dia = self.exc_tools[tool]['C']
kind = ['C', 'F']
- geometry.append({"geom": Point(current_drill_point_coords).
- buffer(dia/2).exterior,
- "kind": kind})
+ geometry.append(
+ {
+ "geom": Point(current_drill_point_coords).buffer(dia/2).exterior,
+ "kind": kind
+ }
+ )
break
if 'G' in gobj:
@@ -4053,8 +4050,12 @@ class CNCjob(Geometry):
# end, therefore, see here too if there is
# a final path.
if len(path) > 1:
- geometry.append({"geom": LineString(path),
- "kind": kind})
+ geometry.append(
+ {
+ "geom": LineString(path),
+ "kind": kind
+ }
+ )
self.gcode_parsed = geometry
return geometry
diff --git a/flatcamEditors/FlatCAMExcEditor.py b/flatcamEditors/FlatCAMExcEditor.py
index e36384a8..5aa9cf8d 100644
--- a/flatcamEditors/FlatCAMExcEditor.py
+++ b/flatcamEditors/FlatCAMExcEditor.py
@@ -3009,7 +3009,8 @@ class FlatCAMExcEditor(QtCore.QObject):
# add a first tool in the Tool Table but only if the Excellon Object is empty
if not self.tool2tooldia:
- self.on_tool_add(tooldia=float('%.2f' % float(self.app.defaults['excellon_editor_newdia'])))
+ self.on_tool_add(tooldia=float('%.*f' % (self.decimals,
+ float(self.app.defaults['excellon_editor_newdia']))))
def update_fcexcellon(self, exc_obj):
"""
diff --git a/flatcamEditors/FlatCAMGrbEditor.py b/flatcamEditors/FlatCAMGrbEditor.py
index f6592933..18b4d59e 100644
--- a/flatcamEditors/FlatCAMGrbEditor.py
+++ b/flatcamEditors/FlatCAMGrbEditor.py
@@ -4959,7 +4959,7 @@ class FlatCAMGrbEditor(QtCore.QObject):
if float(upper_threshold_val) > area > float(lower_threshold_val):
current_pos = geo_el.geo['solid'].exterior.coords[-1]
- text_elem = '%.4f' % area
+ text_elem = '%.*f' % (self.decimals, area)
text.append(text_elem)
position.append(current_pos)
self.geo_to_delete.append(geo_el)
diff --git a/flatcamGUI/FlatCAMGUI.py b/flatcamGUI/FlatCAMGUI.py
index 3d3e7201..2a549e5a 100644
--- a/flatcamGUI/FlatCAMGUI.py
+++ b/flatcamGUI/FlatCAMGUI.py
@@ -32,10 +32,12 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
geom_update = QtCore.pyqtSignal(int, int, int, int, int, name='geomUpdate')
final_save = QtCore.pyqtSignal(name='saveBeforeExit')
- def __init__(self, version, beta, app):
+ def __init__(self, app):
super(FlatCAMGUI, self).__init__()
self.app = app
+ self.decimals = self.app.decimals
+
# Divine icon pack by Ipapun @ finicons.com
# ################################## ##
@@ -2002,8 +2004,8 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
self.setGeometry(100, 100, 1024, 650)
self.setWindowTitle('FlatCAM %s %s - %s' %
- (version,
- ('BETA' if beta else ''),
+ (self.app.version,
+ ('BETA' if self.app.beta else ''),
platform.architecture()[0])
)
@@ -2024,14 +2026,14 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
self.grb_editor_cmenu.menuAction().setVisible(False)
self.e_editor_cmenu.menuAction().setVisible(False)
- self.general_defaults_form = GeneralPreferencesUI()
- self.gerber_defaults_form = GerberPreferencesUI()
- self.excellon_defaults_form = ExcellonPreferencesUI()
- self.geometry_defaults_form = GeometryPreferencesUI()
- self.cncjob_defaults_form = CNCJobPreferencesUI()
- self.tools_defaults_form = ToolsPreferencesUI()
- self.tools2_defaults_form = Tools2PreferencesUI()
- self.util_defaults_form = UtilPreferencesUI()
+ self.general_defaults_form = GeneralPreferencesUI(decimals=self.decimals)
+ self.gerber_defaults_form = GerberPreferencesUI(decimals=self.decimals)
+ self.excellon_defaults_form = ExcellonPreferencesUI(decimals=self.decimals)
+ self.geometry_defaults_form = GeometryPreferencesUI(decimals=self.decimals)
+ self.cncjob_defaults_form = CNCJobPreferencesUI(decimals=self.decimals)
+ self.tools_defaults_form = ToolsPreferencesUI(decimals=self.decimals)
+ self.tools2_defaults_form = Tools2PreferencesUI(decimals=self.decimals)
+ self.util_defaults_form = UtilPreferencesUI(decimals=self.decimals)
QtWidgets.qApp.installEventFilter(self)
@@ -3471,16 +3473,12 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
val, ok = tool_add_popup.get_value()
if ok:
self.app.exc_editor.on_tool_add(tooldia=val)
- formated_val = '%.4f' % float(val)
- self.app.inform.emit('[success] %s: %s %s' %
- (_("Added new tool with dia"),
- formated_val,
- str(self.units)
- )
- )
- else:
+ formated_val = '%.*f' % (self.decimals, float(val))
self.app.inform.emit(
- '[WARNING_NOTCL] %s' % _("Adding Tool cancelled ..."))
+ '[success] %s: %s %s' % (_("Added new tool with dia"), formated_val, str(self.units))
+ )
+ else:
+ self.app.inform.emit('[WARNING_NOTCL] %s' % _("Adding Tool cancelled ..."))
return
# Zoom Fit
diff --git a/flatcamGUI/GUIElements.py b/flatcamGUI/GUIElements.py
index 7a5a285c..9b8afbe4 100644
--- a/flatcamGUI/GUIElements.py
+++ b/flatcamGUI/GUIElements.py
@@ -145,7 +145,7 @@ class RadioSet(QtWidgets.QWidget):
class LengthEntry(QtWidgets.QLineEdit):
- def __init__(self, output_units='IN', parent=None):
+ def __init__(self, output_units='IN', decimals=None, parent=None):
super(LengthEntry, self).__init__(parent)
self.output_units = output_units
@@ -160,6 +160,7 @@ class LengthEntry(QtWidgets.QLineEdit):
}
self.readyToEdit = True
self.editingFinished.connect(self.on_edit_finished)
+ self.decimals = decimals if decimals is not None else 4
def on_edit_finished(self):
self.clearFocus()
@@ -203,8 +204,9 @@ class LengthEntry(QtWidgets.QLineEdit):
log.warning("Could not parse value in entry: %s" % str(raw))
return None
- def set_value(self, val):
- self.setText(str('%.4f' % val))
+ def set_value(self, val, decimals=None):
+ dec_digits = decimals if decimals is not None else self.decimals
+ self.setText(str('%.*f' % (dec_digits, val)))
def sizeHint(self):
default_hint_size = super(LengthEntry, self).sizeHint()
@@ -212,10 +214,11 @@ class LengthEntry(QtWidgets.QLineEdit):
class FloatEntry(QtWidgets.QLineEdit):
- def __init__(self, parent=None):
+ def __init__(self, decimals=None, parent=None):
super(FloatEntry, self).__init__(parent)
self.readyToEdit = True
self.editingFinished.connect(self.on_edit_finished)
+ self.decimals = decimals if decimals is not None else 4
def on_edit_finished(self):
self.clearFocus()
@@ -251,9 +254,10 @@ class FloatEntry(QtWidgets.QLineEdit):
log.error("Could not evaluate val: %s, error: %s" % (str(raw), str(e)))
return None
- def set_value(self, val):
+ def set_value(self, val, decimals=None):
+ dig_digits = decimals if decimals is not None else self.decimals
if val is not None:
- self.setText("%.4f" % float(val))
+ self.setText("%.*f" % (dig_digits, float(val)))
else:
self.setText("")
@@ -263,10 +267,11 @@ class FloatEntry(QtWidgets.QLineEdit):
class FloatEntry2(QtWidgets.QLineEdit):
- def __init__(self, parent=None):
+ def __init__(self, decimals=None, parent=None):
super(FloatEntry2, self).__init__(parent)
self.readyToEdit = True
self.editingFinished.connect(self.on_edit_finished)
+ self.decimals = decimals if decimals is not None else 4
def on_edit_finished(self):
self.clearFocus()
@@ -295,8 +300,9 @@ class FloatEntry2(QtWidgets.QLineEdit):
log.error("Could not evaluate val: %s, error: %s" % (str(raw), str(e)))
return None
- def set_value(self, val):
- self.setText("%.4f" % val)
+ def set_value(self, val, decimals=None):
+ dig_digits = decimals if decimals is not None else self.decimals
+ self.setText("%.*f" % (dig_digits, val))
def sizeHint(self):
default_hint_size = super(FloatEntry2, self).sizeHint()
diff --git a/flatcamGUI/ObjectUI.py b/flatcamGUI/ObjectUI.py
index e81f87ff..dd3d8272 100644
--- a/flatcamGUI/ObjectUI.py
+++ b/flatcamGUI/ObjectUI.py
@@ -35,10 +35,11 @@ class ObjectUI(QtWidgets.QWidget):
put UI elements in ObjectUI.custom_box (QtWidgets.QLayout).
"""
- def __init__(self, icon_file='share/flatcam_icon32.png', title=_('FlatCAM Object'), parent=None, common=True):
+ def __init__(self, icon_file='share/flatcam_icon32.png', title=_('FlatCAM Object'), parent=None, common=True,
+ decimals=4):
QtWidgets.QWidget.__init__(self, parent=parent)
- self.decimals = 4
+ self.decimals = decimals
layout = QtWidgets.QVBoxLayout()
self.setLayout(layout)
@@ -153,9 +154,9 @@ class GerberObjectUI(ObjectUI):
User interface for Gerber objects.
"""
- def __init__(self, parent=None):
- ObjectUI.__init__(self, title=_('Gerber Object'), parent=parent)
- self.decimals = 4
+ def __init__(self, decimals, parent=None):
+ ObjectUI.__init__(self, title=_('Gerber Object'), parent=parent, decimals=decimals)
+ self.decimals = decimals
# Plot options
grid0 = QtWidgets.QGridLayout()
@@ -669,12 +670,13 @@ class ExcellonObjectUI(ObjectUI):
User interface for Excellon objects.
"""
- def __init__(self, parent=None):
+ def __init__(self, decimals, parent=None):
ObjectUI.__init__(self, title=_('Excellon Object'),
icon_file='share/drill32.png',
- parent=parent)
+ parent=parent,
+ decimals=decimals)
- self.decimals = 4
+ self.decimals = decimals
# ### Plot options ####
hlay_plot = QtWidgets.QHBoxLayout()
@@ -1072,10 +1074,10 @@ class GeometryObjectUI(ObjectUI):
User interface for Geometry objects.
"""
- def __init__(self, parent=None):
+ def __init__(self, decimals, parent=None):
super(GeometryObjectUI, self).__init__(title=_('Geometry Object'),
- icon_file='share/geometry32.png', parent=parent)
- self.decimals = 4
+ icon_file='share/geometry32.png', parent=parent, decimals=decimals)
+ self.decimals = decimals
# Plot options
self.plot_options_label = QtWidgets.QLabel("%s:" % _("Plot Options"))
@@ -1623,14 +1625,15 @@ class CNCObjectUI(ObjectUI):
User interface for CNCJob objects.
"""
- def __init__(self, parent=None):
+ def __init__(self, decimals, parent=None):
"""
Creates the user interface for CNCJob objects. GUI elements should
be placed in ``self.custom_box`` to preserve the layout.
"""
-
- ObjectUI.__init__(self, title=_('CNC Job Object'), icon_file='share/cnc32.png', parent=parent)
- self.decimals = 4
+
+ ObjectUI.__init__(self, title=_('CNC Job Object'), icon_file='share/cnc32.png', parent=parent,
+ decimals=decimals)
+ self.decimals = decimals
for i in range(0, self.common_grid.count()):
self.common_grid.itemAt(i).widget().hide()
@@ -1932,7 +1935,7 @@ class ScriptObjectUI(ObjectUI):
User interface for Script objects.
"""
- def __init__(self, parent=None):
+ def __init__(self, decimals, parent=None):
"""
Creates the user interface for Script objects. GUI elements should
be placed in ``self.custom_box`` to preserve the layout.
@@ -1941,7 +1944,10 @@ class ScriptObjectUI(ObjectUI):
ObjectUI.__init__(self, title=_('Script Object'),
icon_file='share/script_new24.png',
parent=parent,
- common=False)
+ common=False,
+ decimals=decimals)
+
+ self.decimals = decimals
# ## Object name
self.name_hlay = QtWidgets.QHBoxLayout()
@@ -1984,7 +1990,7 @@ class DocumentObjectUI(ObjectUI):
User interface for Notes objects.
"""
- def __init__(self, parent=None):
+ def __init__(self, decimals, parent=None):
"""
Creates the user interface for Notes objects. GUI elements should
be placed in ``self.custom_box`` to preserve the layout.
@@ -1993,7 +1999,10 @@ class DocumentObjectUI(ObjectUI):
ObjectUI.__init__(self, title=_('Document Object'),
icon_file='share/notes16_1.png',
parent=parent,
- common=False)
+ common=False,
+ decimals=decimals)
+
+ self.decimals = decimals
# ## Object name
self.name_hlay = QtWidgets.QHBoxLayout()
diff --git a/flatcamGUI/PreferencesUI.py b/flatcamGUI/PreferencesUI.py
index 5fe6b283..9ed21dea 100644
--- a/flatcamGUI/PreferencesUI.py
+++ b/flatcamGUI/PreferencesUI.py
@@ -42,18 +42,19 @@ class OptionsGroupUI(QtWidgets.QGroupBox):
class GeneralPreferencesUI(QtWidgets.QWidget):
- def __init__(self, parent=None):
+ def __init__(self, decimals, parent=None):
QtWidgets.QWidget.__init__(self, parent=parent)
self.layout = QtWidgets.QHBoxLayout()
self.setLayout(self.layout)
+ self.decimals = decimals
- self.general_app_group = GeneralAppPrefGroupUI()
+ self.general_app_group = GeneralAppPrefGroupUI(decimals=self.decimals)
self.general_app_group.setMinimumWidth(290)
- self.general_gui_group = GeneralGUIPrefGroupUI()
+ self.general_gui_group = GeneralGUIPrefGroupUI(decimals=self.decimals)
self.general_gui_group.setMinimumWidth(250)
- self.general_gui_set_group = GeneralGUISetGroupUI()
+ self.general_gui_set_group = GeneralGUISetGroupUI(decimals=self.decimals)
self.general_gui_set_group.setMinimumWidth(250)
self.layout.addWidget(self.general_app_group)
@@ -65,20 +66,21 @@ class GeneralPreferencesUI(QtWidgets.QWidget):
class GerberPreferencesUI(QtWidgets.QWidget):
- def __init__(self, parent=None):
+ def __init__(self, decimals, parent=None):
QtWidgets.QWidget.__init__(self, parent=parent)
self.layout = QtWidgets.QHBoxLayout()
self.setLayout(self.layout)
+ self.decimals = decimals
- self.gerber_gen_group = GerberGenPrefGroupUI()
+ self.gerber_gen_group = GerberGenPrefGroupUI(decimals=self.decimals)
self.gerber_gen_group.setMinimumWidth(250)
- self.gerber_opt_group = GerberOptPrefGroupUI()
+ self.gerber_opt_group = GerberOptPrefGroupUI(decimals=self.decimals)
self.gerber_opt_group.setMinimumWidth(250)
- self.gerber_exp_group = GerberExpPrefGroupUI()
+ self.gerber_exp_group = GerberExpPrefGroupUI(decimals=self.decimals)
self.gerber_exp_group.setMinimumWidth(230)
- self.gerber_adv_opt_group = GerberAdvOptPrefGroupUI()
+ self.gerber_adv_opt_group = GerberAdvOptPrefGroupUI(decimals=self.decimals)
self.gerber_adv_opt_group.setMinimumWidth(200)
- self.gerber_editor_group = GerberEditorPrefGroupUI()
+ self.gerber_editor_group = GerberEditorPrefGroupUI(decimals=self.decimals)
self.gerber_editor_group.setMinimumWidth(200)
self.vlay = QtWidgets.QVBoxLayout()
@@ -95,20 +97,21 @@ class GerberPreferencesUI(QtWidgets.QWidget):
class ExcellonPreferencesUI(QtWidgets.QWidget):
- def __init__(self, parent=None):
+ def __init__(self, decimals, parent=None):
QtWidgets.QWidget.__init__(self, parent=parent)
self.layout = QtWidgets.QHBoxLayout()
self.setLayout(self.layout)
+ self.decimals = decimals
- self.excellon_gen_group = ExcellonGenPrefGroupUI()
+ self.excellon_gen_group = ExcellonGenPrefGroupUI(decimals=self.decimals)
self.excellon_gen_group.setMinimumWidth(220)
- self.excellon_opt_group = ExcellonOptPrefGroupUI()
+ self.excellon_opt_group = ExcellonOptPrefGroupUI(decimals=self.decimals)
self.excellon_opt_group.setMinimumWidth(290)
- self.excellon_exp_group = ExcellonExpPrefGroupUI()
+ self.excellon_exp_group = ExcellonExpPrefGroupUI(decimals=self.decimals)
self.excellon_exp_group.setMinimumWidth(250)
- self.excellon_adv_opt_group = ExcellonAdvOptPrefGroupUI()
+ self.excellon_adv_opt_group = ExcellonAdvOptPrefGroupUI(decimals=self.decimals)
self.excellon_adv_opt_group.setMinimumWidth(250)
- self.excellon_editor_group = ExcellonEditorPrefGroupUI()
+ self.excellon_editor_group = ExcellonEditorPrefGroupUI(decimals=self.decimals)
self.excellon_editor_group.setMinimumWidth(260)
self.vlay = QtWidgets.QVBoxLayout()
@@ -125,18 +128,19 @@ class ExcellonPreferencesUI(QtWidgets.QWidget):
class GeometryPreferencesUI(QtWidgets.QWidget):
- def __init__(self, parent=None):
+ def __init__(self, decimals, parent=None):
QtWidgets.QWidget.__init__(self, parent=parent)
self.layout = QtWidgets.QHBoxLayout()
self.setLayout(self.layout)
+ self.decimals = decimals
- self.geometry_gen_group = GeometryGenPrefGroupUI()
+ self.geometry_gen_group = GeometryGenPrefGroupUI(decimals=self.decimals)
self.geometry_gen_group.setMinimumWidth(220)
- self.geometry_opt_group = GeometryOptPrefGroupUI()
+ self.geometry_opt_group = GeometryOptPrefGroupUI(decimals=self.decimals)
self.geometry_opt_group.setMinimumWidth(300)
- self.geometry_adv_opt_group = GeometryAdvOptPrefGroupUI()
+ self.geometry_adv_opt_group = GeometryAdvOptPrefGroupUI(decimals=self.decimals)
self.geometry_adv_opt_group.setMinimumWidth(270)
- self.geometry_editor_group = GeometryEditorPrefGroupUI()
+ self.geometry_editor_group = GeometryEditorPrefGroupUI(decimals=self.decimals)
self.geometry_editor_group.setMinimumWidth(250)
self.layout.addWidget(self.geometry_gen_group)
@@ -149,38 +153,39 @@ class GeometryPreferencesUI(QtWidgets.QWidget):
class ToolsPreferencesUI(QtWidgets.QWidget):
- def __init__(self, parent=None):
+ def __init__(self, decimals, parent=None):
QtWidgets.QWidget.__init__(self, parent=parent)
self.layout = QtWidgets.QHBoxLayout()
self.setLayout(self.layout)
+ self.decimals = decimals
- self.tools_ncc_group = ToolsNCCPrefGroupUI()
+ self.tools_ncc_group = ToolsNCCPrefGroupUI(decimals=self.decimals)
self.tools_ncc_group.setMinimumWidth(220)
- self.tools_paint_group = ToolsPaintPrefGroupUI()
+ self.tools_paint_group = ToolsPaintPrefGroupUI(decimals=self.decimals)
self.tools_paint_group.setMinimumWidth(220)
- self.tools_cutout_group = ToolsCutoutPrefGroupUI()
+ self.tools_cutout_group = ToolsCutoutPrefGroupUI(decimals=self.decimals)
self.tools_cutout_group.setMinimumWidth(220)
- self.tools_2sided_group = Tools2sidedPrefGroupUI()
+ self.tools_2sided_group = Tools2sidedPrefGroupUI(decimals=self.decimals)
self.tools_2sided_group.setMinimumWidth(220)
- self.tools_film_group = ToolsFilmPrefGroupUI()
+ self.tools_film_group = ToolsFilmPrefGroupUI(decimals=self.decimals)
self.tools_film_group.setMinimumWidth(220)
- self.tools_panelize_group = ToolsPanelizePrefGroupUI()
+ self.tools_panelize_group = ToolsPanelizePrefGroupUI(decimals=self.decimals)
self.tools_panelize_group.setMinimumWidth(220)
- self.tools_calculators_group = ToolsCalculatorsPrefGroupUI()
+ self.tools_calculators_group = ToolsCalculatorsPrefGroupUI(decimals=self.decimals)
self.tools_calculators_group.setMinimumWidth(220)
- self.tools_transform_group = ToolsTransformPrefGroupUI()
+ self.tools_transform_group = ToolsTransformPrefGroupUI(decimals=self.decimals)
self.tools_transform_group.setMinimumWidth(200)
- self.tools_solderpaste_group = ToolsSolderpastePrefGroupUI()
+ self.tools_solderpaste_group = ToolsSolderpastePrefGroupUI(decimals=self.decimals)
self.tools_solderpaste_group.setMinimumWidth(200)
- self.tools_sub_group = ToolsSubPrefGroupUI()
+ self.tools_sub_group = ToolsSubPrefGroupUI(decimals=self.decimals)
self.tools_sub_group.setMinimumWidth(200)
self.vlay = QtWidgets.QVBoxLayout()
@@ -211,24 +216,25 @@ class ToolsPreferencesUI(QtWidgets.QWidget):
class Tools2PreferencesUI(QtWidgets.QWidget):
- def __init__(self, parent=None):
+ def __init__(self, decimals, parent=None):
QtWidgets.QWidget.__init__(self, parent=parent)
self.layout = QtWidgets.QHBoxLayout()
self.setLayout(self.layout)
+ self.decimals = decimals
- self.tools2_checkrules_group = Tools2RulesCheckPrefGroupUI()
+ self.tools2_checkrules_group = Tools2RulesCheckPrefGroupUI(decimals=self.decimals)
self.tools2_checkrules_group.setMinimumWidth(220)
- self.tools2_optimal_group = Tools2OptimalPrefGroupUI()
+ self.tools2_optimal_group = Tools2OptimalPrefGroupUI(decimals=self.decimals)
self.tools2_optimal_group.setMinimumWidth(220)
- self.tools2_qrcode_group = Tools2QRCodePrefGroupUI()
+ self.tools2_qrcode_group = Tools2QRCodePrefGroupUI(decimals=self.decimals)
self.tools2_qrcode_group.setMinimumWidth(220)
- self.tools2_cfill_group = Tools2CThievingPrefGroupUI()
+ self.tools2_cfill_group = Tools2CThievingPrefGroupUI(decimals=self.decimals)
self.tools2_cfill_group.setMinimumWidth(220)
- self.tools2_fiducials_group = Tools2FiducialsPrefGroupUI()
+ self.tools2_fiducials_group = Tools2FiducialsPrefGroupUI(decimals=self.decimals)
self.tools2_fiducials_group.setMinimumWidth(220)
self.vlay = QtWidgets.QVBoxLayout()
@@ -254,16 +260,17 @@ class Tools2PreferencesUI(QtWidgets.QWidget):
class CNCJobPreferencesUI(QtWidgets.QWidget):
- def __init__(self, parent=None):
+ def __init__(self, decimals, parent=None):
QtWidgets.QWidget.__init__(self, parent=parent)
self.layout = QtWidgets.QHBoxLayout()
self.setLayout(self.layout)
+ self.decimals = decimals
- self.cncjob_gen_group = CNCJobGenPrefGroupUI()
+ self.cncjob_gen_group = CNCJobGenPrefGroupUI(decimals=self.decimals)
self.cncjob_gen_group.setMinimumWidth(320)
- self.cncjob_opt_group = CNCJobOptPrefGroupUI()
+ self.cncjob_opt_group = CNCJobOptPrefGroupUI(decimals=self.decimals)
self.cncjob_opt_group.setMinimumWidth(260)
- self.cncjob_adv_opt_group = CNCJobAdvOptPrefGroupUI()
+ self.cncjob_adv_opt_group = CNCJobAdvOptPrefGroupUI(decimals=self.decimals)
self.cncjob_adv_opt_group.setMinimumWidth(260)
self.layout.addWidget(self.cncjob_gen_group)
@@ -275,25 +282,26 @@ class CNCJobPreferencesUI(QtWidgets.QWidget):
class UtilPreferencesUI(QtWidgets.QWidget):
- def __init__(self, parent=None):
+ def __init__(self, decimals, parent=None):
QtWidgets.QWidget.__init__(self, parent=parent)
self.layout = QtWidgets.QHBoxLayout()
self.setLayout(self.layout)
+ self.decimals = decimals
self.vlay = QtWidgets.QVBoxLayout()
- self.fa_excellon_group = FAExcPrefGroupUI()
+ self.fa_excellon_group = FAExcPrefGroupUI(decimals=self.decimals)
self.fa_excellon_group.setMinimumWidth(260)
- self.fa_gcode_group = FAGcoPrefGroupUI()
+ self.fa_gcode_group = FAGcoPrefGroupUI(decimals=self.decimals)
self.fa_gcode_group.setMinimumWidth(260)
self.vlay.addWidget(self.fa_excellon_group)
self.vlay.addWidget(self.fa_gcode_group)
- self.fa_gerber_group = FAGrbPrefGroupUI()
+ self.fa_gerber_group = FAGrbPrefGroupUI(decimals=self.decimals)
self.fa_gerber_group.setMinimumWidth(260)
- self.kw_group = AutoCompletePrefGroupUI()
+ self.kw_group = AutoCompletePrefGroupUI(decimals=self.decimals)
self.kw_group.setMinimumWidth(260)
self.layout.addLayout(self.vlay)
@@ -304,11 +312,12 @@ class UtilPreferencesUI(QtWidgets.QWidget):
class GeneralGUIPrefGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
super(GeneralGUIPrefGroupUI, self).__init__(self)
self.setTitle(str(_("GUI Preferences")))
-
+ self.decimals = decimals
+
# Create a form layout for the Application general settings
self.form_box = QtWidgets.QFormLayout()
@@ -318,7 +327,7 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
_("This is the Grid snap value on X axis.")
)
self.gridx_entry = FCDoubleSpinner()
- self.gridx_entry.set_precision(4)
+ self.gridx_entry.set_precision(self.decimals)
self.gridx_entry.setSingleStep(0.1)
# Grid Y Entry
@@ -327,14 +336,14 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
_("This is the Grid snap value on Y axis.")
)
self.gridy_entry = FCDoubleSpinner()
- self.gridy_entry.set_precision(4)
+ self.gridy_entry.set_precision(self.decimals)
self.gridy_entry.setSingleStep(0.1)
# Snap Max Entry
self.snap_max_label = QtWidgets.QLabel('%s:' % _('Snap Max'))
self.snap_max_label.setToolTip(_("Max. magnet distance"))
self.snap_max_dist_entry = FCDoubleSpinner()
- self.snap_max_dist_entry.set_precision(4)
+ self.snap_max_dist_entry.set_precision(self.decimals)
self.snap_max_dist_entry.setSingleStep(0.1)
# Workspace
@@ -680,11 +689,12 @@ class GeneralGUIPrefGroupUI(OptionsGroupUI):
class GeneralGUISetGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
super(GeneralGUISetGroupUI, self).__init__(self)
self.setTitle(str(_("GUI Settings")))
-
+ self.decimals = decimals
+
# Create a form layout for the Application general settings
self.form_box = QtWidgets.QFormLayout()
@@ -1033,11 +1043,12 @@ class GeneralGUISetGroupUI(OptionsGroupUI):
class GeneralAppPrefGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
super(GeneralAppPrefGroupUI, self).__init__(self)
self.setTitle(str(_("App Preferences")))
-
+ self.decimals = decimals
+
# Create a form layout for the Application general settings
grid0 = QtWidgets.QGridLayout()
self.layout.addLayout(grid0)
@@ -1055,6 +1066,34 @@ class GeneralAppPrefGroupUI(OptionsGroupUI):
grid0.addWidget(self.unitslabel, 0, 0)
grid0.addWidget(self.units_radio, 0, 1)
+ # Precision Metric
+ self.precision_metric_label = QtWidgets.QLabel('%s:' % _('Precision MM'))
+ self.precision_metric_label.setToolTip(
+ _("The number of decimals used throughout the application\n"
+ "when the set units are in METRIC system.\n"
+ "Any change here require an application restart.")
+ )
+ self.precision_metric_entry = FCSpinner()
+ self.precision_metric_entry.set_range(2, 16)
+ self.precision_metric_entry.setWrapping(True)
+
+ grid0.addWidget(self.precision_metric_label, 1, 0)
+ grid0.addWidget(self.precision_metric_entry, 1, 1)
+
+ # Precision Inch
+ self.precision_inch_label = QtWidgets.QLabel('%s:' % _('Precision INCH'))
+ self.precision_inch_label.setToolTip(
+ _("The number of decimals used throughout the application\n"
+ "when the set units are in INCH system.\n"
+ "Any change here require an application restart.")
+ )
+ self.precision_inch_entry = FCSpinner()
+ self.precision_inch_entry.set_range(2, 16)
+ self.precision_inch_entry.setWrapping(True)
+
+ grid0.addWidget(self.precision_inch_label, 2, 0)
+ grid0.addWidget(self.precision_inch_entry, 2, 1)
+
# Graphic Engine for FlatCAM
self.ge_label = QtWidgets.QLabel('%s:' % _('Graphic Engine'))
self.ge_label.setToolTip(_("Choose what graphic engine to use in FlatCAM.\n"
@@ -1066,9 +1105,9 @@ class GeneralAppPrefGroupUI(OptionsGroupUI):
self.ge_radio = RadioSet([{'label': _('Legacy(2D)'), 'value': '2D'},
{'label': _('OpenGL(3D)'), 'value': '3D'}])
- grid0.addWidget(self.ge_label, 1, 0)
- grid0.addWidget(self.ge_radio, 1, 1)
- grid0.addWidget(QtWidgets.QLabel(''), 2, 0)
+ grid0.addWidget(self.ge_label, 3, 0)
+ grid0.addWidget(self.ge_radio, 3, 1)
+ grid0.addWidget(QtWidgets.QLabel(''), 4, 0)
# Application Level for FlatCAM
self.app_level_label = QtWidgets.QLabel('%s:' % _('APP. LEVEL'))
@@ -1080,8 +1119,8 @@ class GeneralAppPrefGroupUI(OptionsGroupUI):
self.app_level_radio = RadioSet([{'label': _('Basic'), 'value': 'b'},
{'label': _('Advanced'), 'value': 'a'}])
- grid0.addWidget(self.app_level_label, 3, 0)
- grid0.addWidget(self.app_level_radio, 3, 1)
+ grid0.addWidget(self.app_level_label, 5, 0)
+ grid0.addWidget(self.app_level_radio, 5, 1)
# Portability for FlatCAM
self.portability_label = QtWidgets.QLabel('%s:' % _('Portable app'))
@@ -1091,16 +1130,16 @@ class GeneralAppPrefGroupUI(OptionsGroupUI):
"in the application folder, in the lib\\config subfolder."))
self.portability_cb = FCCheckBox()
- grid0.addWidget(self.portability_label, 4, 0)
- grid0.addWidget(self.portability_cb, 4, 1)
+ grid0.addWidget(self.portability_label, 6, 0)
+ grid0.addWidget(self.portability_cb, 6, 1)
# Languages for FlatCAM
self.languagelabel = QtWidgets.QLabel('%s:' % _('Languages'))
self.languagelabel.setToolTip(_("Set the language used throughout FlatCAM."))
self.language_cb = FCComboBox()
- grid0.addWidget(self.languagelabel, 5, 0)
- grid0.addWidget(self.language_cb, 5, 1)
+ grid0.addWidget(self.languagelabel, 7, 0)
+ grid0.addWidget(self.language_cb, 7, 1)
self.language_apply_btn = FCButton(_("Apply Language"))
self.language_apply_btn.setToolTip(_("Set the language used throughout FlatCAM.\n"
@@ -1111,8 +1150,8 @@ class GeneralAppPrefGroupUI(OptionsGroupUI):
"security features. In this case the language will be\n"
"applied at the next app start."))
- grid0.addWidget(self.language_apply_btn, 6, 0, 1, 2)
- grid0.addWidget(QtWidgets.QLabel(''), 7, 0)
+ grid0.addWidget(self.language_apply_btn, 8, 0, 1, 2)
+ grid0.addWidget(QtWidgets.QLabel(''), 9, 0)
# Version Check CB
self.version_check_label = QtWidgets.QLabel('%s:' % _('Version Check'))
@@ -1126,8 +1165,8 @@ class GeneralAppPrefGroupUI(OptionsGroupUI):
"for a new version automatically at startup.")
)
- grid0.addWidget(self.version_check_label, 8, 0)
- grid0.addWidget(self.version_check_cb, 8, 1)
+ grid0.addWidget(self.version_check_label, 10, 0)
+ grid0.addWidget(self.version_check_cb, 10, 1)
# Send Stats CB
self.send_stats_label = QtWidgets.QLabel('%s:' % _('Send Stats'))
@@ -1141,8 +1180,8 @@ class GeneralAppPrefGroupUI(OptionsGroupUI):
"stats automatically at startup, to help improve FlatCAM.")
)
- grid0.addWidget(self.send_stats_label, 9, 0)
- grid0.addWidget(self.send_stats_cb, 9, 1)
+ grid0.addWidget(self.send_stats_label, 11, 0)
+ grid0.addWidget(self.send_stats_cb, 11, 1)
self.ois_version_check = OptionalInputSection(self.version_check_cb, [self.send_stats_cb])
@@ -1154,8 +1193,8 @@ class GeneralAppPrefGroupUI(OptionsGroupUI):
self.pan_button_radio = RadioSet([{'label': _('MMB'), 'value': '3'},
{'label': _('RMB'), 'value': '2'}])
- grid0.addWidget(self.panbuttonlabel, 10, 0)
- grid0.addWidget(self.pan_button_radio, 10, 1)
+ grid0.addWidget(self.panbuttonlabel, 12, 0)
+ grid0.addWidget(self.pan_button_radio, 12, 1)
# Multiple Selection Modifier Key
self.mselectlabel = QtWidgets.QLabel('%s:' % _('Multiple Sel'))
@@ -1163,8 +1202,8 @@ class GeneralAppPrefGroupUI(OptionsGroupUI):
self.mselect_radio = RadioSet([{'label': _('CTRL'), 'value': 'Control'},
{'label': _('SHIFT'), 'value': 'Shift'}])
- grid0.addWidget(self.mselectlabel, 11, 0)
- grid0.addWidget(self.mselect_radio, 11, 1)
+ grid0.addWidget(self.mselectlabel, 13, 0)
+ grid0.addWidget(self.mselect_radio, 13, 1)
# Worker Numbers
self.worker_number_label = QtWidgets.QLabel('%s:' % _('Workers number'))
@@ -1187,8 +1226,8 @@ class GeneralAppPrefGroupUI(OptionsGroupUI):
)
self.worker_number_sb.set_range(2, 16)
- grid0.addWidget(self.worker_number_label, 12, 0)
- grid0.addWidget(self.worker_number_sb, 12, 1)
+ grid0.addWidget(self.worker_number_label, 14, 0)
+ grid0.addWidget(self.worker_number_sb, 14, 1)
# Geometric tolerance
tol_label = QtWidgets.QLabel('%s:' % _("Geo Tolerance"))
@@ -1212,9 +1251,9 @@ class GeneralAppPrefGroupUI(OptionsGroupUI):
self.tol_entry.setSingleStep(0.001)
self.tol_entry.set_precision(6)
- grid0.addWidget(tol_label, 13, 0)
- grid0.addWidget(self.tol_entry, 13, 1)
- grid0.addWidget(QtWidgets.QLabel(''), 14, 0)
+ grid0.addWidget(tol_label, 15, 0)
+ grid0.addWidget(self.tol_entry, 15, 1)
+ grid0.addWidget(QtWidgets.QLabel(''), 16, 0)
# Open behavior
self.open_style_cb = FCCheckBox('%s' % _('"Open" behavior'))
@@ -1225,7 +1264,7 @@ class GeneralAppPrefGroupUI(OptionsGroupUI):
"path for saving files or the path for opening files.")
)
- grid0.addWidget(self.open_style_cb, 15, 0, 1, 2)
+ grid0.addWidget(self.open_style_cb, 17, 0, 1, 2)
# Save compressed project CB
self.save_type_cb = FCCheckBox(_('Save Compressed Project'))
@@ -1234,7 +1273,7 @@ class GeneralAppPrefGroupUI(OptionsGroupUI):
"When checked it will save a compressed FlatCAM project.")
)
- grid0.addWidget(self.save_type_cb, 16, 0, 1, 2)
+ grid0.addWidget(self.save_type_cb, 18, 0, 1, 2)
# Project LZMA Comppression Level
self.compress_spinner = FCSpinner()
@@ -1246,8 +1285,8 @@ class GeneralAppPrefGroupUI(OptionsGroupUI):
"but require more RAM usage and more processing time.")
)
- grid0.addWidget(self.compress_label, 17, 0)
- grid0.addWidget(self.compress_spinner, 17, 1)
+ grid0.addWidget(self.compress_label, 19, 0)
+ grid0.addWidget(self.compress_spinner, 19, 1)
self.proj_ois = OptionalInputSection(self.save_type_cb, [self.compress_label, self.compress_spinner], True)
@@ -1260,8 +1299,8 @@ class GeneralAppPrefGroupUI(OptionsGroupUI):
"but the menu will hold only so much.")
)
- grid0.addWidget(self.bm_limit_label, 18, 0)
- grid0.addWidget(self.bm_limit_spinner, 18, 1)
+ grid0.addWidget(self.bm_limit_label, 20, 0)
+ grid0.addWidget(self.bm_limit_spinner, 20, 1)
# Machinist settings that allow unsafe settings
self.machinist_cb = FCCheckBox(_("Allow Machinist Unsafe Settings"))
@@ -1273,7 +1312,7 @@ class GeneralAppPrefGroupUI(OptionsGroupUI):
"<>: Don't change this unless you know what you are doing !!!")
)
- grid0.addWidget(self.machinist_cb, 19, 0, 1, 2)
+ grid0.addWidget(self.machinist_cb, 21, 0, 1, 2)
self.layout.addStretch()
@@ -1283,12 +1322,13 @@ class GeneralAppPrefGroupUI(OptionsGroupUI):
class GerberGenPrefGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
# OptionsGroupUI.__init__(self, "Gerber General Preferences", parent=parent)
super(GerberGenPrefGroupUI, self).__init__(self)
self.setTitle(str(_("Gerber General")))
-
+ self.decimals = decimals
+
# ## Plot options
self.plot_options_label = QtWidgets.QLabel("%s:" % _("Plot Options"))
self.layout.addWidget(self.plot_options_label)
@@ -1383,10 +1423,10 @@ class GerberGenPrefGroupUI(OptionsGroupUI):
class GerberOptPrefGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
# OptionsGroupUI.__init__(self, "Gerber Options Preferences", parent=parent)
super(GerberOptPrefGroupUI, self).__init__(self)
- self.decimals = 4
+ self.decimals = decimals
self.setTitle(str(_("Gerber Options")))
@@ -1434,7 +1474,7 @@ class GerberOptPrefGroupUI(OptionsGroupUI):
self.iso_overlap_entry = FCDoubleSpinner(suffix='%')
self.iso_overlap_entry.set_precision(self.decimals)
self.iso_overlap_entry.setWrapping(True)
- self.iso_overlap_entry.setRange(0.0000,99.9999)
+ self.iso_overlap_entry.setRange(0.0000, 99.9999)
self.iso_overlap_entry.setSingleStep(0.1)
grid0.addWidget(overlabel, 2, 0)
@@ -1540,12 +1580,12 @@ class GerberOptPrefGroupUI(OptionsGroupUI):
class GerberAdvOptPrefGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
# OptionsGroupUI.__init__(self, "Gerber Adv. Options Preferences", parent=parent)
super(GerberAdvOptPrefGroupUI, self).__init__(self)
self.setTitle(str(_("Gerber Adv. Options")))
- self.decimals = 4
+ self.decimals = decimals
# ## Advanced Gerber Parameters
self.adv_param_label = QtWidgets.QLabel('%s:' % _('Advanced Options'))
@@ -1698,11 +1738,11 @@ class GerberAdvOptPrefGroupUI(OptionsGroupUI):
class GerberExpPrefGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
super(GerberExpPrefGroupUI, self).__init__(self)
self.setTitle(str(_("Gerber Export")))
- self.decimals = 4
+ self.decimals = decimals
# Plot options
self.export_options_label = QtWidgets.QLabel("%s:" % _("Export Options"))
@@ -1796,12 +1836,12 @@ class GerberExpPrefGroupUI(OptionsGroupUI):
class GerberEditorPrefGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
# OptionsGroupUI.__init__(self, "Gerber Adv. Options Preferences", parent=parent)
super(GerberEditorPrefGroupUI, self).__init__(self)
self.setTitle(str(_("Gerber Editor")))
- self.decimals = 4
+ self.decimals = decimals
# Advanced Gerber Parameters
self.param_label = QtWidgets.QLabel("%s:" % _("Parameters"))
@@ -1876,7 +1916,6 @@ class GerberEditorPrefGroupUI(OptionsGroupUI):
self.grb_array_size_entry = FCSpinner()
self.grb_array_size_entry.set_range(0, 9999)
-
grid0.addWidget(self.grb_array_size_label, 4, 0)
grid0.addWidget(self.grb_array_size_entry, 4, 1)
@@ -1974,7 +2013,6 @@ class GerberEditorPrefGroupUI(OptionsGroupUI):
self.grb_buff_entry.set_precision(self.decimals)
self.grb_buff_entry.set_range(-9999, 9999)
-
grid0.addWidget(self.grb_buff_label, 14, 0)
grid0.addWidget(self.grb_buff_entry, 14, 1)
@@ -2025,12 +2063,13 @@ class GerberEditorPrefGroupUI(OptionsGroupUI):
class ExcellonGenPrefGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
# OptionsGroupUI.__init__(self, "Excellon Options", parent=parent)
super(ExcellonGenPrefGroupUI, self).__init__(self)
self.setTitle(str(_("Excellon General")))
-
+ self.decimals = decimals
+
# Plot options
self.plot_options_label = QtWidgets.QLabel("%s:" % _("Plot Options"))
self.layout.addWidget(self.plot_options_label)
@@ -2269,12 +2308,13 @@ class ExcellonGenPrefGroupUI(OptionsGroupUI):
class ExcellonOptPrefGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
# OptionsGroupUI.__init__(self, "Excellon Options", parent=parent)
super(ExcellonOptPrefGroupUI, self).__init__(self)
self.setTitle(str(_("Excellon Options")))
-
+ self.decimals = decimals
+
# ## Create CNC Job
self.cncjob_label = QtWidgets.QLabel('%s' % _('Create CNC Job'))
self.cncjob_label.setToolTip(
@@ -2301,7 +2341,7 @@ class ExcellonOptPrefGroupUI(OptionsGroupUI):
self.cutz_entry.set_range(-9999.9999, 9999.9999)
self.cutz_entry.setSingleStep(0.1)
- self.cutz_entry.set_precision(4)
+ self.cutz_entry.set_precision(self.decimals)
grid2.addWidget(self.cutz_entry, 0, 1)
# Travel Z
@@ -2312,7 +2352,7 @@ class ExcellonOptPrefGroupUI(OptionsGroupUI):
)
grid2.addWidget(travelzlabel, 1, 0)
self.travelz_entry = FCDoubleSpinner()
- self.travelz_entry.set_precision(4)
+ self.travelz_entry.set_precision(self.decimals)
if machinist_setting == 0:
self.travelz_entry.set_range(0.0001, 9999.9999)
@@ -2338,7 +2378,7 @@ class ExcellonOptPrefGroupUI(OptionsGroupUI):
)
grid2.addWidget(toolchangezlabel, 3, 0)
self.toolchangez_entry = FCDoubleSpinner()
- self.toolchangez_entry.set_precision(4)
+ self.toolchangez_entry.set_precision(self.decimals)
if machinist_setting == 0:
self.toolchangez_entry.set_range(0.0001, 9999.9999)
@@ -2354,7 +2394,7 @@ class ExcellonOptPrefGroupUI(OptionsGroupUI):
"the last move at the end of the job.")
)
self.eendz_entry = FCDoubleSpinner()
- self.eendz_entry.set_precision(4)
+ self.eendz_entry.set_precision(self.decimals)
if machinist_setting == 0:
self.eendz_entry.set_range(0.0000, 9999.9999)
@@ -2373,7 +2413,7 @@ class ExcellonOptPrefGroupUI(OptionsGroupUI):
"This is for linear move G01.")
)
self.feedrate_entry = FCDoubleSpinner()
- self.feedrate_entry.set_precision(4)
+ self.feedrate_entry.set_precision(self.decimals)
self.feedrate_entry.set_range(0, 999)
grid2.addWidget(frlabel, 5, 0)
@@ -2401,7 +2441,7 @@ class ExcellonOptPrefGroupUI(OptionsGroupUI):
)
self.dwell_cb = FCCheckBox()
self.dwelltime_entry = FCDoubleSpinner()
- self.dwelltime_entry.set_precision(4)
+ self.dwelltime_entry.set_precision(self.decimals)
self.dwelltime_entry.set_range(0, 99999.9999)
grid2.addWidget(dwelllabel, 7, 0)
@@ -2452,7 +2492,7 @@ class ExcellonOptPrefGroupUI(OptionsGroupUI):
_("Diameter of the cutting tool.")
)
self.tooldia_entry = FCDoubleSpinner()
- self.tooldia_entry.set_precision(4)
+ self.tooldia_entry.set_precision(self.decimals)
self.tooldia_entry.set_range(0, 999.9999)
grid2.addWidget(tdlabel, 12, 0)
@@ -2464,7 +2504,7 @@ class ExcellonOptPrefGroupUI(OptionsGroupUI):
"when milling slots.")
)
self.slot_tooldia_entry = FCDoubleSpinner()
- self.slot_tooldia_entry.set_precision(4)
+ self.slot_tooldia_entry.set_precision(self.decimals)
self.slot_tooldia_entry.set_range(0, 999.9999)
grid2.addWidget(stdlabel, 13, 0)
@@ -2484,12 +2524,13 @@ class ExcellonOptPrefGroupUI(OptionsGroupUI):
class ExcellonAdvOptPrefGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
# OptionsGroupUI.__init__(self, "Excellon Advanced Options", parent=parent)
super(ExcellonAdvOptPrefGroupUI, self).__init__(self)
self.setTitle(str(_("Excellon Adv. Options")))
-
+ self.decimals = decimals
+
# #######################
# ## ADVANCED OPTIONS ###
# #######################
@@ -2511,7 +2552,7 @@ class ExcellonAdvOptPrefGroupUI(OptionsGroupUI):
"to create the desired exit hole diameter due of the tip shape.\n"
"The value here can compensate the Cut Z parameter."))
self.offset_entry = FCDoubleSpinner()
- self.offset_entry.set_precision(4)
+ self.offset_entry.set_precision(self.decimals)
self.offset_entry.set_range(-999.9999, 999.9999)
grid1.addWidget(offsetlabel, 0, 0)
@@ -2544,7 +2585,7 @@ class ExcellonAdvOptPrefGroupUI(OptionsGroupUI):
"ignore for any other cases.")
)
self.feedrate_rapid_entry = FCDoubleSpinner()
- self.feedrate_rapid_entry.set_precision(4)
+ self.feedrate_rapid_entry.set_precision(self.decimals)
self.feedrate_rapid_entry.set_range(0, 9999999.9999)
grid1.addWidget(fr_rapid_label, 3, 0)
@@ -2557,7 +2598,7 @@ class ExcellonAdvOptPrefGroupUI(OptionsGroupUI):
"to probe. Negative value, in current units.")
)
self.pdepth_entry = FCDoubleSpinner()
- self.pdepth_entry.set_precision(4)
+ self.pdepth_entry.set_precision(self.decimals)
self.pdepth_entry.set_range(-99999, -0.000001)
grid1.addWidget(self.pdepth_label, 4, 0)
@@ -2569,7 +2610,7 @@ class ExcellonAdvOptPrefGroupUI(OptionsGroupUI):
_("The feedrate used while the probe is probing.")
)
self.feedrate_probe_entry = FCDoubleSpinner()
- self.feedrate_probe_entry.set_precision(4)
+ self.feedrate_probe_entry.set_precision(self.decimals)
self.feedrate_probe_entry.set_range(0, 9999999.9999)
grid1.addWidget(self.feedrate_probe_label, 5, 0)
@@ -2618,11 +2659,12 @@ class ExcellonAdvOptPrefGroupUI(OptionsGroupUI):
class ExcellonExpPrefGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
super(ExcellonExpPrefGroupUI, self).__init__(self)
self.setTitle(str(_("Excellon Export")))
-
+ self.decimals = decimals
+
# Plot options
self.export_options_label = QtWidgets.QLabel("%s:" % _("Export Options"))
self.export_options_label.setToolTip(
@@ -2766,10 +2808,11 @@ class ExcellonExpPrefGroupUI(OptionsGroupUI):
class ExcellonEditorPrefGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
super(ExcellonEditorPrefGroupUI, self).__init__(self)
self.setTitle(str(_("Excellon Editor")))
+ self.decimals = decimals
# Excellon Editor Parameters
self.param_label = QtWidgets.QLabel("%s:" % _("Parameters"))
@@ -2804,7 +2847,7 @@ class ExcellonEditorPrefGroupUI(OptionsGroupUI):
self.addtool_entry = FCDoubleSpinner()
self.addtool_entry.set_range(0.000001, 99.9999)
- self.addtool_entry.set_precision(4)
+ self.addtool_entry.set_precision(self.decimals)
grid0.addWidget(self.addtool_entry_lbl, 1, 0)
grid0.addWidget(self.addtool_entry, 1, 1)
@@ -2849,7 +2892,7 @@ class ExcellonEditorPrefGroupUI(OptionsGroupUI):
# self.drill_pitch_label.setMinimumWidth(100)
self.drill_pitch_entry = FCDoubleSpinner()
self.drill_pitch_entry.set_range(0, 99999.9999)
- self.drill_pitch_entry.set_precision(4)
+ self.drill_pitch_entry.set_precision(self.decimals)
grid0.addWidget(self.drill_pitch_label, 5, 0)
grid0.addWidget(self.drill_pitch_entry, 5, 1)
@@ -2861,7 +2904,7 @@ class ExcellonEditorPrefGroupUI(OptionsGroupUI):
)
self.drill_angle_entry = FCDoubleSpinner()
self.drill_pitch_entry.set_range(-360, 360)
- self.drill_pitch_entry.set_precision(4)
+ self.drill_pitch_entry.set_precision(self.decimals)
self.drill_angle_entry.setWrapping(True)
self.drill_angle_entry.setSingleStep(5)
@@ -2891,7 +2934,7 @@ class ExcellonEditorPrefGroupUI(OptionsGroupUI):
)
self.drill_circular_angle_entry = FCDoubleSpinner()
self.drill_circular_angle_entry.set_range(-360, 360)
- self.drill_circular_angle_entry.set_precision(4)
+ self.drill_circular_angle_entry.set_precision(self.decimals)
self.drill_circular_angle_entry.setWrapping(True)
self.drill_circular_angle_entry.setSingleStep(5)
@@ -2912,7 +2955,7 @@ class ExcellonEditorPrefGroupUI(OptionsGroupUI):
self.slot_length_entry = FCDoubleSpinner()
self.slot_length_entry.set_range(0, 99999)
- self.slot_length_entry.set_precision(4)
+ self.slot_length_entry.set_precision(self.decimals)
self.slot_length_entry.setWrapping(True)
self.slot_length_entry.setSingleStep(1)
@@ -2946,7 +2989,7 @@ class ExcellonEditorPrefGroupUI(OptionsGroupUI):
self.slot_angle_label.setMinimumWidth(100)
self.slot_angle_spinner = FCDoubleSpinner()
- self.slot_angle_spinner.set_precision(4)
+ self.slot_angle_spinner.set_precision(self.decimals)
self.slot_angle_spinner.setWrapping(True)
self.slot_angle_spinner.setRange(-359.99, 360.00)
self.slot_angle_spinner.setSingleStep(5)
@@ -2996,7 +3039,7 @@ class ExcellonEditorPrefGroupUI(OptionsGroupUI):
)
# self.drill_pitch_label.setMinimumWidth(100)
self.slot_array_pitch_entry = FCDoubleSpinner()
- self.slot_array_pitch_entry.set_precision(4)
+ self.slot_array_pitch_entry.set_precision(self.decimals)
self.slot_array_pitch_entry.setWrapping(True)
self.slot_array_pitch_entry.setRange(0, 999999)
self.slot_array_pitch_entry.setSingleStep(1)
@@ -3010,7 +3053,7 @@ class ExcellonEditorPrefGroupUI(OptionsGroupUI):
_("Angle at which each element in circular array is placed.")
)
self.slot_array_angle_entry = FCDoubleSpinner()
- self.slot_array_angle_entry.set_precision(4)
+ self.slot_array_angle_entry.set_precision(self.decimals)
self.slot_array_angle_entry.setWrapping(True)
self.slot_array_angle_entry.setRange(-360, 360)
self.slot_array_angle_entry.setSingleStep(5)
@@ -3040,12 +3083,11 @@ class ExcellonEditorPrefGroupUI(OptionsGroupUI):
_("Angle at which each element in circular array is placed.")
)
self.slot_array_circular_angle_entry = FCDoubleSpinner()
- self.slot_array_circular_angle_entry.set_precision(4)
+ self.slot_array_circular_angle_entry.set_precision(self.decimals)
self.slot_array_circular_angle_entry.setWrapping(True)
self.slot_array_circular_angle_entry.setRange(-360, 360)
self.slot_array_circular_angle_entry.setSingleStep(5)
-
grid0.addWidget(self.slot_array_circular_angle_label, 21, 0)
grid0.addWidget(self.slot_array_circular_angle_entry, 21, 1)
@@ -3053,11 +3095,12 @@ class ExcellonEditorPrefGroupUI(OptionsGroupUI):
class GeometryGenPrefGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
# OptionsGroupUI.__init__(self, "Geometry General Preferences", parent=parent)
super(GeometryGenPrefGroupUI, self).__init__(self)
self.setTitle(str(_("Geometry General")))
+ self.decimals = decimals
# ## Plot options
self.plot_options_label = QtWidgets.QLabel("%s:" % _("Plot Options"))
@@ -3105,11 +3148,12 @@ class GeometryGenPrefGroupUI(OptionsGroupUI):
class GeometryOptPrefGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
# OptionsGroupUI.__init__(self, "Geometry Options Preferences", parent=parent)
super(GeometryOptPrefGroupUI, self).__init__(self)
self.setTitle(str(_("Geometry Options")))
+ self.decimals = decimals
# ------------------------------
# ## Create CNC Job
@@ -3138,7 +3182,7 @@ class GeometryOptPrefGroupUI(OptionsGroupUI):
else:
self.cutz_entry.set_range(-9999.9999, 9999.9999)
- self.cutz_entry.set_precision(4)
+ self.cutz_entry.set_precision(self.decimals)
self.cutz_entry.setSingleStep(0.1)
self.cutz_entry.setWrapping(True)
@@ -3169,7 +3213,7 @@ class GeometryOptPrefGroupUI(OptionsGroupUI):
self.depthperpass_entry = FCDoubleSpinner()
self.depthperpass_entry.set_range(0, 99999)
- self.depthperpass_entry.set_precision(4)
+ self.depthperpass_entry.set_precision(self.decimals)
self.depthperpass_entry.setSingleStep(0.1)
self.depthperpass_entry.setWrapping(True)
@@ -3191,7 +3235,7 @@ class GeometryOptPrefGroupUI(OptionsGroupUI):
else:
self.travelz_entry.set_range(-9999.9999, 9999.9999)
- self.travelz_entry.set_precision(4)
+ self.travelz_entry.set_precision(self.decimals)
self.travelz_entry.setSingleStep(0.1)
self.travelz_entry.setWrapping(True)
@@ -3225,7 +3269,7 @@ class GeometryOptPrefGroupUI(OptionsGroupUI):
else:
self.toolchangez_entry.set_range(-9999.9999, 9999.9999)
- self.toolchangez_entry.set_precision(4)
+ self.toolchangez_entry.set_precision(self.decimals)
self.toolchangez_entry.setSingleStep(0.1)
self.toolchangez_entry.setWrapping(True)
@@ -3245,7 +3289,7 @@ class GeometryOptPrefGroupUI(OptionsGroupUI):
else:
self.gendz_entry.set_range(-9999.9999, 9999.9999)
- self.gendz_entry.set_precision(4)
+ self.gendz_entry.set_precision(self.decimals)
self.gendz_entry.setSingleStep(0.1)
self.gendz_entry.setWrapping(True)
@@ -3260,7 +3304,7 @@ class GeometryOptPrefGroupUI(OptionsGroupUI):
)
self.cncfeedrate_entry = FCDoubleSpinner()
self.cncfeedrate_entry.set_range(0, 99999)
- self.cncfeedrate_entry.set_precision(4)
+ self.cncfeedrate_entry.set_precision(self.decimals)
self.cncfeedrate_entry.setSingleStep(0.1)
self.cncfeedrate_entry.setWrapping(True)
@@ -3276,7 +3320,7 @@ class GeometryOptPrefGroupUI(OptionsGroupUI):
)
self.cncplunge_entry = FCDoubleSpinner()
self.cncplunge_entry.set_range(0, 99999)
- self.cncplunge_entry.set_precision(4)
+ self.cncplunge_entry.set_precision(self.decimals)
self.cncplunge_entry.setSingleStep(0.1)
self.cncplunge_entry.setWrapping(True)
@@ -3308,7 +3352,7 @@ class GeometryOptPrefGroupUI(OptionsGroupUI):
)
self.dwelltime_entry = FCDoubleSpinner()
self.dwelltime_entry.set_range(0, 99999)
- self.dwelltime_entry.set_precision(4)
+ self.dwelltime_entry.set_precision(self.decimals)
self.dwelltime_entry.setSingleStep(0.1)
self.dwelltime_entry.setWrapping(True)
@@ -3333,11 +3377,12 @@ class GeometryOptPrefGroupUI(OptionsGroupUI):
class GeometryAdvOptPrefGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
# OptionsGroupUI.__init__(self, "Geometry Advanced Options Preferences", parent=parent)
super(GeometryAdvOptPrefGroupUI, self).__init__(self)
self.setTitle(str(_("Geometry Adv. Options")))
+ self.decimals = decimals
# ------------------------------
# ## Advanced Options
@@ -3383,7 +3428,7 @@ class GeometryAdvOptPrefGroupUI(OptionsGroupUI):
)
self.cncfeedrate_rapid_entry = FCDoubleSpinner()
self.cncfeedrate_rapid_entry.set_range(0, 99999)
- self.cncfeedrate_rapid_entry.set_precision(4)
+ self.cncfeedrate_rapid_entry.set_precision(self.decimals)
self.cncfeedrate_rapid_entry.setSingleStep(0.1)
self.cncfeedrate_rapid_entry.setWrapping(True)
@@ -3408,7 +3453,7 @@ class GeometryAdvOptPrefGroupUI(OptionsGroupUI):
)
self.pdepth_entry = FCDoubleSpinner()
self.pdepth_entry.set_range(-99999, -0.000001)
- self.pdepth_entry.set_precision(4)
+ self.pdepth_entry.set_precision(self.decimals)
self.pdepth_entry.setSingleStep(0.1)
self.pdepth_entry.setWrapping(True)
@@ -3422,7 +3467,7 @@ class GeometryAdvOptPrefGroupUI(OptionsGroupUI):
)
self.feedrate_probe_entry = FCDoubleSpinner()
self.feedrate_probe_entry.set_range(0, 99999)
- self.feedrate_probe_entry.set_precision(4)
+ self.feedrate_probe_entry.set_precision(self.decimals)
self.feedrate_probe_entry.setSingleStep(0.1)
self.feedrate_probe_entry.setWrapping(True)
@@ -3464,7 +3509,7 @@ class GeometryAdvOptPrefGroupUI(OptionsGroupUI):
)
self.segx_entry = FCDoubleSpinner()
self.segx_entry.set_range(0, 99999)
- self.segx_entry.set_precision(4)
+ self.segx_entry.set_precision(self.decimals)
self.segx_entry.setSingleStep(0.1)
self.segx_entry.setWrapping(True)
@@ -3480,7 +3525,7 @@ class GeometryAdvOptPrefGroupUI(OptionsGroupUI):
)
self.segy_entry = FCDoubleSpinner()
self.segy_entry.set_range(0, 99999)
- self.segy_entry.set_precision(4)
+ self.segy_entry.set_precision(self.decimals)
self.segy_entry.setSingleStep(0.1)
self.segy_entry.setWrapping(True)
@@ -3491,11 +3536,12 @@ class GeometryAdvOptPrefGroupUI(OptionsGroupUI):
class GeometryEditorPrefGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
# OptionsGroupUI.__init__(self, "Gerber Adv. Options Preferences", parent=parent)
super(GeometryEditorPrefGroupUI, self).__init__(self)
self.setTitle(str(_("Geometry Editor")))
+ self.decimals = decimals
# Advanced Geometry Parameters
self.param_label = QtWidgets.QLabel("%s:" % _("Parameters"))
@@ -3538,11 +3584,12 @@ class GeometryEditorPrefGroupUI(OptionsGroupUI):
class CNCJobGenPrefGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
# OptionsGroupUI.__init__(self, "CNC Job General Preferences", parent=None)
super(CNCJobGenPrefGroupUI, self).__init__(self)
self.setTitle(str(_("CNC Job General")))
+ self.decimals = decimals
# ## Plot options
self.plot_options_label = QtWidgets.QLabel("%s:" % _("Plot Options"))
@@ -3610,7 +3657,7 @@ class CNCJobGenPrefGroupUI(OptionsGroupUI):
)
self.tooldia_entry = FCDoubleSpinner()
self.tooldia_entry.set_range(0, 99999)
- self.tooldia_entry.set_precision(4)
+ self.tooldia_entry.set_precision(self.decimals)
self.tooldia_entry.setSingleStep(0.1)
self.tooldia_entry.setWrapping(True)
@@ -3678,11 +3725,12 @@ class CNCJobGenPrefGroupUI(OptionsGroupUI):
class CNCJobOptPrefGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
# OptionsGroupUI.__init__(self, "CNC Job Options Preferences", parent=None)
super(CNCJobOptPrefGroupUI, self).__init__(self)
self.setTitle(str(_("CNC Job Options")))
+ self.decimals = decimals
# ## Export G-Code
self.export_gcode_label = QtWidgets.QLabel("%s:" % _("Export G-Code"))
@@ -3738,9 +3786,10 @@ class CNCJobOptPrefGroupUI(OptionsGroupUI):
class CNCJobAdvOptPrefGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
# OptionsGroupUI.__init__(self, "CNC Job Advanced Options Preferences", parent=None)
super(CNCJobAdvOptPrefGroupUI, self).__init__(self)
+ self.decimals = decimals
self.setTitle(str(_("CNC Job Adv. Options")))
@@ -3890,12 +3939,12 @@ class CNCJobAdvOptPrefGroupUI(OptionsGroupUI):
class ToolsNCCPrefGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
# OptionsGroupUI.__init__(self, "NCC Tool Options", parent=parent)
super(ToolsNCCPrefGroupUI, self).__init__(self)
self.setTitle(str(_("NCC Tool Options")))
- self.decimals = 4
+ self.decimals = decimals
# ## Clear non-copper regions
self.clearcopper_label = QtWidgets.QLabel("%s:" % _("Parameters"))
@@ -4182,12 +4231,12 @@ class ToolsNCCPrefGroupUI(OptionsGroupUI):
class ToolsCutoutPrefGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
# OptionsGroupUI.__init__(self, "Cutout Tool Options", parent=parent)
super(ToolsCutoutPrefGroupUI, self).__init__(self)
self.setTitle(str(_("Cutout Tool Options")))
- self.decimals = 4
+ self.decimals = decimals
# ## Board cutout
self.board_cutout_label = QtWidgets.QLabel("%s:" % _("Parameters"))
@@ -4341,12 +4390,12 @@ class ToolsCutoutPrefGroupUI(OptionsGroupUI):
class Tools2sidedPrefGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
# OptionsGroupUI.__init__(self, "2sided Tool Options", parent=parent)
super(Tools2sidedPrefGroupUI, self).__init__(self)
self.setTitle(str(_("2Sided Tool Options")))
- self.decimals = 4
+ self.decimals = decimals
# ## Board cuttout
self.dblsided_label = QtWidgets.QLabel("%s:" % _("Parameters"))
@@ -4403,12 +4452,12 @@ class Tools2sidedPrefGroupUI(OptionsGroupUI):
class ToolsPaintPrefGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
# OptionsGroupUI.__init__(self, "Paint Area Tool Options", parent=parent)
super(ToolsPaintPrefGroupUI, self).__init__(self)
self.setTitle(str(_("Paint Tool Options")))
- self.decimals = 4
+ self.decimals = decimals
# ------------------------------
# ## Paint area
@@ -4563,12 +4612,12 @@ class ToolsPaintPrefGroupUI(OptionsGroupUI):
class ToolsFilmPrefGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
# OptionsGroupUI.__init__(self, "Cutout Tool Options", parent=parent)
super(ToolsFilmPrefGroupUI, self).__init__(self)
self.setTitle(str(_("Film Tool Options")))
- self.decimals = 4
+ self.decimals = decimals
# ## Parameters
self.film_label = QtWidgets.QLabel("%s:" % _("Parameters"))
@@ -4860,12 +4909,12 @@ class ToolsFilmPrefGroupUI(OptionsGroupUI):
class ToolsPanelizePrefGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
# OptionsGroupUI.__init__(self, "Cutout Tool Options", parent=parent)
super(ToolsPanelizePrefGroupUI, self).__init__(self)
self.setTitle(str(_("Panelize Tool Options")))
- self.decimals = 4
+ self.decimals = decimals
# ## Board cuttout
self.panelize_label = QtWidgets.QLabel("%s:" % _("Parameters"))
@@ -4987,12 +5036,12 @@ class ToolsPanelizePrefGroupUI(OptionsGroupUI):
class ToolsCalculatorsPrefGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
# OptionsGroupUI.__init__(self, "Calculators Tool Options", parent=parent)
super(ToolsCalculatorsPrefGroupUI, self).__init__(self)
self.setTitle(str(_("Calculators Tool Options")))
- self.decimals = 4
+ self.decimals = decimals
# ## V-shape Calculator Tool
self.vshape_tool_label = QtWidgets.QLabel("%s:" % _("V-Shape Tool Calculator"))
@@ -5111,12 +5160,12 @@ class ToolsCalculatorsPrefGroupUI(OptionsGroupUI):
class ToolsTransformPrefGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
super(ToolsTransformPrefGroupUI, self).__init__(self)
self.setTitle(str(_("Transform Tool Options")))
- self.decimals = 4
+ self.decimals = decimals
# ## Transformations
self.transform_label = QtWidgets.QLabel("%s:" % _("Parameters"))
@@ -5287,12 +5336,12 @@ class ToolsTransformPrefGroupUI(OptionsGroupUI):
class ToolsSolderpastePrefGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
super(ToolsSolderpastePrefGroupUI, self).__init__(self)
self.setTitle(str(_("SolderPaste Tool Options")))
- self.decimals = 4
+ self.decimals = decimals
# ## Solder Paste Dispensing
self.solderpastelabel = QtWidgets.QLabel("%s:" % _("Parameters"))
@@ -5512,11 +5561,12 @@ class ToolsSolderpastePrefGroupUI(OptionsGroupUI):
class ToolsSubPrefGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
super(ToolsSubPrefGroupUI, self).__init__(self)
self.setTitle(str(_("Substractor Tool Options")))
+ self.decimals = decimals
# ## Subtractor Tool Parameters
self.sublabel = QtWidgets.QLabel("%s:" % _("Parameters"))
@@ -5534,12 +5584,12 @@ class ToolsSubPrefGroupUI(OptionsGroupUI):
class Tools2RulesCheckPrefGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
super(Tools2RulesCheckPrefGroupUI, self).__init__(self)
self.setTitle(str(_("Check Rules Tool Options")))
- self.decimals = 4
+ self.decimals = decimals
self.crlabel = QtWidgets.QLabel("%s:" % _("Parameters"))
self.crlabel.setToolTip(
@@ -5757,12 +5807,12 @@ class Tools2RulesCheckPrefGroupUI(OptionsGroupUI):
class Tools2OptimalPrefGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
super(Tools2OptimalPrefGroupUI, self).__init__(self)
self.setTitle(str(_("Optimal Tool Options")))
- self.decimals = 4
+ self.decimals = decimals
# ## Parameters
self.optlabel = QtWidgets.QLabel("%s:" % _("Parameters"))
@@ -5794,12 +5844,12 @@ class Tools2OptimalPrefGroupUI(OptionsGroupUI):
class Tools2QRCodePrefGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
super(Tools2QRCodePrefGroupUI, self).__init__(self)
self.setTitle(str(_("QRCode Tool Options")))
- self.decimals = 4
+ self.decimals = decimals
# ## Parameters
self.qrlabel = QtWidgets.QLabel("%s:" % _("Parameters"))
@@ -5982,12 +6032,12 @@ class Tools2QRCodePrefGroupUI(OptionsGroupUI):
class Tools2CThievingPrefGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
super(Tools2CThievingPrefGroupUI, self).__init__(self)
self.setTitle(str(_("Copper Thieving Tool Options")))
- self.decimals = 4
+ self.decimals = decimals
# ## Grid Layout
grid_lay = QtWidgets.QGridLayout()
@@ -6071,7 +6121,6 @@ class Tools2CThievingPrefGroupUI(OptionsGroupUI):
grid_lay.addWidget(self.bbox_type_label, 5, 0)
grid_lay.addWidget(self.bbox_type_radio, 5, 1)
-
separator_line = QtWidgets.QFrame()
separator_line.setFrameShape(QtWidgets.QFrame.HLine)
separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
@@ -6238,12 +6287,12 @@ class Tools2CThievingPrefGroupUI(OptionsGroupUI):
class Tools2FiducialsPrefGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
super(Tools2FiducialsPrefGroupUI, self).__init__(self)
self.setTitle(str(_("Fiducials Tools Options")))
- self.decimals = 4
+ self.decimals = decimals
# ## Grid Layout
grid_lay = QtWidgets.QGridLayout()
@@ -6354,11 +6403,12 @@ class Tools2FiducialsPrefGroupUI(OptionsGroupUI):
class FAExcPrefGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
# OptionsGroupUI.__init__(self, "Excellon File associations Preferences", parent=None)
super().__init__(self)
self.setTitle(str(_("Excellon File associations")))
+ self.decimals = decimals
self.layout.setContentsMargins(2, 2, 2, 2)
@@ -6436,11 +6486,12 @@ class FAExcPrefGroupUI(OptionsGroupUI):
class FAGcoPrefGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
# OptionsGroupUI.__init__(self, "Gcode File associations Preferences", parent=None)
super(FAGcoPrefGroupUI, self).__init__(self)
self.setTitle(str(_("GCode File associations")))
+ self.decimals = decimals
self.restore_btn = FCButton(_("Restore"))
self.restore_btn.setToolTip(_("Restore the extension list to the default state."))
@@ -6505,11 +6556,12 @@ class FAGcoPrefGroupUI(OptionsGroupUI):
class FAGrbPrefGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
# OptionsGroupUI.__init__(self, "Gerber File associations Preferences", parent=None)
super(FAGrbPrefGroupUI, self).__init__(self)
self.setTitle(str(_("Gerber File associations")))
+ self.decimals = decimals
self.restore_btn = FCButton(_("Restore"))
self.restore_btn.setToolTip(_("Restore the extension list to the default state."))
@@ -6574,11 +6626,12 @@ class FAGrbPrefGroupUI(OptionsGroupUI):
class AutoCompletePrefGroupUI(OptionsGroupUI):
- def __init__(self, parent=None):
+ def __init__(self, decimals=4, parent=None):
# OptionsGroupUI.__init__(self, "Gerber File associations Preferences", parent=None)
super().__init__(self, parent=parent)
self.setTitle(str(_("Autocompleter Keywords")))
+ self.decimals = decimals
self.restore_btn = FCButton(_("Restore"))
self.restore_btn.setToolTip(_("Restore the autocompleter keywords list to the default state."))
diff --git a/flatcamParsers/ParseExcellon.py b/flatcamParsers/ParseExcellon.py
index 728f6a17..9725ecd3 100644
--- a/flatcamParsers/ParseExcellon.py
+++ b/flatcamParsers/ParseExcellon.py
@@ -77,6 +77,7 @@ class Excellon(Geometry):
:return: Excellon object.
:rtype: Excellon
"""
+ self.decimals = self.app.decimals
if geo_steps_per_circle is None:
geo_steps_per_circle = int(Excellon.defaults['geo_steps_per_circle'])
diff --git a/flatcamParsers/ParseGerber.py b/flatcamParsers/ParseGerber.py
index dfc27c58..ba4ab780 100644
--- a/flatcamParsers/ParseGerber.py
+++ b/flatcamParsers/ParseGerber.py
@@ -83,6 +83,7 @@ class Gerber(Geometry):
# How to approximate a circle with lines.
self.steps_per_circle = int(self.app.defaults["gerber_circle_steps"])
+ self.decimals = self.app.decimals
# Initialize parent
Geometry.__init__(self, geo_steps_per_circle=self.steps_per_circle)
diff --git a/flatcamTools/ToolCalculators.py b/flatcamTools/ToolCalculators.py
index a31efd0a..2cc2551e 100644
--- a/flatcamTools/ToolCalculators.py
+++ b/flatcamTools/ToolCalculators.py
@@ -30,7 +30,7 @@ class ToolCalculator(FlatCAMTool):
FlatCAMTool.__init__(self, app)
self.app = app
- self.decimals = 6
+ self.decimals = self.app.decimals
# ## Title
title_label = QtWidgets.QLabel("%s" % self.toolName)
diff --git a/flatcamTools/ToolCalibrateExcellon.py b/flatcamTools/ToolCalibrateExcellon.py
index 6c6544a3..e8f20a9f 100644
--- a/flatcamTools/ToolCalibrateExcellon.py
+++ b/flatcamTools/ToolCalibrateExcellon.py
@@ -38,7 +38,7 @@ class ToolCalibrateExcellon(FlatCAMTool):
self.app = app
self.canvas = self.app.plotcanvas
- self.decimals = 4
+ self.decimals = self.app.decimals
# ## Title
title_label = QtWidgets.QLabel("%s" % self.toolName)
diff --git a/flatcamTools/ToolCopperThieving.py b/flatcamTools/ToolCopperThieving.py
index 7f847c13..275931eb 100644
--- a/flatcamTools/ToolCopperThieving.py
+++ b/flatcamTools/ToolCopperThieving.py
@@ -45,7 +45,7 @@ class ToolCopperThieving(FlatCAMTool):
self.app = app
self.canvas = self.app.plotcanvas
- self.decimals = 4
+ self.decimals = self.app.decimals
self.units = self.app.defaults['units']
# ## Title
diff --git a/flatcamTools/ToolCutOut.py b/flatcamTools/ToolCutOut.py
index 1ddf8964..0e2506f7 100644
--- a/flatcamTools/ToolCutOut.py
+++ b/flatcamTools/ToolCutOut.py
@@ -46,7 +46,7 @@ class CutOut(FlatCAMTool):
self.app = app
self.canvas = app.plotcanvas
- self.decimals = 4
+ self.decimals = self.app.decimals
# Title
title_label = QtWidgets.QLabel("%s" % self.toolName)
diff --git a/flatcamTools/ToolDblSided.py b/flatcamTools/ToolDblSided.py
index e005a281..1905a72e 100644
--- a/flatcamTools/ToolDblSided.py
+++ b/flatcamTools/ToolDblSided.py
@@ -26,7 +26,7 @@ class DblSidedTool(FlatCAMTool):
def __init__(self, app):
FlatCAMTool.__init__(self, app)
- self.decimals = 4
+ self.decimals = self.app.decimals
# ## Title
title_label = QtWidgets.QLabel("%s" % self.toolName)
diff --git a/flatcamTools/ToolDistance.py b/flatcamTools/ToolDistance.py
index 00aa8b4c..025535b9 100644
--- a/flatcamTools/ToolDistance.py
+++ b/flatcamTools/ToolDistance.py
@@ -33,6 +33,8 @@ class Distance(FlatCAMTool):
FlatCAMTool.__init__(self, app)
self.app = app
+ self.decimals = self.app.decimals
+
self.canvas = self.app.plotcanvas
self.units = self.app.defaults['units'].lower()
@@ -135,8 +137,6 @@ class Distance(FlatCAMTool):
self.mm = None
self.mr = None
- self.decimals = 4
-
# VisPy visuals
if self.app.is_legacy is False:
self.sel_shapes = ShapeCollection(parent=self.app.plotcanvas.view.scene, layers=1)
diff --git a/flatcamTools/ToolDistanceMin.py b/flatcamTools/ToolDistanceMin.py
index ea138df6..b038434d 100644
--- a/flatcamTools/ToolDistanceMin.py
+++ b/flatcamTools/ToolDistanceMin.py
@@ -36,6 +36,7 @@ class DistanceMin(FlatCAMTool):
self.app = app
self.canvas = self.app.plotcanvas
self.units = self.app.defaults['units'].lower()
+ self.decimals = self.app.decimals
# ## Title
title_label = QtWidgets.QLabel("%s
" % self.toolName)
@@ -137,7 +138,6 @@ class DistanceMin(FlatCAMTool):
self.layout.addStretch()
- self.decimals = 4
self.h_point = (0, 0)
self.measure_btn.clicked.connect(self.activate_measure_tool)
diff --git a/flatcamTools/ToolFiducials.py b/flatcamTools/ToolFiducials.py
index 6508030c..4eaeb329 100644
--- a/flatcamTools/ToolFiducials.py
+++ b/flatcamTools/ToolFiducials.py
@@ -38,7 +38,7 @@ class ToolFiducials(FlatCAMTool):
self.app = app
self.canvas = self.app.plotcanvas
- self.decimals = 4
+ self.decimals = self.app.decimals
self.units = ''
# ## Title
diff --git a/flatcamTools/ToolFilm.py b/flatcamTools/ToolFilm.py
index a94462a4..dadd4d39 100644
--- a/flatcamTools/ToolFilm.py
+++ b/flatcamTools/ToolFilm.py
@@ -44,7 +44,7 @@ class Film(FlatCAMTool):
def __init__(self, app):
FlatCAMTool.__init__(self, app)
- self.decimals = 4
+ self.decimals = self.app.decimals
# Title
title_label = QtWidgets.QLabel("%s" % self.toolName)
diff --git a/flatcamTools/ToolImage.py b/flatcamTools/ToolImage.py
index 674c5ebc..2e203df0 100644
--- a/flatcamTools/ToolImage.py
+++ b/flatcamTools/ToolImage.py
@@ -26,6 +26,9 @@ class ToolImage(FlatCAMTool):
def __init__(self, app):
FlatCAMTool.__init__(self, app)
+ self.app = app
+ self.decimals = self.app.decimals
+
# Title
title_label = QtWidgets.QLabel("%s" % _('Image to PCB'))
title_label.setStyleSheet("""
diff --git a/flatcamTools/ToolMove.py b/flatcamTools/ToolMove.py
index e46c1b36..7b6f9079 100644
--- a/flatcamTools/ToolMove.py
+++ b/flatcamTools/ToolMove.py
@@ -30,6 +30,8 @@ class ToolMove(FlatCAMTool):
def __init__(self, app):
FlatCAMTool.__init__(self, app)
+ self.app = app
+ self.decimals = self.app.decimals
self.layout.setContentsMargins(0, 0, 3, 0)
self.setSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Maximum)
diff --git a/flatcamTools/ToolNonCopperClear.py b/flatcamTools/ToolNonCopperClear.py
index 8b75a7cd..1717e0e7 100644
--- a/flatcamTools/ToolNonCopperClear.py
+++ b/flatcamTools/ToolNonCopperClear.py
@@ -39,7 +39,7 @@ class NonCopperClear(FlatCAMTool, Gerber):
def __init__(self, app):
self.app = app
- self.decimals = 4
+ self.decimals = self.app.decimals
FlatCAMTool.__init__(self, app)
Gerber.__init__(self, steps_per_circle=self.app.defaults["gerber_circle_steps"])
diff --git a/flatcamTools/ToolOptimal.py b/flatcamTools/ToolOptimal.py
index 6bd4291b..c5cd509d 100644
--- a/flatcamTools/ToolOptimal.py
+++ b/flatcamTools/ToolOptimal.py
@@ -40,7 +40,7 @@ class ToolOptimal(FlatCAMTool):
FlatCAMTool.__init__(self, app)
self.units = self.app.defaults['units'].upper()
- self.decimals = 4
+ self.decimals = self.app.decimals
# ############################################################################
# ############################ GUI creation ##################################
diff --git a/flatcamTools/ToolPDF.py b/flatcamTools/ToolPDF.py
index cef1993e..9c8c1812 100644
--- a/flatcamTools/ToolPDF.py
+++ b/flatcamTools/ToolPDF.py
@@ -44,6 +44,7 @@ class ToolPDF(FlatCAMTool):
def __init__(self, app):
FlatCAMTool.__init__(self, app)
self.app = app
+ self.decimals = self.app.decimals
self.step_per_circles = self.app.defaults["gerber_circle_steps"]
self.stream_re = re.compile(b'.*?FlateDecode.*?stream(.*?)endstream', re.S)
diff --git a/flatcamTools/ToolPaint.py b/flatcamTools/ToolPaint.py
index 720040a6..45442680 100644
--- a/flatcamTools/ToolPaint.py
+++ b/flatcamTools/ToolPaint.py
@@ -42,7 +42,7 @@ class ToolPaint(FlatCAMTool, Gerber):
def __init__(self, app):
self.app = app
- self.decimals = 4
+ self.decimals = self.app.decimals
FlatCAMTool.__init__(self, app)
Geometry.__init__(self, geo_steps_per_circle=self.app.defaults["geometry_circle_steps"])
diff --git a/flatcamTools/ToolPanelize.py b/flatcamTools/ToolPanelize.py
index 81233410..fb8fa7fd 100644
--- a/flatcamTools/ToolPanelize.py
+++ b/flatcamTools/ToolPanelize.py
@@ -34,8 +34,9 @@ class Panelize(FlatCAMTool):
toolName = _("Panelize PCB")
def __init__(self, app):
- super(Panelize, self).__init__(self)
- self.app = app
+ self.decimals = app.decimals
+
+ FlatCAMTool.__init__(self, app)
# ## Title
title_label = QtWidgets.QLabel("%s" % self.toolName)
diff --git a/flatcamTools/ToolPcbWizard.py b/flatcamTools/ToolPcbWizard.py
index e176bf37..fb61e0fa 100644
--- a/flatcamTools/ToolPcbWizard.py
+++ b/flatcamTools/ToolPcbWizard.py
@@ -34,6 +34,7 @@ class PcbWizard(FlatCAMTool):
FlatCAMTool.__init__(self, app)
self.app = app
+ self.decimals = self.app.decimals
# Title
title_label = QtWidgets.QLabel("%s" % _('Import 2-file Excellon'))
diff --git a/flatcamTools/ToolProperties.py b/flatcamTools/ToolProperties.py
index 5086b393..b25aff06 100644
--- a/flatcamTools/ToolProperties.py
+++ b/flatcamTools/ToolProperties.py
@@ -34,7 +34,7 @@ class Properties(FlatCAMTool):
self.setSizePolicy(QtWidgets.QSizePolicy.Ignored, QtWidgets.QSizePolicy.Ignored)
- self.decimals = 4
+ self.decimals = self.app.decimals
# this way I can hide/show the frame
self.properties_frame = QtWidgets.QFrame()
diff --git a/flatcamTools/ToolQRCode.py b/flatcamTools/ToolQRCode.py
index 97c0cef3..7e5aac40 100644
--- a/flatcamTools/ToolQRCode.py
+++ b/flatcamTools/ToolQRCode.py
@@ -48,7 +48,7 @@ class QRCode(FlatCAMTool):
self.app = app
self.canvas = self.app.plotcanvas
- self.decimals = 4
+ self.decimals = self.app.decimals
self.units = ''
# ## Title
diff --git a/flatcamTools/ToolRulesCheck.py b/flatcamTools/ToolRulesCheck.py
index 509380d7..bad1f902 100644
--- a/flatcamTools/ToolRulesCheck.py
+++ b/flatcamTools/ToolRulesCheck.py
@@ -35,9 +35,9 @@ class RulesCheck(FlatCAMTool):
tool_finished = QtCore.pyqtSignal(list)
def __init__(self, app):
- super(RulesCheck, self).__init__(self)
- self.app = app
- self.decimals = 4
+ self.decimals = app.decimals
+
+ FlatCAMTool.__init__(self, app)
# ## Title
title_label = QtWidgets.QLabel("%s" % self.toolName)
diff --git a/flatcamTools/ToolSolderPaste.py b/flatcamTools/ToolSolderPaste.py
index f954db42..89be8609 100644
--- a/flatcamTools/ToolSolderPaste.py
+++ b/flatcamTools/ToolSolderPaste.py
@@ -40,7 +40,7 @@ class SolderPaste(FlatCAMTool):
FlatCAMTool.__init__(self, app)
# Number of decimals to be used for tools/nozzles in this FlatCAM Tool
- self.decimals = 4
+ self.decimals = self.app.decimals
# ## Title
title_label = QtWidgets.QLabel("%s" % self.toolName)
diff --git a/flatcamTools/ToolSub.py b/flatcamTools/ToolSub.py
index 3d472874..37d47ed3 100644
--- a/flatcamTools/ToolSub.py
+++ b/flatcamTools/ToolSub.py
@@ -36,6 +36,7 @@ class ToolSub(FlatCAMTool):
def __init__(self, app):
self.app = app
+ self.decimals = self.app.decimals
FlatCAMTool.__init__(self, app)
diff --git a/flatcamTools/ToolTransform.py b/flatcamTools/ToolTransform.py
index d56904ba..0b83c5c6 100644
--- a/flatcamTools/ToolTransform.py
+++ b/flatcamTools/ToolTransform.py
@@ -30,7 +30,7 @@ class ToolTransform(FlatCAMTool):
def __init__(self, app):
FlatCAMTool.__init__(self, app)
- self.decimals = 4
+ self.decimals = self.app.decimals
self.transform_lay = QtWidgets.QVBoxLayout()
self.layout.addLayout(self.transform_lay)
diff --git a/postprocessors/Berta_CNC.py b/postprocessors/Berta_CNC.py
index cdde130f..540ba0f5 100644
--- a/postprocessors/Berta_CNC.py
+++ b/postprocessors/Berta_CNC.py
@@ -47,7 +47,8 @@ class Berta_CNC(FlatCAMPostProc):
gcode += '(Z Toolchange: ' + str(p['z_toolchange']) + units + ')\n'
if coords_xy is not None:
- gcode += '(X,Y Toolchange: ' + "%.4f, %.4f" % (coords_xy[0], coords_xy[1]) + units + ')\n'
+ gcode += '(X,Y Toolchange: ' + "%.*f, %.*f" % (p.decimals, coords_xy[0],
+ p.decimals, coords_xy[1]) + units + ')\n'
else:
gcode += '(X,Y Toolchange: ' + "None" + units + ')\n'
@@ -110,10 +111,7 @@ class Berta_CNC(FlatCAMPostProc):
if int(p.tool) == 1 and p.startz is not None:
z_toolchange = p.startz
- if p.units.upper() == 'MM':
- toolC_formatted = format(p.toolC, '.2f')
- else:
- toolC_formatted = format(p.toolC, '.4f')
+ toolC_formatted = '%.*f' % (p.decimals, p.toolC)
if str(p['options']['type']) == 'Excellon':
for i in p['options']['Tools_in_use']:
diff --git a/postprocessors/ISEL_CNC.py b/postprocessors/ISEL_CNC.py
index 9ef5e927..cae7774b 100644
--- a/postprocessors/ISEL_CNC.py
+++ b/postprocessors/ISEL_CNC.py
@@ -44,7 +44,8 @@ class ISEL_CNC(FlatCAMPostProc):
gcode += '(Z Toolchange: ' + str(p['z_toolchange']) + units + ')\n'
if coords_xy is not None:
- gcode += '(X,Y Toolchange: ' + "%.4f, %.4f" % (coords_xy[0], coords_xy[1]) + units + ')\n'
+ gcode += '(X,Y Toolchange: ' + "%.*f, %.*f" % (p.decimals, coords_xy[0],
+ p.decimals, coords_xy[1]) + units + ')\n'
else:
gcode += '(X,Y Toolchange: ' + "None" + units + ')\n'
@@ -84,10 +85,7 @@ class ISEL_CNC(FlatCAMPostProc):
f_plunge = p.f_plunge
no_drills = 1
- if p.units.upper() == 'MM':
- toolC_formatted = format(p.toolC, '.2f')
- else:
- toolC_formatted = format(p.toolC, '.4f')
+ toolC_formatted = '%.*f' % (p.decimals, p.toolC)
if str(p['options']['type']) == 'Excellon':
for i in p['options']['Tools_in_use']:
diff --git a/postprocessors/Paste_1.py b/postprocessors/Paste_1.py
index 94e7319d..c7e42c09 100644
--- a/postprocessors/Paste_1.py
+++ b/postprocessors/Paste_1.py
@@ -36,7 +36,8 @@ class Paste_1(FlatCAMPostProc_Tools):
gcode += '(Z_Travel: ' + str(p['z_travel']) + units + ')\n'
gcode += '(Z Toolchange: ' + str(p['z_toolchange']) + units + ')\n'
- gcode += '(X,Y Toolchange: ' + "%.4f, %.4f" % (coords_xy[0], coords_xy[1]) + units + ')\n'
+ gcode += '(X,Y Toolchange: ' + "%.*f, %.*f" % (p.decimals, coords_xy[0],
+ p.decimals, coords_xy[1]) + units + ')\n'
if 'Paste' in p.pp_solderpaste_name:
gcode += '(Postprocessor SolderPaste Dispensing Geometry: ' + str(p.pp_solderpaste_name) + ')\n' + '\n'
@@ -74,11 +75,11 @@ class Paste_1(FlatCAMPostProc_Tools):
if toolchangexy is not None:
x_toolchange = toolchangexy[0]
y_toolchange = toolchangexy[1]
-
- if p.units.upper() == 'MM':
- toolC_formatted = format(float(p['toolC']), '.2f')
else:
- toolC_formatted = format(float(p['toolC']), '.4f')
+ x_toolchange = 0.0
+ y_toolchange = 0.0
+
+ toolC_formatted = '%.*f' % (p.decimals, float(p['toolC']))
if toolchangexy is not None:
gcode = """
diff --git a/postprocessors/Repetier.py b/postprocessors/Repetier.py
index de96319c..a5d11d7e 100644
--- a/postprocessors/Repetier.py
+++ b/postprocessors/Repetier.py
@@ -45,7 +45,8 @@ class Repetier(FlatCAMPostProc):
gcode += ';Z Toolchange: ' + str(p['z_toolchange']) + units + '\n'
if coords_xy is not None:
- gcode += ';X,Y Toolchange: ' + "%.4f, %.4f" % (coords_xy[0], coords_xy[1]) + units + '\n'
+ gcode += ';X,Y Toolchange: ' + "%.*f, %.*f" % (p.decimals, coords_xy[0],
+ p.decimals, coords_xy[1]) + units + '\n'
else:
gcode += ';X,Y Toolchange: ' + "None" + units + '\n'
@@ -95,10 +96,7 @@ class Repetier(FlatCAMPostProc):
if int(p.tool) == 1 and p.startz is not None:
z_toolchange = p.startz
- if p.units.upper() == 'MM':
- toolC_formatted = format(p.toolC, '.2f')
- else:
- toolC_formatted = format(p.toolC, '.4f')
+ toolC_formatted = '%.*f' % (p.decimals, p.toolC)
if str(p['options']['type']) == 'Excellon':
for i in p['options']['Tools_in_use']:
diff --git a/postprocessors/Toolchange_Custom.py b/postprocessors/Toolchange_Custom.py
index c98ef5fe..e8637187 100644
--- a/postprocessors/Toolchange_Custom.py
+++ b/postprocessors/Toolchange_Custom.py
@@ -44,7 +44,8 @@ class Toolchange_Custom(FlatCAMPostProc):
gcode += '(Z Toolchange: ' + str(p['z_toolchange']) + units + ')\n'
if coords_xy is not None:
- gcode += '(X,Y Toolchange: ' + "%.4f, %.4f" % (coords_xy[0], coords_xy[1]) + units + ')\n'
+ gcode += '(X,Y Toolchange: ' + "%.*f, %.*f" % (p.decimals, coords_xy[0],
+ p.decimals, coords_xy[1]) + units + ')\n'
else:
gcode += '(X,Y Toolchange: ' + "None" + units + ')\n'
@@ -93,10 +94,7 @@ class Toolchange_Custom(FlatCAMPostProc):
if int(p.tool) == 1 and p.startz is not None:
z_toolchange = p.startz
- if p.units.upper() == 'MM':
- toolC_formatted = format(p.toolC, '.2f')
- else:
- toolC_formatted = format(p.toolC, '.4f')
+ toolC_formatted = '%.*f' % (p.decimals, p.toolC)
if str(p['options']['type']) == 'Excellon':
for i in p['options']['Tools_in_use']:
diff --git a/postprocessors/Toolchange_Probe_MACH3.py b/postprocessors/Toolchange_Probe_MACH3.py
index 0df3cc66..eb94eb7e 100644
--- a/postprocessors/Toolchange_Probe_MACH3.py
+++ b/postprocessors/Toolchange_Probe_MACH3.py
@@ -45,7 +45,8 @@ class Toolchange_Probe_MACH3(FlatCAMPostProc):
gcode += '(Z Toolchange: ' + str(p['z_toolchange']) + units + ')\n'
if coords_xy is not None:
- gcode += '(X,Y Toolchange: ' + "%.4f, %.4f" % (coords_xy[0], coords_xy[1]) + units + ')\n'
+ gcode += '(X,Y Toolchange: ' + "%.*f, %.*f" % (p.decimals, coords_xy[0],
+ p.decimals, coords_xy[1]) + units + ')\n'
else:
gcode += '(X,Y Toolchange: ' + "None" + units + ')\n'
@@ -99,10 +100,7 @@ class Toolchange_Probe_MACH3(FlatCAMPostProc):
if int(p.tool) == 1 and p.startz is not None:
z_toolchange = p.startz
- if p.units.upper() == 'MM':
- toolC_formatted = format(p.toolC, '.2f')
- else:
- toolC_formatted = format(p.toolC, '.4f')
+ toolC_formatted = '%.*f' % (p.decimals, p.toolC)
if str(p['options']['type']) == 'Excellon':
for i in p['options']['Tools_in_use']:
diff --git a/postprocessors/Toolchange_manual.py b/postprocessors/Toolchange_manual.py
index d4fe3c08..767ec8c3 100644
--- a/postprocessors/Toolchange_manual.py
+++ b/postprocessors/Toolchange_manual.py
@@ -43,7 +43,8 @@ class Toolchange_manual(FlatCAMPostProc):
gcode += '(Z_Move: ' + str(p['z_move']) + units + ')\n'
gcode += '(Z Toolchange: ' + str(p['z_toolchange']) + units + ')\n'
if coords_xy is not None:
- gcode += '(X,Y Toolchange: ' + "%.4f, %.4f" % (coords_xy[0], coords_xy[1]) + units + ')\n'
+ gcode += '(X,Y Toolchange: ' + "%.*f, %.*f" % (p.decimals, coords_xy[0],
+ p.decimals, coords_xy[1]) + units + ')\n'
else:
gcode += '(X,Y Toolchange: ' + "None" + units + ')\n'
gcode += '(Z Start: ' + str(p['startz']) + units + ')\n'
@@ -97,10 +98,7 @@ class Toolchange_manual(FlatCAMPostProc):
if int(p.tool) == 1 and p.startz is not None:
z_toolchange = p.startz
- if p.units.upper() == 'MM':
- toolC_formatted = format(p.toolC, '.2f')
- else:
- toolC_formatted = format(p.toolC, '.4f')
+ toolC_formatted = '%.*f' % (p.decimals, p.toolC)
if str(p['options']['type']) == 'Excellon':
for i in p['options']['Tools_in_use']:
diff --git a/postprocessors/default.py b/postprocessors/default.py
index 0b1e8db2..6a8a540f 100644
--- a/postprocessors/default.py
+++ b/postprocessors/default.py
@@ -44,7 +44,8 @@ class default(FlatCAMPostProc):
gcode += '(Z Toolchange: ' + str(p['z_toolchange']) + units + ')\n'
if coords_xy is not None:
- gcode += '(X,Y Toolchange: ' + "%.4f, %.4f" % (coords_xy[0], coords_xy[1]) + units + ')\n'
+ gcode += '(X,Y Toolchange: ' + "%.*f, %.*f" % (p.decimals, coords_xy[0],
+ p.decimals, coords_xy[1]) + units + ')\n'
else:
gcode += '(X,Y Toolchange: ' + "None" + units + ')\n'
@@ -95,10 +96,7 @@ class default(FlatCAMPostProc):
if int(p.tool) == 1 and p.startz is not None:
z_toolchange = p.startz
- if p.units.upper() == 'MM':
- toolC_formatted = format(p.toolC, '.2f')
- else:
- toolC_formatted = format(p.toolC, '.4f')
+ toolC_formatted = '%.*f' % (p.decimals, p.toolC)
if str(p['options']['type']) == 'Excellon':
for i in p['options']['Tools_in_use']:
diff --git a/postprocessors/grbl_11.py b/postprocessors/grbl_11.py
index efa44c90..db486094 100644
--- a/postprocessors/grbl_11.py
+++ b/postprocessors/grbl_11.py
@@ -43,7 +43,8 @@ class grbl_11(FlatCAMPostProc):
gcode += '(Z_Move: ' + str(p['z_move']) + units + ')\n'
gcode += '(Z Toolchange: ' + str(p['z_toolchange']) + units + ')\n'
if coords_xy is not None:
- gcode += '(X,Y Toolchange: ' + "%.4f, %.4f" % (coords_xy[0], coords_xy[1]) + units + ')\n'
+ gcode += '(X,Y Toolchange: ' + "%.*f, %.*f" % (p.decimals, coords_xy[0],
+ p.decimals, coords_xy[1]) + units + ')\n'
else:
gcode += '(X,Y Toolchange: ' + "None" + units + ')\n'
gcode += '(Z Start: ' + str(p['startz']) + units + ')\n'
@@ -94,10 +95,7 @@ class grbl_11(FlatCAMPostProc):
if int(p.tool) == 1 and p.startz is not None:
z_toolchange = p.startz
- if p.units.upper() == 'MM':
- toolC_formatted = format(p.toolC, '.2f')
- else:
- toolC_formatted = format(p.toolC, '.4f')
+ toolC_formatted = '%.*f' % (p.decimals, p.toolC)
if str(p['options']['type']) == 'Excellon':
for i in p['options']['Tools_in_use']:
diff --git a/postprocessors/line_xyz.py b/postprocessors/line_xyz.py
index 52f49179..06dd77ca 100644
--- a/postprocessors/line_xyz.py
+++ b/postprocessors/line_xyz.py
@@ -43,7 +43,8 @@ class line_xyz(FlatCAMPostProc):
gcode += '(Z_Move: ' + str(p['z_move']) + units + ')\n'
gcode += '(Z Toolchange: ' + str(p['z_toolchange']) + units + ')\n'
if coords_xy is not None:
- gcode += '(X,Y Toolchange: ' + "%.4f, %.4f" % (coords_xy[0], coords_xy[1]) + units + ')\n'
+ gcode += '(X,Y Toolchange: ' + "%.*f, %.*f" % (p.decimals, coords_xy[0],
+ p.decimals, coords_xy[1]) + units + ')\n'
else:
gcode += '(X,Y Toolchange: ' + "None" + units + ')\n'
gcode += '(Z Start: ' + str(p['startz']) + units + ')\n'
@@ -109,10 +110,7 @@ class line_xyz(FlatCAMPostProc):
if int(p.tool) == 1 and p.startz is not None:
z_toolchange = p.startz
- if p.units.upper() == 'MM':
- toolC_formatted = format(p.toolC, '.2f')
- else:
- toolC_formatted = format(p.toolC, '.4f')
+ toolC_formatted = '%.*f' % (p.decimals, p.toolC)
if str(p['options']['type']) == 'Excellon':
for i in p['options']['Tools_in_use']:
diff --git a/postprocessors/marlin.py b/postprocessors/marlin.py
index 61ab6008..08345b2b 100644
--- a/postprocessors/marlin.py
+++ b/postprocessors/marlin.py
@@ -45,7 +45,8 @@ class marlin(FlatCAMPostProc):
gcode += ';Z Toolchange: ' + str(p['z_toolchange']) + units + '\n'
if coords_xy is not None:
- gcode += ';X,Y Toolchange: ' + "%.4f, %.4f" % (coords_xy[0], coords_xy[1]) + units + '\n'
+ gcode += ';X,Y Toolchange: ' + "%.*f, %.*f" % (p.decimals, coords_xy[0],
+ p.decimals, coords_xy[1]) + units + '\n'
else:
gcode += ';X,Y Toolchange: ' + "None" + units + '\n'
@@ -95,10 +96,7 @@ class marlin(FlatCAMPostProc):
if int(p.tool) == 1 and p.startz is not None:
z_toolchange = p.startz
- if p.units.upper() == 'MM':
- toolC_formatted = format(p.toolC, '.2f')
- else:
- toolC_formatted = format(p.toolC, '.4f')
+ toolC_formatted = '%.*f' % (p.decimals, p.toolC)
if str(p['options']['type']) == 'Excellon':
for i in p['options']['Tools_in_use']:
diff --git a/tclCommands/TclCommandCopperClear.py b/tclCommands/TclCommandCopperClear.py
index efa38d13..1cb2ccc3 100644
--- a/tclCommands/TclCommandCopperClear.py
+++ b/tclCommands/TclCommandCopperClear.py
@@ -89,6 +89,17 @@ class TclCommandCopperClear(TclCommand):
name = args['name']
+ # Get source object.
+ try:
+ obj = self.app.collection.get_by_name(str(name))
+ except Exception as e:
+ log.debug("TclCommandCopperClear.execute() --> %s" % str(e))
+ self.raise_tcl_error("%s: %s" % (_("Could not retrieve object"), name))
+ return "Could not retrieve object: %s" % name
+
+ if obj is None:
+ return "Object not found: %s" % name
+
if 'tooldia' in args:
tooldia = str(args['tooldia'])
else:
@@ -181,7 +192,7 @@ class TclCommandCopperClear(TclCommand):
tooluid += 1
ncc_tools.update({
int(tooluid): {
- 'tooldia': float('%.4f' % tool),
+ 'tooldia': float('%.*f' % (obj.decimals, tool)),
'offset': 'Path',
'offset_value': 0.0,
'type': 'Iso',
@@ -204,17 +215,6 @@ class TclCommandCopperClear(TclCommand):
else:
outname = name + "_ncc_rm"
- # Get source object.
- try:
- obj = self.app.collection.get_by_name(str(name))
- except Exception as e:
- log.debug("TclCommandCopperClear.execute() --> %s" % str(e))
- self.raise_tcl_error("%s: %s" % (_("Could not retrieve object"), name))
- return "Could not retrieve object: %s" % name
-
- if obj is None:
- return "Object not found: %s" % name
-
# Non-Copper clear all polygons in the non-copper clear object
if 'all' in args and args['all'] == 1:
self.app.ncclear_tool.clear_copper(ncc_obj=obj,
diff --git a/tclCommands/TclCommandDrillcncjob.py b/tclCommands/TclCommandDrillcncjob.py
index 92324cb2..f7719439 100644
--- a/tclCommands/TclCommandDrillcncjob.py
+++ b/tclCommands/TclCommandDrillcncjob.py
@@ -89,6 +89,13 @@ class TclCommandDrillcncjob(TclCommandSignaled):
name = args['name']
+ obj = self.app.collection.get_by_name(name)
+ if obj is None:
+ if muted == 0:
+ self.raise_tcl_error("Object not found: %s" % name)
+ else:
+ return "fail"
+
if 'outname' not in args:
args['outname'] = name + "_cnc"
@@ -97,13 +104,6 @@ class TclCommandDrillcncjob(TclCommandSignaled):
else:
muted = 0
- obj = self.app.collection.get_by_name(name)
- if obj is None:
- if muted == 0:
- self.raise_tcl_error("Object not found: %s" % name)
- else:
- return "fail"
-
if not isinstance(obj, FlatCAMExcellon):
if muted == 0:
self.raise_tcl_error('Expected FlatCAMExcellon, got %s %s.' % (name, type(obj)))
@@ -127,10 +127,8 @@ class TclCommandDrillcncjob(TclCommandSignaled):
req_tools = set()
for tool in obj.tools:
for req_dia in diameters:
- obj_dia_form = float('%.2f' % float(obj.tools[tool]["C"])) if units == 'MM' else \
- float('%.4f' % float(obj.tools[tool]["C"]))
- req_dia_form = float('%.2f' % float(req_dia)) if units == 'MM' else \
- float('%.4f' % float(req_dia))
+ obj_dia_form = float('%.*f' % (obj.decimals, float(obj.tools[tool]["C"])))
+ req_dia_form = float('%.*f' % (obj.decimals, float(req_dia)))
if 'diatol' in args:
tolerance = args['diatol'] / 100
diff --git a/tclCommands/TclCommandMillDrills.py b/tclCommands/TclCommandMillDrills.py
index 8c336462..625ac2db 100644
--- a/tclCommands/TclCommandMillDrills.py
+++ b/tclCommands/TclCommandMillDrills.py
@@ -70,15 +70,15 @@ class TclCommandMillDrills(TclCommandSignaled):
name = args['name']
- if 'outname' not in args:
- args['outname'] = name + "_mill_drills"
-
try:
obj = self.app.collection.get_by_name(str(name))
except Exception as e:
obj = None
self.raise_tcl_error("Could not retrieve object: %s" % name)
+ if 'outname' not in args:
+ args['outname'] = name + "_mill_drills"
+
if not obj.drills:
self.raise_tcl_error("The Excellon object has no drills: %s" % name)
@@ -92,10 +92,8 @@ class TclCommandMillDrills(TclCommandSignaled):
req_tools = set()
for tool in obj.tools:
for req_dia in diameters:
- obj_dia_form = float('%.2f' % float(obj.tools[tool]["C"])) if units == 'MM' else \
- float('%.4f' % float(obj.tools[tool]["C"]))
- req_dia_form = float('%.2f' % float(req_dia)) if units == 'MM' else \
- float('%.4f' % float(req_dia))
+ obj_dia_form = float('%.*f' % (obj.decimals, float(obj.tools[tool]["C"])))
+ req_dia_form = float('%.*f' % (obj.decimals, float(req_dia)))
if 'diatol' in args:
tolerance = args['diatol'] / 100
diff --git a/tclCommands/TclCommandMillSlots.py b/tclCommands/TclCommandMillSlots.py
index a44eb5b0..0ca129a7 100644
--- a/tclCommands/TclCommandMillSlots.py
+++ b/tclCommands/TclCommandMillSlots.py
@@ -70,15 +70,15 @@ class TclCommandMillSlots(TclCommandSignaled):
name = args['name']
- if 'outname' not in args:
- args['outname'] = name + "_mill_slots"
-
try:
obj = self.app.collection.get_by_name(str(name))
except Exception:
obj = None
self.raise_tcl_error("Could not retrieve object: %s" % name)
+ if 'outname' not in args:
+ args['outname'] = name + "_mill_slots"
+
if not obj.slots:
self.raise_tcl_error("The Excellon object has no slots: %s" % name)
@@ -91,10 +91,8 @@ class TclCommandMillSlots(TclCommandSignaled):
req_tools = set()
for tool in obj.tools:
for req_dia in diameters:
- obj_dia_form = float('%.2f' % float(obj.tools[tool]["C"])) if units == 'MM' else \
- float('%.4f' % float(obj.tools[tool]["C"]))
- req_dia_form = float('%.2f' % float(req_dia)) if units == 'MM' else \
- float('%.4f' % float(req_dia))
+ obj_dia_form = float('%.*f' % (obj.decimals, float(obj.tools[tool]["C"])))
+ req_dia_form = float('%.*f' % (obj.decimals, float(req_dia)))
if 'diatol' in args:
tolerance = args['diatol'] / 100
diff --git a/tclCommands/TclCommandPaint.py b/tclCommands/TclCommandPaint.py
index 5d55a6f9..14088dcc 100644
--- a/tclCommands/TclCommandPaint.py
+++ b/tclCommands/TclCommandPaint.py
@@ -89,6 +89,14 @@ class TclCommandPaint(TclCommand):
name = args['name']
+ # Get source object.
+ try:
+ obj = self.app.collection.get_by_name(str(name))
+ except Exception as e:
+ log.debug("TclCommandPaint.execute() --> %s" % str(e))
+ self.raise_tcl_error("%s: %s" % (_("Could not retrieve object"), name))
+ return "Could not retrieve object: %s" % name
+
if 'tooldia' in args:
tooldia = str(args['tooldia'])
else:
@@ -129,14 +137,6 @@ class TclCommandPaint(TclCommand):
else:
outname = name + "_paint"
- # Get source object.
- try:
- obj = self.app.collection.get_by_name(str(name))
- except Exception as e:
- log.debug("TclCommandPaint.execute() --> %s" % str(e))
- self.raise_tcl_error("%s: %s" % (_("Could not retrieve object"), name))
- return "Could not retrieve object: %s" % name
-
try:
tools = [float(eval(dia)) for dia in tooldia.split(",") if dia != '']
except AttributeError:
@@ -181,7 +181,7 @@ class TclCommandPaint(TclCommand):
tooluid += 1
paint_tools.update({
int(tooluid): {
- 'tooldia': float('%.4f' % tool),
+ 'tooldia': float('%.*f' % (obj.decimals, tool)),
'offset': 'Path',
'offset_value': 0.0,
'type': 'Iso',