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.

Trying to Create a Simple Thin Extrude Remove on Feature Studio

jordan_karyanto374jordan_karyanto374 Member Posts: 4
edited January 19 in FeatureScript
Hi everyone,

I am trying to create a custom feature that draw some sketches and extrude them as thin feature and removed it from the existing solid.

It is a simple thing to do with the built-in extrude feature, but I have been scratching my head on how to implement them in the feature studio.
I have been trying to use opExtrude, but that seem to not able to do thin feature, and the normal extrude function is not able to be pulled out in the feature studio.

Here are my existing code:


///
FeatureScript 2241; import(path : "onshape/std/common.fs", version : "2241.0");
annotation { "Feature Type Name" : "Fillet Cut2" }
export const Filletcut = defineFeature(function(context is Context, id is Id, definition is map)
    precondition
    {
        // annotation { "Name" : "Fillet Size" }
        // isLength(definition.filletSize, LENGTH_BOUNDS);

        // annotation { "Name" : "Side Length" }
        // isLength(definition.sideLength, LENGTH_BOUNDS);

        annotation { "Name" : "Plane", "Filter" : EntityType.FACE, "MaxNumberOfPicks" : 1 }
        definition.plane is Query;

        annotation { "Name" : "Top Point", "Filter" : EntityType.VERTEX, "MaxNumberOfPicks" : 1 }
        definition.pointT is Query;

        annotation { "Name" : "Right Point", "Filter" : EntityType.VERTEX, "MaxNumberOfPicks" : 1 }
        definition.pointS is Query;

    }
    {
        // Define the function's action

        // Create a plane at the top right corner of the selected face
        const facePlane = evFaceTangentPlane(context, {
                    "face" : definition.plane,
                    "parameter" : vector(1, 1) //This means that the plane will be at the top right corner 0,0 is the bottom left
                });

        const pointT = definition.pointT;
        const pointS = definition.pointS;
        const custom_plane = definition.plane;

        const l_diff = 11.3 * sin(45 * degree);

        var sketch1 = newSketch(context, id + "sketch1", {
                "sketchPlane" : definition.plane
            });

        // Create sketch entities here

        var rectangular1 = skRectangle(sketch1, "rectangle1", {
                "firstCorner" : vector(3, 0) * millimeter,
                "secondCorner" : vector(54.6, 51.6) * millimeter
            });

        skArc(sketch1, "arc1", {
                    "start" : vector(3, 11.3) * millimeter,
                    "mid" : vector(14.3 - l_diff, 11.3 - l_diff) * millimeter,
                    "end" : vector(14.3, 0) * millimeter
                });

        skArc(sketch1, "arc2", {
                    "start" : vector(3, 40.3) * millimeter,
                    "mid" : vector(14.3 - l_diff, 40.3 + l_diff) * millimeter,
                    "end" : vector(14.3, 51.6) * millimeter
                });

        skArc(sketch1, "arc3", {
                    "start" : vector(43.3, 51.6) * millimeter,
                    "mid" : vector(43.3 + l_diff, 40.3 + l_diff) * millimeter,
                    "end" : vector(54.6, 40.3) * millimeter
                });

        skArc(sketch1, "arc4", {
                    "start" : vector(54.6, 11.3) * millimeter,
                    "mid" : vector(43.3 + l_diff, 11.3 - l_diff) * millimeter,
                    "end" : vector(43.3, 0) * millimeter
                });


        skSolve(sketch1);         // Here is where I struggle to turn the sketch above into thin extrude feature to remove it from the existing solid.  });
///

Comments

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,715
    You have to break it down into individual modelling steps. Extrude surface > thicken > remove > delete surface (that's what the built-in feature is doing). The tutorial does exactly that: https://cad.onshape.com/FsDoc/tutorials/create-a-slot-feature.html
    Senior Director, Technical Services, EMEAI
  • jordan_karyanto374jordan_karyanto374 Member Posts: 4
    Thanks Neil! 

    I will take a closer look. One quick question though. There are many entities on my sketch, how do I select the one I am interested to extrude as surface?
  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,715
    sketchEntityQuery
    Senior Director, Technical Services, EMEAI
Sign In or Register to comment.