From 716dddb851e8a338717246fdfc0aa9c5a52d3395 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Wed, 13 Apr 2022 20:12:54 +0300 Subject: [PATCH] - in Geometry Editor made sure that the MultiPolygon shapes (like those made by the Text Tool) will update the coordinates in the UI --- CHANGELOG.md | 1 + appEditors/AppGeoEditor.py | 15 ++++++++++++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6820a647..a9102bff 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ CHANGELOG for FlatCAM Evo beta - in Geometry Editor - update (some reformatting and adding shape data) - in Geometry Editor - fixed the Explode tool to work on the result of adding Text geometry - all the Geometry Editor plugins are moved inside another folder and the UI's are moved into their own class +- in Geometry Editor made sure that the MultiPolygon shapes (like those made by the Text Tool) will update the coordinates in the UI 7.04.2022 diff --git a/appEditors/AppGeoEditor.py b/appEditors/AppGeoEditor.py index 95b7894d..756ee483 100644 --- a/appEditors/AppGeoEditor.py +++ b/appEditors/AppGeoEditor.py @@ -2376,12 +2376,25 @@ class AppGeoEditor(QtCore.QObject): coords = '' vertex_nr = 0 - for idx, line in enumerate(last_sel_geo): + for idx, line in enumerate(last_sel_geo.geoms): line_coords = list(line.coords) vertex_nr += len(line_coords) coords += 'Line %s\n' % str(idx) coords += str(line_coords) + '\n' + elif last_sel_geo.geom_type == 'MultiPolygon': + length = 0.0 + self.is_simple_entry.set_value('None') + self.is_ring_entry.set_value('None') + self.is_ccw_entry.set_value('None') + coords = '' + vertex_nr = 0 + for idx, poly in enumerate(last_sel_geo.geoms): + poly_coords = list(poly.exterior.coords) + [list(i.coords) for i in poly.interiors] + vertex_nr += len(poly_coords) + + coords += 'Polygon %s\n' % str(idx) + coords += str(poly_coords) + '\n' elif last_sel_geo.geom_type in ['LinearRing', 'LineString']: length = last_sel_geo.length coords = list(last_sel_geo.coords)