Split Named Selection
Original Named Selection containing 80 Faces.
Select the Named Selection Object in the Tree and run the script to split it into 80 Named Selections.
NamedSelectionObject = Model.NamedSelections
NamedSelection = Tree.FirstActiveObject
scoping = NamedSelection.Location
SelectionType = str(NamedSelection.Location.SelectionType)
IDS = scoping.Ids
GroupNamedSelections = list()
if SelectionType == "MeshElements": Elem = 1
else: Elem = 0
with Transaction():
for ElementID in IDS:
if Elem == 1: NewSelection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.MeshElements)
else: NewSelection = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
NewSelection.Ids = [ElementID]
NewNamedSelection = NamedSelectionObject.AddNamedSelection()
NewNamedSelection.Location = NewSelection
GroupNamedSelections.append(NewNamedSelection)
Group = Tree.Group(GroupNamedSelections)
Group.Name = str(NamedSelection.Name) + " splitted into " + str(GroupNamedSelections.Count) + " sets"