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 ] ( 118 views )   |  permalink  |  related link
OAuth Training Available 
From posting quotations, recipes, and articles to Twitter, Facebook, and Linked-in, to sending 'robomail & uploading data for The Quote For Today, I write allot of robots.



Relatively new to the technical learning-locus has been our need to use more secure ways to allow my communities to subscribe and grant us access to their information.

In as much as I believe in easing difficult learning tasks for others, I wanted to let everyone know that we are putting the finishing touches on a new training opportunity. Known as "OAuth for Developers," the mission of our new two-day learn-share is to allow my fellow software afficionados to quickly discover how to integrate Google, Facebook, Linked-in, Monster, and a growing host of other OAuth2 security providers into their on-line community & content management plans.

Fee free to contact me to arrange for an OAuth 2.0, or any other, educational upgrade for your clientèle and / or R&D Team.


Sincerely,

-Rn


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

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