]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
[bos #38044][EDF] (2023-T3) Support for automatic reparation. Added checking params...
authorKonstantin Leontev <Konstantin.LEONTEV@opencascade.com>
Wed, 27 Mar 2024 18:01:13 +0000 (18:01 +0000)
committerKonstantin Leontev <Konstantin.LEONTEV@opencascade.com>
Fri, 14 Jun 2024 17:03:06 +0000 (18:03 +0100)
src/RepairGUIAdv/locate_subshapes.py

index 9aeacc6b45f3f0b2466107dc0b66b3ea70e4c84a..2102997208f07e7c9f3bf0ae9f63fe486d6b20a4 100644 (file)
@@ -195,9 +195,9 @@ class LocateSubShapesDlg(BaseDlg):
 
         # Update counters
         geompy = geomBuilder.New()
-        all_ids = geompy.SubShapeAllIDs(self._selected_object, self.get_selection_level())
+        total = geompy.NumberOfSubShapes(self._selected_object, self.get_selection_level())
         selected_ids = self.get_local_selection()
-        self.set_subshapes_counters(len(selected_ids), len(all_ids))
+        self.set_subshapes_counters(len(selected_ids), total)
 
         # Update label
         self.update_subshapes_label()
@@ -240,42 +240,29 @@ class LocateSubShapesDlg(BaseDlg):
         # Get all sub-shapes
         geompy = geomBuilder.New()
         selection_level = self.get_selection_level()
-        subshapes_ids = geompy.SubShapeAllIDs(self._selected_object, selection_level)
+        subshapes = geompy.SubShapeAll(self._selected_object, selection_level)
 
         # Iterate over ids to check if it fits to limits
-        # TODO: implement selections
+        param_ids = { GEOM.EDGE : 0, GEOM.FACE : 1, GEOM.SOLID : 2 }
+        param_index = param_ids[selection_level]
+
         limits = self.get_limits()
-        for id in subshapes_ids:
-            # Get a sub-shape by id
-            pass
-
-            # Get related parameter to check it later
-            param = None
-            if selection_level == GEOM.EDGE:
-                # Get a lenght of an edge
-                pass
-            elif selection_level == GEOM.FACE:
-                # Get an area of a face
-                pass
-            elif selection_level == GEOM.SOLID:
-                # Get a volume of a solid
-                pass
-            else:
-                # We shouldn't fall here
-                QMessageBox.warning(
-                    None, 'Warning', 'Wrong selection level: %s!' % (selection_level))
-                return
+        for shape in subshapes:
+            # Get properties as a list [theLength, theSurfArea, theVolume]
+            properties = geompy.BasicProperties(shape)
+            param = properties[param_index]
 
             # Check if it fits to the limits
             if param >= limits[0] and param <= limits[1]:
+                # TODO: implement selections with GEOM_Swig_LocalSelector or something...
                 # Select sub-shape
                 pass
             else:
                 # Deselect sub-shape
                 pass
 
-            # Update displayed info
-            self.update_subshapes_info()
+        # Update displayed info
+        self.update_subshapes_info()
 
 
     def on_limit_changed(self):