Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- 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.
Is it possible to check if a point(x,y,z) is on a surface or in free space?
frederik_larsen108
Member Posts: 9 EDU
i'm making a script that genrates some holes automatically.. I'll need to check if the polygon i'm extruding is in free space or on a surface? is that possible and how?
Tagged:
0
Best Answer
-
Jake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
const distanceResult = evDistance(context, {"side0" : someFace, "extendSide0" : true, "side1" : somePoint}); if (distanceResult.distance < TOLERANCE.zeroLength) { // somePoint lies on the underlying surface of someFace } else { // somePoint does not lie on the underlying surface of someFace<br> }
'somePoint' can be a Query for a Vertex, a vector (like vector(1, 2, 3) * inch or the result of evVertexPoint), or even a Query for all the vertices of your polygon (the 'distance' will be the distance of the closest point, so by doing this you could tell if any of the points lie on the surface).
Jake Rosenfeld - Modeling Team1
Answers
https://cad.onshape.com/FsDoc/library.html#evDistance-Context-map
'somePoint' can be a Query for a Vertex, a vector (like vector(1, 2, 3) * inch or the result of evVertexPoint), or even a Query for all the vertices of your polygon (the 'distance' will be the distance of the closest point, so by doing this you could tell if any of the points lie on the surface).
Could you provide a URL for a document that has an example of the issue you're facing? It would be easier to answer if I could see what's going on.
Here is a link, its on line 125
If that doesn't help, try focusing on one of the points in your pointArray and displaying it and the points returned by evDistance using the debug function.