Manage Min / Max for locate Subhapes

This commit is contained in:
NATHALIE GORE 2024-05-23 15:59:14 +02:00 committed by Konstantin Leontev
parent de9595d5e5
commit 5340b002d3

View File

@ -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()