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.

Create a variance on a face with opExtrude?

daniel_cravensdaniel_cravens Member Posts: 29
What is the best way to create a variance on face? My thought is simply to reduce the part with opExtrude by the variance amount (i.e. 1 mm) + opBoolean (subtract) to cut the 1 mm variance from the part.  However, my problem is that I cannot figure out how to determine the correct direction for the opExtrude from the face once I calculate the normal. I can calculate the normal from the face (see below), but that doesn't tell me whether the cut should be in the normal direction or the anti-normal direction in order to reduce the part. What am I misunderstanding?

========

export function evFaceNormal(context, qface is Query) returns Vector
{
      
    var plane = evPlane(context, {
            "face" : qface
    });

    return plane.normal;
}


Comments

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,714
    If you are removing material you want to extrude in the opposite direction. You may also want to check opMoveFace.
    Senior Director, Technical Services, EMEAI
  • daniel_cravensdaniel_cravens Member Posts: 29
    Thank you! OpOffsetFace with a negative offset did the trick. I'm still getting the hang of feature script and really appreciate the support!

            var cutFaces = qCreatedBy(id + "cutFemale", EntityType.FACE);
            opOffsetFace(context, id + "offsetFace1", {
                    "moveFaces" : cutFaces,
                    "offsetDistance" : -.1 * millimeter
            });
  • daniel_cravensdaniel_cravens Member Posts: 29
    As a follow up, although opoffsetface solved my problem for this feature. I'm still curious about how to arrive at the general solution. If I have a face, how can I determine programmatically which blind extrude direction will remove material and which will add material? Is it as simple as a negative number will always remove material?
  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,714
    Face normal always points outwards so make it bigger is positive and make it smaller is negative. 
    Senior Director, Technical Services, EMEAI
  • daniel_cravensdaniel_cravens Member Posts: 29
    Awesome. That is easy enough.
Sign In or Register to comment.