Selaa lähdekoodia

- Cutout Tool - fixed mouse bites feature in case of using a Geometry object and Freeform cutout
- Cutout Tool - can do cutouts on multigeo Geometry objects: it will automatically select the geometry of first tool
- Geometry Editor - fixed exception raised when trying to move and there is no shape to move

Marius Stanciu 5 vuotta sitten
vanhempi
commit
26ac02e484
3 muutettua tiedostoa jossa 20 lisäystä ja 3 poistoa
  1. 3 0
      CHANGELOG.md
  2. 5 1
      appEditors/AppGeoEditor.py
  3. 12 2
      appTools/ToolCutOut.py

+ 3 - 0
CHANGELOG.md

@@ -16,6 +16,9 @@ CHANGELOG for FlatCAM beta
 - Cutout Tool - rectangular and freeform cutouts are done in a threaded way
 - Cutout Tool - added the Mouse Bites feature for the Rectangular and Freeform cutouts and right now it fails in case of using a Geometry object and Freeform cutout (weird result)
 - some changes in camlib due of warnigns for future changes in Shapely 2.0
+- Cutout Tool - fixed mouse bites feature in case of using a Geometry object and Freeform cutout
+- Cutout Tool - can do cutouts on multigeo Geometry objects: it will automatically select the geometry of first tool
+- Geometry Editor - fixed exception raised when trying to move and there is no shape to move
 
 28.08.2020
 

+ 5 - 1
appEditors/AppGeoEditor.py

@@ -4378,8 +4378,12 @@ class AppGeoEditor(QtCore.QObject):
         self.on_tool_select('move')
 
     def on_move_click(self):
+        try:
+            x, y = self.snap(self.x, self.y)
+        except TypeError:
+            return
         self.on_move()
-        self.active_tool.set_origin(self.snap(self.x, self.y))
+        self.active_tool.set_origin((x, y))
 
     def on_copy_click(self):
         if not self.selected:

+ 12 - 2
appTools/ToolCutOut.py

@@ -732,7 +732,11 @@ class CutOut(AppTool):
                             geo_buf = object_geo.buffer(margin - abs(dia / 2))
                         geo = geo_buf.exterior
                     else:
-                        geo = object_geo
+                        if isinstance(object_geo, MultiPolygon):
+                            x0, y0, x1, y1 = object_geo.bounds
+                            object_geo = box(x0, y0, x1, y1)
+                        geo_buf = object_geo.buffer(0)
+                        geo = geo_buf.exterior
 
                     solid_geo, rest_geo = cutout_handler(geom=geo, gapsize=gapsize)
                     if gap_type == 'bt' and thin_entry != 0:
@@ -779,7 +783,11 @@ class CutOut(AppTool):
                                 geo_buf = mb_object_geo.buffer(margin - mb_buff_val)
                             mb_geo = geo_buf.exterior
                         else:
-                            mb_geo = mb_object_geo
+                            if isinstance(mb_object_geo, MultiPolygon):
+                                x0, y0, x1, y1 = mb_object_geo.bounds
+                                mb_object_geo = box(x0, y0, x1, y1)
+                            geo_buf = mb_object_geo.buffer(0)
+                            mb_geo = geo_buf.exterior
 
                         __, rest_geo = cutout_handler(geom=mb_geo, gapsize=gapsize)
                         mouse_bites_geo = rest_geo
@@ -1122,6 +1130,8 @@ class CutOut(AppTool):
                                 mb_geo = mb_geo.buffer(margin + mb_buff_val)
                             else:
                                 mb_geo = mb_geo.buffer(margin - mb_buff_val)
+                        else:
+                            mb_geo = mb_geo.buffer(0)
 
                         mb_solid_geo = cutout_rect_handler(mb_geo, gapsize, xmin, ymin, xmax, ymax)