render_gear_rack.py revision edee13f2ac1205fb2d9ccc42a40c8c3657154c3c
'''
Copyright (C) 2013 Brett Graham (hahahaha @ hahaha.org)
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
'''
import inkex
import simplestyle
from math import *
def involute_intersect_angle(Rb, R):
return (x, y)
def points_to_svgd(p):
"""
p: list of 2 tuples (x, y coordinates)
"""
f = p[0]
p = p[1:]
svgd = 'M%.3f,%.3f' % f
for x in p:
svgd += 'L%.3f,%.3f' % x
return svgd
"-l", "--length",
help="Rack Length")
"-s", "--spacing",
help="Tooth Spacing")
"-a", "--angle",
help="Contact Angle")
# generate points: list of (x, y) pairs
points = []
x = 0
while x < length:
# move along path, generating the next 'tooth'
x += spacing * 2.
# Embed gear in group to make animation easier:
# Translate group, Rotate path.
g_attribs = {
'transform': t}
# Create SVG Path for gear
gear_attribs = {
'd': path}
if __name__ == '__main__':
e = RackGear()
e.affect()