Salome HOME
Merge branch 'hydro/imps_2015' into V7_dev
[modules/smesh.git] / src / Tools / blocFissure / gmu / compoundFromList.py
1 # -*- coding: utf-8 -*-
2
3 import logging
4 from geomsmesh import geompy
5 from geomsmesh import geomPublish
6 from geomsmesh import geomPublishInFather
7 import initLog
8
9 def compoundFromList(elements, nom=None):
10   """
11   
12   """
13   logging.debug('start')
14   
15   shapeList = []
16   for a in elements:
17     if not isinstance(a, list):
18       shapeList.append(a)
19     else:
20       if a[0] is not None:
21         shapeList.append(a[0])
22       
23   if nom is not None:
24     for i,a in enumerate(shapeList):
25       nomi = nom +"%d"%i
26       logging.debug('nom: %s',nomi)
27       geomPublish(initLog.debug, a, nomi)
28
29   shapeCompound = None
30   if len(shapeList) > 0:
31     shapeCompound =geompy.MakeCompound(shapeList)
32     nomc = "compound_%s"%nom
33     geomPublish(initLog.debug, shapeCompound, nomc)
34   return shapeCompound
35