cq_warehouse icon indicating copy to clipboard operation
cq_warehouse copied to clipboard

Feature request: Snap-fit fasteners

Open alikureishy opened this issue 3 years ago • 15 comments

[Looks like I'm inaugurating the issues section of this repository :-P ]

Would configurable snap-fit fasteners (cantilevered, torsional and annular) be possible additions to this repository? I've been contemplating ways to include snap-fits into a "smart splitting" mechanism, so that a part being split (for example, for 3D printability) could automatically be augmented with snap-fits for eventual re-assembly. I haven't been able to give it much thought yet, but figured I'd post this here since it seemed in line with the kind of utilities that this repository has already implemented.

I understand this is a non-trivial issue to solve, so this is merely a food for thought. Meanwhile, if I do get time to implement something along these lines, I'll submit a PR.

alikureishy avatar Sep 05 '21 05:09 alikureishy

Thank you for creating the first issue - Snap-fit fasteners sounds like a valuable addition to the warehouse.

I'm currently working on an enhancement to fasteners which integrates screws into your Workplane design flow, for example:

cap_screw = SocketHeadCapScrew(size="#8-32", length=(1 / 2) * IN)
result = (
    cq.Workplane(cq.Plane.XY())
    .box(80, 40, 10)
    .faces(">Z")
    .workplane()
    .rect(70, 30, forConstruction=True)
    .vertices()
    .clearanceHole(
        screw=cap_screw,
        fit="Close",
        counterSunk=True,
        extraDepth=0.01 * IN,
        keepFastener=True,
        clean=False,
    )
)

which results in: clearance_holes

I imagine the same concepts would work with snap-fit fasteners. What do you think?

For now all can commit to is thinking about how this would work. I've got quite a few threaded fastener additions in the works and I'll be adding gears to the cq_warehouse before too long. If you get a chance to implement something please share.

gumyr avatar Sep 05 '21 14:09 gumyr

Thanks for the reply, @gumyr . I think that new API would work well with snapfits too. There would need to be some concept of "complementary" fits (male-female etc), but the general idea you've mentioned, of incorporating it into the workplane design flow, would definitely be convenient. I haven't had much of a chance to look into the specifics of what would be needed for snapfits, but I'll be sure to update this thread, or initiate a PR for discussing that if/when I get to it.

Makes sense ... Yes, if I get a chance to implement something, I'll be sure to share.

alikureishy avatar Sep 07 '21 06:09 alikureishy

I am hoping to create an extremely simple snap-fit joint soon. When that's done, I will post an update and we can discuss whether it is universal-enough to be added to cq_warehouse, before I start porting the code.

alikureishy avatar Sep 07 '21 06:09 alikureishy

[Disclaimer: I'm not a mechanical engineer, so this design may not align exactly with theory. It is specific to my use case.]

I've got a simple snap-fit fastener implemented. I use it for a ball bearing housing, so that the bearing can "snap-in". There are more complex snapfits that could be made too, but at the moment this is all I needed. I'll update this thread if I add more. Screenshot from 2021-09-15 11-28-55

Thoughts?

alikureishy avatar Sep 15 '21 19:09 alikureishy

(Btw, it's awesome that you're going to be adding gears and more threaded fasteners!)

alikureishy avatar Sep 15 '21 20:09 alikureishy

Cool. I can see how being able to just indicate that a cantilever snap fit fastener goes here would greatly simplify their use.

One of my primary goals with cq_warehouse is to make it relatively easy for people to use (even those new to cadquery) so I'd like to see the user interface for this. It seems like there would be quite a few parameters. Are there any standards for snap-fit connectors? As I add more screws I've come to the conclusion that the data management is just as difficult as the solid modelling. I've found that being able to refer to a standard greatly simplifies things.

On Wed, Sep 15, 2021 at 4:14 PM Ali Safdar Kureishy < @.***> wrote:

(Btw, it's awesome that you're going to be adding gears and more threaded fasteners!)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/gumyr/cq_warehouse/issues/2#issuecomment-920343957, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUNL25TMDZA2BWUCW7ZPPZLUCD5BNANCNFSM5DOI5HKA .

gumyr avatar Sep 15 '21 22:09 gumyr

@gumyr I completely agree that the data management is hairy, and a formal standard would definitely need to be adhered to. For the same reason, the interface I have is not yet ready for prime-time either ;). However, if you're curious, here are the parameters that I'm presently using for the above (obviously, this will need to be adapted to a standard):

class CantileveredSnapfit(object):
    def __init__(self,
                 fit: Tuple[float, float, float]         # overhang width, depth and height
                 taper_angle_degrees: float,     # the taper of the overhang
                 edge_curvature: float,              # Within the bounds [-1.0 to 1.0] : +ve when wedge faces inward, -ve when wedge faces outward
                 cantilever_thickness: float,             # larger = stronger
                 clearance: float = 0.25             # How much space is needed around the cantilever, for free motion within the slot
    ):

    ....
    ....

Then, using a separate plugin (somewhat like the clearanceHole() plugin you mentioned), I position it at all the points on the workplane stack:

snapfit = CantileveredSnapfit(....)
result = (
    cq.Workplane("XY")
    .box(80, 40, 10)
    .faces(">Z")
    .workplane(offset=-15)
    .rect(20, 20, forConstruction=True)
    .vertices()
    .snapfit(
        tool=snapfit,
        ...
        ...
        clean=False,
    )
)

Actualy, the CantileveredSnapfit class produces two intermediate cq.Solids: - a punch tool to create space for the snapfit, and - the cantilever to insert into that space ... which are then cut/inserted automatically by the snapfit() invocation.

I had come across a scattering of articles about snapfits in the past, but no formal standard so far; though I hadn't invested much in that direction yet. At the moment I was just trying to produce a rough sketch for my immediate needs, and figured I'd get some feedback here about the concept, before I researched and polished it further. I will keep this thread updated as I go along ... but if you'd rather not have an open issue sitting around, I understand if you'd like to close it (and/or tag it accordingly).

(Apologies for the multiple edits: The "Preview" tab wasn't working for some reason)

alikureishy avatar Sep 16 '21 23:09 alikureishy

There is no problem at all in keeping this issue open as long as you're working on it. I appreciate the work you're doing to add to cq_warehouse.

In your case it sounds like you're locking another object into your part but I would guess the most common use case will be locking two halves of a part together. With that in mind, what would the other side look like?

Cheers, Roger

On Thu, Sep 16, 2021 at 7:50 PM Ali Safdar Kureishy < @.***> wrote:

@gumyr https://github.com/gumyr I completely agree that the data management is hairy, and a formal standard would definitely need to be adhered to. For the same reason, the interface I have is not yet ready for prime-time either ;). However, if you're curious, here are the parameters that I'm presently using for the above:

def __init__(self,
             fit: Tuple[float, float, float]         # overhang width, depth and height
             taper_angle_degrees: float,     # the taper of the overhang
             edge_curvature: float,              # Within the bounds [-1.0 to 1.0] : +ve when wedge faces inward, -ve when wedge faces outward
             cantilever_depth: float,             # larger = stronger
             clearance: float = 0.25             # How much space is needed around the cantilever, for free motion within the slot
):

Eventually I produce two cq.Solids:

  • a punch tool to create space for the snapfit, and
  • the cantilever to insert into that space

Then, using a separate plugin (somewhat like the clearanceHole() plugin you mentioned), I position these separately at all the points on the workplane stack.

I had come across a scattering of articles about snapfits in the past, but no formal standard so far; though I hadn't invested much in that direction yet. At the moment I was just trying to produce a rough sketch for my immediate needs, and figured I'd get some feedback here about the concept, before I researched and polished it further. I will keep this thread updated as I go along ... but if you'd rather not have an open issue sitting around, I understand if you'd like to close it (and/or tag it accordingly).

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/gumyr/cq_warehouse/issues/2#issuecomment-921338769, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUNL25REWXUWLMBDQAVIMTDUCJ7GBANCNFSM5DOI5HKA .

gumyr avatar Sep 17 '21 16:09 gumyr

My pleasure. And likewise, for all that you've produced here already.

Yes, my present use case does not involve the other half of a part. I presume you're asking if I have a visual demonstration of that? At the moment, I do not, but will likely need something like that within a month or so, and will update this issue with an illustration at that time.

alikureishy avatar Sep 19 '21 10:09 alikureishy

Btw, @gumyr , when were you planning to have gears available? I'm in need of some gears and thought I'd check in case you had anything I could pull and try out? :)

alikureishy avatar Sep 23 '21 17:09 alikureishy

Unfortunately, I'm still working on fasteners (I now have many new head types in the dev branch). I've got a bunch of work done on the gears already and will ultimately be re-creating all of the gears from my OpenSCAD version - see here: https://www.thingiverse.com/thing:4603821

What gears are you looking for? I can work on those first.

Cheers, Roger

On Thu, Sep 23, 2021 at 1:52 PM Ali Safdar Kureishy < @.***> wrote:

Btw, @gumyr https://github.com/gumyr , when were you planning to have gears available? I'm in need of some gears and thought I'd check in case you had anything I could pull and try out? :)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/gumyr/cq_warehouse/issues/2#issuecomment-926029251, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUNL25T52QBEU23FUVO7O63UDNSNFANCNFSM5DOI5HKA .

gumyr avatar Sep 23 '21 22:09 gumyr

Apologies for the late reply, @gumyr . Thanks for the thingiverse link! I'll check it out. I am looking to try out various sizes of spur (and pinion) gears, that can be set-screwed to their respective shafts (so they move together). Basically I have a worm gear that drives a shaft, and now I need 2 spur gears (potentially different sizes) to efficiently transfer motion from that shaft to another parallel shaft carrying the actual load (rotational direction isn't important). The important part is being able to secure the gear to the shaft for power transfer. I'll see if I can get that from your openscad tool, but if that's not available there, I'll be excited to see the cq_warehouse version when you've got it ready. :)

