From e091fd232d53df60206709b28af49fce27897623 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Thu, 14 Feb 2019 00:09:48 +0200 Subject: [PATCH] - added (and commented) an experimental FlatCAMObj.FlatCAMGerber.plot_apertures() --- FlatCAMObj.py | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 3 ++- 2 files changed, 68 insertions(+), 1 deletion(-) diff --git a/FlatCAMObj.py b/FlatCAMObj.py index 4270da10..bfb2d5b5 100644 --- a/FlatCAMObj.py +++ b/FlatCAMObj.py @@ -946,6 +946,72 @@ class FlatCAMGerber(FlatCAMObj, Gerber): except (ObjectDeleted, AttributeError): self.shapes.clear(update=True) + # experimental plot() when the solid_geometry is stored in the self.apertures + # def plot_apertures(self, **kwargs): + # """ + # + # :param kwargs: color and face_color + # :return: + # """ + # + # FlatCAMApp.App.log.debug(str(inspect.stack()[1][3]) + " --> FlatCAMGerber.plot()") + # + # # Does all the required setup and returns False + # # if the 'ptint' option is set to False. + # if not FlatCAMObj.plot(self): + # return + # + # if 'color' in kwargs: + # color = kwargs['color'] + # else: + # color = self.app.defaults['global_plot_line'] + # if 'face_color' in kwargs: + # face_color = kwargs['face_color'] + # else: + # face_color = self.app.defaults['global_plot_fill'] + # + # geometry = {} + # for ap in self.apertures: + # geometry[ap] = self.apertures[ap]['solid_geometry'] + # try: + # _ = iter(geometry[ap]) + # except TypeError: + # geometry[ap] = [geometry[ap]] + # + # def random_color(): + # color = np.random.rand(4) + # color[3] = 1 + # return color + # + # try: + # if self.options["solid"]: + # for geo in geometry: + # for g in geometry[geo]: + # if type(g) == Polygon or type(g) == LineString: + # self.add_shape(shape=g, color=color, + # face_color=random_color() if self.options['multicolored'] + # else face_color, visible=self.options['plot']) + # else: + # for el in g: + # self.add_shape(shape=el, color=color, + # face_color=random_color() if self.options['multicolored'] + # else face_color, visible=self.options['plot']) + # else: + # for geo in geometry: + # for g in geometry[geo]: + # if type(g) == Polygon or type(g) == LineString: + # self.add_shape(shape=g, + # color=random_color() if self.options['multicolored'] else 'black', + # visible=self.options['plot']) + # else: + # for el in g: + # self.add_shape(shape=el, + # color=random_color() if self.options['multicolored'] else 'black', + # visible=self.options['plot']) + # self.shapes.redraw() + # except (ObjectDeleted, AttributeError): + # self.shapes.clear(update=True) + def serialize(self): return { "options": self.options, diff --git a/README.md b/README.md index e57ed2e0..9d8d3adc 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,9 @@ CAD program, and create G-Code for Isolation routing. - changed the layout in the Selected Tab UI - started to add apertures table support - finished Gerber aperture table display -- made the Gerber aperture table not visibile as default and added a checkbox that can toggle the visibility +- made the Gerber aperture table not visible as default and added a checkbox that can toggle the visibility - fixed issue with plotting in CNCJob; with Plot kind set to something else than 'all' when toggling Plot, it was defaulting to kind = 'all' +- added (and commented) an experimental FlatCAMObj.FlatCAMGerber.plot_apertures() 12.02.2019