The idea is to generate a named selection with conta and target areas included in all contacts.
This can be easily done with Mechanical scripting. Assuming that all contacts are face-to-face and defined by geometrical entities, we can loop over them, extract ids and assign them to a named selection. Below the code:
all_contacts = ExtAPI.DataModel.GetObjectsByType(DataModelObjectCategory.ContactRegion) ids_surfaces = [] for contact in all_contacts: ids_surfaces.append(contact.SourceLocation.Ids) ids_surfaces.append(contact.TargetLocation.Ids) ids_unique = list(set(item for sublist in ids_surfaces for item in sublist)) tempSel = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities) tempSel.Ids = ids_unique ns = ExtAPI.DataModel.Project.Model.AddNamedSelection() ns.Location = tempSel ns.Name = 'NS_Contacts'