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

opExtractSurface using derived feature

papawopapawo Member, Developers Posts: 206 PRO

Comments

  • Options
    Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    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
  • Options
    papawopapawo Member, Developers Posts: 206 PRO
    edited January 2018
    Thank you ! It works! can you further explain this code?
    but i must say qEdgeTopology should be qEdgeTopologyFilter
  • Options
    kevin_o_toole_1kevin_o_toole_1 Onshape Employees, Developers, HDM Posts: 565
    A different approach:

    Add a function at the bottom named qOuterSketchRegions:
    </code>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
        }
    }
    </pre><div>(This function uses the standard&nbsp;<span><a href="https://cad.onshape.com/FsDoc/library.html#qSketchRegion-Id-boolean">qSketchRegion</a> function, which has a filterInnerLoops option)</span><br><br>Then change your definition of profileEntities to:<br><pre class="CodeBlock"><code>        const profileEntities = qOuterSketchRegions(definition.profile);

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

Sign In or Register to comment.