-# Copyright (C) 2014-2019 CEA/DEN, EDF R&D
+# Copyright (C) 2014-2020 CEA/DEN, EDF R&D
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
aSOIter = SHAPERSTUDY_utils.getStudy().NewChildIterator(aComponent)
while aSOIter.More():
aSO = aSOIter.Value()
- aSOIter.Next() ### here because there is continue inside the loop!
+ aSOIter.Next() # here because there is continue inside the loop
anIOR = aSO.GetIOR()
if len(anIOR):
anObj = salome.orb.string_to_object(anIOR)
if aRes:
aBuilder = SHAPERSTUDY_utils.getStudy().NewBuilder()
aBuilder.RemoveReference(aSO2)
- # 18884 - remove also the shape object and all sub-objects
- aBuilder = SHAPERSTUDY_utils.getStudy().NewBuilder()
- aBuilder.RemoveObjectWithChildren(aSO)
+ # if the object is not marked as dead, mark it (#3201) to make all entries unique
+ aDeadEntry = anObj.GetEntry()
+ if not aDeadEntry.startswith("dead"):
+ anIndex = aSO.Tag()
+ anObj.SetEntry("dead0" + str(anIndex) + "_" + aDeadEntry)
+
+ # also for groups
+ aGrSOIter = SHAPERSTUDY_utils.getStudy().NewChildIterator(aSO)
+ while aGrSOIter.More():
+ aGroupSO = aGrSOIter.Value()
+ aGrSOIter.Next()
+ anIOR = aGroupSO.GetIOR()
+ if len(anIOR):
+ aGroup = salome.orb.string_to_object(anIOR)
+ if isinstance(aGroup, SHAPERSTUDY_ORB._objref_SHAPER_Group) or \
+ isinstance(aGroup, SHAPERSTUDY_ORB._objref_SHAPER_Field):
+ if not aGroup.GetEntry().startswith("dead"):
+ aDeadGroupEntry = "dead0" + str(anIndex) + "_" + aGroup.GetEntry()
+ aGroup.SetEntry(aDeadGroupEntry)
# Part of the "execute" method: processes the Groups of theRes result publication.
# If theFields is true, the same is performed for Fields.
aShape = aSelection.value()
if aShape:
allShapesList = [] # collect all sub-shapes selected in the group
- if aShape.shapeType() == 0: # compound
+ if aShape.shapeType() == 0 or aShape.shapeType() != aSelType: # compound or whole res
anExplorer = GeomAPI_ShapeExplorer(aShape, aSelType)
while anExplorer.more():
allShapesList.append(anExplorer.current())