Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Snap-fit fasteners #2

Open
alikureishy opened this issue Sep 5, 2021 · 15 comments
Open

Feature request: Snap-fit fasteners #2

alikureishy opened this issue Sep 5, 2021 · 15 comments
Labels
enhancement New feature or request

Comments

@alikureishy
Copy link
Contributor

[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.

@gumyr
Copy link
Owner

gumyr commented Sep 5, 2021

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.

@alikureishy
Copy link
Contributor Author

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
Copy link
Contributor Author

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
Copy link
Contributor Author

alikureishy commented Sep 15, 2021

[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
Copy link
Contributor Author

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

@gumyr
Copy link
Owner

gumyr commented Sep 15, 2021 via email

@alikureishy
Copy link
Contributor Author

alikureishy commented Sep 16, 2021

@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)

@gumyr
Copy link
Owner

gumyr commented Sep 17, 2021 via email

@alikureishy
Copy link
Contributor Author

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
Copy link
Contributor Author

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? :)

@gumyr
Copy link
Owner

gumyr commented Sep 23, 2021 via email

@alikureishy
Copy link
Contributor Author

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. :)

@gumyr
Copy link
Owner

gumyr commented Sep 28, 2021 via email

@gumyr
Copy link
Owner

gumyr commented Sep 28, 2021 via email

@alikureishy
Copy link
Contributor Author

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?

@gumyr gumyr added the enhancement New feature or request label Oct 17, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants