How to get closest face to a given location in SC/Disco API?

Options
Gabriel Messager
Gabriel Messager Member, Employee Posts: 49
5 Likes Name Dropper First Anniversary Ansys Employee

How to get closest face to a given location in SC/Disco API?

Answers

  • Gabriel Messager
    Gabriel Messager Member, Employee Posts: 49
    5 Likes Name Dropper First Anniversary Ansys Employee
    Options
    def locfindface(xx,yy,zz):
    
        searchPoint = Point.Create(MM(xx), MM(yy),MM(zz))
        direction = Direction.DirX
        rayOrigin = searchPoint + (direction.UnitVector * -.001)
        list = RayFire.Fire(rayOrigin, direction, 1E-10, 1E-5)
    
        for item in list:
            if isinstance(item, IDesignFace):
                Selection.Create(item).CreateAGroup("my_face")
                break
    
    locfindface(5.54,10,14.45)