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.

FS Hole example

cory_isaacsoncory_isaacson Member, Developers Posts: 43 PRO
The documentation is incomplete for the hole feature, is there an example of how to drill a hole in a part? Looking at the hole.fs source, it's not obvious how to do it either.

Best Answer

  • cory_isaacsoncory_isaacson Member, Developers Posts: 43 PRO
    Answer ✓
    I worked out how to do this, I just added the holes to the original sketch and ignored the nested areas during the extrude, then the holes were all there. Your suggestion would have worked too.

Answers

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,310
    Are you wanting to add custom holes to the current hole tool or are you creating your own feature? Many times all you need to do is extrude a cylinder and subtract it from the solids. Every case and application is different. 

    Senior Director, Technical Services, EMEAI
  • cory_isaacsoncory_isaacson Member, Developers Posts: 43 PRO
    I need holes in a custom feature I am building. I need a hole through several parts that are stacked, based on a sketch in the top part. Sounds like extruding a cylinder will be fine, I'll try that and let you know if issues.
  • cory_isaacsoncory_isaacson Member, Developers Posts: 43 PRO
    I ended up just adding circles to my initial sketch, and filtering those out during the extrude. I tried to create a new sketch and then make cylinders, but the query got very involved when I tried to do the boolean. I had a lot of parts to go through, and could not figure out how to make a query to penetrate all of them. Is there an easy way to chain queries together to incorporate multiple parts?

    Here are some of the things I tried (you can see options in comments).

    // Perform boolean operation to remove the cylinders, leaving the holes.<br>    var cylinderQuery is Query = qContainsPoint(qCreatedBy(id + "holesExtrude1", EntityType.BODY), vector(upperHoleCenter[0], upperHoleCenter[1],0 * inch));<br>    logMessage(context, debugFlag, "cylinderQuery", cylinderQuery);<br>    <br>    // // Build a query based on all value.extrudeNames, which will return all layers.<br>    // var layerQueryArray is array = makeArray(value.numberOfParts);<br>    <br>    // for(var j=0;j<value.numberOfParts;j+=1)<br>    // {<br>    //     layerQueryArray[j] = qCreatedBy(id + value.extrudeNames[j]);<br>    // }<br>    <br>    // var layersQuery is Query = qIntersection(layerQueryArray);<br>    //var layersQuery is Query = qEdgeAdjacent(cylinderQuery, EntityType.BODY);<br>    var layersQuery is Query = qCreatedBy(id + "extrude0", EntityType.BODY);<br>    logMessage(context, debugFlag, "layersQuery", layersQuery);<br>    <br>    opBoolean(context, id + "extrude0" + "holesBoolean", {<br>            "tools" : cylinderQuery,<br>            "targets" : layersQuery,<br>            "operationType" : BooleanOperationType.SUBTRACTION<br>    });


  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,310
    edited January 2017
    If you are subtracting all the bodies you made in the feature then you can just use qCreatedBy(id, EntityType.BODY). 

    If you are only subtracting some, then you can use qUnion and qSubtraction to build lists of bodies you need to use.
    Senior Director, Technical Services, EMEAI
  • cory_isaacsoncory_isaacson Member, Developers Posts: 43 PRO
    Answer ✓
    I worked out how to do this, I just added the holes to the original sketch and ignored the nested areas during the extrude, then the holes were all there. Your suggestion would have worked too.
Sign In or Register to comment.