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.

Find Face Containing Point

jack_white396jack_white396 Member Posts: 6 EDU
I am very new to featurescript and to coding as a whole, so I imagine this problem has an easy solution. I need to let the user select a point, which I know how to do, but then I need the feature to decide what face contains that point and then use it as the face for a sketch. How would I do this? Thank you so much for any help.

Comments

  • Jacob_CorderJacob_Corder Member Posts: 63 PRO
    use qContainsPoint(queryToFilter, point);
    or qWithinRadius(queryToFilter, point, radius);
  • chadstoltzfuschadstoltzfus Member, Developers Posts: 77 PRO
    qClosestTo(queryToFilter, point) could also work. Each of these querying options has different levels of granularity, and I would recommend reading through the documentation on https://cad.onshape.com/FsDoc/library.html to figure out which one would work best for this case. I would also make sure you include some code to account for what happens if multiple entities are queries. For example, if you use qContainsPoint but multiple faces contain that point, how does one decide which face to use? Queries can be extremely flexible, but that robustness can get out of control if you're not careful. 
Sign In or Register to comment.