+ aBrep = self.geompy.RestoreShape(aDump)
+ aName = aBodyResult.data().name()
+
+ # Make unique name
+ aId = getObjectIndex(aName)
+ if aId != 0:
+ aName = aName + '_' + str(aId)
+
+ self.geompy.addToStudy(aBrep, aName)
+ self.geomObjects.append([aShape, aBrep])
+
+ ## Exports all groups
+ def exportGroups(self):
+ # iterate all features to find groups
+ aFeaturesNum = self.Part.size("Features")
+ groupIndex = 0
+ for anIndex in range(0, aFeaturesNum):
+ aFeature = self.Part.object("Features", anIndex)
+ aSelectionList = aFeature.data().selectionList("group_list")
+ # 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)
+
+ ## Creates a group by given list of selected objects and the name
+ # @param theSelectionList: list of selected objects
+ # @param theGroupName: name of the group to create
+ def createGroupFromList(self, theSelectionList, theGroupName):
+ # iterate on all selected entities of the group
+ # and get the corresponding ID
+ aSelectionNum = theSelectionList.size()
+ Ids = []
+ for aSelIndex in range(0, aSelectionNum):
+ aSelection = theSelectionList.value(aSelIndex)
+ aSelectionContext = aSelection.context()
+ anID = aSelection.Id()
+ Ids.append(anID)
+ if aSelection.value().isVertex():
+ groupType = "VERTEX"
+ elif aSelection.value().isEdge():
+ groupType = "EDGE"
+ elif aSelection.value().isFace():
+ groupType = "FACE"
+ else:
+ groupType = "SOLID"