From: NATHALIE GORE Date: Thu, 23 May 2024 13:59:14 +0000 (+0200) Subject: Manage Min / Max for locate Subhapes X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5340b002d3de074575eec5921801da639627a72f;p=modules%2Fgeom.git Manage Min / Max for locate Subhapes --- diff --git a/src/RepairGUIAdv/locate_subshapes_limits.py b/src/RepairGUIAdv/locate_subshapes_limits.py index a65f84083..16fc4fbef 100755 --- a/src/RepairGUIAdv/locate_subshapes_limits.py +++ b/src/RepairGUIAdv/locate_subshapes_limits.py @@ -69,8 +69,31 @@ def run(args_dict, progress_emitter): sleep(1) - logging.warning('The algo script is not implemented! Return default values...') - limits = [0.0, 100.0] + geom_builder_types = { GEOM.EDGE : 'EDGE', GEOM.FACE : 'FACE', GEOM.SOLID : 'SOLID' } + type_str = geom_builder_types[selection_level] + shape_type = geompy.ShapeType[type_str] + + logging.info('Computing Min / Max...') + if type_str == "EDGE": + basicProp = 0 + elif type_str == "FACE": + basicProp = 1 + elif type_str == "SOLID": + basicProp = 2 + else : + logging.info("Problème avec la définition du type d'élément !") + return False + + lElements = geompy.SubShapeAll(source_solid, shape_type) + minSize = 1e7 + maxSize = -1 + for element in lElements: + size = geompy.BasicProperties(element)[basicProp] + if size < minSize : + minSize = size + if size > maxSize : + maxSize = size + limits = [minSize, maxSize] logging.info('Done.') progress_emitter.emit()