Selaa lähdekoodia

- in CNCJob UI Autolevelling: solved some small errors: when manual adding probe points dragging the mouse with left button pressed created selection rectangles; detection of click inside the solid geometry was failing
- in CNCJob UI Autolevelling: in manual adding of probe points make sure you always add a first probe point in origin

Marius Stanciu 5 vuotta sitten
vanhempi
commit
ab414ce348
2 muutettua tiedostoa jossa 42 lisäystä ja 5 poistoa
  1. 6 1
      CHANGELOG.md
  2. 36 4
      appObjects/FlatCAMCNCJob.py

+ 6 - 1
CHANGELOG.md

@@ -7,6 +7,11 @@ CHANGELOG for FlatCAM beta
 
 =================================================
 
+2.09.2020
+
+- in CNCJob UI Autolevelling: solved some small errors: when manual adding probe points dragging the mouse with left button pressed created selection rectangles; detection of click inside the solid geometry was failing
+- in CNCJob UI Autolevelling: in manual adding of probe points make sure you always add a first probe point in origin
+
 31.08.2020
 
 - updated the Italian translation files by Massimiliano Golfetto
@@ -23,7 +28,7 @@ CHANGELOG for FlatCAM beta
 - updated the translation files to the current state of the app
 - 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
+- some changes in camlib due of warnings 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

+ 36 - 4
appObjects/FlatCAMCNCJob.py

@@ -738,6 +738,7 @@ class CNCJobObject(FlatCAMObj, CNCjob):
 
         else:
             self.app.inform.emit(_("Click on canvas to add a Probe Point..."))
+            self.app.defaults['global_selection_shape'] = False
 
             if self.app.is_legacy is False:
                 self.app.plotcanvas.graph_event_disconnect('key_press', self.app.ui.keyPressEvent)
@@ -902,12 +903,43 @@ class CNCJobObject(FlatCAMObj, CNCjob):
 
             probe_pt = Point(snapped_pos)
 
-            xmin, xmax, ymin, ymax = self.solid_geo.bounds
-            if not probe_pt.within(box(xmin, ymin, xmax, ymax)):
-                self.app.inform.emit(
-                    _("Point is not within the object area. Choose another point."))
+            xxmin, yymin, xxmax, yymax = self.solid_geo.bounds
+            box_geo = box(xxmin, yymin, xxmax, yymax)
+            if not probe_pt.within(box_geo):
+                self.app.inform.emit(_("Point is not within the object area. Choose another point."))
                 return
 
+            found = False
+            # add the first point in the origin, only once (if not added yet.
+            for k in self.al_geometry_dict:
+                if self.al_geometry_dict[k]['point'] == Point([xxmin, yymin]):
+                    found = True
+                    break
+
+            if found is False:
+                f_probe_pt = Point([xxmin, yymin])
+                if not self.al_geometry_dict:
+                    new_dict = {
+                        'point': f_probe_pt,
+                        'geo': None,
+                        'height': 0.0
+                    }
+                    self.al_geometry_dict[1] = deepcopy(new_dict)
+                else:
+                    int_keys = [int(k) for k in self.al_geometry_dict.keys()]
+                    new_id = max(int_keys) + 1
+                    new_dict = {
+                        'point': f_probe_pt,
+                        'geo': None,
+                        'height': 0.0
+                    }
+                    self.al_geometry_dict[new_id] = deepcopy(new_dict)
+
+                radius = 0.3 if self.units == 'MM' else 0.012
+                fprobe_pt_buff = f_probe_pt.buffer(radius)
+
+                self.plot_voronoi(geometry=fprobe_pt_buff, visibility=True, custom_color="#0000FFFA")
+
             if not self.al_geometry_dict:
                 new_dict = {
                     'point': probe_pt,