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.

Featurescript to add heat-set threaded inserts

david_riedelldavid_riedell Member Posts: 23 ✭✭
I use a lot of M3 heat-set threaded inserts in my 3Dprints but it takes several hole operations to generate the type of geometry I need. I haven't really created a featurescript before, but I think this would be a good use-case to simplify my workflow.

What I'd like is to be able to specify a somewhat complicated hole type and select multiple points to apply it to. I'm usually attaching an acrylic sheet on top of a 3d printed part, like in the picture below.

I need a counterbore in the acrylic, then a 3.4mm clearance hole for the M3 screw. I'd like to be able to specify the counterbore depth as well as the hole depth.

I also need a 4.5mm hole that starts at the top of the 3D printed part, with a small countersink to give the plastic somewhere to go when it becomes molten during the insertion.


Like I said I haven't done a lot with featurescript before, can someone give me some pointers on how to go about making this?


Best Answer

  • eric_pestyeric_pesty Member Posts: 1,877 PRO
    Answer ✓
    One way to do this would be to create a solid representing the volume you want. Then you could potentially just use the "super derive" feature to place as many of these as you want in your model as a "remove".

    To turn this into a featurescript would be pretty similar, you could us a different solid to "import" for the different size and place your solids wherever you want and then boolean them out of the target parts.

Answers

  • _anton_anton Member, Onshape Employees Posts: 410
    There's a number of ways to skin this cat, of course, but many examples exist. Off the top of my head, here's a feature I use in my own prints (unpublished and unreviewed, mind): https://cad.onshape.com/documents/4fbfbc68c6ae0a2499f2226b/v/d4f153975d298f537b37fa75/e/aa2bdb1a72151ba9e466f358

    Probably the correct way is to extrude multiple cylinders of different diameters.
  • david_riedelldavid_riedell Member Posts: 23 ✭✭
    Thanks for that, it got me started.

    I'm able to follow it so far but the headRegion and screwRegion code is throwing me off. Is there a way to select sketch regions based on the circleId i.e. screwProfile and headProfile instead of doing a qSubtraction?
  • _anton_anton Member, Onshape Employees Posts: 410
    So here I'm sketching two circles:

    - qSketchRegion(sketchId, false) gets the full region enclosed by the bigger circle.
    - qSubtraction(qSketchRegion(sketchId, false), qSketchRegion(sketchId, true)) gets the inner region.

    This only really works for the case of one region contained in another. We don't normally do more complex cases. I think, if you've got a sketch with more regions than that, you've got two options:

    1. Use qContainsPoint (I haven't tested this) and feed in a point you know lies only in a specific region.
    2. Just make multiple sketches and extrude them separately to avoid all of this. I think that would be the easiest approach.

    Regardless, protip: debug(context, myQuery) is an invaluable tool for testing your feature.
  • eric_pestyeric_pesty Member Posts: 1,877 PRO
    Answer ✓
    One way to do this would be to create a solid representing the volume you want. Then you could potentially just use the "super derive" feature to place as many of these as you want in your model as a "remove".

    To turn this into a featurescript would be pretty similar, you could us a different solid to "import" for the different size and place your solids wherever you want and then boolean them out of the target parts.
  • david_riedelldavid_riedell Member Posts: 23 ✭✭
    @eric_pesty
    Ok that's way easier, I didn't know "super derive" was a thing. I'll probably go back and work on my featurescript more later but this'll work for now. Thanks.
  • nick_papageorge073nick_papageorge073 Member, csevp Posts: 818 PRO
    @eric_pesty
    Ok that's way easier, I didn't know "super derive" was a thing. I'll probably go back and work on my featurescript more later but this'll work for now. Thanks.
    Check out also the public FS "transform pattern". Once the solid you want is in your part studio (or you drew it in there to start), you can copy it to as many points as you like.
  • emagdalenaC2iemagdalenaC2i Member, Developers, Channel partner Posts: 863 ✭✭✭✭✭
    @david_riedellYou can take a look at this post https://forum.onshape.com/discussion/23179/new-onshape-macros-c2i-fs-custom-cuts-and-c2i-fs-multiple-custom-cuts where I introduce a new macro that we've included in the collection provided to our customers in the Onshape C2i Business Program https://www.c2i.es/onshape-c2i-business.

    I believe this macro, Custom Cuts, fits perfectly with what you're looking for.

    You can see here https://www.c2i.es/slides/macros-featurescript-para-onshape-1355 the complete collection of macros included, along with many other tools and our technical support, in the Onshape C2i Business program.


    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
Sign In or Register to comment.