diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5cc09ab5..1a24d282 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -20,7 +20,7 @@ CHANGELOG for FlatCAM beta
- in Geometry Editor - added a context menu in the Geometry Table
- fixed crash when launching with 2D Graphic Engine (due of recent changes)
- in Geometry Editor - added new feature: Zoom on selected (by selecting a geometry element in the Geometry Table)
-
+- in Geometry Object Properties UI - added the UI for Utilities and within Utilities added the Simplification UI
26.11.2020
diff --git a/appEditors/AppGeoEditor.py b/appEditors/AppGeoEditor.py
index f79fd997..a78a7251 100644
--- a/appEditors/AppGeoEditor.py
+++ b/appEditors/AppGeoEditor.py
@@ -3490,13 +3490,14 @@ class AppGeoEditor(QtCore.QObject):
separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
grid0.addWidget(separator_line, 28, 0, 1, 3)
- # Simplification
+ # Simplification Title
simplif_lbl = FCLabel('%s:' % _("Simplification"))
simplif_lbl.setToolTip(
- _("Simplify a geometry element by reducing its vertex points number.")
+ _("Simplify a geometry by reducing its vertex points number.")
)
grid0.addWidget(simplif_lbl, 30, 0, 1, 3)
+ # Simplification Tolerance
simplification_tol_lbl = FCLabel('%s:' % _("Tolerance"))
simplification_tol_lbl.setToolTip(
_("All points in the simplified object will be\n"
@@ -3511,6 +3512,7 @@ class AppGeoEditor(QtCore.QObject):
grid0.addWidget(simplification_tol_lbl, 32, 0)
grid0.addWidget(self.geo_tol_entry, 32, 1, 1, 2)
+ # Simplification button
self.simplification_btn = FCButton(_("Simplify"))
self.simplification_btn.setIcon(QtGui.QIcon(self.app.resource_location + '/simplify32.png'))
self.simplification_btn.setToolTip(
diff --git a/appGUI/ObjectUI.py b/appGUI/ObjectUI.py
index a081ec4b..4b6ba2bf 100644
--- a/appGUI/ObjectUI.py
+++ b/appGUI/ObjectUI.py
@@ -1791,9 +1791,9 @@ class GeometryObjectUI(ObjectUI):
self.grid4.setColumnStretch(1, 1)
self.geo_tools_box.addLayout(self.grid4)
- # ##############
- # Paint area ##
- # ##############
+ # #############################################################################################################
+ # ############################################ Tools ##########################################################
+ # #############################################################################################################
self.tools_label = FCLabel('%s' % _('TOOLS'))
self.tools_label.setToolTip(
_("Launch Paint Tool in Tools Tab.")
@@ -1822,12 +1822,6 @@ class GeometryObjectUI(ObjectUI):
"whole area of a polygon.")
)
- # self.paint_tool_button.setStyleSheet("""
- # QPushButton
- # {
- # font-weight: bold;
- # }
- # """)
self.grid4.addWidget(self.paint_tool_button, 36, 0, 1, 2)
# NCC Tool
@@ -1845,6 +1839,99 @@ class GeometryObjectUI(ObjectUI):
# """)
self.grid4.addWidget(self.generate_ncc_button, 38, 0, 1, 2)
+ separator_line = QtWidgets.QFrame()
+ separator_line.setFrameShape(QtWidgets.QFrame.HLine)
+ separator_line.setFrameShadow(QtWidgets.QFrame.Sunken)
+ self.grid4.addWidget(separator_line, 40, 0, 1, 2)
+
+ # UTILITIES BUTTON
+ self.util_button = FCButton('%s' % _("UTILTIES"), checkable=True)
+ self.util_button.setIcon(QtGui.QIcon(self.app.resource_location + '/settings18.png'))
+ self.util_button.setToolTip(_("Show the Utilties."))
+ self.util_button.setStyleSheet("""
+ QPushButton
+ {
+ font-weight: bold;
+ }
+ """)
+ self.grid4.addWidget(self.util_button, 42, 0, 1, 2)
+
+ # UTILITIES Frame
+ self.util_frame = QtWidgets.QFrame()
+ self.util_frame.setContentsMargins(0, 0, 0, 0)
+ self.grid4.addWidget(self.util_frame, 44, 0, 1, 2)
+
+ self.util_box = QtWidgets.QVBoxLayout()
+ self.util_box.setContentsMargins(0, 0, 0, 0)
+ self.util_frame.setLayout(self.util_box)
+ self.util_frame.hide()
+
+ util_grid = QtWidgets.QGridLayout()
+ util_grid.setColumnStretch(0, 0)
+ util_grid.setColumnStretch(1, 1)
+ self.util_box.addLayout(util_grid)
+
+ # Simplification Title
+ simplif_lbl = FCLabel('%s:' % _("Simplification"))
+ simplif_lbl.setToolTip(
+ _("Simplify a geometry by reducing its vertex points number.")
+ )
+ util_grid.addWidget(simplif_lbl, 0, 0, 1, 3)
+
+ # Vertex Points
+ vertexes_lbl = FCLabel('%s:' % _("Points"))
+ vertexes_lbl.setToolTip(
+ _("Total of vertex points in the geometry.")
+ )
+ self.vertex_points_entry = FCEntry()
+
+ util_grid.addWidget(vertexes_lbl, 2, 0)
+ util_grid.addWidget(self.vertex_points_entry, 2, 1)
+
+ # Calculate vertexes button
+ self.vertex_points_btn = FCButton(_("Calculate"))
+ # self.vertex_points_btn.setIcon(QtGui.QIcon(self.app.resource_location + '/simplify32.png'))
+ self.vertex_points_btn.setToolTip(
+ _("Calculate the number of vertex points in the geometry.")
+ )
+ # self.vertex_points_btn.setStyleSheet("""
+ # QPushButton
+ # {
+ # font-weight: bold;
+ # }
+ # """)
+
+ util_grid.addWidget(self.vertex_points_btn, 2, 2)
+
+ # Simplification Tolerance
+ simplification_tol_lbl = FCLabel('%s:' % _("Tolerance"))
+ simplification_tol_lbl.setToolTip(
+ _("All points in the simplified object will be\n"
+ "within the tolerance distance of the original geometry.")
+ )
+ self.geo_tol_entry = FCDoubleSpinner()
+ self.geo_tol_entry.set_precision(self.decimals)
+ self.geo_tol_entry.setSingleStep(10 ** -self.decimals)
+ self.geo_tol_entry.set_range(0.0000, 10000.0000)
+
+ util_grid.addWidget(simplification_tol_lbl, 4, 0)
+ util_grid.addWidget(self.geo_tol_entry, 4, 1)
+
+ # Simplification button
+ self.simplification_btn = FCButton(_("Simplify"))
+ # self.simplification_btn.setIcon(QtGui.QIcon(self.app.resource_location + '/simplify32.png'))
+ self.simplification_btn.setToolTip(
+ _("Simplify a geometry element by reducing its vertex points number.")
+ )
+ # self.simplification_btn.setStyleSheet("""
+ # QPushButton
+ # {
+ # font-weight: bold;
+ # }
+ # """)
+
+ util_grid.addWidget(self.simplification_btn, 4, 2)
+
class CNCObjectUI(ObjectUI):
"""
diff --git a/appObjects/FlatCAMGeometry.py b/appObjects/FlatCAMGeometry.py
index edff56f1..638eeef3 100644
--- a/appObjects/FlatCAMGeometry.py
+++ b/appObjects/FlatCAMGeometry.py
@@ -664,6 +664,11 @@ class GeometryObject(FlatCAMObj, Geometry):
self.ui.generate_ncc_button.clicked.connect(lambda: self.app.ncclear_tool.run(toggle=True))
self.ui.milling_button.clicked.connect(self.on_milling_button_clicked)
+ self.ui.util_button.clicked.connect(lambda st: self.ui.util_frame.show() if st else self.ui.util_frame.hide())
+
+ self.ui.vertex_points_entry.set_value(0)
+ self.ui.geo_tol_entry.set_value(10 ** -self.decimals)
+
# # Postprocessor change
# self.ui.pp_geometry_name_cb.activated.connect(self.on_pp_changed)
#