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.

Options

Internal or External Surface Selection

chris_ICLchris_ICL Member Posts: 2 EDU
Hi, I am learning how to use Feature Scripts and I have come up against a bit of a road block that I'm sure must be relatively easy to solve:

I can't figure out how to tell whether a user selected surface is an external or internal face (for example a cylindrical surface could be either a hole or a shaft).

Please could someone point me in the right direction?

Thanks,

Chris
Tagged:

Comments

  • Options
    S1monS1mon Member Posts: 2,359 PRO
    I don't really know the answer, but because of all the edge cases, looking at convexity of the edges of the cylinder won't work. What might work is if you find the normal of the surface. I've never used it, but evFaceCurvature seems like it should get you a useful vector for maxCurvature and maxDirection. If you can identify the axis of rotation, you can see if the vector intersects the axis. There's also a canBeCylinder which you may need to use.

    Just in case this isn't obvious, you will also need to make sure that the body is solid. If not, the surface normals could be deceiving.
  • Options
    chris_ICLchris_ICL Member Posts: 2 EDU
    Thanks for your help S1mon, I will try those out and see how it goes.
  • Options
    antlu65antlu65 Member Posts: 55 EDU
    edited August 2022
    Late answer, but was just doing something similar with shafts/holes - adding incase someone has same question in future. As S1mon suggested, one can determine whether the selected face of a simple cylindrical/conical body is exterior/interior by using evFaceCurvature and checking the returned values of maxCurvature/minCurvature. An external face will have maxCurvature > 0, an interior face will have minCurvature < 0.

    const curvatureResult = evFaceCurvature(context, {
        "face" : qFace,
        "parameter" : vector(0.5, 0.5)
    });
    const isExterior = curvatureResult.maxCurvature > 0 / millimeter;
    // const isInterior = curvatureResult.minCurvature < 0 / millimeter;
Sign In or Register to comment.