Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upCustomized where-dial gear cutting #1308
Comments
This comment has been minimized.
This comment has been minimized.
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"?>
<svg
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
width="210mm"
height="297mm"
viewBox="-100 -100 210 297">
<defs>
<path id="textguide1" d="M0,-{textrad:} A{textrad:},{textrad:},0,0,1,{textrad:},0"/>
</defs>
<circle
style="opacity:0.98000004;fill:none;fill-opacity:1;stroke:#007c00;stroke-width:0.41600001;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
id="path2102"
cx="0"
cy="0"
r="{circlerad:}" />
<path
style="opacity:0.98000004;fill:none;fill-opacity:1;stroke:#007c00;stroke-width:0.41600001;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="{gearpath:}" />
<path
style="opacity:0.98000004;fill:blue;fill-opacity:1;stroke:none;stroke-width:0.41600001;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
d="{trianglepath:}" />
<g
id="layer1">
{textblock:}
</g>
</svg>
"""
txtbit = """
<text
style="font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:1.25;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332"
transform="rotate(%.3f 0 0)">
<textPath xlink:href = "#textguide1">
%s
</textPath>
</text>
"""
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)))
strianglepath.append("Z")
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))
fout.close() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The rim is here: https://github.com/johnmckerrell/WhereDialBody
But we really want properly shaped gear teeth, like shown here:
https://geargenerator.com/#200,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.