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.
Querying faces/objects located on one side of a plane
yurii_haiovyi
Member Posts: 8 ✭
Is there any way to query faces that are located on one or another side of a given plane? qSplitBy doesn't return unaffected faces from faceTargets query, so there's no way of knowing what's where.
Thanks!
Thanks!
0
Comments
You could use a dummy plane (PlaneB) that is just slightly offset to the wrong side of the original plane (PlaneA). Then, for each object of interest you can perform evDistance to both planes. If an object is closer to PlaneA than PlaneB, then it's on the right side.
Alternatively, you can create a giant dummy volume bordering your plane and query for all objects that intersect with it.
Here is a similar approach to what @mahir was suggesting. This approach takes the centroid of every part and checks if it is on the positive side or negative side of the plane. The key here is taking that centroid vector and getting the Z value from it. Vectors are stored in array format like this [x, y, z]. To get the Z value from it would look like this centroidVector[2]. Then you can determine if it is positive or negative relative to the measuring plane.
I have placed this inside of a function so that all you need to do is import the function into your project to be able to use the function in your feature definition.
https://cad.onshape.com/documents/3b7cb6cdfff8caa4fde98d8e/w/e656ed116b6492f6e01625fd/e/eadcf365f911e7410b5d0e23?renderMode=0&uiState=63bd72f62e5bc928d81b9c1b
Place this at the top of your FeatureScript:
Then, you can use the function qThisSidePascoe() like this within your feature. This will return the entities on either side of the plane you give it:
If you don't want to import the function and would rather do it manually, here is how you can do that:
Learn more about the Gospel of Christ ( Here )
CADSharp - We make custom features and integrated Onshape apps! Learn How to FeatureScript Here 🔴