Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. Be respectful, on topic and if you see a problem, Flag it.

If you would like to contact our Community Manager personally, feel free to send a private message or an email.

Get the pair of faces that are furthest apart

Lee_HeskethLee_Hesketh Member, Developers Posts: 148 ✭✭✭
How would I get the pair of faces that belong to a part that are furthest apart? I tried using evDistance and setting it to maximum, but the index was unexpected, it returned one correct face and one that was adjacent to it. What would be the best way of doing this?
There are 10 types of people in the world. Those who know binary, those who don't and those who didn't expect base 3!

Comments

  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    hi, there is qFarthestAlong query, did you tested it?
  • Lee_HeskethLee_Hesketh Member, Developers Posts: 148 ✭✭✭
    I tired it but it didn't get the results I wanted. I have fixed my issue now. I iterated through each face and found it's origin using evFaceTangentPlane, and then appended each point to an array. Then passed that through evDistance and then used qContainsPoint to get the face.
    There are 10 types of people in the world. Those who know binary, those who don't and those who didn't expect base 3!
  • ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,210
    You're probably looking to find the pair of faces that maximizes the minimum separation between them.  evDistance maximizes the maximum separation between them (i.e., it finds two points on the body farthest apart and gives you a pair of faces that contains them).  For the general case, I can't think of a better way than calling evDistance (minimum) for a large number of pairs of faces and taking the max.  You don't have to do all pairs of faces, if you maintain a running maximum and use qWithinRadius from a point on the face (or a small number) to filter out faces that cannot increase the maximum.
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,671
    Are you trying to find the furthest faces or the bounding box of the part? You could simply use evBox3d. Checking the distances between the centers of faces would not give you a reliable result.
    Senior Director, Technical Services, EMEAI
Sign In or Register to comment.