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.

Fillet edges only on faces in extruded direction

richard_marcusrichard_marcus Member Posts: 17 EDU
Is there a query that will give me only the edges on a body that are in the extruded direction (i.e. perpendicular to the sketch plane)? I don't want to fillet anything on the end faces. Queries are still a little bit of a mystery to me.

This seems to work if I just extruded a body:

var ExtrudedEdges is Query = qSubtraction(qSubtraction(qCreatedBy(id + "extrude1", EntityType.EDGE), qCapEntity(id + "extrude1", true)), qCapEntity(id + "extrude1", false));

opFillet(context, id + "fillet1", {
                "entities" : ExtrudedEdges,
                "radius" : 0.5 * millimeter
        });

However, if I have done other operations (such as boolean remove) on the body, the qCapEntity doesn't really work anymore since it references a feature creation not the body.
Any advice?

Best Answer

  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    Answer ✓
    once i needed the same functionality, and i wrote a function
    function selectParallelEdges(context is Context, edges is Query, vector is Vector)<br>{<br>    var parallelEdges = [];<br>    for (var edge in evaluateQuery(context, edges))<br>    {<br>        if (parallelVectors(evLine(context, { "edge" : edge }).direction, vector))<br>        {<br>            parallelEdges = append(parallelEdges, edge);<br>        }<br>    }<br>    return qUnion(parallelEdges);<br>}<br><br>


Answers

  • konstantin_shiriazdanovkonstantin_shiriazdanov Member Posts: 1,221 ✭✭✭✭✭
    Answer ✓
    once i needed the same functionality, and i wrote a function
    function selectParallelEdges(context is Context, edges is Query, vector is Vector)<br>{<br>    var parallelEdges = [];<br>    for (var edge in evaluateQuery(context, edges))<br>    {<br>        if (parallelVectors(evLine(context, { "edge" : edge }).direction, vector))<br>        {<br>            parallelEdges = append(parallelEdges, edge);<br>        }<br>    }<br>    return qUnion(parallelEdges);<br>}<br><br>


  • Jake_RosenfeldJake_Rosenfeld Moderator, Onshape Employees, Developers Posts: 1,646
    edited August 2017
    Seems like you're doing pretty well with queries already!  You could try something like this:
            // Get the cap entities
            var caps = qUnion([qCapEntity(id + "extrude1", true), qCapEntity(id + "extrude1", false)]);
            // Filter for just the faces
            var capFaces = qEntityFilter(caps, EntityType.FACE);
            
            // Do something to the extruded body
            ............
    
            // Get all the edges on the body created by extrude1
            //    qCreatedBy(id + "extrude1", EntityType.EDGE) will only have the edges
            //    created by the extrude, so we do something more complicated
            var allEdges = qOwnedByBody(qCreatedBy(id + "extrude1", EntityType.BODY), EntityType.EDGE);
            // Get all the edges surrounding the cap faces
            var capEdges = qEdgeAdjacent(capFaces, EntityType.EDGE);
            // Subtract the cap geometry
            var desiredEdges = qSubtraction(allEdges, capEdges);
            
            // run opFillet on the desiredEdges
            opFillet(...);
    Let me know if this works for you!

    Edit: Nice function Konstantin!
    Jake Rosenfeld - Modeling Team
  • emagdalenaC2iemagdalenaC2i Member, Developers, Channel partner Posts: 858 ✭✭✭✭✭
    If you are working with sheet metal parts you can use this in the selection to avoid that edges:


            annotation { "Name" : "Select two parallel edges that belong to the same planar face", "Filter" : (ActiveSheetMetal.NO && EntityType.EDGE && EdgeTopology.TWO_SIDED && GeometryType.LINE
                                || EntityType.EDGE && SheetMetalDefinitionEntityType.VERTEX
                                && ConstructionObject.NO && SketchObject.NO && ModifiableEntityOnly.YES),
                        "AdditionalBoxSelectFilter" : EntityType.EDGE,

    You can see an example here https://cad.onshape.com/documents/3d52520839c0fa3587798c0f/w/2c36a47f3c428c7a3f8e3a5f/e/acc8270b7d8719708565ee1e

    Just try to create a full round in a sheet metal part
    Un saludo,

    Eduardo Magdalena                         C2i Change 2 improve                         ☑ ¿Por qué no organizamos una reunión online?  
                                                                         Partner de PTC - Onshape                                     Averigua a quién conocemos en común
  • antti_andreimannantti_andreimann Member Posts: 4
    Seems like only the first line of Konstantin's answer is visible now. Did something happen to the forum software that it ate the rest of the code?
  • antti_andreimannantti_andreimann Member Posts: 4
    Let's see if some copy-paste brings back the lost code.<br><br>
    <code>function selectParallelEdges(context is Context, edges is Query, vector is Vector)<br>{<br>&nbsp;&nbsp;&nbsp; var parallelEdges = [];<br>&nbsp;&nbsp;&nbsp; for (var edge in evaluateQuery(context, edges))<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (parallelVectors(evLine(context, { "edge" : edge }).direction, vector))<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; parallelEdges = append(parallelEdges, edge);<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; return qUnion(parallelEdges);<br>}

Sign In or Register to comment.