]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Improve ShaperResults part level 40622_PartsLevel
authorEkaterina Sukhareva <ekaterina.sukhareva@opencascade.com>
Wed, 21 Feb 2024 17:20:27 +0000 (17:20 +0000)
committerEkaterina Sukhareva <ekaterina.sukhareva@opencascade.com>
Wed, 21 Feb 2024 17:20:27 +0000 (17:20 +0000)
src/ConnectorPlugin/ConnectorPlugin_PublishToStudyFeature.py

index c1dc8749e1be24b7d281eae1670f9348452d0811..42793113e53e715784163fc3d652d4bec775c672 100644 (file)
@@ -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