diff --git a/CHANGELOG.md b/CHANGELOG.md index 5fec8490..95972e31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ CHANGELOG for FlatCAM beta - added the toggle button for Beginner/Advanced mode for the CNCjob, Geometry, Gerber, Excellon Objects UI (Properties Tab) - some changes in PreferencesManager due of Milling Tool changing names of the geometry defaults to tools_mill_ defaults +- for Excellon, Geometry and Gerber objects now in the Object UI (Properties Tab) by default the Offset field is populated with the coordinates of the center of the current object 6.01.2021 diff --git a/appGUI/ObjectUI.py b/appGUI/ObjectUI.py index 512a1953..db7814c4 100644 --- a/appGUI/ObjectUI.py +++ b/appGUI/ObjectUI.py @@ -127,7 +127,6 @@ class ObjectUI(QtWidgets.QWidget): # ### Offset #### self.offsetvector_entry = NumericalEvalTupleEntry(border_color='#0069A9') - self.offsetvector_entry.setText("(0.0, 0.0)") self.offsetvector_entry.setToolTip( _("Amount by which to move the object\n" "in the x and y axes in (x, y) format.\n" diff --git a/appObjects/FlatCAMExcellon.py b/appObjects/FlatCAMExcellon.py index 68071877..0d1dae86 100644 --- a/appObjects/FlatCAMExcellon.py +++ b/appObjects/FlatCAMExcellon.py @@ -187,6 +187,13 @@ class ExcellonObject(FlatCAMObj, Excellon): self.units_found = self.app.defaults['units'] + xmin, ymin, xmax, ymax = self.bounds() + center_coords = ( + xmin + abs((xmax - xmin) / 2), + ymin + abs((ymax - ymin) / 2) + ) + self.ui.offsetvector_entry.set_value(str(center_coords)) + def change_level(self, level): """ diff --git a/appObjects/FlatCAMGeometry.py b/appObjects/FlatCAMGeometry.py index 0a092b60..bf51c959 100644 --- a/appObjects/FlatCAMGeometry.py +++ b/appObjects/FlatCAMGeometry.py @@ -701,6 +701,13 @@ class GeometryObject(FlatCAMObj, Geometry): # # self.launch_job.connect(self.mtool_gen_cncjob) + xmin, ymin, xmax, ymax = self.bounds() + center_coords = ( + xmin + abs((xmax - xmin) / 2), + ymin + abs((ymax - ymin) / 2) + ) + self.ui.offsetvector_entry.set_value(str(center_coords)) + # Show/Hide Advanced Options app_mode = self.app.defaults["global_app_level"] self.change_level(app_mode) diff --git a/appObjects/FlatCAMGerber.py b/appObjects/FlatCAMGerber.py index dbb341ff..dffdfc63 100644 --- a/appObjects/FlatCAMGerber.py +++ b/appObjects/FlatCAMGerber.py @@ -195,6 +195,13 @@ class GerberObject(FlatCAMObj, Gerber): self.build_ui() self.units_found = self.app.defaults['units'] + xmin, ymin, xmax, ymax = self.bounds() + center_coords = ( + xmin + abs((xmax - xmin) / 2), + ymin + abs((ymax - ymin) / 2) + ) + self.ui.offsetvector_entry.set_value(str(center_coords)) + def change_level(self, level): """