Site Sponsors:
Web Gears, Part II 
Well the weekend is here. Time to hit the wood shop once again.

Last weekend we started creating our decimal counter. While the gears for the project are made entirely of wood, the assistive electronics (simple analog motor + a transistorized dump circuit) for the project are presently cooling in the garage.

Setting the sights on the next project, we decided to make the next gearing task out of cogs.

Updating last week's Web Gear generator, we came up with the following:


import turtle


def draw_cog(zSlices=10, zRange=100, zStep=10, zBite=120):
zt = turtle.Turtle(shape='turtle')
angle = int(360 / zSlices)
print(angle)
notpi = 2.85 # the smaller, the larger the cog-spacing. Keep it <= pi.
circumference = 2.0 * notpi * float(zRange)
overhill = circumference / float(zSlices)
zt.hideturtle()
for ref in range(1, 360, angle):
zt.pendown()
zt.left(angle)
zt.forward(zRange)
zt.pencolor('blue')
zt.circle(overhill / 2)
zt.pencolor('green')
zt.left(zBite)
zt.forward(overhill * 1.2)
zt.penup()
zt.right(zBite)
zt.forward(overhill * 1.2)
zt.pencolor('black')
zt.goto(0, 0)

for i in range(1, zRange + zStep, zStep):
zt.right(90)
zt.forward(i)
zt.right(270)
zt.pendown()
zt.circle(i)
zt.penup()
zt.home()

zLoc = zRange + zStep
zt.goto(zLoc * -1, zLoc)
zt.write("draw_cog(zSlices=" + str(zSlices) + ", zRange=" + str(zRange) + ", zStep=" + str(zStep) + ", zBite=" + str(zBite) + ")")
zt.hideturtle()

turtle.hideturtle()
draw_cog(zSlices=10, zRange=200, zStep=100, zBite=145)
turtle.getscreen()._root.mainloop()


Cutting along either the green "zByte" line, or the blue "notpi" circle will allow us to choose the type of cog (pinwheel or classic cog) that we want to cut:




Sharing is caring,

-Randall


P.S: Eliminating "zBite" so as to make the effective angle based upon our "zStep" (nice triangle to re-use there!) is presently on the # TODO: list! (i.e. it's been a long day =)

-Rn


[ add comment ] ( 54 views )   |  permalink  |  related link

<<First <Back | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | Next> Last>>