Create a selection of all Bodies in Mechanical

Options
Ayush Kumar
Ayush Kumar Member, Moderator, Employee Posts: 408
First Anniversary Ansys Employee Solution Developer Community of Practice Member First Answer

Create a selection of all Bodies in Mechanical

Comments

  • Ayush Kumar
    Ayush Kumar Member, Moderator, Employee Posts: 408
    First Anniversary Ansys Employee Solution Developer Community of Practice Member First Answer
    Options
    all_bodies = []
    for assembly in ExtAPI.DataModel.GeoData.Assemblies:
        for part in assembly.Parts:
            for body in part.Bodies:
                all_bodies.append(body.Id)
    
    sel = ExtAPI.SelectionManager.CreateSelectionInfo(SelectionTypeEnum.GeometryEntities)
    sel.Ids = all_bodies