From 9401129906de3c451ac793fed0287d5a65b593ab Mon Sep 17 00:00:00 2001 From: Konstantin Leontev Date: Wed, 27 Mar 2024 18:01:13 +0000 Subject: [PATCH] [bos #38044][EDF] (2023-T3) Support for automatic reparation. Added checking params for sub-shapes. --- src/RepairGUIAdv/locate_subshapes.py | 39 ++++++++++------------------ 1 file changed, 13 insertions(+), 26 deletions(-) diff --git a/src/RepairGUIAdv/locate_subshapes.py b/src/RepairGUIAdv/locate_subshapes.py index 9aeacc6b4..210299720 100644 --- a/src/RepairGUIAdv/locate_subshapes.py +++ b/src/RepairGUIAdv/locate_subshapes.py @@ -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): -- 2.39.2