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

Unable to fillet an existing object - Need help

Hi,

I am unable to fillet an existing object, it always throws up errors and ive tried everything to get around this such as trying to draw arcs with lines so i wouldnt have to fillet after i extrude to no avail.

Here is my code:

var length = 100*millimeter;
        var depth = 50*millimeter;
        var width = 500*millimeter;
        var thickness = 5*millimeter;
        
        
        var sketch1 = newSketch(context, id + "sketch1", {
                "sketchPlane" : qCreatedBy(makeId("Front"), EntityType.FACE)
        });
        
        skRectangle(sketch1, "rectangle1", {
                "firstCorner" : vector(0,0)*millimeter,
                "secondCorner" : vector(width,length)
        });
        
        skSolve(sketch1);
        
        extrude(context, id + "extrude1", {
                "entities" : qSketchRegion(id + "sketch1"),
                "endBound" : BoundingType.BLIND,
                "oppositeDirection" : true,
                "depth" : depth
        });
        
        var sketch2 = newSketch(context, id + "sketch2", {
                "sketchPlane" : qCreatedBy(makeId("Right"), EntityType.FACE)
        });
        
        skRectangle(sketch2, "rectangle2", {
                "firstCorner" : vector(thickness,thickness),
                "secondCorner" : vector(depth,length-thickness)
        });
        
        skSolve(sketch2);
        
        extrude(context, id + "extrude2", {
                "entities" : qSketchRegion(id + "sketch2"),
                "endBound" : BoundingType.BLIND,
                "operationType" : NewBodyOperationType.REMOVE,
                "depth" : width
        });
        
        opFillet(context, id + "fillet1", {
                "entities" : qCreatedBy(id + "extrude2", EntityType.EDGE),
                "radius" : 2.5*millimeter
        });
        

There arent any preconditions, im unsure how to find out which edges to fillet manually and I want it all in one feature. I just want the the inner edges (the concave ones) to be filleted rather than all the edges around it.

Thanks,


Comments

  • Options
    ilya_baranilya_baran Onshape Employees, Developers, HDM Posts: 1,175
    It can be a little tricky to select just the edges you want and there are usually several ways.  For example, the following code creates a query for all edges such that both adjacent faces are created by extrude2 (this resolves to the two edges you want):

            var facesNotByExtrude2 = qSubtraction(qEverything(EntityType.FACE), qCreatedBy(id + "extrude2", EntityType.FACE));
            var adjacentEdges = qEdgeAdjacent(facesNotByExtrude2, EntityType.EDGE);
            var innerEdges = qSubtraction(qCreatedBy(id + "extrude2", EntityType.EDGE), adjacentEdges);

    Another way is to look for all concave edges among those created by extrude2:

            var concaveEdges = [];
            for (var edge in evaluateQuery(context, qCreatedBy(id + "extrude2", EntityType.EDGE)))        
            {
                if (evEdgeConvexity(context, { "edge" : edge}) == EdgeConvexityType.CONCAVE)
                    concaveEdges = append(concaveEdges, edge);
            }
            
            opFillet(context, id + "fillet1", {
                    "entities" : qUnion(concaveEdges),
                    "radius" : 2.5*millimeter
            });

    Yet another way is to do the fillet manually and munge the code from the part studio -- you get something like:

            var e1 = makeQuery(id + "extrude2.boolean.opBoolean", "COPY", EntityType.EDGE, { "derivedFrom" : makeQuery(id + "extrude2.opExtrude", "SWEPT_EDGE", EntityType.EDGE, { "disambiguationData" : [originalSetDisambiguation([sketchEntityQuery(id + "sketch2.wireOp", EntityType.EDGE, "rectangle2.left"), sketchEntityQuery(id + "sketch2.wireOp", EntityType.EDGE, "rectangle2.bottom")])] }) });
            var e2 = makeQuery(id + "extrude2.boolean.opBoolean", "COPY", EntityType.EDGE, { "derivedFrom" : makeQuery(id + "extrude2.opExtrude", "SWEPT_EDGE", EntityType.EDGE, { "disambiguationData" : [originalSetDisambiguation([sketchEntityQuery(id + "sketch2.wireOp", EntityType.EDGE, "rectangle2.left"), sketchEntityQuery(id + "sketch2.wireOp", EntityType.EDGE, "rectangle2.top")])] }) });
            
            opFillet(context, id + "fillet1", {
                        "entities" : qUnion([e1, e2]),
                        "radius" : 2.5 * millimeter
                    });

    This approach is a last resort -- the result is nearly unreadable, but has the advantage that it lets you pick specific edges without any rule or logic that ties them together.
    Ilya Baran \ VP, Architecture and FeatureScript \ Onshape Inc
  • Options
    andrew_hastings190andrew_hastings190 Member Posts: 4 PRO
    Thank you very much! It has filleted the parts out properly
Sign In or Register to comment.