From: Ekaterina Sukhareva Date: Wed, 21 Feb 2024 17:20:27 +0000 (+0000) Subject: Improve ShaperResults part level X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3bf6ac4ed11e3d8e4b3a17867f5ddd4bf26fef95;p=modules%2Fshaper.git Improve ShaperResults part level --- diff --git a/src/ConnectorPlugin/ConnectorPlugin_PublishToStudyFeature.py b/src/ConnectorPlugin/ConnectorPlugin_PublishToStudyFeature.py index c1dc8749e..42793113e 100644 --- a/src/ConnectorPlugin/ConnectorPlugin_PublishToStudyFeature.py +++ b/src/ConnectorPlugin/ConnectorPlugin_PublishToStudyFeature.py @@ -89,7 +89,19 @@ class PublishToStudyFeature(ModelAPI.ModelAPI_Feature): # Collects all features of exported results to find results of the same features and extend id. # Map from feature index to index of result. If index is zero (initial), no surrfix to entry is added. aFeaturesIndices = {} + cnt = 1 for aResId in range(aPartDoc.size(model.ModelAPI_ResultBody.group())): + # add part to study + if cnt==1: + aPartEntry = str(aPartFeatureId) + print(aPartEntry) + aPart = anEngine.FindOrCreateShape(aPartEntry) + aPart.SetShapeByStream(aPartRes.shape().getShapeStream(False)) + if not aPart.GetSO(): # publish in case it is a new shape + anEngine.AddInStudy(aPart, aPartRes.data().name(), None) + allProcessed.append(aPartEntry) + cnt+=1 + aResObject = aPartDoc.object(model.ModelAPI_ResultBody.group(), aResId) aRes = model.objectToResult(aResObject) #do not export images @@ -105,7 +117,7 @@ class PublishToStudyFeature(ModelAPI.ModelAPI_Feature): aSShape = anEngine.FindOrCreateShape(aSSEntry) aSShape.SetShapeByStream(aRes.shape().getShapeStream(False)) if not aSShape.GetSO(): # publish in case it is a new shape - anEngine.AddInStudy(aSShape, aRes.data().name(), None) + anEngine.AddInStudy(aSShape, aRes.data().name(), aPart) else: # restore a red reference if it was deleted aDone, aSO2 = aSShape.GetSO().FindSubObject(1) if aDone: @@ -120,7 +132,7 @@ class PublishToStudyFeature(ModelAPI.ModelAPI_Feature): self.processGroups(aRes, anEngine, aPartFeatureId, aSShape, True) # process all SHAPER-STUDY shapes to find dead - aSOIter = SHAPERSTUDY_utils.getStudy().NewChildIterator(aComponent) + aSOIter = SHAPERSTUDY_utils.getStudy().NewChildIterator(aComponent) #must be adapted to accommodate the new structure while aSOIter.More(): aSO = aSOIter.Value() aSOIter.Next() # here because there is continue inside the loop