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: 7 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. This is my current code in case it helps-https://cad.onshape.com/documents/dd9b41942bbf9f447e9d9d6d/w/2b64a0a98ab7927062949adf/e/7a70e61408d6be428a6f3ba7

Answers

  • EvanReeseEvanReese Member, Mentor Posts: 2,135 ✭✭✭✭✭
    If the point they select is always a sketch point, you can use evOwnerSketchPlane and get a plane there. If that works for you, you could also change your filter in the UI so user's can only pick sketch points. Something like this:
    annotation { "Name" : "Point", "Filter" : EntityType.VERTEX && SketchObject.YES, "MaxNumberOfPicks" : 1 }
           definition.center is Query;
    If you don't want to limit to sketch points I'm not 100% sure, but without trying any of them, maybe qAdjacent or qContainsPoint, and failing those, you could brute force it by querying all of the model faces and then getting the closest one with qClosestTo
    Evan Reese
Sign In or Register to comment.