If i have a contact defined by some faces - now from contact and target faces, how to identify the bodies they belong to ?
Use can use the below snippet to find out the bodies to which the contact and target faces belong to. For now it is searching only for the contact named 'My Contact'.
model = ExtAPI.DataModel.Project.Model geodata = ExtAPI.DataModel.GeoData conn_group = next(c for c in model.Connections.Children if c.Name == "Contacts") contact_region = next(cr for cr in conn_group.Children if cr.Name == "My Contact") s = contact_region.SourceLocation t = contact_region.TargetLocation for face in s: my_geobody = geodata.GeoEntityById(s.Ids[0]).Bodies[0] my_tree_body = ExtAPI.DataModel.Project.Model.Geometry.GetBody(my_geobody) print('contact face belongs to '+ my_tree_body.Name) my_geobody1 = geodata.GeoEntityById(t.Ids[0]).Bodies[0] my_tree_body1 = ExtAPI.DataModel.Project.Model.Geometry.GetBody(my_geobody1) print('target face belongs to '+ my_tree_body1.Name)