[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
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
limits = self.get_limits()
for id in subshapes_ids:
# Get a sub-shape by id
pass
param_ids = { GEOM.EDGE : 0, GEOM.FACE : 1, GEOM.SOLID : 2 }
param_index = param_ids[selection_level]
# 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
limits = self.get_limits()
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):