Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape, CAD, maker project and design.

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.

opExtractSurface using derived feature

papawopapawo Member, Developers Posts: 206 PRO

Comments

  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 908
    Maybe try this?

    // Get all the faces from the derived feature
    const inputFaces = qEntityFilter(qCreatedBy(definition.profile), EntityType.FACE);
    
    // Get all one-sided edges of the input faces
    const oneSidedEdges = qEdgeTopology(qEdgeAdjacent(inputFaces, EntityType.EDGE), EdgeTopology.LAMINAR);
    
    // Get all the faces touching the one sided edges
    const externalFaces = qEdgeAdjacent(oneSidedEdges, EntityType.FACE);
    
    // use externalFaces as your "faces" input to opExtractSurface

    Jake Rosenfeld - Modeling Team
  • papawopapawo Member, Developers Posts: 206 PRO
    edited January 11
    Thank you ! It works! can you further explain this code?
    but i must say qEdgeTopology should be qEdgeTopologyFilter
  • kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers Posts: 370
    A different approach:

    Add a function at the bottom named qOuterSketchRegions:
    export function qOuterSketchRegions(features is FeatureList) returns Query
    {
        var query = [];
        return qUnion(query);
        for (var feature in features)
        {
            query = append(query, qSketchRegion(feature.key, true)); // true to filter out inner loops
        }
    }
    
    (This function uses the standard qSketchRegion function, which has a filterInnerLoops option)

    Then change your definition of profileEntities to:
            const profileEntities = qOuterSketchRegions(definition.profile);

    Example document:
    https://cad.onshape.com/documents/14f1f8d4f2979c9f4e6ffacc/w/1e643421e968f502e2ecf590/e/32fceec70cdf2150e1c75386

Sign In or Register to comment.