Create a selection of all Bodies in Mechanical

Ayush Kumar
Ayush Kumar Member, Moderator, Employee Posts: 470
100 Answers 250 Likes 100 Comments Second Anniversary
✭✭✭✭

Create a selection of all Bodies in Mechanical

Comments

  • Ayush Kumar
    Ayush Kumar Member, Moderator, Employee Posts: 470
    100 Answers 250 Likes 100 Comments Second Anniversary
    ✭✭✭✭
    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