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.

Looping sketch creation with Extrude Cut or Boolean

Nath_McCNath_McC Member Posts: 127 PRO
Hi All,

I have a feature script for crate a broached hex, and I have three main issues, which I'm hoping I can get help on.

The link to the document is here: https://cad.onshape.com/documents/143d97f968e97efe61cf1d4f/w/86344877e8b059d820b296f3/e/7dd59a453a901190faf0a82a

  1. I am trying to have the extrude cut feature remove the hex, but it does not seem to work when using "operationType" : NewBodyOperationType.REMOVE: I'm unsure if this is correct or if I need to include a boolean subtraction operation. What is the best way to achieve the cut operation?
  2. If I select multiple points, I get an error; from troubleshooting, I think this is due to some issue with the //Create hex sketch. If I // out that section, the hole itself generates. Could somebody please look at my code and see where I am going wrong?
  3. The code below is on line 189 and removed the sketch for the drill hole, but if I copy it and replace id + "sketch" with id + "Hsketch", I hope to remove the hex/polygon sketch. Can I remove all the sketches in one operation at the end?
opDeleteBodies(context, id + "delete_sketch", { "entities" : qCreatedBy(id + "sketch", EntityType.BODY) }); 

Some of my code was taken from the ports feature script, but I can't figure out the last parts.

Any help would be greatly appreciated.

Comments

  • NeilCookeNeilCooke Moderator, Onshape Employees Posts: 5,671
    edited September 2022
    The most efficient way to do this would be to create a solid for the hole (using opRevolve), a solid for the hex (opExtrude), boolean together (opBoolean), get the transforms between all the hole points, pattern (opPattern), remove all from part (opBoolean), delete sketches. Therefore you only make 2 sketches and 2 booleans.
    Senior Director, Technical Services, EMEAI
  • Nath_McCNath_McC Member Posts: 127 PRO
    Thank you @NeilCooke, I will try and give that a go. 
Sign In or Register to comment.