From: mpv Date: Wed, 11 Dec 2019 11:38:22 +0000 (+0300) Subject: Correct creation of shapes in SHAPER-STUDY X-Git-Tag: V9_5_0a1~17^2~20 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b92b4388de3b92c38f3065b76f0314c3aa0ed39f;p=modules%2Fshaper.git Correct creation of shapes in SHAPER-STUDY --- diff --git a/src/ConnectorPlugin/ConnectorPlugin_PublishToStudyFeature.py b/src/ConnectorPlugin/ConnectorPlugin_PublishToStudyFeature.py index 725939b7b..45ec3985f 100644 --- a/src/ConnectorPlugin/ConnectorPlugin_PublishToStudyFeature.py +++ b/src/ConnectorPlugin/ConnectorPlugin_PublishToStudyFeature.py @@ -61,10 +61,22 @@ class PublishToStudyFeature(ModelAPI.ModelAPI_Feature): def execute(self): print("### Execution of PublishToStudy") - ## Get SHAPER active document - aSession = ModelAPI.ModelAPI_Session.get() # find a shaper-study component salome.salome_init(1) import SHAPERSTUDY_utils SHAPERSTUDY_utils.findOrCreateComponent() anEngine = SHAPERSTUDY_utils.getEngine() + + # iterate all parts and all results to publish them in SHAPER_STUDY + aSession = ModelAPI.ModelAPI_Session.get() + aPartSet = aSession.moduleDocument() + for aPartId in range(aPartSet.size(model.ModelAPI_ResultPart_group())): + aPartObject = aPartSet.object(model.ModelAPI_ResultPart_group(), aPartId) + aPart = ModelAPI.modelAPI_ResultPart(ModelAPI.modelAPI_Result(aPartObject)).partDoc() + for aResId in range(aPart.size(model.ModelAPI_ResultBody_group())): + aResObject = aPart.object(model.ModelAPI_ResultBody_group(), aResId) + aRes = model.objectToResult(aResObject) + print("Found a result to publish ", aRes.data().name()) + aSShape = anEngine.CreateShape() + aSShape.SetShapeByStream(aRes.shape().getShapeStream()) + anEngine.AddInStudy(aSShape, aRes.data().name(), None)