From 5340b002d3de074575eec5921801da639627a72f Mon Sep 17 00:00:00 2001 From: NATHALIE GORE Date: Thu, 23 May 2024 15:59:14 +0200 Subject: [PATCH] Manage Min / Max for locate Subhapes --- src/RepairGUIAdv/locate_subshapes_limits.py | 27 +++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) 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()