From: mpv Date: Fri, 5 Jun 2020 13:08:13 +0000 (+0300) Subject: Fix for the issue #19231: Wrong group in SHAPERSTUDY created by GroupSubstraction X-Git-Tag: V9_5_0rc1~7 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=0556a4e6e3025c121fa844a7dda2792a4e5645d8;p=modules%2Fshaper.git Fix for the issue #19231: Wrong group in SHAPERSTUDY created by GroupSubstraction --- diff --git a/src/ConnectorPlugin/ConnectorPlugin_PublishToStudyFeature.py b/src/ConnectorPlugin/ConnectorPlugin_PublishToStudyFeature.py index 6e3629fbf..30be5591d 100644 --- a/src/ConnectorPlugin/ConnectorPlugin_PublishToStudyFeature.py +++ b/src/ConnectorPlugin/ConnectorPlugin_PublishToStudyFeature.py @@ -173,25 +173,15 @@ class PublishToStudyFeature(ModelAPI.ModelAPI_Feature): else: aSelList = aRef.selectionList("group_list") aSelType = GeomAPI_Shape.shapeTypeByStr(aSelList.selectionType()) - for aSelIndex in range(aSelList.size()): - aSelection = aSelList.value(aSelIndex) - if aSelection.contextObject(): - aShape = aSelection.value() - if aShape: - allShapesList = [] # collect all sub-shapes selected in the group - if aShape.shapeType() == 0 or aShape.shapeType() != aSelType: # compound or whole res - anExplorer = GeomAPI_ShapeExplorer(aShape, aSelType) - while anExplorer.more(): - allShapesList.append(anExplorer.current()) - anExplorer.next() - else: - allShapesList.append(aShape) - # get index of each selected shape: if 0, this sub-shape is not in our result - for aSelected in allShapesList: - anId = GeomAlgoAPI.GeomAlgoAPI_CompoundBuilder.id(aResShape, aSelected) - if anId > 0 and not anId in aGroupHasIndex: - aGroupIndices.append(anId) - aGroupHasIndex[anId] = 0 + for aGroupRes in aRef.results(): + aShape = aGroupRes.shape() + anExplorer = GeomAPI_ShapeExplorer(aShape, aSelType) + while anExplorer.more(): + anId = GeomAlgoAPI.GeomAlgoAPI_CompoundBuilder.id(aResShape, anExplorer.current()) + if anId > 0 and not anId in aGroupHasIndex: + aGroupIndices.append(anId) + aGroupHasIndex[anId] = 0 + anExplorer.next() if len(aGroupIndices): # create group aGroupFeatureId = aRef.data().featureId() if theFields: