]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
import image: remove from ShaperResult (SHAPERSTUDY)
authorrraphael <raphael.raphael@c-s.fr>
Wed, 27 Jan 2021 16:33:41 +0000 (17:33 +0100)
committerrraphael <raphael.raphael@c-s.fr>
Wed, 27 Jan 2021 16:35:58 +0000 (17:35 +0100)
src/ConnectorPlugin/ConnectorPlugin_ExportFeature.py
src/ConnectorPlugin/ConnectorPlugin_PublishToStudyFeature.py
src/ExchangePlugin/ExchangePlugin_ExportFeature.cpp

index 141155028ef2d0b73c3544913ec74d552713d5d2..4fa7741fac1e41e2fb1dfa312b6b80e4527b58a2 100644 (file)
@@ -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)
index a2e401aae849520225473c1b214435a0bf1cb9bf..a5d8ed26e7dd7f2d485e49a0bfb69712e285a4f8 100644 (file)
@@ -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
index eb63437373c7a8c215cec3b4fc9bca64437a3068..49f71586d5626de1e005163e4126d022bc137cfe 100644 (file)
@@ -412,6 +412,7 @@ void ExchangePlugin_ExportFeature::exportXAO(const std::string& theFileName)
   std::list<DocumentPtr> aDocuments; /// documents of Parts selected and used in export
   std::map<DocumentPtr, GeomTrsfPtr> 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<ModelAPI_Result>(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;
   }