gumyr / cq_warehouse

A cadquery parametric part collection
Apache License 2.0
107 stars 23 forks source link

Simulating thread cutters #78

Open MarcWeber opened 1 year ago

MarcWeber commented 1 year ago

Task: You have 11mm diameter cylinder and want 10mm iso thread with pitch 0.75 on it.

1) lookup right size from CSV 2) use something like this code

def thread_exp():
    thread_height = 10
    thread = IsoThread(12,1, thread_height, True)
    cyl = (cq.Workplane("XY").circle(12/2).extrude(30))
    ring = (cq.Workplane("XY").circle(12/2).extrude(thread_height).circle(thread.root_radius).cutThruAll())
    all = cyl - ring + thread
    return all

Now it's much code. Most perfect syntax I can imagine would be something like

cyl.add(thread.negativeBody(offset=10)) which roughly means don't build the the thread, but the removed material and substract it from the cyl. Now I learned that substracting threads is not always possible. So what comes to mind is that a body could have a flag 'substract=true' thus be negative. Then its like cyl.add(negative cylinder).add(thread).

The general case is like having a cyl and adding threads at both ends (or even more complicated shapes).

So maybe even .faces(">Z").addIsoThread(...) would be a nice syntax.

Also interesting is looking at choosing the perfect thread size.

Cause you might have a lathe but only 8 and 100mm iso thread cutters but not 9mm. Thus you want something like .faces(">Z").addBiggestIsoThreadFrom(sizes=[8,10,12], length = 10) ?

Just wildly guessing. I am still new to CadQuery.

MarcWeber commented 1 year ago

But because you might want to use extern and intern threads (nuts) and have the automatically determined size be shared .. maybe the size calculation should be a separate utility function.

gumyr commented 1 year ago

As far as I know, there is no single specification of valid ISO threads. Each ISO Fastener standard has it's own list of valid sizes. Any thoughts on how to overcome this?

regattaguru commented 7 months ago

ISO 261: 1995 is a list of all standard threads - in ISO the threads remain the same across all screw fastener types, which vary in head dimensions and thread length, but the thread profile (ISO 68) remains constant and the sizes are laid out in ISO 261. I'm happy to help you get those reference documents if you need.

gumyr commented 7 months ago

As far as I know, all of the threads used in the thread/fastener package are correct and follow the appropriate standards.