X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FTools%2FblocFissure%2Fgmu%2FsubstractSubShapes.py;h=9f867ebf9ec9363a27b677b3bfd1fae8e33d58fa;hp=7abb8b564a0775e3e6464cc0513ca8e164bafd5d;hb=HEAD;hpb=b7a7d49664daa32e1befb558280e13ed0bde37c9 diff --git a/src/Tools/blocFissure/gmu/substractSubShapes.py b/src/Tools/blocFissure/gmu/substractSubShapes.py index 7abb8b564..71df5ad60 100644 --- a/src/Tools/blocFissure/gmu/substractSubShapes.py +++ b/src/Tools/blocFissure/gmu/substractSubShapes.py @@ -1,23 +1,41 @@ # -*- coding: utf-8 -*- +# Copyright (C) 2014-2024 EDF +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +"""Substract a list of subShapes from another""" import logging -from .geomsmesh import geompy -# ----------------------------------------------------------------------------- -# --- substract a list of subShapes from another +from .geomsmesh import geompy def substractSubShapes(obj, subs, toRemove): - """ - liste de subshapes par difference - """ + """liste de subshapes par difference""" logging.info("start") - idToremove = {} - subList = [] - for s in toRemove: - idToremove[geompy.GetSubShapeID(obj, s)] = s - for s in subs: - idsub = geompy.GetSubShapeID(obj, s) - if idsub not in list(idToremove.keys()): - subList.append(s) + idToremove = dict() + for shape in toRemove: + idToremove[geompy.GetSubShapeID(obj, shape)] = shape + + subList = list() + for shape in subs: + idsub = geompy.GetSubShapeID(obj, shape) + if ( idsub not in idToremove ): + subList.append(shape) + logging.debug("subList=%s", subList) + return subList