alikureishy avatar Sep 27 '21 20:09 alikureishy

My OpenSCAD gear warehouse should be able to create the gears you describe including the set-screw hole and even a keyway if you'd like (the keyway increases the maximum torque significantly) . If you're going to 3D print the gears the STL files that OpenSCAD creates will be sufficient. As OpenSCAD is a mesh modelling tool it can't generate STEP files hence the desire to translate to cadquery.

Let me know if you have any questions or if something isn't working correctly; it's been a while since I've used it.

Cheers, Roger

On Mon, Sep 27, 2021 at 4:03 PM Ali Safdar Kureishy < @.***> wrote:

Apologies for the late reply, @gumyr https://github.com/gumyr . Thanks for the thingiverse link! I'll check it out. I am looking to try out various sizes of spur (and pinion) gears, that can be set-screwed to their respective shafts (so they move together). Basically I have a worm gear that drives a shaft, and now I need 2 spur gears (potentially different sizes) to efficiently transfer motion from that shaft to another parallel shaft carrying the actual load (rotational direction isn't important). The important part is being able to secure the gear to the shaft for power transfer. I'll see if I can get that from your openscad tool, but if that's not available there, I'll be excited to see the cq_warehouse version when you've got it ready. :)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/gumyr/cq_warehouse/issues/2#issuecomment-928225918, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUNL25XXJMXHDLZKSKKP2RDUEDEYXANCNFSM5DOI5HKA .

