From cccc5634c93df7f3030a8c29be992c11e080e8f0 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Sat, 7 Nov 2020 14:37:49 +0200 Subject: [PATCH] - fixed an if/else selection in the AppObject.on_object_created() that made the plotting of CNCJob objects to be done twice and second time will disregard the Plot Kind Preference value --- CHANGELOG.md | 1 + appObjects/AppObject.py | 2 +- appObjects/FlatCAMCNCJob.py | 4 ++-- app_Main.py | 2 +- camlib.py | 6 +++--- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 952f50c5..efbc89d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ CHANGELOG for FlatCAM beta - fixed some issues with not finding the methods when treating the startup arguments - set the app to "Unstable" status +- fixed an if/else selection in the AppObject.on_object_created() that made the plotting of CNCJob objects to be done twice and second time will disregard the Plot Kind Preference value 7.11.2020 diff --git a/appObjects/AppObject.py b/appObjects/AppObject.py index 994c2d3a..fcf9bcff 100644 --- a/appObjects/AppObject.py +++ b/appObjects/AppObject.py @@ -452,7 +452,7 @@ class AppObject(QtCore.QObject): with self.app.proc_container.new('%s ...' % _("Plotting")): if t_obj.kind == 'cncjob': t_obj.plot(kind=self.app.defaults["cncjob_plot_kind"]) - if t_obj.kind == 'gerber': + elif t_obj.kind == 'gerber': t_obj.plot(color=t_obj.outline_color, face_color=t_obj.fill_color) else: t_obj.plot() diff --git a/appObjects/FlatCAMCNCJob.py b/appObjects/FlatCAMCNCJob.py index 1241ad45..24221520 100644 --- a/appObjects/FlatCAMCNCJob.py +++ b/appObjects/FlatCAMCNCJob.py @@ -2489,7 +2489,7 @@ class CNCJobObject(FlatCAMObj, CNCjob): if self.origin_kind == "excellon": if self.exc_cnc_tools: for tooldia_key in self.exc_cnc_tools: - tooldia = float('%.*f' % (self.decimals, float(tooldia_key))) + tooldia = self.app.dec_format(float(tooldia_key), self.decimals) gcode_parsed = self.exc_cnc_tools[tooldia_key]['gcode_parsed'] if not gcode_parsed: continue @@ -2499,7 +2499,7 @@ class CNCJobObject(FlatCAMObj, CNCjob): # multiple tools usage if self.cnc_tools: for tooluid_key in self.cnc_tools: - tooldia = float('%.*f' % (self.decimals, float(self.cnc_tools[tooluid_key]['tooldia']))) + tooldia = self.app.dec_format(float(self.cnc_tools[tooluid_key]['tooldia']), self.decimals) gcode_parsed = self.cnc_tools[tooluid_key]['gcode_parsed'] self.plot2(tooldia=tooldia, obj=self, visible=visible, gcode_parsed=gcode_parsed, kind=kind) diff --git a/app_Main.py b/app_Main.py index 80c2ba14..dcc6dd7e 100644 --- a/app_Main.py +++ b/app_Main.py @@ -8197,7 +8197,7 @@ class App(QtCore.QObject): """ dec_nr = dec if dec is not None else self.decimals - return float('%.*f' % (dec_nr, val)) + return float('%.*f' % (dec_nr, float(val))) class ArgsThread(QtCore.QObject): diff --git a/camlib.py b/camlib.py index 7c2b0204..adf44c18 100644 --- a/camlib.py +++ b/camlib.py @@ -6795,8 +6795,7 @@ class CNCjob(Geometry): try: # if the geos are travel lines if geo['kind'][0] == 'T': - poly = geo['geom'].buffer(distance=(tooldia / 1.99999999), - resolution=self.steps_per_circle) + poly = geo['geom'].buffer((tooldia / 1.99999999), self.steps_per_circle) else: poly = Polygon(geo['geom']) @@ -6806,9 +6805,10 @@ class CNCjob(Geometry): continue else: # plot the geometry of any objects other than Excellon - poly = geo['geom'].buffer(distance=(tooldia / 1.99999999), resolution=self.steps_per_circle) + poly = geo['geom'].buffer((tooldia / 1.99999999), self.steps_per_circle) poly = poly.simplify(tool_tolerance) + # Plotting the shapes if kind == 'all': obj.add_shape(shape=poly, color=color[geo['kind'][0]][1], face_color=color[geo['kind'][0]][0], visible=visible, layer=1 if geo['kind'][0] == 'C' else 2)