From: rraphael Date: Wed, 27 Jan 2021 16:33:41 +0000 (+0100) Subject: import image: remove from ShaperResult (SHAPERSTUDY) X-Git-Tag: V9_7_0a1~13^2~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=3ca27a27415fd4b21ee7409dd8194eb6aa13284e;p=modules%2Fshaper.git import image: remove from ShaperResult (SHAPERSTUDY) --- diff --git a/src/ConnectorPlugin/ConnectorPlugin_ExportFeature.py b/src/ConnectorPlugin/ConnectorPlugin_ExportFeature.py index 141155028..4fa7741fa 100644 --- a/src/ConnectorPlugin/ConnectorPlugin_ExportFeature.py +++ b/src/ConnectorPlugin/ConnectorPlugin_ExportFeature.py @@ -68,6 +68,9 @@ class ExportFeature(ModelAPI.ModelAPI_Feature): for aResIndex in range(self.Part.size(aResultType)): anObject = self.Part.object(aResultType, aResIndex) aResult = model.objectToResult(anObject) + # do nt export picture + if aResult.hasTextureFile() is True: + continue if not aResult is None: if (not aResult.shape() or aResult.shape().isNull()) and isPart: aPart = model.modelAPI_ResultPart(aResult) diff --git a/src/ConnectorPlugin/ConnectorPlugin_PublishToStudyFeature.py b/src/ConnectorPlugin/ConnectorPlugin_PublishToStudyFeature.py index a2e401aae..a5d8ed26e 100644 --- a/src/ConnectorPlugin/ConnectorPlugin_PublishToStudyFeature.py +++ b/src/ConnectorPlugin/ConnectorPlugin_PublishToStudyFeature.py @@ -90,8 +90,11 @@ class PublishToStudyFeature(ModelAPI.ModelAPI_Feature): # Map from feature index to index of result. If index is zero (initial), no surrfix to entry is added. aFeaturesIndices = {} for aResId in range(aPartDoc.size(model.ModelAPI_ResultBody_group())): - aResObject = aPartDoc.object(model.ModelAPI_ResultBody_group(), aResId) + aResObject = aPartDoc.object(model.ModelAPI_ResultBody_group(), aResId) aRes = model.objectToResult(aResObject) + #do not export images + if aRes.hasTextureFile() is True: + continue aResFeatureId = str(aPartDoc.feature(aRes).data().featureId()) if aResFeatureId in aFeaturesIndices: aFeaturesIndices[aResFeatureId] += 1 diff --git a/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp b/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp index eb6343737..49f71586d 100644 --- a/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp +++ b/src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp @@ -412,6 +412,7 @@ void ExchangePlugin_ExportFeature::exportXAO(const std::string& theFileName) std::list aDocuments; /// documents of Parts selected and used in export std::map aDocTrsf; /// translation of the part + bool anExCludedIsImage = false; AttributeSelectionListPtr aSelection = selectionList(XAO_SELECTION_LIST_ID()); bool aIsSelection = aSelection->isInitialized() && aSelection->size() > 0; if (aIsSelection) { // a mode for export to geom result by result @@ -419,9 +420,12 @@ void ExchangePlugin_ExportFeature::exportXAO(const std::string& theFileName) AttributeSelectionPtr anAttr = aSelection->value(a); ResultPtr aBodyContext = std::dynamic_pointer_cast(anAttr->context()); - if (aBodyContext.get() && !aBodyContext->isDisabled() && aBodyContext->shape().get() + if (aBodyContext.get() && !aBodyContext->isDisabled() && aBodyContext->shape().get()) { /// do not export pictures - && !aBodyContext->hasTextureFile()) { + if(aBodyContext->hasTextureFile()){ + anExCludedIsImage = true; + continue; + } aResults.push_back(aBodyContext); GeomShapePtr aShape = anAttr->value(); if (!aShape.get()) @@ -454,7 +458,8 @@ void ExchangePlugin_ExportFeature::exportXAO(const std::string& theFileName) } } if (aShapes.empty()) { - setError("No shapes to export"); + if(!anExCludedIsImage) + setError("No shapes to export"); return; }