gumyr avatar Sep 28 '21 00:09 gumyr

I left out another good solution - get your STEP model from McMaster-Carr https://www.mcmaster.com/gears/. Once you select a gear (or any part really), you can request the CAD model as a STEP file. The STEP file can be imported into your cadquery design and away you go. You'll have to manage the files and they don't come with an API to provide useful information like pitch radius but for a single design this shouldn't be too difficult to manage.

Cheers, Roger

On Mon, Sep 27, 2021 at 4:03 PM Ali Safdar Kureishy < @.***> wrote:

Apologies for the late reply, @gumyr https://github.com/gumyr . Thanks for the thingiverse link! I'll check it out. I am looking to try out various sizes of spur (and pinion) gears, that can be set-screwed to their respective shafts (so they move together). Basically I have a worm gear that drives a shaft, and now I need 2 spur gears (potentially different sizes) to efficiently transfer motion from that shaft to another parallel shaft carrying the actual load (rotational direction isn't important). The important part is being able to secure the gear to the shaft for power transfer. I'll see if I can get that from your openscad tool, but if that's not available there, I'll be excited to see the cq_warehouse version when you've got it ready. :)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/gumyr/cq_warehouse/issues/2#issuecomment-928225918, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUNL25XXJMXHDLZKSKKP2RDUEDEYXANCNFSM5DOI5HKA .

gumyr avatar Sep 28 '21 14:09 gumyr

Thanks a bunch, Roger (@gumyr )! The openscad utility you've written is amazing. And so is the mcmaster link. Definitely what I was looking for. So, thanks again! I do have some questions about the gear tool (which might be relevant to cq_warehouse too), but should probably post those questions separately, to keep this thread relevant to the topic. Would you mind if I created a "gears" issue for that discussion?

alikureishy avatar Sep 29 '21 02:09 alikureishy