opIntersectFaces curves don't create extrudable region

barry_foust
barry_foust Member Posts: 6 ✭

I'm trying to write a FeatureScript that takes a part in the shape of a wing dissected by an array of planes. The intersection of the wing at each plane is then extruded to create a series of ribs. The curves that I get from opIntersectFaces aren't in the sketch I create, and the curves don't form a region that can be extruded. Here is what I have so far:

https://cad.onshape.com/documents/9303fb86fa91de5af31b14a6/w/c1a4f814459ac83e9bdeb89e/e/7147c8b08dd81f056f656a6c?renderMode=0&uiState=68d134fd343ea5ede30ae77a

Comments

  • GregBrown
    GregBrown Member, Onshape Employees, csevp, pcbaevp Posts: 412 image

    The way I've always done this is to get the intersecting curves, then make a fill surface from them, and thicken this surface. It saves messing around with sketches. I also think it is easier to do it for a single intersection, then use feature patterning to to the other ribs…

  • barry_foust
    barry_foust Member Posts: 6 ✭

    Thanks, You lead me down the right path. Here is what I ended up with…

            // Define the function's action
            const allFaces = evaluateQuery(context, definition.faces);
            var i = 0;
            // for each plane
            for (var face in allFaces)
            {
                i += 1;
    
                // Intersect with the wingBody
                const bodyFaces = qOwnedByBody(definition.wingBody, EntityType.FACE);
    
                const curve = opIntersectFaces(context, id + (i ~ "intersect"), {
                            "tools" : bodyFaces,
                            "targets" : face
                        });
    
                opFillSurface(context, id + (i ~ "fillSurface"), {
                            "edgesG0" : qCreatedBy(id + (i ~ "intersect"), EntityType.EDGE)
                        });
    
                var plane = evPlane(context, {
                        "face" : face
                    });
    
                var extrudeFace = qCreatedBy(id + (i ~ "fillSurface"), EntityType.FACE);
    
                opExtrude(context, id + (i ~ "extrude"), {
                            "entities" : extrudeFace,
                            "endBound" : BoundingType.BLIND,
                            "endDepth" : definition.ribWidth * inch,
                            "direction" : plane.normal
                        });
            }