Salome HOME
decoupage insereFissureGenerale, renommée construitFissureGenerale, premiere phase...
[modules/smesh.git] / src / Tools / blocFissure / gmu / compoundFromList.py
1 # -*- coding: utf-8 -*-
2
3 import logging
4 from geomsmesh import geompy
5
6 def compoundFromList(elements, nom=None):
7   """
8   
9   """
10   logging.debug('start')
11   
12   shapeList = []
13   for a in elements:
14     if not isinstance(a, list):
15       shapeList.append(a)
16     else:
17       if a[0] is not None:
18         shapeList.append(a[0])
19       
20   if nom is not None:
21     for i,a in enumerate(shapeList):
22       nom = nom +"%d"%i
23       logging.debug('nom: %s',nom)
24       geompy.addToStudy(a, nom)
25
26   shapeCompound = None
27   if len(shapeList) > 0:
28     shapeCompound =geompy.MakeCompound(shapeList)
29
30   return shapeCompound
31