From a02a1ee7a80105007d0480562b19d701daddc5f3 Mon Sep 17 00:00:00 2001 From: mpv Date: Thu, 12 Dec 2019 14:41:41 +0300 Subject: [PATCH] Get rid of BaseObject in the SHAPERSTUDY implementation: it is not connected to the Object in the previous approach. --- .../ConnectorPlugin_PublishToStudyFeature.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) 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) -- 2.39.2