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

Customized where-dial gear cutting #1308

goatchurchprime opened this issue Nov 6, 2019 · 1 comment


Copy link

@goatchurchprime goatchurchprime commented Nov 6, 2019

The rim is here:

But we really want properly shaped gear teeth, like shown here:,200,100,6,1,3,0,4,1,8,2,4,27,-90,0,0,0,0,0,0,16,4,4,27,-60,0,0,0,0,1,1,12,1,12,20,-60,0,0,0,0,2,0,60,5,12,20,0,1,0,0,0,0,0,3,-515

However, it possibly does not apply as the gear is positioned by gravity rather than by fixed axles, so is deeper in the teeth than would be if held in position.

And to be able to fill in the 12 rotated words for etching, before cutting on the laser cutter.


This comment has been minimized.

Copy link
Contributor Author

@goatchurchprime goatchurchprime commented Nov 10, 2019

Here's the hacky script to generate a numeric wheredial.

Need to load the output into inkscape, select the words, convert object to path, and then save as dxf.

Should cut 3mm acrylic with: engrave 250 50, cut at 12 70

import math
def dsin(a):  return math.sin(math.radians(a))
def dcos(a):  return math.cos(math.radians(a))

svgtemplate = """<?xml version="1.0" encoding="UTF-8" standalone="no"?>
   viewBox="-100 -100 210 297">
        <path id="textguide1" d="M0,-{textrad:} A{textrad:},{textrad:},0,0,1,{textrad:},0"/>
       r="{circlerad:}" />
       d="{gearpath:}" />
       d="{trianglepath:}" />

txtbit = """
               transform="rotate(%.3f 0 0)">
            <textPath xlink:href = "#textguide1">

words = ["zero", 
         ("one",1), ("two",1), "three", "four", "five", 
         "six", "seven", "eight", "nine", "ten", ("eleven",3)]

ginnerrad = 61
gouterrad = 66
gearteeth = 60
toothang = 360/gearteeth
toothtransrad = 10
toothwidth = toothang*0.39
toothtrans = toothang*0.05
circlerad = 85
textrad = 74

triangleinnerrad = 66.9
triangleouterrad = 70
triangledegwidth = 3

stxtblock = [ ]
for i, w in enumerate(words):
    dpos = 0
    if type(w) == tuple:
        dpos = w[1]
        w = w[0]
    dpos += len(w)*2
    stxtblock.append(txtbit%(i/len(words)*360-dpos, w))
txtblock = "\n".join(stxtblock)

strianglepath = [ ]
for i in range(len(words)):
    ttip = i/len(words)*360
    tleft = ttip-triangledegwidth/2
    tright = ttip+triangledegwidth/2
    strianglepath.append("M%.3f,%.3f" % (triangleinnerrad*dsin(ttip), triangleinnerrad*dcos(ttip)))
    strianglepath.append("L%.3f,%.3f" % (triangleouterrad*dsin(tleft), triangleouterrad*dcos(tleft)))
    strianglepath.append("L%.3f,%.3f" % (triangleouterrad*dsin(tright), triangleouterrad*dcos(tright)))
trianglepath = " ".join(strianglepath)

toothstartang = -(toothang-toothwidth-2*toothtrans)/2
sgearpath = ["M%.3f,%.3f" % (gouterrad*dsin(toothstartang), gouterrad*dcos(toothstartang))]
for i in range(gearteeth):
    t0 = i*toothang+toothstartang
    t4 = (i+1)*toothang+toothstartang
    t3 = t4 - toothtrans
    t2 = t3 - toothwidth
    t1 = t2 - toothtrans
    sgearpath.append("A%.3f %.3f 0 0 0 %.3f,%.3f" % (gouterrad, gouterrad, gouterrad*dsin(t1), gouterrad*dcos(t1)))
    sgearpath.append("A%.3f %.3f 0 0 0 %.3f,%.3f" % (toothtransrad, toothtransrad, ginnerrad*dsin(t2), ginnerrad*dcos(t2)))
    sgearpath.append("A%.3f %.3f 0 0 0 %.3f,%.3f" % (ginnerrad, ginnerrad, ginnerrad*dsin(t3), ginnerrad*dcos(t3)))
    sgearpath.append("A%.3f %.3f 0 0 0 %.3f,%.3f" % (toothtransrad, toothtransrad, gouterrad*dsin(t4), gouterrad*dcos(t4)))
gearpath = " ".join(sgearpath)

fout = open("test4.svg", "w")
fout.write(svgtemplate.format(circlerad=circlerad, textrad=textrad, textblock=txtblock, gearpath=gearpath, trianglepath=trianglepath))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.