Salome HOME
Fix fillet validator
[modules/shaper.git] / src / ConnectorPlugin / ConnectorPlugin_ExportFeature.py
index 26ab3ca9fd49099ae27ac15dd0198b381852be41..30844b6744a29fb0c941fb4d783fe027fd5d6bb5 100644 (file)
@@ -84,9 +84,11 @@ class ExportFeature(ModelAPI.ModelAPI_Feature):
         for anIndex in range(0, aFeaturesNum):
             aFeature = self.Part.object("Features", anIndex)
             aSelectionList = aFeature.data().selectionList("group_list")
-            aName = aFeature.data().name()
             # if a group has been found
             if aSelectionList:
+                aFeature = ModelAPI.objectToFeature(aFeature)
+                if aFeature.firstResult() is not None:
+                  aName = aFeature.firstResult().data().name()
                 groupIndex = groupIndex + 1
                 self.createGroupFromList(aSelectionList, aName)
                      
@@ -112,13 +114,15 @@ class ExportFeature(ModelAPI.ModelAPI_Feature):
             else:
                 groupType = "SOLID"
 
-        # iterate on exported objects and check if the current
-        # group refers to this object
-        for obj in self.geomObjects: 
-            if aSelectionContext.shape().isEqual(obj[0]):
-                aGroup = self.geompy.CreateGroup(obj[1], self.geompy.ShapeType[groupType])
-                self.geompy.UnionIDs(aGroup,Ids)
-                self.geompy.addToStudyInFather(obj[1], aGroup, theGroupName)
+        aContextBody = ModelAPI.modelAPI_ResultBody(aSelectionContext)
+        if aContextBody is not None:
+          # iterate on exported objects and check if the current
+          # group refers to this object
+          for obj in self.geomObjects: 
+              if aContextBody.isLatestEqual(obj[0]):
+                  aGroup = self.geompy.CreateGroup(obj[1], self.geompy.ShapeType[groupType])
+                  self.geompy.UnionIDs(aGroup,Ids)
+                  self.geompy.addToStudyInFather(obj[1], aGroup, theGroupName)
           
     ## Exports all shapes and groups into the GEOM module.
     def execute(self):