From 3c1349a6c48e42abb7612d1805d53733f72c3e3e Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Thu, 1 Sep 2022 13:08:06 +0300 Subject: [PATCH] - added a new feature for Geometry export-as-SVG, the ability to export only the paths (outlines); the new feature is controlled from a new parameter in Preferences -> Geometry -> Export --- CHANGELOG.md | 4 ++++ appGUI/preferences/PreferencesUIManager.py | 1 + .../preferences/geometry/GeometryExpPrefGroupUI.py | 12 ++++++++++-- camlib.py | 7 ++++--- defaults.py | 1 + 5 files changed, 20 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b8a06fb..4d12c0c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ CHANGELOG for FlatCAM Evo beta ================================================= +1.09.2022 + +- added a new feature for Geometry export-as-SVG, the ability to export only the paths (outlines); the new feature is controlled from a new parameter in Preferences -> Geometry -> Export + 1.08.2022 - fixed some bugs in Geometry Editor in regards of Buffer Tool diff --git a/appGUI/preferences/PreferencesUIManager.py b/appGUI/preferences/PreferencesUIManager.py index a66ec630..a8b3c978 100644 --- a/appGUI/preferences/PreferencesUIManager.py +++ b/appGUI/preferences/PreferencesUIManager.py @@ -267,6 +267,7 @@ class PreferencesUIManager(QtCore.QObject): # Geometry Export "geometry_dxf_format": self.ui.geo_pref_form.geometry_exp_group.dxf_format_combo, + "geometry_paths_only": self.ui.geo_pref_form.geometry_exp_group.svg_paths_only_cb, # Geometry Editor "geometry_editor_sel_limit": self.ui.geo_pref_form.geometry_editor_group.sel_limit_entry, diff --git a/appGUI/preferences/geometry/GeometryExpPrefGroupUI.py b/appGUI/preferences/geometry/GeometryExpPrefGroupUI.py index f14d8ab1..92933bc3 100644 --- a/appGUI/preferences/geometry/GeometryExpPrefGroupUI.py +++ b/appGUI/preferences/geometry/GeometryExpPrefGroupUI.py @@ -1,6 +1,7 @@ + from PyQt6 import QtWidgets, QtCore -from appGUI.GUIElements import FCLabel, FCComboBox, GLay, FCFrame +from appGUI.GUIElements import FCLabel, FCComboBox, GLay, FCFrame, FCCheckBox from appGUI.preferences.OptionsGroupUI import OptionsGroupUI import gettext import appTranslation as fcTranslate @@ -36,7 +37,7 @@ class GeometryExpPrefGroupUI(OptionsGroupUI): export_grid = GLay(v_spacing=5, h_spacing=3) export_frame.setLayout(export_grid) - # Excellon non-decimal format + # DXF format self.dxf_format_label = FCLabel("%s:" % _("Format")) self.dxf_format_label.setToolTip( _("Autodesk DXF Format used when exporting Geometry as DXF.") @@ -48,4 +49,11 @@ class GeometryExpPrefGroupUI(OptionsGroupUI): export_grid.addWidget(self.dxf_format_label, 0, 0) export_grid.addWidget(self.dxf_format_combo, 0, 1) + # SVG format + self.svg_paths_only_cb = FCCheckBox(_("SVG Paths-Only")) + self.svg_paths_only_cb.setToolTip( + _("SVG Format. When checked it will export only paths.") + ) + export_grid.addWidget(self.svg_paths_only_cb, 2, 0, 1, 2) + self.layout.addStretch() diff --git a/camlib.py b/camlib.py index 4416c259..af06ab01 100644 --- a/camlib.py +++ b/camlib.py @@ -2326,12 +2326,13 @@ class Geometry(object): flat_geo = [] if self.multigeo: for tool in self.tools: - flat_geo += self.flatten(self.tools[tool]['solid_geometry']) + flat_geo += self.flatten(self.tools[tool]['solid_geometry'], + pathonly=self.app.options["geometry_paths_only"]) geom_svg = unary_union(flat_geo) else: - geom_svg = unary_union(self.flatten()) + geom_svg = unary_union(self.flatten(pathonly=self.app.options["geometry_paths_only"])) else: - geom_svg = unary_union(self.flatten()) + geom_svg = unary_union(self.flatten(pathonly=self.app.options["geometry_paths_only"])) xmin, ymin, xmax, ymax = geom_svg.bounds diff --git a/defaults.py b/defaults.py index 0db909a0..67c8f401 100644 --- a/defaults.py +++ b/defaults.py @@ -322,6 +322,7 @@ class AppDefaults: # Geometry Export "geometry_dxf_format": 'R2010', + "geometry_paths_only": True, # Geometry Editor "geometry_editor_sel_limit": 30,