From: mpv Date: Thu, 12 Dec 2019 11:41:41 +0000 (+0300) Subject: Get rid of BaseObject in the SHAPERSTUDY implementation: it is not connected to the... X-Git-Tag: V9_5_0a1~17^2~18 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=a02a1ee7a80105007d0480562b19d701daddc5f3;p=modules%2Fshaper.git Get rid of BaseObject in the SHAPERSTUDY implementation: it is not connected to the Object in the previous approach. --- diff --git a/src/ConnectorPlugin/ConnectorPlugin_PublishToStudyFeature.py b/src/ConnectorPlugin/ConnectorPlugin_PublishToStudyFeature.py index 45ec3985f..45a1aed6c 100644 --- a/src/ConnectorPlugin/ConnectorPlugin_PublishToStudyFeature.py +++ b/src/ConnectorPlugin/ConnectorPlugin_PublishToStudyFeature.py @@ -72,11 +72,18 @@ class PublishToStudyFeature(ModelAPI.ModelAPI_Feature): 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) + aPartRes = ModelAPI.modelAPI_ResultPart(ModelAPI.modelAPI_Result(aPartObject)) + aPartDoc = aPartRes.partDoc() + if aPartDoc is None and aPartObject is not None: + EventsAPI.Events_InfoMessage("PublishToStudy", "For publish to SHAPER-STUDY some Part is not activated", self).send() + break + aPartFeatureId = aPartSet.feature(aPartRes).data().featureId() + for aResId in range(aPartDoc.size(model.ModelAPI_ResultBody_group())): + aResObject = aPartDoc.object(model.ModelAPI_ResultBody_group(), aResId) aRes = model.objectToResult(aResObject) print("Found a result to publish ", aRes.data().name()) - aSShape = anEngine.CreateShape() + aResFeatureId = aPartDoc.feature(aRes).data().featureId() + aSSEntry = str(aPartFeatureId) + ":" + str(aResFeatureId) + aSShape = anEngine.CreateShape(aSSEntry) aSShape.SetShapeByStream(aRes.shape().getShapeStream()) anEngine.AddInStudy(aSShape, aRes.data().name(), None)