2014-09-08 18:58:52 +06:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
|
|
|
import logging
|
|
|
|
from geomsmesh import geompy
|
2014-12-11 19:45:06 +05:00
|
|
|
from geomsmesh import geomPublish
|
|
|
|
from geomsmesh import geomPublishInFather
|
|
|
|
import initLog
|
2014-09-08 18:58:52 +06:00
|
|
|
|
|
|
|
def compoundFromList(elements, nom=None):
|
|
|
|
"""
|
|
|
|
|
|
|
|
"""
|
|
|
|
logging.debug('start')
|
|
|
|
|
|
|
|
shapeList = []
|
|
|
|
for a in elements:
|
|
|
|
if not isinstance(a, list):
|
|
|
|
shapeList.append(a)
|
|
|
|
else:
|
|
|
|
if a[0] is not None:
|
|
|
|
shapeList.append(a[0])
|
|
|
|
|
|
|
|
if nom is not None:
|
|
|
|
for i,a in enumerate(shapeList):
|
2016-01-12 19:00:56 +05:00
|
|
|
nomi = nom +"%d"%i
|
|
|
|
logging.debug('nom: %s',nomi)
|
|
|
|
geomPublish(initLog.debug, a, nomi)
|
2014-09-08 18:58:52 +06:00
|
|
|
|
|
|
|
shapeCompound = None
|
|
|
|
if len(shapeList) > 0:
|
|
|
|
shapeCompound =geompy.MakeCompound(shapeList)
|
2016-01-12 19:00:56 +05:00
|
|
|
nomc = "compound_%s"%nom
|
|
|
|
geomPublish(initLog.debug, shapeCompound, nomc)
|
2014-09-08 18:58:52 +06:00
|
|
|
return shapeCompound
|
|
|
|
|