[bos #38044][EDF] (2023-T3) Support for automatic reparation. Added checking params for sub-shapes.

This commit is contained in:
Konstantin Leontev 2024-03-27 18:01:13 +00:00
parent cd33417290
commit 9401129906

View File

@ -195,9 +195,9 @@ class LocateSubShapesDlg(BaseDlg):
# Update counters # Update counters
geompy = geomBuilder.New() 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() 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 # Update label
self.update_subshapes_label() self.update_subshapes_label()
@ -240,42 +240,29 @@ class LocateSubShapesDlg(BaseDlg):
# Get all sub-shapes # Get all sub-shapes
geompy = geomBuilder.New() geompy = geomBuilder.New()
selection_level = self.get_selection_level() 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 # Iterate over ids to check if it fits to limits
# TODO: implement selections param_ids = { GEOM.EDGE : 0, GEOM.FACE : 1, GEOM.SOLID : 2 }
limits = self.get_limits() param_index = param_ids[selection_level]
for id in subshapes_ids:
# Get a sub-shape by id
pass
# Get related parameter to check it later limits = self.get_limits()
param = None for shape in subshapes:
if selection_level == GEOM.EDGE: # Get properties as a list [theLength, theSurfArea, theVolume]
# Get a lenght of an edge properties = geompy.BasicProperties(shape)
pass param = properties[param_index]
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
# Check if it fits to the limits # Check if it fits to the limits
if param >= limits[0] and param <= limits[1]: if param >= limits[0] and param <= limits[1]:
# TODO: implement selections with GEOM_Swig_LocalSelector or something...
# Select sub-shape # Select sub-shape
pass pass
else: else:
# Deselect sub-shape # Deselect sub-shape
pass pass
# Update displayed info # Update displayed info
self.update_subshapes_info() self.update_subshapes_info()
def on_limit_changed(self): def on_limit_changed(self):