Select a body by location

Gabriel Messager
Gabriel Messager Member, Employee Posts: 49
5 Likes Name Dropper First Anniversary Ansys Employee
edited June 2023 in 3D Design

Select a body by location

Comments

  • Gabriel Messager
    Gabriel Messager Member, Employee Posts: 49
    5 Likes Name Dropper First Anniversary Ansys Employee
    x = 0
    y = 31
    z = -20
    box_ref = Box.Create(Point.Create(MM(x), MM(y), MM(z)))
    
    for body in GetRootPart().GetAllBodies():
        body_box = body.Shape.GetBoundingBox(Matrix.Identity)
        if (box_ref & body_box).IsEmpty==False:
            Selection.Create(body).SetActive()